Documentation ¶
Index ¶
- 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) BelowOrInActiveRootBlockRange(id iotago.BlockID) (belowRange bool, inRange bool)
- func (s *State) Export(writer io.WriteSeeker, targetSlot iotago.SlotIndex) (err error)
- func (s *State) Import(reader io.ReadSeeker) error
- 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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// 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) BelowOrInActiveRootBlockRange ¶
BelowOrInActiveRootBlockRange checks if the Block associated with the given id is within or below the active root block range with respect to the latest committed slot.
func (*State) Export ¶
Export exports the root blocks to the given writer. 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) 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_.