Documentation ¶
Index ¶
- Variables
- type Manager
- func (s *Manager) BalancesWorker(ctx context.Context, interval time.Duration) error
- func (s *Manager) ChangeSkipThreshold(desiredChange payment.Amount) payment.Amount
- func (s *Manager) CrowdfundedSkip() event.Event[payment.Amount]
- func (s *Manager) CrowdfundedSkippingEnabled() bool
- func (s *Manager) CrowdfundedTransactionReceived() event.Event[*types.CrowdfundedTransaction]
- func (s *Manager) EmptySkipAndRainAccounts(ctx context.Context, forMedia string, mediaRequestedBy *string) (skipTotal, rainTotal, rainedByRequester payment.Amount, err error)
- func (s *Manager) RainAccountStatus() *RainAccountStatus
- func (s *Manager) SetCrowdfundedSkippingEnabled(enabled bool)
- func (s *Manager) SkipAccountStatus() *SkipAccountStatus
- func (s *Manager) SkipThresholdReductionMilestoneReached() event.Event[float64]
- func (s *Manager) StatusUpdated() event.Event[SkipStatusUpdatedEventArgs]
- func (s *Manager) UpdateSkipThreshold(resetChange bool)
- func (s *Manager) Worker(ctx context.Context) error
- type RainAccountStatus
- type SkipAccountStatus
- type SkipStatusUpdatedEventArgs
Constants ¶
This section is empty.
Variables ¶
var NoSkipPeriodBeforeMediaEnd = 30 * time.Second
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages skipping and tipping
func New ¶
func New(log *log.Logger, rpc rpc.Client, skipAccount *wallet.Account, rainAccount *wallet.Account, collectorAccountAddress string, mediaQueue *mediaqueue.MediaQueue, pricer *pricer.Pricer, ) *Manager
New returns an initialized skip manager
func (*Manager) BalancesWorker ¶
func (*Manager) ChangeSkipThreshold ¶
func (*Manager) CrowdfundedSkip ¶
CrowdfundedSkip is the event that is fired when the community skips a track. The total amount used to skip is sent as the argument
func (*Manager) CrowdfundedSkippingEnabled ¶
func (*Manager) CrowdfundedTransactionReceived ¶
func (s *Manager) CrowdfundedTransactionReceived() event.Event[*types.CrowdfundedTransaction]
CrowdfundedTransactionReceived is the event that is fired when a community skipping or community tipping transaction is received
func (*Manager) EmptySkipAndRainAccounts ¶
func (s *Manager) EmptySkipAndRainAccounts(ctx context.Context, forMedia string, mediaRequestedBy *string) (skipTotal, rainTotal, rainedByRequester payment.Amount, err error)
EmptySkipAndRainAccounts empties the skipping and tipping accounts and returns the total balance that was contained in both
func (*Manager) RainAccountStatus ¶
func (s *Manager) RainAccountStatus() *RainAccountStatus
func (*Manager) SetCrowdfundedSkippingEnabled ¶
func (*Manager) SkipAccountStatus ¶
func (s *Manager) SkipAccountStatus() *SkipAccountStatus
func (*Manager) SkipThresholdReductionMilestoneReached ¶
SkipThresholdReductionMilestoneReached is the event that is fired when a milestone in skip threshold reduction is reached
func (*Manager) StatusUpdated ¶
func (s *Manager) StatusUpdated() event.Event[SkipStatusUpdatedEventArgs]
StatusUpdated is the event that is fired when the skip status is updated
func (*Manager) UpdateSkipThreshold ¶
type RainAccountStatus ¶
RainAccountStatus returns the status of the tip account
type SkipAccountStatus ¶
type SkipAccountStatus struct { SkipStatus proto.SkipStatus Address string Balance payment.Amount Threshold payment.Amount ThresholdLowerable bool }
SkipAccountStatus returns the status of the skip account
type SkipStatusUpdatedEventArgs ¶
type SkipStatusUpdatedEventArgs struct { SkipAccountStatus *SkipAccountStatus RainAccountStatus *RainAccountStatus }
SkipStatusUpdatedEventArgs are the arguments to the event that is fired when the skip status is updated