state

package
v1.11.6-jackson Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package state is a generated GoMock package.

Index

Constants

View Source
const CodecVersion = 0

Variables

Functions

This section is empty.

Types

type BlockState

type BlockState interface {
	GetBlock(blkID ids.ID) (block.Block, choices.Status, error)
	PutBlock(blk block.Block, status choices.Status) error
	DeleteBlock(blkID ids.ID) error
}

func NewBlockState

func NewBlockState(db database.Database) BlockState

func NewMeteredBlockState

func NewMeteredBlockState(db database.Database, namespace string, metrics prometheus.Registerer) (BlockState, error)

type ChainState

type ChainState interface {
	SetLastAccepted(blkID ids.ID) error
	DeleteLastAccepted() error
	GetLastAccepted() (ids.ID, error)
}

func NewChainState

func NewChainState(db database.Database) ChainState

type HeightIndex

type HeightIndex interface {
	HeightIndexWriter
	HeightIndexGetter
}

HeightIndex contains mapping of blockHeights to accepted proposer block IDs along with some metadata (fork height and checkpoint).

func NewHeightIndex

func NewHeightIndex(db database.Database, commitable versiondb.Commitable) HeightIndex

type HeightIndexGetter

type HeightIndexGetter interface {
	// GetMinimumHeight return the smallest height of an indexed blockID. If
	// there are no indexed blockIDs, ErrNotFound will be returned.
	GetMinimumHeight() (uint64, error)
	GetBlockIDAtHeight(height uint64) (ids.ID, error)

	// Fork height is stored when the first post-fork block/option is accepted.
	// Before that, fork height won't be found.
	GetForkHeight() (uint64, error)
}

type HeightIndexWriter

type HeightIndexWriter interface {
	SetForkHeight(height uint64) error
	SetBlockIDAtHeight(height uint64, blkID ids.ID) error
	DeleteBlockIDAtHeight(height uint64) error
}

type MockState

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

MockState is a mock of State interface.

func NewMockState

func NewMockState(ctrl *gomock.Controller) *MockState

NewMockState creates a new mock instance.

func (*MockState) DeleteBlock

func (m *MockState) DeleteBlock(arg0 ids.ID) error

DeleteBlock mocks base method.

func (*MockState) DeleteBlockIDAtHeight

func (m *MockState) DeleteBlockIDAtHeight(arg0 uint64) error

DeleteBlockIDAtHeight mocks base method.

func (*MockState) DeleteLastAccepted

func (m *MockState) DeleteLastAccepted() error

DeleteLastAccepted mocks base method.

func (*MockState) EXPECT

func (m *MockState) EXPECT() *MockStateMockRecorder

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

func (*MockState) GetBlock

func (m *MockState) GetBlock(arg0 ids.ID) (block.Block, choices.Status, error)

GetBlock mocks base method.

func (*MockState) GetBlockIDAtHeight

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

GetBlockIDAtHeight mocks base method.

func (*MockState) GetForkHeight

func (m *MockState) GetForkHeight() (uint64, error)

GetForkHeight mocks base method.

func (*MockState) GetLastAccepted

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

GetLastAccepted mocks base method.

func (*MockState) GetMinimumHeight

func (m *MockState) GetMinimumHeight() (uint64, error)

GetMinimumHeight mocks base method.

func (*MockState) PutBlock

func (m *MockState) PutBlock(arg0 block.Block, arg1 choices.Status) error

PutBlock mocks base method.

func (*MockState) SetBlockIDAtHeight

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

SetBlockIDAtHeight mocks base method.

func (*MockState) SetForkHeight

func (m *MockState) SetForkHeight(arg0 uint64) error

SetForkHeight mocks base method.

func (*MockState) SetLastAccepted

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

SetLastAccepted mocks base method.

type MockStateMockRecorder

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

MockStateMockRecorder is the mock recorder for MockState.

func (*MockStateMockRecorder) DeleteBlock

func (mr *MockStateMockRecorder) DeleteBlock(arg0 any) *gomock.Call

DeleteBlock indicates an expected call of DeleteBlock.

func (*MockStateMockRecorder) DeleteBlockIDAtHeight

func (mr *MockStateMockRecorder) DeleteBlockIDAtHeight(arg0 any) *gomock.Call

DeleteBlockIDAtHeight indicates an expected call of DeleteBlockIDAtHeight.

func (*MockStateMockRecorder) DeleteLastAccepted

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

DeleteLastAccepted indicates an expected call of DeleteLastAccepted.

func (*MockStateMockRecorder) GetBlock

func (mr *MockStateMockRecorder) GetBlock(arg0 any) *gomock.Call

GetBlock indicates an expected call of GetBlock.

func (*MockStateMockRecorder) GetBlockIDAtHeight

func (mr *MockStateMockRecorder) GetBlockIDAtHeight(arg0 any) *gomock.Call

GetBlockIDAtHeight indicates an expected call of GetBlockIDAtHeight.

func (*MockStateMockRecorder) GetForkHeight

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

GetForkHeight indicates an expected call of GetForkHeight.

func (*MockStateMockRecorder) GetLastAccepted

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

GetLastAccepted indicates an expected call of GetLastAccepted.

func (*MockStateMockRecorder) GetMinimumHeight

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

GetMinimumHeight indicates an expected call of GetMinimumHeight.

func (*MockStateMockRecorder) PutBlock

func (mr *MockStateMockRecorder) PutBlock(arg0, arg1 any) *gomock.Call

PutBlock indicates an expected call of PutBlock.

func (*MockStateMockRecorder) SetBlockIDAtHeight

func (mr *MockStateMockRecorder) SetBlockIDAtHeight(arg0, arg1 any) *gomock.Call

SetBlockIDAtHeight indicates an expected call of SetBlockIDAtHeight.

func (*MockStateMockRecorder) SetForkHeight

func (mr *MockStateMockRecorder) SetForkHeight(arg0 any) *gomock.Call

SetForkHeight indicates an expected call of SetForkHeight.

func (*MockStateMockRecorder) SetLastAccepted

func (mr *MockStateMockRecorder) SetLastAccepted(arg0 any) *gomock.Call

SetLastAccepted indicates an expected call of SetLastAccepted.

type State

type State interface {
	ChainState
	BlockState
	HeightIndex
}

func New

func New(db *versiondb.Database) State

func NewMetered

func NewMetered(db *versiondb.Database, namespace string, metrics prometheus.Registerer) (State, error)

Jump to

Keyboard shortcuts

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