states

package
v1.9.15 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package states is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingParentState = errors.New("missing parent state")
)

Functions

This section is empty.

Types

type Chain added in v1.9.8

type Chain interface {
	ReadOnlyChain
	avax.UTXOAdder
	avax.UTXODeleter

	AddTx(tx *txs.Tx)
	AddBlock(block blocks.Block)
	SetLastAccepted(blkID ids.ID)
	SetTimestamp(t time.Time)
}

type Diff added in v1.9.8

type Diff interface {
	Chain

	Apply(Chain)
}

func NewDiff added in v1.9.8

func NewDiff(
	parentID ids.ID,
	stateVersions Versions,
) (Diff, error)

type MockChain added in v1.9.12

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

MockChain is a mock of Chain interface.

func NewMockChain added in v1.9.12

func NewMockChain(ctrl *gomock.Controller) *MockChain

NewMockChain creates a new mock instance.

func (*MockChain) AddBlock added in v1.9.12

func (m *MockChain) AddBlock(arg0 blocks.Block)

AddBlock mocks base method.

func (*MockChain) AddTx added in v1.9.12

func (m *MockChain) AddTx(arg0 *txs.Tx)

AddTx mocks base method.

func (*MockChain) AddUTXO added in v1.9.12

func (m *MockChain) AddUTXO(arg0 *avax.UTXO)

AddUTXO mocks base method.

func (*MockChain) DeleteUTXO added in v1.9.12

func (m *MockChain) DeleteUTXO(arg0 ids.ID)

DeleteUTXO mocks base method.

func (*MockChain) EXPECT added in v1.9.12

func (m *MockChain) EXPECT() *MockChainMockRecorder

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

func (*MockChain) GetBlock added in v1.9.12

func (m *MockChain) GetBlock(arg0 ids.ID) (blocks.Block, error)

GetBlock mocks base method.

func (*MockChain) GetBlockID added in v1.9.12

func (m *MockChain) GetBlockID(arg0 uint64) (ids.ID, error)

GetBlockID mocks base method.

func (*MockChain) GetLastAccepted added in v1.9.12

func (m *MockChain) GetLastAccepted() ids.ID

GetLastAccepted mocks base method.

func (*MockChain) GetTimestamp added in v1.9.12

func (m *MockChain) GetTimestamp() time.Time

GetTimestamp mocks base method.

func (*MockChain) GetTx added in v1.9.12

func (m *MockChain) GetTx(arg0 ids.ID) (*txs.Tx, error)

GetTx mocks base method.

func (*MockChain) GetUTXO added in v1.9.12

func (m *MockChain) GetUTXO(arg0 ids.ID) (*avax.UTXO, error)

GetUTXO mocks base method.

func (*MockChain) GetUTXOFromID added in v1.9.12

func (m *MockChain) GetUTXOFromID(arg0 *avax.UTXOID) (*avax.UTXO, error)

GetUTXOFromID mocks base method.

func (*MockChain) SetLastAccepted added in v1.9.12

func (m *MockChain) SetLastAccepted(arg0 ids.ID)

SetLastAccepted mocks base method.

func (*MockChain) SetTimestamp added in v1.9.12

func (m *MockChain) SetTimestamp(arg0 time.Time)

SetTimestamp mocks base method.

type MockChainMockRecorder added in v1.9.12

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

MockChainMockRecorder is the mock recorder for MockChain.

func (*MockChainMockRecorder) AddBlock added in v1.9.12

func (mr *MockChainMockRecorder) AddBlock(arg0 interface{}) *gomock.Call

AddBlock indicates an expected call of AddBlock.

func (*MockChainMockRecorder) AddTx added in v1.9.12

func (mr *MockChainMockRecorder) AddTx(arg0 interface{}) *gomock.Call

AddTx indicates an expected call of AddTx.

func (*MockChainMockRecorder) AddUTXO added in v1.9.12

