Documentation ¶
Index ¶
- Variables
- type VersionControl
- func (v *VersionControl) AddVersionUpdatesConsumer(consumer VersionControlConsumer)
- func (v *VersionControl) BlockFinalized(h *flow.Header)
- func (v *VersionControl) CompatibleAtBlock(height uint64) (bool, error)
- func (v *VersionControl) EndHeight() uint64
- func (v *VersionControl) StartHeight() uint64
- type VersionControlConsumer
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
func (*VersionControl) EndHeight ¶
func (v *VersionControl) EndHeight() uint64
EndHeight return the last block that the version supports. End height is the last processed height if there is no end boundary in the current spork.
func (*VersionControl) StartHeight ¶
func (v *VersionControl) StartHeight() uint64
StartHeight return the first block that the version supports. Start height is the sealed root block if there is no start boundary in the current spork.
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.