eviction

package
v1.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

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 (s *State) AdvanceActiveWindowToIndex(slot iotago.SlotIndex)

func (*State) AllActiveRootBlocks

func (s *State) AllActiveRootBlocks() map[iotago.BlockID]iotago.CommitmentID

func (*State) BelowOrInActiveRootBlockRange

func (s *State) BelowOrInActiveRootBlockRange(id iotago.BlockID) (belowRange bool, inRange bool)

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

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) Initialize

func (s *State) Initialize(lastCommittedSlot iotago.SlotIndex)

func (*State) IsActiveRootBlock

func (s *State) IsActiveRootBlock(id iotago.BlockID) (has bool)

IsActiveRootBlock returns true if the given block is an _active_ root block.

func (*State) LastEvictedSlot

func (s *State) LastEvictedSlot() iotago.SlotIndex

func (*State) LatestActiveRootBlock

func (s *State) LatestActiveRootBlock() (iotago.BlockID, iotago.CommitmentID)

func (*State) RemoveRootBlock

func (s *State) RemoveRootBlock(id iotago.BlockID)

RemoveRootBlock removes a solid entry points from the map.

func (*State) Reset

func (s *State) Reset()

func (*State) Rollback

func (s *State) Rollback(lowerTarget iotago.SlotIndex, targetSlot iotago.SlotIndex) error

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_.

Jump to

Keyboard shortcuts

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