func (mr *MockChainMockRecorder) AddUTXO(arg0 interface{}) *gomock.Call

AddUTXO indicates an expected call of AddUTXO.

func (*MockChainMockRecorder) DeleteUTXO added in v1.9.12

func (mr *MockChainMockRecorder) DeleteUTXO(arg0 interface{}) *gomock.Call

DeleteUTXO indicates an expected call of DeleteUTXO.

func (*MockChainMockRecorder) GetBlock added in v1.9.12

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

GetBlock indicates an expected call of GetBlock.

func (*MockChainMockRecorder) GetBlockID added in v1.9.12

func (mr *MockChainMockRecorder) GetBlockID(arg0 interface{}) *gomock.Call

GetBlockID indicates an expected call of GetBlockID.

func (*MockChainMockRecorder) GetLastAccepted added in v1.9.12

func (mr *MockChainMockRecorder) GetLastAccepted() *gomock.Call

GetLastAccepted indicates an expected call of GetLastAccepted.

func (*MockChainMockRecorder) GetTimestamp added in v1.9.12

func (mr *MockChainMockRecorder) GetTimestamp() *gomock.Call

GetTimestamp indicates an expected call of GetTimestamp.

func (*MockChainMockRecorder) GetTx added in v1.9.12

func (mr *MockChainMockRecorder) GetTx(arg0 interface{}) *gomock.Call

GetTx indicates an expected call of GetTx.

func (*MockChainMockRecorder) GetUTXO added in v1.9.12

func (mr *MockChainMockRecorder) GetUTXO(arg0 interface{}) *gomock.Call

GetUTXO indicates an expected call of GetUTXO.

func (*MockChainMockRecorder) GetUTXOFromID added in v1.9.12

func (mr *MockChainMockRecorder) GetUTXOFromID(arg0 interface{}) *gomock.Call

GetUTXOFromID indicates an expected call of GetUTXOFromID.

func (*MockChainMockRecorder) SetLastAccepted added in v1.9.12

func (mr *MockChainMockRecorder) SetLastAccepted(arg0 interface{}) *gomock.Call

SetLastAccepted indicates an expected call of SetLastAccepted.

func (*MockChainMockRecorder) SetTimestamp added in v1.9.12

func (mr *MockChainMockRecorder) SetTimestamp(arg0 interface{}) *gomock.Call

SetTimestamp indicates an expected call of SetTimestamp.

type MockDiff added in v1.9.12

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

MockDiff is a mock of Diff interface.

func NewMockDiff added in v1.9.12

func NewMockDiff(ctrl *gomock.Controller) *MockDiff

NewMockDiff creates a new mock instance.

func (*MockDiff) AddBlock added in v1.9.12

func (m *MockDiff) AddBlock(arg0 blocks.Block)

AddBlock mocks base method.

func (*MockDiff) AddTx added in v1.9.12

func (m *MockDiff) AddTx(arg0 *txs.Tx)

AddTx mocks base method.

func (*MockDiff) AddUTXO added in v1.9.12

func (m *MockDiff) AddUTXO(arg0 *avax.UTXO)

AddUTXO mocks base method.

func (*MockDiff) Apply added in v1.9.12

func (m *MockDiff) Apply(arg0 Chain)

Apply mocks base method.

func (*MockDiff) DeleteUTXO added in v1.9.12

func (m *MockDiff) DeleteUTXO(arg0 ids.ID)

DeleteUTXO mocks base method.

func (*MockDiff) EXPECT added in v1.9.12

func (m *MockDiff) EXPECT() *MockDiffMockRecorder

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

func (*MockDiff) GetBlock added in v1.9.12

func (m *MockDiff) GetBlock(arg0 ids.ID) (blocks.Block, error)

GetBlock mocks base method.

func (*MockDiff) GetBlockID added in v1.9.12

func (m *MockDiff) GetBlockID(arg0 uint64) (ids.ID, error)

