mock

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSettlement

func NewSettlement(opts ...Option) settlement.Interface

NewChequeStore creates the mock chequeStore implementation

func NewTraffic

func NewTraffic(opts ...Option) traffic.ApiInterface

NewChequeStore creates the mock chequeStore implementation

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is the option passed to the mock ChequeStore service

func WithAddress

func WithAddress(f func() common.Address) Option

func WithAvailableBalance

func WithAvailableBalance(f func() (*big.Int, error)) Option

func WithCashCheque

func WithCashCheque(f func(ctx context.Context, peer boson.Address) (common.Hash, error)) Option

func WithGetPeerBalance

func WithGetPeerBalance(f func(peer boson.Address) (*big.Int, error)) Option

func WithGetUnPaidBalance

func WithGetUnPaidBalance(f func(peer boson.Address) (*big.Int, error)) Option

func WithLastReceivedCheque

func WithLastReceivedCheque(f func(peer boson.Address) (*chequePkg.SignedCheque, error)) Option

func WithLastSentCheque

func WithLastSentCheque(f func(peer boson.Address) (*chequePkg.Cheque, error)) Option

WithsettlementFunc sets the mock settlement function

func WithPay

func WithPay(f func(ctx context.Context, peer boson.Address, paymentThreshold *big.Int) error) Option

func WithPutRetrieveTraffic

func WithPutRetrieveTraffic(f func(peer boson.Address, traffic *big.Int) error) Option

func WithPutTransferTraffic

func WithPutTransferTraffic(f func(peer boson.Address, traffic *big.Int) error) Option

func WithRetrieveTraffic

func WithRetrieveTraffic(f func(peer boson.Address) (traffic *big.Int, err error)) Option

func WithSetNotifyPaymentFunc

func WithSetNotifyPaymentFunc(f func(notifyPaymentFunc settlement.NotifyPaymentFunc)) Option

func WithTrafficCheques

func WithTrafficCheques(f func() ([]*traffic.TrafficCheque, error)) Option

func WithTransferTraffic

func WithTransferTraffic(f func(peer boson.Address) (traffic *big.Int, err error)) Option

type TraafficMock

type TraafficMock struct {
	// contains filtered or unexported fields
}

func (*TraafficMock) Address

func (s *TraafficMock) Address() common.Address

func (*TraafficMock) AvailableBalance

func (s *TraafficMock) AvailableBalance() (*big.Int, error)

AvailableBalance Get actual available balance

func (*TraafficMock) CashCheque

func (s *TraafficMock) CashCheque(ctx context.Context, peer boson.Address) (common.Hash, error)

CashCheque sends a cashing transaction for the last cheque of the peer

func (*TraafficMock) GetPeerBalance

func (s *TraafficMock) GetPeerBalance(peer boson.Address) (*big.Int, error)

func (*TraafficMock) GetUnPaidBalance

func (s *TraafficMock) GetUnPaidBalance(peer boson.Address) (*big.Int, error)

func (*TraafficMock) LastReceivedCheque

func (s *TraafficMock) LastReceivedCheque(peer boson.Address) (*chequePkg.SignedCheque, error)

LastReceivedCheques returns the list of last received cheques for all peers

func (*TraafficMock) LastSentCheque

func (s *TraafficMock) LastSentCheque(peer boson.Address) (*chequePkg.Cheque, error)

LastSentCheque returns the last sent cheque for the peer

func (*TraafficMock) Pay

func (s *TraafficMock) Pay(ctx context.Context, peer boson.Address, paymentThreshold *big.Int) error

func (*TraafficMock) PutRetrieveTraffic

func (s *TraafficMock) PutRetrieveTraffic(peer boson.Address, traffic *big.Int) error

func (*TraafficMock) PutTransferTraffic

func (s *TraafficMock) PutTransferTraffic(peer boson.Address, traffic *big.Int) error

func (*TraafficMock) RetrieveTraffic

func (s *TraafficMock) RetrieveTraffic(peer boson.Address) (traffic *big.Int, err error)

func (*TraafficMock) SetNotifyPaymentFunc

func (s *TraafficMock) SetNotifyPaymentFunc(notifyPaymentFunc settlement.NotifyPaymentFunc)

SetNotifyPaymentFunc sets the NotifyPaymentFunc to notify

func (*TraafficMock) TrafficCheques

func (s *TraafficMock) TrafficCheques() ([]*traffic.TrafficCheque, error)

func (*TraafficMock) TrafficInfo

func (s *TraafficMock) TrafficInfo() (*traffic.TrafficInfo, error)

func (*TraafficMock) TrafficInit

func (s *TraafficMock) TrafficInit() error

func (*TraafficMock) TransferTraffic

func (s *TraafficMock) TransferTraffic(peer boson.Address) (traffic *big.Int, err error)

Jump to

Keyboard shortcuts

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