badger

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: AGPL-3.0 Imports: 19 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

Cluster implements interface protocol.Cluster It is a container with all information about a specific cluster.

func (Cluster) ChainID

func (c Cluster) ChainID() flow.ChainID

func (Cluster) EpochCounter

func (c Cluster) EpochCounter() uint64

func (Cluster) Index

func (c Cluster) Index() uint

func (Cluster) Members

func (c Cluster) Members() flow.IdentityList

func (Cluster) RootBlock

func (c Cluster) RootBlock() *cluster.Block

func (Cluster) RootQC

func (c Cluster) RootQC() *flow.QuorumCertificate

type CommittedEpoch

type CommittedEpoch struct {
	SetupEpoch
	// contains filtered or unexported fields
}

CommittedEpoch represents an epoch that has been committed. Both the EpochSetup and EpochCommitted events for the epoch have been emitted as of the point at which the epoch was queried.

func NewCommittedEpoch

func NewCommittedEpoch(setupEvent *flow.EpochSetup, commitEvent *flow.EpochCommit) *CommittedEpoch

func (*CommittedEpoch) Cluster

func (es *CommittedEpoch) Cluster(index uint) (protocol.Cluster, error)

func (*CommittedEpoch) DKG

func (es *CommittedEpoch) DKG() (protocol.DKG, error)

type Config

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

func DefaultConfig

func DefaultConfig() Config

type DKG

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

func (*DKG) GroupKey

func (d *DKG) GroupKey() crypto.PublicKey

func (*DKG) Index

func (d *DKG) Index(nodeID flow.Identifier) (uint, error)

func (*DKG) KeyShare

func (d *DKG) KeyShare(nodeID flow.Identifier) (crypto.PublicKey, error)

func (*DKG) Size

func (d *DKG) Size() uint

type EpochQuery

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

EpochQuery encapsulates querying epochs w.r.t. a snapshot.

func (*EpochQuery) Current

func (q *EpochQuery) Current() protocol.Epoch

Current returns the current epoch.

func (*EpochQuery) Next

func (q *EpochQuery) Next() protocol.Epoch

Next returns the next epoch, if it is available.

func (*EpochQuery) Previous added in v0.13.0

func (q *EpochQuery) Previous() protocol.Epoch

Previous returns the previous epoch. During the first epoch after the root block, this returns a sentinel error (since there is no previous epoch). For all other epochs, returns the previous epoch.

type InvalidEpoch

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

InvalidEpoch represents an epoch that does not exist. Neither the EpochSetup nor EpochCommitted events for the epoch have been emitted as of the point at which the epoch was queried.

func NewInvalidEpoch

func NewInvalidEpoch(err error) *InvalidEpoch

func (*InvalidEpoch) Cluster

func (u *InvalidEpoch) Cluster(uint) (protocol.Cluster, error)

func (*InvalidEpoch) Clustering

func (u *InvalidEpoch) Clustering() (flow.ClusterList, error)

func (*InvalidEpoch) Counter

func (u *InvalidEpoch) Counter() (uint64, error)

func (*InvalidEpoch) DKG

func (u *InvalidEpoch) DKG() (protocol.DKG, error)

func (*InvalidEpoch) FinalView

func (u *InvalidEpoch) FinalView() (uint64, error)

func (*InvalidEpoch) FirstView added in v0.13.0

func (u *InvalidEpoch) FirstView() (uint64, error)

func (*InvalidEpoch) InitialIdentities

func (u *InvalidEpoch) InitialIdentities() (flow.IdentityList, error)

func (*InvalidEpoch) Seed

func (u *InvalidEpoch) Seed(...uint32) ([]byte, error)

type InvalidEpochQuery

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

InvalidEpochQuery is an epoch query for an invalid snapshot.

func (*InvalidEpochQuery) Current

func (u *InvalidEpochQuery) Current() protocol.Epoch

func (*InvalidEpochQuery) Next

func (u *InvalidEpochQuery) Next() protocol.Epoch

func (*InvalidEpochQuery) Previous added in v0.13.0

func (u *InvalidEpochQuery) Previous() protocol.Epoch

type InvalidSnapshot

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

InvalidSnapshot represents a snapshot referencing an invalid block, or for which an error occurred while resolving the reference block.

func NewInvalidSnapshot

func NewInvalidSnapshot(err error) *InvalidSnapshot

func (*InvalidSnapshot) Commit

func (u *InvalidSnapshot) Commit() (flow.StateCommitment, error)

func (*InvalidSnapshot) Epochs

func (u *InvalidSnapshot) Epochs() protocol.EpochQuery

func (*InvalidSnapshot) Head

func (u *InvalidSnapshot) Head() (*flow.Header, error)

func (*InvalidSnapshot) Identities

func (*InvalidSnapshot) Identity

func (u *InvalidSnapshot) Identity(_ flow.Identifier) (*flow.Identity, error)

func (*InvalidSnapshot) Pending

func (u *InvalidSnapshot) Pending() ([]flow.Identifier, error)

func (*InvalidSnapshot) Phase

func (u *InvalidSnapshot) Phase() (flow.EpochPhase, error)