GetBlockID mocks base method.

func (*MockDiff) GetLastAccepted added in v1.9.12

func (m *MockDiff) GetLastAccepted() ids.ID

GetLastAccepted mocks base method.

func (*MockDiff) GetTimestamp added in v1.9.12

func (m *MockDiff) GetTimestamp() time.Time

GetTimestamp mocks base method.

func (*MockDiff) GetTx added in v1.9.12

func (m *MockDiff) GetTx(arg0 ids.ID) (*txs.Tx, error)

GetTx mocks base method.

func (*MockDiff) GetUTXO added in v1.9.12

func (m *MockDiff) GetUTXO(arg0 ids.ID) (*avax.UTXO, error)

GetUTXO mocks base method.

func (*MockDiff) GetUTXOFromID added in v1.9.12

func (m *MockDiff) GetUTXOFromID(arg0 *avax.UTXOID) (*avax.UTXO, error)

GetUTXOFromID mocks base method.

func (*MockDiff) SetLastAccepted added in v1.9.12

func (m *MockDiff) SetLastAccepted(arg0 ids.ID)

SetLastAccepted mocks base method.

func (*MockDiff) SetTimestamp added in v1.9.12

func (m *MockDiff) SetTimestamp(arg0 time.Time)

SetTimestamp mocks base method.

type MockDiffMockRecorder added in v1.9.12

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

MockDiffMockRecorder is the mock recorder for MockDiff.

func (*MockDiffMockRecorder) AddBlock added in v1.9.12

func (mr *MockDiffMockRecorder) AddBlock(arg0 interface{}) *gomock.Call

AddBlock indicates an expected call of AddBlock.

func (*MockDiffMockRecorder) AddTx added in v1.9.12

func (mr *MockDiffMockRecorder) AddTx(arg0 interface{}) *gomock.Call

AddTx indicates an expected call of AddTx.

func (*MockDiffMockRecorder) AddUTXO added in v1.9.12

func (mr *MockDiffMockRecorder) AddUTXO(arg0 interface{}) *gomock.Call

AddUTXO indicates an expected call of AddUTXO.

func (*MockDiffMockRecorder) Apply added in v1.9.12

func (mr *MockDiffMockRecorder) Apply(arg0 interface{}) *gomock.Call

Apply indicates an expected call of Apply.

func (*MockDiffMockRecorder) DeleteUTXO added in v1.9.12

func (mr *MockDiffMockRecorder) DeleteUTXO(arg0 interface{}) *gomock.Call

DeleteUTXO indicates an expected call of DeleteUTXO.

func (*MockDiffMockRecorder) GetBlock added in v1.9.12

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

GetBlock indicates an expected call of GetBlock.

func (*MockDiffMockRecorder) GetBlockID added in v1.9.12

func (mr *MockDiffMockRecorder) GetBlockID(arg0 interface{}) *gomock.Call

GetBlockID indicates an expected call of GetBlockID.

func (*MockDiffMockRecorder) GetLastAccepted added in v1.9.12

func (mr *MockDiffMockRecorder) GetLastAccepted() *gomock.Call

GetLastAccepted indicates an expected call of GetLastAccepted.

func (*MockDiffMockRecorder) GetTimestamp added in v1.9.12

func (mr *MockDiffMockRecorder) GetTimestamp() *gomock.Call

GetTimestamp indicates an expected call of GetTimestamp.

func (*MockDiffMockRecorder) GetTx added in v1.9.12

func (mr *MockDiffMockRecorder) GetTx(arg0 interface{}) *gomock.Call

GetTx indicates an expected call of GetTx.

func (*MockDiffMockRecorder) GetUTXO added in v1.9.12

func (mr *MockDiffMockRecorder) GetUTXO(arg0 interface{}) *gomock.Call

GetUTXO indicates an expected call of GetUTXO.

func (*MockDiffMockRecorder) GetUTXOFromID added in v1.9.12

