mocks

package
v0.38.0-preview.0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockResult

type BlockResult struct {
	Block  *entity.ExecutableBlock
	Result *execution.ComputationResult
}

type MockBlockStore

type MockBlockStore struct {
	sync.Mutex
	ResultByBlock map[flow.Identifier]*BlockResult
	Executed      map[flow.Identifier]struct{}
	RootBlock     *flow.Header
}

MockBlockStore contains mocked block computation result it ensures that as blocks computation result are created, the block's start state is the same as its parent block's end state. it also stores which block is executed, so that the mock execution state or computer can determine what result to return

func NewMockBlockStore

func NewMockBlockStore(t *testing.T) *MockBlockStore

func (*MockBlockStore) AssertExecuted

func (bs *MockBlockStore) AssertExecuted(t *testing.T, alias string, block flow.Identifier)

func (*MockBlockStore) AssertNotExecuted

func (bs *MockBlockStore) AssertNotExecuted(t *testing.T, alias string, block flow.Identifier)

func (*MockBlockStore) CreateBlockAndMockResult

func (bs *MockBlockStore) CreateBlockAndMockResult(t *testing.T, block *entity.ExecutableBlock) *execution.ComputationResult

func (*MockBlockStore) GetExecuted

func (bs *MockBlockStore) GetExecuted(blockID flow.Identifier) (*BlockResult, error)

func (*MockBlockStore) MarkExecuted

func (bs *MockBlockStore) MarkExecuted(computationResult *execution.ComputationResult) error

type MockCollectionStore

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

func NewMockCollectionStore

func NewMockCollectionStore() *MockCollectionStore

func (*MockCollectionStore) ByID

func (*MockCollectionStore) LightByID

func (*MockCollectionStore) LightByTransactionID

func (m *MockCollectionStore) LightByTransactionID(id flow.Identifier) (*flow.LightCollection, error)

func (*MockCollectionStore) Remove

func (m *MockCollectionStore) Remove(id flow.Identifier) error

func (*MockCollectionStore) Store

func (*MockCollectionStore) StoreLight

func (m *MockCollectionStore) StoreLight(collection *flow.LightCollection) error

func (*MockCollectionStore) StoreLightAndIndexByTransaction

func (m *MockCollectionStore) StoreLightAndIndexByTransaction(collection *flow.LightCollection) error

type MockFetcher

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

func NewMockFetcher

func NewMockFetcher() *MockFetcher

func (*MockFetcher) FetchCollection

func (r *MockFetcher) FetchCollection(blockID flow.Identifier, height uint64, guarantee *flow.CollectionGuarantee) error

func (*MockFetcher) Force

func (r *MockFetcher) Force()

func (*MockFetcher) IsFetched

func (r *MockFetcher) IsFetched(id flow.Identifier) bool

Jump to

Keyboard shortcuts

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