Documentation
¶
Index ¶
- func NewAccounting(opts ...Option) accounting.Interface
- type MockPricer
- type Option
- func WithBalanceFunc(f func(swarm.Address) (int64, error)) Option
- func WithBalancesFunc(f func() (map[string]int64, error)) Option
- func WithCreditFunc(f func(peer swarm.Address, price uint64) error) Option
- func WithDebitFunc(f func(peer swarm.Address, price uint64) error) Option
- func WithReleaseFunc(f func(peer swarm.Address, price uint64)) Option
- func WithReserveFunc(f func(peer swarm.Address, price uint64) error) Option
- type Service
- func (s *Service) Balance(peer swarm.Address) (int64, error)
- func (s *Service) Balances() (map[string]int64, error)
- func (s *Service) Credit(peer swarm.Address, price uint64) error
- func (s *Service) Debit(peer swarm.Address, price uint64) error
- func (s *Service) Release(peer swarm.Address, price uint64)
- func (s *Service) Reserve(peer swarm.Address, price uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAccounting ¶
func NewAccounting(opts ...Option) accounting.Interface
NewAccounting creates the mock accounting implementation
Types ¶
type MockPricer ¶
type MockPricer struct {
// contains filtered or unexported fields
}
func NewPricer ¶
func NewPricer(price, peerPrice uint64) *MockPricer
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is the option passed to the mock accounting service
func WithBalanceFunc ¶
WithBalanceFunc sets the mock Balance function
func WithBalancesFunc ¶
WithBalancesFunc sets the mock Balances function
func WithCreditFunc ¶
WithCreditFunc sets the mock Credit function
func WithDebitFunc ¶
WithDebitFunc sets the mock Debit function
func WithReleaseFunc ¶
WithReleaseFunc sets the mock Release function
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the mock Accounting service.
Click to show internal directories.
Click to hide internal directories.