func (mr *MockDiffMockRecorder) GetUTXOFromID(arg0 interface{}) *gomock.Call

GetUTXOFromID indicates an expected call of GetUTXOFromID.

func (*MockDiffMockRecorder) SetLastAccepted added in v1.9.12

func (mr *MockDiffMockRecorder) SetLastAccepted(arg0 interface{}) *gomock.Call

SetLastAccepted indicates an expected call of SetLastAccepted.

func (*MockDiffMockRecorder) SetTimestamp added in v1.9.12

func (mr *MockDiffMockRecorder) SetTimestamp(arg0 interface{}) *gomock.Call

SetTimestamp indicates an expected call of SetTimestamp.

type MockState added in v1.9.12

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

MockState is a mock of State interface.

func NewMockState added in v1.9.12

func NewMockState(ctrl *gomock.Controller) *MockState

NewMockState creates a new mock instance.

func (*MockState) Abort added in v1.9.12

func (m *MockState) Abort()

Abort mocks base method.

func (*MockState) AddBlock added in v1.9.12

func (m *MockState) AddBlock(arg0 blocks.Block)

AddBlock mocks base method.

func (*MockState) AddStatus added in v1.9.12

func (m *MockState) AddStatus(arg0 ids.ID, arg1 choices.Status)

AddStatus mocks base method.

func (*MockState) AddTx added in v1.9.12

func (m *MockState) AddTx(arg0 *txs.Tx)

AddTx mocks base method.

func (*MockState) AddUTXO added in v1.9.12

func (m *MockState) AddUTXO(arg0 *avax.UTXO)

AddUTXO mocks base method.

func (*MockState) Close added in v1.9.12

func (m *MockState) Close() error

Close mocks base method.

func (*MockState) Commit added in v1.9.12

func (m *MockState) Commit() error

Commit mocks base method.

func (*MockState) CommitBatch added in v1.9.12

func (m *MockState) CommitBatch() (database.Batch, error)

CommitBatch mocks base method.

func (*MockState) DeleteUTXO added in v1.9.12

func (m *MockState) DeleteUTXO(arg0 ids.ID)

DeleteUTXO mocks base method.

func (*MockState) EXPECT added in v1.9.12

func (m *MockState) EXPECT() *MockStateMockRecorder

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

func (*MockState) GetBlock added in v1.9.12

func (m *MockState) GetBlock(arg0 ids.ID) (blocks.Block, error)

GetBlock mocks base method.

func (*MockState) GetBlockID added in v1.9.12

func (m *MockState) GetBlockID(arg0 uint64) (ids.ID, error)

GetBlockID mocks base method.

func (*MockState) GetLastAccepted added in v1.9.12

func (m *MockState) GetLastAccepted() ids.ID

GetLastAccepted mocks base method.

func (*MockState) GetStatus added in v1.9.12

func (m *MockState) GetStatus(arg0 ids.ID) (choices.Status, error)

GetStatus mocks base method.

func (*MockState) GetTimestamp added in v1.9.12

func (m *MockState) GetTimestamp() time.Time

GetTimestamp mocks base method.

func (*MockState) GetTx added in v1.9.12

func (m *MockState) GetTx(arg0 ids.ID) (*txs.Tx, error)

GetTx mocks base method.

func (*MockState) GetUTXO added in v1.9.12

func (m *MockState) GetUTXO(arg0 ids.ID) (*avax.UTXO, error)

GetUTXO mocks base method.

func (*MockState) GetUTXOFromID added in v1.9.12

func (m *MockState) GetUTXOFromID(arg0 *avax.UTXOID) (*avax.UTXO, error)

GetUTXOFromID mocks base method.

func (*MockState) InitializeChainState added in v1.9.12

func (m *MockState) InitializeChainState(arg0 ids.ID, arg1 time.Time) error

InitializeChainState mocks base method.

