seatmanager

package
v1.0.0-alpha.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		BlockProcessed:             event.New1[*blocks.Block](),
		OnlineCommitteeSeatAdded:   event.New2[account.SeatIndex, iotago.AccountID](),
		OnlineCommitteeSeatRemoved: event.New1[account.SeatIndex](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

This section is empty.

Types

type Events

type Events struct {
	BlockProcessed             *event.Event1[*blocks.Block]
	OnlineCommitteeSeatAdded   *event.Event2[account.SeatIndex, iotago.AccountID]
	OnlineCommitteeSeatRemoved *event.Event1[account.SeatIndex]

	event.Group[Events, *Events]
}

type SeatManager

type SeatManager interface {
	// RotateCommittee rotates the committee evaluating the given set of candidates to produce the new committee.
	RotateCommittee(epoch iotago.EpochIndex, candidates accounts.AccountsData) (*account.SeatedAccounts, error)

	// ReuseCommittee reuses the committee from a previous epoch.
	ReuseCommittee(prevEpoch iotago.EpochIndex, targetEpoch iotago.EpochIndex) (*account.SeatedAccounts, error)

	// InitializeCommittee initializes the committee for the current slot by marking whole or a subset of the committee as active.
	// This is used when initializing committee after node startup (loaded from snapshot or database).
	InitializeCommittee(epoch iotago.EpochIndex, activityTime time.Time) error

	// CommitteeInSlot returns the set of validators that is used to track confirmation at a given slot.
	CommitteeInSlot(slot iotago.SlotIndex) (*account.SeatedAccounts, bool)

	// CommitteeInEpoch returns the set of validators that is used to track confirmation in a given epoch.
	CommitteeInEpoch(epoch iotago.EpochIndex) (*account.SeatedAccounts, bool)

	// OnlineCommittee returns the set of online validators that is used to track acceptance.
	OnlineCommittee() ds.Set[account.SeatIndex]

	// SeatCountInSlot returns the number of seats in the SeatManager for the given slot's epoch.
	SeatCountInSlot(slot iotago.SlotIndex) int

	// SeatCountInEpoch returns the number of seats in the SeatManager for the given epoch.
	SeatCountInEpoch(epoch iotago.EpochIndex) int

	// Interface embeds the required methods of the module.Module.
	module.Module
}

SeatManager is the minimal interface for the SeatManager component of the IOTA protocol.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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