mocks

package
v0.7.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStore

type MockStore[H header.Header] struct {
	Headers    map[int64]H
	HeadHeight int64
}

func NewStore

func NewStore[H header.Header](t *testing.T, gen test.Generator[H], numHeaders int) *MockStore[H]

NewStore creates a mock store and adds several random headers

func (*MockStore[H]) Append

func (m *MockStore[H]) Append(ctx context.Context, headers ...H) (int, error)

func (*MockStore[H]) Get

func (m *MockStore[H]) Get(ctx context.Context, hash header.Hash) (H, error)

func (*MockStore[H]) GetByHeight

func (m *MockStore[H]) GetByHeight(ctx context.Context, height uint64) (H, error)

func (*MockStore[H]) GetRangeByHeight

func (m *MockStore[H]) GetRangeByHeight(ctx context.Context, from, to uint64) ([]H, error)

func (*MockStore[H]) GetVerifiedRange

func (m *MockStore[H]) GetVerifiedRange(
	ctx context.Context,
	h H,
	to uint64,
) ([]H, error)

func (*MockStore[H]) Has

func (m *MockStore[H]) Has(context.Context, header.Hash) (bool, error)

func (*MockStore[H]) HasAt added in v0.7.0

func (m *MockStore[H]) HasAt(_ context.Context, height uint64) bool

func (*MockStore[H]) Head

func (m *MockStore[H]) Head(context.Context) (H, error)

func (*MockStore[H]) Height

func (m *MockStore[H]) Height() uint64

func (*MockStore[H]) Init

func (m *MockStore[H]) Init(context.Context, H) error

func (*MockStore[H]) Start

func (m *MockStore[H]) Start(context.Context) error

func (*MockStore[H]) Stop

func (m *MockStore[H]) Stop(context.Context) error

Jump to

Keyboard shortcuts

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