badger

package
v0.36.11-previewnet Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: AGPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBootstrapped added in v0.14.0

func IsBootstrapped(db *badger.DB, clusterID flow.ChainID) (bool, error)

IsBootstrapped returns whether the database contains a bootstrapped state.

Types

type MutableState added in v0.14.0

type MutableState struct {
	*State
	// contains filtered or unexported fields
}

func NewMutableState added in v0.14.0

func NewMutableState(state *State, tracer module.Tracer, headers storage.Headers, payloads storage.ClusterPayloads) (*MutableState, error)

func (*MutableState) Extend added in v0.14.0

func (m *MutableState) Extend(candidate *cluster.Block) error

Extend introduces the given block into the cluster state as a pending without modifying the current finalized state. The block's parent must have already been successfully inserted. TODO(ramtin) pass context here Expected errors during normal operations:

  • state.OutdatedExtensionError if the candidate block is outdated (e.g. orphaned)
  • state.UnverifiableExtensionError if the reference block is _not_ a known finalized block
  • state.InvalidExtensionError if the candidate block is invalid

type Params added in v0.9.6

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

func (*Params) ChainID added in v0.9.6

func (p *Params) ChainID() flow.ChainID

type Snapshot

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

Snapshot represents a snapshot of chain state anchored at a particular reference block.

func (*Snapshot) Collection

func (s *Snapshot) Collection() (*flow.Collection, error)

func (*Snapshot) Head

func (s *Snapshot) Head() (*flow.Header, error)

func (*Snapshot) Pending

func (s *Snapshot) Pending() ([]flow.Identifier, error)

type State

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

func Bootstrap added in v0.14.0

func Bootstrap(db *badger.DB, stateRoot *StateRoot) (*State, error)

Bootstrap initializes the persistent cluster state with a genesis block. The genesis block must have height 0, a parent hash of 32 zero bytes, and an empty collection as payload.

func OpenState added in v0.14.0

func OpenState(db *badger.DB, _ module.Tracer, _ storage.Headers, _ storage.ClusterPayloads, clusterID flow.ChainID, epoch uint64) (*State, error)

func (*State) AtBlockID

func (s *State) AtBlockID(blockID flow.Identifier) cluster.Snapshot

func (*State) Final

func (s *State) Final() cluster.Snapshot

func (*State) Params added in v0.9.6

func (s *State) Params() cluster.Params

type StateRoot added in v0.14.0

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

StateRoot is the root information required to bootstrap the cluster state.

func NewStateRoot added in v0.14.0

func NewStateRoot(genesis *cluster.Block, qc *flow.QuorumCertificate, epoch uint64) (*StateRoot, error)

func (StateRoot) Block added in v0.14.0

func (s StateRoot) Block() *cluster.Block

func (StateRoot) ClusterID added in v0.14.0

func (s StateRoot) ClusterID() flow.ChainID

func (StateRoot) EpochCounter added in v0.31.0

func (s StateRoot) EpochCounter() uint64

func (StateRoot) QC added in v0.29.0

type Translator

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

Translator is a translation layer that determines the reference block on the main chain for a given cluster block, using the reference block from the cluster block's payload.

func NewTranslator

func NewTranslator(payloads storage.ClusterPayloads, state protocol.State) *Translator

NewTranslator returns a new block ID translator.

func (*Translator) Translate

func (t *Translator) Translate(blockID flow.Identifier) (flow.Identifier, error)

Translate retrieves the reference main-chain block ID for the given cluster block ID.

Jump to

Keyboard shortcuts

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