skipmanager

package
v0.0.0-...-e9c30ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 (s *Manager) BalancesWorker(ctx context.Context, interval time.Duration) error

func (*Manager) ChangeSkipThreshold

func (s *Manager) ChangeSkipThreshold(desiredChange payment.Amount) payment.Amount

func (*Manager) CrowdfundedSkip

func (s *Manager) CrowdfundedSkip() event.Event[payment.Amount]

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 (s *Manager) CrowdfundedSkippingEnabled() bool

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 (s *Manager) SetCrowdfundedSkippingEnabled(enabled bool)

func (*Manager) SkipAccountStatus

func (s *Manager) SkipAccountStatus() *SkipAccountStatus

func (*Manager) SkipThresholdReductionMilestoneReached

func (s *Manager) SkipThresholdReductionMilestoneReached() event.Event[float64]

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

func (s *Manager) UpdateSkipThreshold(resetChange bool)

func (*Manager) Worker

func (s *Manager) Worker(ctx context.Context) error

type RainAccountStatus

type RainAccountStatus struct {
	Address string
	Balance payment.Amount
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL