cluster

package
v0.43.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: AGPL-3.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalClusterID

func CanonicalClusterID(epoch uint64, participants flow.IdentifierList) flow.ChainID

CanonicalClusterID returns the canonical chain ID for the given cluster in the given epoch.

func CanonicalRootBlock

func CanonicalRootBlock(epoch uint64, participants flow.IdentitySkeletonList) (*cluster.Block, error)

CanonicalRootBlock returns the canonical root block for the given cluster in the given epoch. It contains an empty collection referencing

Types

type MutableState added in v0.14.0

type MutableState interface {
	State
	// 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.
	// 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
	Extend(proposal *cluster.Proposal) error
}

MutableState allows extending the cluster state in a consistent manner that preserves integrity, validity, and functionality of the database. It enforces a number of invariants on the input data to ensure internal bookkeeping mechanisms remain functional and valid.

type Params added in v0.9.6

type Params interface {
	// ChainID returns the chain ID for this cluster.
	ChainID() flow.ChainID
}

Params contains constant information about this cluster state.

type Snapshot

type Snapshot interface {

	// Collection returns the collection designated as the reference for this
	// snapshot. Technically, this is a portion of the payload of a cluster block.
	//
	// Expected error returns during normal operations:
	//  - If the snapshot is for an unknown collection [state.ErrUnknownSnapshotReference]
	Collection() (*flow.Collection, error)

	// Head returns the header of the collection that is designated as the reference for
	// this snapshot. Technically, this is the header of a [cluster.Block]
	//
	// Expected error returns during normal operations:
	//  - If the snapshot is for an unknown collection [state.ErrUnknownSnapshotReference]
	Head() (*flow.Header, error)

	// Pending returns the IDs of *all* collections descending from the snapshot's head collection.
	// The result is ordered such that parents are included before their children. While only valid
	// descendants will be returned, note that the descendants may not be finalized yet.
	//
	// CAUTION: the list of descendants is constructed for each call via database reads,
	// and may be expensive to compute, especially if the reference collection is older.
	//
	// Expected error returns during normal operations:
	//  - If the snapshot is for an unknown collection [state.ErrUnknownSnapshotReference]
	Pending() ([]flow.Identifier, error)
}

Snapshot pertains to a specific fork of the collector cluster consensus. Specifically, it references one block denoted as the `Head`. This Snapshot type is for collector clusters, so we are referencing a cluster block, aka collection, here.

type State

type State interface {

	// Params returns constant information about the cluster state.
	Params() Params

	// Final returns the snapshot of the cluster state at the latest finalized
	// block. The returned snapshot is therefore immutable over time.
	Final() Snapshot

	// AtBlockID returns the snapshot of the persistent cluster at the given
	// block ID. It is available for any block that was introduced into the
	// cluster state, and can thus represent an ambiguous state that was or
	// will never be finalized.
	// If the block is unknown, it returns an invalid snapshot, which returns
	// state.ErrUnknownSnapshotReference for all methods
	AtBlockID(blockID flow.Identifier) Snapshot
}

State represents the chain state for collection node cluster consensus. It tracks which blocks are finalized and indexes blocks by number and ID. The purpose of cluster consensus is to agree on collections of transactions, so each block within the cluster state corresponds to a proposed collection.

NOTE: This is modelled after, and is a simpler version of, protocol.State.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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