executor

package
v1.10.1-rc.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: BSD-3-Clause Imports: 23 Imported by: 0

README

Package executor

This package deals with state management for P-Chain blocks.

*Block

The *Block type implements the snowman.Block interface. This is the type that the platformvm deals with when it uses snowman.Blocks. *Block wraps a blocks.Block and a manager. The *Block itself doesn't have any state. The state is all held by the manager, and the *Block acts upon the manager to get/set the state. Therefore, we don't need to worry about deduplicating *Block instances.

The platformvm uses the manager to create blocks and query block state because the manager.GetBlock returns a stateful block (*Block), whereas state.State's GetStatelessBlock returns a blocks.Block.

Visitors

This package contains three implementations of blocks.Visitor: verifier, acceptor and rejector. These implement the logic for verifying, accepting and rejecting blocks. Each implementation has a reference to a shared *backend, which maintains state, etc. (The manager has a reference to the shared *backend as well.)

Documentation

Overview

Package executor is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	blocks.Block
	// contains filtered or unexported fields
}

Exported for testing in platformvm package.

func (*Block) Accept

func (b *Block) Accept(context.Context) error

func (*Block) Options

func (b *Block) Options(context.Context) ([2]snowman.Block, error)

func (*Block) Reject

func (b *Block) Reject(context.Context) error

func (*Block) Status

func (b *Block) Status() choices.Status

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

func (*Block) Verify

func (b *Block) Verify(context.Context) error

type Manager

type Manager interface {
	state.Versions

	// Returns the ID of the most recently accepted block.
	LastAccepted() ids.ID
	GetBlock(blkID ids.ID) (snowman.Block, error)
	GetStatelessBlock(blkID ids.ID) (blocks.Block, error)
	NewBlock(blocks.Block) snowman.Block
}

func NewManager

func NewManager(
	mempool mempool.Mempool,
	metrics metrics.Metrics,
	s state.State,
	txExecutorBackend *executor.Backend,
	recentlyAccepted window.Window[ids.ID],
) Manager

type MockManager added in v1.9.4

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

MockManager is a mock of Manager interface.

func NewMockManager added in v1.9.4

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) EXPECT added in v1.9.4

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) GetBlock added in v1.9.4

func (m *MockManager) GetBlock(arg0 ids.ID) (snowman.Block, error)

GetBlock mocks base method.

func (*MockManager) GetState added in v1.9.4

func (m *MockManager) GetState(arg0 ids.ID) (state.Chain, bool)

GetState mocks base method.

func (*MockManager) GetStatelessBlock added in v1.9.4

func (m *MockManager) GetStatelessBlock(arg0 ids.ID) (blocks.Block, error)

GetStatelessBlock mocks base method.

func (*MockManager) LastAccepted added in v1.9.4

func (m *MockManager) LastAccepted() ids.ID

LastAccepted mocks base method.

func (*MockManager) NewBlock added in v1.9.4

func (m *MockManager) NewBlock(arg0 blocks.Block) snowman.Block

NewBlock mocks base method.

type MockManagerMockRecorder added in v1.9.4

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) GetBlock added in v1.9.4

func (mr *MockManagerMockRecorder) GetBlock(arg0 interface{}) *gomock.Call

GetBlock indicates an expected call of GetBlock.

func (*MockManagerMockRecorder) GetState added in v1.9.4

func (mr *MockManagerMockRecorder) GetState(arg0 interface{}) *gomock.Call

GetState indicates an expected call of GetState.

func (*MockManagerMockRecorder) GetStatelessBlock added in v1.9.4

func (mr *MockManagerMockRecorder) GetStatelessBlock(arg0 interface{}) *gomock.Call

GetStatelessBlock indicates an expected call of GetStatelessBlock.

func (*MockManagerMockRecorder) LastAccepted added in v1.9.4

func (mr *MockManagerMockRecorder) LastAccepted() *gomock.Call

LastAccepted indicates an expected call of LastAccepted.

func (*MockManagerMockRecorder) NewBlock added in v1.9.4

func (mr *MockManagerMockRecorder) NewBlock(arg0 interface{}) *gomock.Call

NewBlock indicates an expected call of NewBlock.

Jump to

Keyboard shortcuts

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