tipmanagerv1

package
v1.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

NewProvider creates a new TipManager provider, that can be used to inject the component into an engine.

Types

type TipManager

type TipManager struct {

	// Module embeds the required module.Module interface.
	module.Module
	// contains filtered or unexported fields
}

TipManager is a component that manages the tips of the Tangle.

func New

func New(
	blockRetriever func(blockID iotago.BlockID) (block *blocks.Block, exists bool),
	retrieveCommitteeInSlot func(slot iotago.SlotIndex) (*account.SeatedAccounts, bool),
) *TipManager

New creates a new TipManager.

func (*TipManager) AddBlock

func (t *TipManager) AddBlock(block *blocks.Block) tipmanager.TipMetadata

AddBlock adds a Block to the TipManager and returns the TipMetadata if the Block was added successfully.

func (*TipManager) AddSeat

func (t *TipManager) AddSeat(seat account.SeatIndex)

AddSeat adds a validator to the tracking of the TipManager.

func (*TipManager) Evict

func (t *TipManager) Evict(slot iotago.SlotIndex)

Evict evicts a slot from the TipManager.

func (*TipManager) OnBlockAdded

func (t *TipManager) OnBlockAdded(handler func(block tipmanager.TipMetadata)) (unsubscribe func())

OnBlockAdded registers a callback that is triggered whenever a new Block was added to the TipManager.

func (*TipManager) RemoveSeat

func (t *TipManager) RemoveSeat(seat account.SeatIndex)

RemoveSeat removes a validator from the tracking of the TipManager.

func (*TipManager) Reset

func (t *TipManager) Reset()

Reset resets the component to a clean state as if it was created at the last commitment.

func (*TipManager) Shutdown

func (t *TipManager) Shutdown()

Shutdown marks the TipManager as shutdown.

func (*TipManager) StrongTips

func (t *TipManager) StrongTips(optAmount ...int) []tipmanager.TipMetadata

StrongTips returns the strong tips of the TipManager (with an optional limit).

func (*TipManager) ValidationTips

func (t *TipManager) ValidationTips(optAmount ...int) []tipmanager.TipMetadata

func (*TipManager) WeakTips

func (t *TipManager) WeakTips(optAmount ...int) []tipmanager.TipMetadata

WeakTips returns the weak tips of the TipManager (with an optional limit).

type TipMetadata

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

TipMetadata represents the metadata for a block in the TipManager.

func NewBlockMetadata

func NewBlockMetadata(block *blocks.Block) *TipMetadata

NewBlockMetadata creates a new TipMetadata instance.

func (*TipMetadata) Block

func (t *TipMetadata) Block() *blocks.Block

Block returns the block that the TipMetadata belongs to.

func (*TipMetadata) Evicted

func (t *TipMetadata) Evicted() reactive.Event

Evicted exposes an event that is triggered when the block is evicted.

func (*TipMetadata) ID

func (t *TipMetadata) ID() iotago.BlockID

ID returns the identifier of the block the TipMetadata belongs to.

func (*TipMetadata) IsOrphaned

func (t *TipMetadata) IsOrphaned() reactive.ReadableVariable[bool]

IsOrphaned returns a ReadableVariable that indicates if the block was orphaned.

func (*TipMetadata) IsStrongTip

func (t *TipMetadata) IsStrongTip() reactive.ReadableVariable[bool]

IsStrongTip returns a ReadableVariable that indicates if the block is a strong tip.

func (*TipMetadata) IsWeakTip

func (t *TipMetadata) IsWeakTip() reactive.ReadableVariable[bool]

IsWeakTip returns a ReadableVariable that indicates if the block is a weak tip.

func (*TipMetadata) LivenessThresholdReached

func (t *TipMetadata) LivenessThresholdReached() reactive.Event

LivenessThresholdReached exposes an event that is triggered when the liveness threshold is reached.

func (*TipMetadata) String

func (t *TipMetadata) String() string

String returns a human-readable representation of the TipMetadata.

func (*TipMetadata) TipPool

TipPool exposes a variable that stores the current TipPool of the block.

Jump to

Keyboard shortcuts

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