Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMissingParentState = errors.New("missing parent state")
)
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain interface { GetUTXO(utxoID ids.ID) (*avax.UTXO, error) AddUTXO(utxo *avax.UTXO) DeleteUTXO(utxoID ids.ID) GetTx(txID ids.ID) (*txs.Tx, error) AddTx(tx *txs.Tx) GetBlockID(height uint64) (ids.ID, error) GetBlock(blkID ids.ID) (blocks.Block, error) AddBlock(block blocks.Block) GetLastAccepted() ids.ID SetLastAccepted(blkID ids.ID) GetTimestamp() time.Time SetTimestamp(t 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)
Click to show internal directories.
Click to hide internal directories.