func (*MockState) IsInitialized added in v1.9.12

func (m *MockState) IsInitialized() (bool, error)

IsInitialized mocks base method.

func (*MockState) SetInitialized added in v1.9.12

func (m *MockState) SetInitialized() error

SetInitialized mocks base method.

func (*MockState) SetLastAccepted added in v1.9.12

func (m *MockState) SetLastAccepted(arg0 ids.ID)

SetLastAccepted mocks base method.

func (*MockState) SetTimestamp added in v1.9.12

func (m *MockState) SetTimestamp(arg0 time.Time)

SetTimestamp mocks base method.

func (*MockState) UTXOIDs added in v1.9.12

func (m *MockState) UTXOIDs(arg0 []byte, arg1 ids.ID, arg2 int) ([]ids.ID, error)

UTXOIDs mocks base method.

type MockStateMockRecorder added in v1.9.12

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

MockStateMockRecorder is the mock recorder for MockState.

func (*MockStateMockRecorder) Abort added in v1.9.12

func (mr *MockStateMockRecorder) Abort() *gomock.Call

Abort indicates an expected call of Abort.

func (*MockStateMockRecorder) AddBlock added in v1.9.12

func (mr *MockStateMockRecorder) AddBlock(arg0 interface{}) *gomock.Call

AddBlock indicates an expected call of AddBlock.

func (*MockStateMockRecorder) AddStatus added in v1.9.12

func (mr *MockStateMockRecorder) AddStatus(arg0, arg1 interface{}) *gomock.Call

AddStatus indicates an expected call of AddStatus.

func (*MockStateMockRecorder) AddTx added in v1.9.12

func (mr *MockStateMockRecorder) AddTx(arg0 interface{}) *gomock.Call

AddTx indicates an expected call of AddTx.

func (*MockStateMockRecorder) AddUTXO added in v1.9.12

func (mr *MockStateMockRecorder) AddUTXO(arg0 interface{}) *gomock.Call

AddUTXO indicates an expected call of AddUTXO.

func (*MockStateMockRecorder) Close added in v1.9.12

func (mr *MockStateMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockStateMockRecorder) Commit added in v1.9.12

