mock

package
v1.13.1-rc7 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchStore

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

BatchStore is a mock BatchStorer

func New

func New(opts ...Option) *BatchStore

New creates a new mock BatchStore

func (*BatchStore) Exists added in v1.1.0

func (bs *BatchStore) Exists(id []byte) (bool, error)

Exists reports whether batch referenced by the give id exists.

func (*BatchStore) Get

func (bs *BatchStore) Get(id []byte) (*postage.Batch, error)

Get mocks the Get method from the BatchStore.

func (*BatchStore) GetChainState

func (bs *BatchStore) GetChainState() *postage.ChainState

GetChainState mocks the GetChainState method from the BatchStore

func (*BatchStore) GetReserveState

func (bs *BatchStore) GetReserveState() *postage.ReserveState

func (*BatchStore) IsWithinStorageRadius added in v1.12.0

func (bs *BatchStore) IsWithinStorageRadius(swarm.Address) bool

func (*BatchStore) Iterate added in v1.4.2

func (bs *BatchStore) Iterate(f func(*postage.Batch) (bool, error)) error

Iterate mocks the Iterate method from the BatchStore

func (*BatchStore) PutChainState

func (bs *BatchStore) PutChainState(cs *postage.ChainState) error

PutChainState mocks the PutChainState method from the BatchStore

func (*BatchStore) Reset

func (bs *BatchStore) Reset() error

func (*BatchStore) ResetCalls

func (bs *BatchStore) ResetCalls() int

func (*BatchStore) Save added in v1.4.2

func (bs *BatchStore) Save(batch *postage.Batch) error

Save mocks the Save method from the BatchStore.

func (*BatchStore) SetBatchExpiryHandler added in v1.8.0

func (bs *BatchStore) SetBatchExpiryHandler(eh postage.BatchExpiryHandler)

func (*BatchStore) SetStorageRadius added in v1.8.0

func (bs *BatchStore) SetStorageRadius(f func(uint8) uint8) error

func (*BatchStore) SetStorageRadiusSetter added in v1.8.0

func (bs *BatchStore) SetStorageRadiusSetter(r postage.StorageRadiusSetter)

func (*BatchStore) StorageRadius added in v1.12.0

func (bs *BatchStore) StorageRadius() uint8

func (*BatchStore) Unreserve added in v1.0.0

func (bs *BatchStore) Unreserve(_ postage.UnreserveIteratorFn) error

func (*BatchStore) Update added in v1.4.2

func (bs *BatchStore) Update(batch *postage.Batch, newValue *big.Int, newDepth uint8) error

Update mocks the Update method from the BatchStore.

type MockEventUpdater added in v1.8.0

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

func NewNotReady added in v1.8.0

func NewNotReady() *MockEventUpdater

func NewWithError added in v1.8.0

func NewWithError(err error) *MockEventUpdater

func (*MockEventUpdater) GetSyncStatus added in v1.8.0

func (s *MockEventUpdater) GetSyncStatus() (isDone bool, err error)

type Option

type Option func(*BatchStore)

Option is an option passed to New.

func WithAcceptAllExistsFunc added in v1.6.3

func WithAcceptAllExistsFunc() Option

func WithBatch added in v1.0.0

func WithBatch(b *postage.Batch) Option

WithBatch will set batch to the one provided by user. This will be returned in the next Get.

func WithChainState

func WithChainState(cs *postage.ChainState) Option

WithChainState will set the initial chainstate in the ChainStore mock.

func WithExistsFunc added in v1.6.3

func WithExistsFunc(f func([]byte) (bool, error)) Option

func WithGetErr

func WithGetErr(err error, delayCnt int) Option

WithGetErr will set the get error returned by the ChainStore mock. The error will be returned on each subsequent call after delayCnt calls to Get have been made.

func WithIsWithinStorageRadius added in v1.12.0

func WithIsWithinStorageRadius(b bool) Option

func WithReserveState

func WithReserveState(rs *postage.ReserveState) Option

WithReserveState will set the initial reservestate in the ChainStore mock.

func WithSaveError added in v1.14.0

func WithSaveError(err error) Option

func WithUpdateErr added in v1.4.2

func WithUpdateErr(err error, delayCnt int) Option

WithUpdateErr will set the put error returned by the ChainStore mock. The error will be returned on each subsequent call after delayCnt calls to Update have been made.

Jump to

Keyboard shortcuts

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