Documentation ¶
Index ¶
- func NewProvider() module.Provider[*engine.Engine, tipmanager.TipManager]
- type TipManager
- func (t *TipManager) AddBlock(block *blocks.Block) tipmanager.TipMetadata
- func (t *TipManager) Evict(slot iotago.SlotIndex)
- func (t *TipManager) OnBlockAdded(handler func(block tipmanager.TipMetadata)) (unsubscribe func())
- func (t *TipManager) Reset()
- func (t *TipManager) Shutdown()
- func (t *TipManager) StrongTips(optAmount ...int) []tipmanager.TipMetadata
- func (t *TipManager) WeakTips(optAmount ...int) []tipmanager.TipMetadata
- type TipMetadata
- func (t *TipMetadata) Block() *blocks.Block
- func (t *TipMetadata) Evicted() reactive.Event
- func (t *TipMetadata) ID() iotago.BlockID
- func (t *TipMetadata) IsOrphaned() reactive.ReadableVariable[bool]
- func (t *TipMetadata) IsStrongTip() reactive.ReadableVariable[bool]
- func (t *TipMetadata) IsWeakTip() reactive.ReadableVariable[bool]
- func (t *TipMetadata) LivenessThresholdReached() reactive.Event
- func (t *TipMetadata) String() string
- func (t *TipMetadata) TipPool() reactive.Variable[tipmanager.TipPool]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶
func NewProvider() module.Provider[*engine.Engine, tipmanager.TipManager]
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)) *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) 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) 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) 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 ¶
func (t *TipMetadata) TipPool() reactive.Variable[tipmanager.TipPool]
TipPool exposes a variable that stores the current TipPool of the block.