func (mr *MockStateMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit.

func (*MockStateMockRecorder) CommitBatch added in v1.9.12

func (mr *MockStateMockRecorder) CommitBatch() *gomock.Call

CommitBatch indicates an expected call of CommitBatch.

func (*MockStateMockRecorder) DeleteUTXO added in v1.9.12

func (mr *MockStateMockRecorder) DeleteUTXO(arg0 interface{}) *gomock.Call

DeleteUTXO indicates an expected call of DeleteUTXO.

func (*MockStateMockRecorder) GetBlock added in v1.9.12

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

GetBlock indicates an expected call of GetBlock.

func (*MockStateMockRecorder) GetBlockID added in v1.9.12

func (mr *MockStateMockRecorder) GetBlockID(arg0 interface{}) *gomock.Call

GetBlockID indicates an expected call of GetBlockID.

func (*MockStateMockRecorder) GetLastAccepted added in v1.9.12

func (mr *MockStateMockRecorder) GetLastAccepted() *gomock.Call

GetLastAccepted indicates an expected call of GetLastAccepted.

func (*MockStateMockRecorder) GetStatus added in v1.9.12

func (mr *MockStateMockRecorder) GetStatus(arg0 interface{}) *gomock.Call

GetStatus indicates an expected call of GetStatus.

func (*MockStateMockRecorder) GetTimestamp added in v1.9.12

func (mr *MockStateMockRecorder) GetTimestamp() *gomock.Call

GetTimestamp indicates an expected call of GetTimestamp.

func (*MockStateMockRecorder) GetTx added in v1.9.12

func (mr *MockStateMockRecorder) GetTx(arg0 interface{}) *gomock.Call

GetTx indicates an expected call of GetTx.

func (*MockStateMockRecorder) GetUTXO added in v1.9.12

func (mr *MockStateMockRecorder) GetUTXO(arg0 interface{}) *gomock.Call

GetUTXO indicates an expected call of GetUTXO.

func (*MockStateMockRecorder) GetUTXOFromID added in v1.9.12

func (mr *MockStateMockRecorder) GetUTXOFromID(arg0 interface{}) *gomock.Call

GetUTXOFromID indicates an expected call of GetUTXOFromID.

func (*MockStateMockRecorder) InitializeChainState added in v1.9.12

func (mr *MockStateMockRecorder) InitializeChainState(arg0, arg1 interface{}) *gomock.Call

InitializeChainState indicates an expected call of InitializeChainState.

func (*MockStateMockRecorder) IsInitialized added in v1.9.12

func (mr *MockStateMockRecorder) IsInitialized() *gomock.Call

IsInitialized indicates an expected call of IsInitialized.

func (*MockStateMockRecorder) SetInitialized added in v1.9.12

func (mr *MockStateMockRecorder) SetInitialized() *gomock.Call

SetInitialized indicates an expected call of SetInitialized.

func (*MockStateMockRecorder) SetLastAccepted added in v1.9.12

func (mr *MockStateMockRecorder) SetLastAccepted(arg0 interface{}) *gomock.Call

SetLastAccepted indicates an expected call of SetLastAccepted.

func (*MockStateMockRecorder) SetTimestamp added in v1.9.12

func (mr *MockStateMockRecorder) SetTimestamp(arg0 interface{}) *gomock.Call

SetTimestamp indicates an expected call of SetTimestamp.

func (*MockStateMockRecorder) UTXOIDs added in v1.9.12

func (mr *MockStateMockRecorder) UTXOIDs(arg0, arg1, arg2 interface{}) *gomock.Call

UTXOIDs indicates an expected call of UTXOIDs.

type ReadOnlyChain added in v1.9.12

type ReadOnlyChain interface {
	avax.UTXOGetter

	// TODO: Remove GetUTXOFromID after the DAG linearization
	GetUTXOFromID(utxoID *avax.UTXOID) (*avax.UTXO, error)

	GetTx(txID ids.ID) (*txs.Tx, error)
	GetBlockID(height uint64) (ids.ID, error)
	GetBlock(blkID ids.ID) (blocks.Block, error)
	GetLastAccepted() ids.ID
	GetTimestamp() time.Time
}

type State

type State interface {
	Chain
	avax.UTXOReader

	IsInitialized() (bool, error)
	SetInitialized() error

	// InitializeChainState is called after the VM has been linearized. Calling
	// [GetLastAccepted] or [GetTimestamp] before calling this function will
	// return uninitialized data.
	//
	// Invariant: After the chain is linearized, this function is expected to be
	// called during startup.
	InitializeChainState(stopVertexID ids.ID, genesisTimestamp time.Time) error

	// TODO: deprecate statuses. We should only persist accepted state
	// Status returns a status from storage.
	GetStatus(id ids.ID) (choices.Status, error)
	// AddStatus saves a status in storage.
	AddStatus(id ids.ID, status choices.Status)

	// Discard uncommitted changes to the database.
	Abort()

	// Commit changes to the base database.
	Commit() error

	// Returns a batch of unwritten changes that, when written, will commit all
	// pending changes to the base database.
	CommitBatch() (database.Batch, error)

	Close() error
}

State persistently maintains a set of UTXOs, transaction, statuses, and singletons.

func New

func New(
	db *versiondb.Database,
	parser blocks.Parser,
	metrics prometheus.Registerer,
) (State, error)

type Versions added in v1.9.8

type Versions interface {
	// GetState returns the state of the chain after [blkID] has been accepted.
	// If the state is not known, `false` will be returned.
	GetState(blkID ids.ID) (Chain, bool)
}

Jump to

Keyboard shortcuts

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