Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrOutOfRange = errors.New("height is out of range")
ErrOutOfRange indicates that height is higher than last handled block height
var NoHeight = uint64(0)
NoHeight represents the maximum possible height for blocks.
Functions ¶
This section is empty.
Types ¶
type VersionControl ¶
type VersionControl struct { // Noop implements the protocol.Consumer interface with no operations. psEvents.Noop sync.Mutex component.Component // contains filtered or unexported fields }
VersionControl manages the version control system for the node. It consumes BlockFinalized events and updates the node's version control based on the latest version beacon.
func NewVersionControl ¶
func NewVersionControl( log zerolog.Logger, versionBeacons storage.VersionBeacons, nodeVersion *semver.Version, sealedRootBlockHeight uint64, latestFinalizedBlockHeight uint64, ) (*VersionControl, error)
NewVersionControl creates a new VersionControl instance.
We currently have no strong guarantee that the node version is a valid semver. See build.SemverV2 for more details. That is why nil is a valid input for node version.
func (*VersionControl) AddVersionUpdatesConsumer ¶
func (v *VersionControl) AddVersionUpdatesConsumer(consumer VersionControlConsumer)
AddVersionUpdatesConsumer adds a consumer for version update events.
func (*VersionControl) BlockFinalized ¶
func (v *VersionControl) BlockFinalized(h *flow.Header)
BlockFinalized is called when a block is finalized. It implements the protocol.Consumer interface.
func (*VersionControl) CompatibleAtBlock ¶
func (v *VersionControl) CompatibleAtBlock(height uint64) (bool, error)
CompatibleAtBlock checks if the node's version is compatible at a given block height. It returns true if the node's version is compatible within the specified height range. Returns expected errors: - ErrOutOfRange if incoming block height is higher that last handled block height
type VersionControlConsumer ¶
VersionControlConsumer defines a function type that consumes version control updates. It is called with the block height and the corresponding semantic version. There are two possible notifications options: - A new or updated version will have a height and a semantic version at that height. - A deleted version will have the previous height and nil semantic version, indicating that the update was deleted.