Versions in this module Expand all Collapse all v0 v0.2.3 Jun 20, 2021 Changes in this version + var ErrDisconnectThresholdExceeded = errors.New("disconnect threshold exceeded") + var ErrInvalidValue = errors.New("invalid value") + var ErrOverdraft = errors.New("attempted overdraft") + var ErrOverflow = errors.New("overflow error") + var ErrPeerNoBalance = errors.New("no balance for peer") + type Accounting struct + func NewAccounting(PaymentThreshold, PaymentTolerance, EarlyPayment *big.Int, ...) (*Accounting, error) + func (a *Accounting) AsyncNotifyPayment(peer swarm.Address, amount *big.Int) error + func (a *Accounting) Balance(peer swarm.Address) (balance *big.Int, err error) + func (a *Accounting) Balances() (map[string]*big.Int, error) + func (a *Accounting) CompensatedBalance(peer swarm.Address) (compensated *big.Int, err error) + func (a *Accounting) CompensatedBalances() (map[string]*big.Int, error) + func (a *Accounting) Credit(peer swarm.Address, price uint64) error + func (a *Accounting) Debit(peer swarm.Address, price uint64) error + func (a *Accounting) Metrics() []prometheus.Collector + func (a *Accounting) NotifyPayment(peer swarm.Address, amount *big.Int) error + func (a *Accounting) NotifyPaymentThreshold(peer swarm.Address, paymentThreshold *big.Int) error + func (a *Accounting) Release(peer swarm.Address, price uint64) + func (a *Accounting) Reserve(ctx context.Context, peer swarm.Address, price uint64) error + func (a *Accounting) SurplusBalance(peer swarm.Address) (balance *big.Int, err error) + type FixedPricer struct + func NewFixedPricer(overlay swarm.Address, poPrice uint64) *FixedPricer + func (pricer *FixedPricer) PeerPrice(peer, chunk swarm.Address) uint64 + func (pricer *FixedPricer) Price(chunk swarm.Address) uint64 + type Interface interface + Balance func(peer swarm.Address) (*big.Int, error) + Balances func() (map[string]*big.Int, error) + CompensatedBalance func(peer swarm.Address) (*big.Int, error) + CompensatedBalances func() (map[string]*big.Int, error) + Credit func(peer swarm.Address, price uint64) error + Debit func(peer swarm.Address, price uint64) error + Release func(peer swarm.Address, price uint64) + Reserve func(ctx context.Context, peer swarm.Address, price uint64) error + SurplusBalance func(peer swarm.Address) (*big.Int, error) + type Pricer interface + PeerPrice func(peer, chunk swarm.Address) uint64 + Price func(chunk swarm.Address) uint64