Documentation ¶
Index ¶
- Variables
- type Events
- type State
- func (s *State) AddRootBlock(id iotago.BlockID, commitmentID iotago.CommitmentID)
- func (s *State) AdvanceActiveWindowToIndex(slot iotago.SlotIndex)
- func (s *State) AllActiveRootBlocks() map[iotago.BlockID]iotago.CommitmentID
- func (s *State) Export(writer io.WriteSeeker, lowerTarget iotago.SlotIndex, ...) (err error)
- func (s *State) Import(reader io.ReadSeeker) error
- func (s *State) InActiveRootBlockRange(id iotago.BlockID) bool
- func (s *State) Initialize(lastCommittedSlot iotago.SlotIndex)
- func (s *State) IsActiveRootBlock(id iotago.BlockID) (has bool)
- func (s *State) LastEvictedSlot() iotago.SlotIndex
- func (s *State) LatestActiveRootBlock() (iotago.BlockID, iotago.CommitmentID)
- func (s *State) RemoveRootBlock(id iotago.BlockID)
- func (s *State) Reset()
- func (s *State) Rollback(lowerTarget iotago.SlotIndex, targetSlot iotago.SlotIndex) error
- func (s *State) RootBlockCommitmentID(id iotago.BlockID) (commitmentID iotago.CommitmentID, exists bool)
Constants ¶
This section is empty.
Variables ¶
var NewEvents = event.CreateGroupConstructor(func() (self *Events) { return &Events{ SlotEvicted: event.New1[iotago.SlotIndex](), } })
NewEvents contains the constructor of the Events object (it is generated by a generic factory).
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct { Events *Events // contains filtered or unexported fields }
State represents the state of the eviction and keeps track of the root blocks.
func NewState ¶
func NewState(settings *permanent.Settings, rootBlockStorageFunc func(iotago.SlotIndex) (*slotstore.Store[iotago.BlockID, iotago.CommitmentID], error)) (state *State)
NewState creates a new eviction State.
func (*State) AddRootBlock ¶
func (s *State) AddRootBlock(id iotago.BlockID, commitmentID iotago.CommitmentID)
AddRootBlock inserts a solid entry point to the seps map.
func (*State) AdvanceActiveWindowToIndex ¶
func (*State) AllActiveRootBlocks ¶
func (s *State) AllActiveRootBlocks() map[iotago.BlockID]iotago.CommitmentID
func (*State) Export ¶
func (s *State) Export(writer io.WriteSeeker, lowerTarget iotago.SlotIndex, targetSlot iotago.SlotIndex) (err error)
Export exports the root blocks to the given writer. The lowerTarget is usually going to be the last finalized slot because Rootblocks are special when creating a snapshot. They not only are needed as a Tangle root on the slot we're targeting to export (usually last committed slot) but also to derive the rootcommitment. The rootcommitment, however, must not depend on the committed slot but on the finalized slot. Otherwise, we could never switch a chain after committing (as the rootcommitment is our genesis and we don't solidify/switch chains below it).
func (*State) Import ¶
func (s *State) Import(reader io.ReadSeeker) error
Import imports the root blocks from the given reader.
func (*State) InActiveRootBlockRange ¶
InActiveRootBlockRange checks if the Block associated with the given id is within the active root block range with respect to the latest committed slot.
func (*State) Initialize ¶
func (*State) IsActiveRootBlock ¶
IsActiveRootBlock returns true if the given block is an _active_ root block.
func (*State) LastEvictedSlot ¶
func (*State) LatestActiveRootBlock ¶
func (s *State) LatestActiveRootBlock() (iotago.BlockID, iotago.CommitmentID)
func (*State) RemoveRootBlock ¶
RemoveRootBlock removes a solid entry points from the map.
func (*State) RootBlockCommitmentID ¶
func (s *State) RootBlockCommitmentID(id iotago.BlockID) (commitmentID iotago.CommitmentID, exists bool)
RootBlockCommitmentID returns the commitmentID if it is a known root block, _no matter if active or not_.