state

package
v1.11.13 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: BSD-3-Clause Imports: 17 Imported by: 5

Documentation

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, error)
	PutBlock(blk block.Block) 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 added in v1.7.5

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 added in v1.7.5

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

type HeightIndexGetter added in v1.7.5

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 added in v1.7.5

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

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)

Directories

Path Synopsis
Package statemock is a generated GoMock package.
Package statemock is a generated GoMock package.

Jump to

Keyboard shortcuts

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