Documentation ¶
Index ¶
- type Option
- type PullStorage
- func (s *PullStorage) Cursors(ctx context.Context) (curs []uint64, err error)
- func (s *PullStorage) Get(_ context.Context, _ storage.ModeGet, addrs ...swarm.Address) (chs []swarm.Chunk, err error)
- func (s *PullStorage) Has(_ context.Context, addr swarm.Address) (bool, error)
- func (s *PullStorage) IntervalChunks(_ context.Context, bin uint8, from, to uint64, limit int) (chunks []swarm.Address, topmost uint64, err error)
- func (s *PullStorage) Put(_ context.Context, _ storage.ModePut, chs ...swarm.Chunk) error
- func (s *PullStorage) PutCalls() int
- func (s *PullStorage) Set(ctx context.Context, mode storage.ModeSet, addrs ...swarm.Address) error
- func (s *PullStorage) SetCalls() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithChunks ¶
WithChunks mocks the set of chunks that the store is aware of (used in Get and Has calls).
func WithCursors ¶
func WithCursorsErr ¶
func WithEvilChunk ¶
WithEvilChunk allows to inject a malicious chunk (request a certain address of a chunk, but get another), in order to mock unsolicited chunk delivery.
func WithIntervalsResp ¶
WithIntervalsResp mocks a desired response when calling IntervalChunks method. Different possible responses for subsequent responses in multi-call scenarios are possible (i.e. first call yields a,b,c, second call yields d,e,f). Mock maintains state of current call using chunksCalls counter.
type PullStorage ¶
type PullStorage struct {
// contains filtered or unexported fields
}
func NewPullStorage ¶
func NewPullStorage(opts ...Option) *PullStorage
NewPullStorage returns a new PullStorage mock.
func (*PullStorage) Cursors ¶
func (s *PullStorage) Cursors(ctx context.Context) (curs []uint64, err error)
func (*PullStorage) Get ¶
func (s *PullStorage) Get(_ context.Context, _ storage.ModeGet, addrs ...swarm.Address) (chs []swarm.Chunk, err error)
Get chunks.
func (*PullStorage) IntervalChunks ¶
func (s *PullStorage) IntervalChunks(_ context.Context, bin uint8, from, to uint64, limit int) (chunks []swarm.Address, topmost uint64, err error)
IntervalChunks returns a set of chunk in a requested interval.
func (*PullStorage) PutCalls ¶
func (s *PullStorage) PutCalls() int
PutCalls returns the amount of times Put was called.
func (*PullStorage) SetCalls ¶
func (s *PullStorage) SetCalls() int
SetCalls returns the amount of times Set was called.