func (*InvalidSnapshot) Seed

func (u *InvalidSnapshot) Seed(_ ...uint32) ([]byte, error)

type Mutator

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

func (*Mutator) Bootstrap

func (m *Mutator) Bootstrap(root *flow.Block, result *flow.ExecutionResult, seal *flow.Seal) error

func (*Mutator) Extend

func (m *Mutator) Extend(candidate *flow.Block) error

func (*Mutator) Finalize

func (m *Mutator) Finalize(blockID flow.Identifier) error

func (*Mutator) HeaderExtend

func (m *Mutator) HeaderExtend(candidate *flow.Block) error

func (*Mutator) MarkValid

func (m *Mutator) MarkValid(blockID flow.Identifier) error

MarkValid marks the block as valid in protocol state, and triggers `BlockProcessable` event to notify that its parent block is processable. why the parent block is processable, not the block itself? because a block having a child block means it has been verified by the majority of consensus participants. Hence, if a block has passed the header validity check, its parent block must have passed both the header validity check and the body validity check. So that consensus followers can skip the block body validity checks and wait for its child to arrive, and if the child passes the header validity check, it means the consensus participants have done a complete check on its parent block, so consensus followers can trust consensus nodes did the right job, and start processing the parent block. NOTE: since a parent can have multiple children, `BlockProcessable` event could be triggered multiple times for the same block. NOTE: BlockProcessable should not be blocking, otherwise, it will block the follower

type Params

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

func (*Params) ChainID

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

func (*Params) Root

func (p *Params) Root() (*flow.Header, error)

func (*Params) Seal

func (p *Params) Seal() (*flow.Seal, error)

type SetupEpoch

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

SetupEpoch represents an epoch that has been setup, but not committed. Only the EpochSetup event for the epoch has been emitted as of the point at which the epoch was queried.

func NewSetupEpoch

func NewSetupEpoch(setupEvent *flow.EpochSetup) *SetupEpoch

func (*SetupEpoch) Cluster

func (es *SetupEpoch) Cluster(_ uint) (protocol.Cluster, error)

func (*SetupEpoch) Clustering

func (es *SetupEpoch) Clustering() (flow.ClusterList, error)

func (*SetupEpoch) Counter

func (es *SetupEpoch) Counter() (uint64, error)

func (*SetupEpoch) DKG

func (es *SetupEpoch) DKG() (protocol.DKG, error)

func (*SetupEpoch) FinalView

func (es *SetupEpoch) FinalView() (uint64, error)

func (*SetupEpoch) FirstView added in v0.13.0

func (es *SetupEpoch) FirstView() (uint64, error)

func (*SetupEpoch) InitialIdentities

func (es *SetupEpoch) InitialIdentities() (flow.IdentityList, error)

func (*SetupEpoch) Seed

func (es *SetupEpoch) Seed(indices ...uint32) ([]byte, error)

type Snapshot

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

Snapshot implements the protocol.Snapshot interface. It represents a read-only immutable snapshot of the protocol state at the block it is constructed with. It allows efficient access to data associated directly with blocks at a given state (finalized, sealed), such as the related header, commit, seed or pending children. A block snapshot can lazily convert to an epoch snapshot in order to make data associated directly with epochs accessible through its API.

func NewSnapshot

func NewSnapshot(state *State, blockID flow.Identifier) *Snapshot

func (*Snapshot) Commit

func (s *Snapshot) Commit() (flow.StateCommitment, error)

Commit retrieves the latest execution state commitment at the current block snapshot. This commitment represents the execution state as currently finalized.

func (*Snapshot) Epochs

func (s *Snapshot) Epochs() protocol.EpochQuery

func (*Snapshot) Head

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

func (*Snapshot) Identities

func (s *Snapshot) Identities(selector flow.IdentityFilter) (flow.IdentityList, error)

func (*Snapshot) Identity

func (s *Snapshot) Identity(nodeID flow.Identifier) (*flow.Identity, error)

func (*Snapshot) Pending

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

func (*Snapshot) Phase

func (s *Snapshot) Phase() (flow.EpochPhase, error)

func (*Snapshot) Seed

func (s *Snapshot) Seed(indices ...uint32) ([]byte, error)

Seed returns the random seed at the given indices for the current block snapshot.

type State

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

func NewState

func NewState(
	metrics module.ComplianceMetrics,
	tracer module.Tracer,
	db *badger.DB,
	headers storage.Headers,
	seals storage.Seals,
	index storage.Index,
	payloads storage.Payloads,
	blocks storage.Blocks,
	setups storage.EpochSetups,
	commits storage.EpochCommits,
	statuses storage.EpochStatuses,
	consumer protocol.Consumer,
) (*State, error)

NewState initializes a new state backed by a badger database, applying the optional configuration parameters.

func (*State) AtBlockID

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

func (*State) AtHeight

func (s *State) AtHeight(height uint64) protocol.Snapshot

func (*State) Final

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

func (*State) Mutate

func (s *State) Mutate() protocol.Mutator

func (*State) Params

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

func (*State) Sealed

func (s *State) Sealed() protocol.Snapshot

Jump to

Keyboard shortcuts

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