scheduler

package
v1.0.0-alpha.25 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		BlockEnqueued:  event.New1[*blocks.Block](),
		BlockScheduled: event.New1[*blocks.Block](),
		BlockSkipped:   event.New1[*blocks.Block](),
		BlockDropped:   event.New2[*blocks.Block, error](),
	}
})

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 {
	// BlockEnqueued is triggered when a block is added to the queue.
	BlockEnqueued *event.Event1[*blocks.Block]
	// BlockScheduled is triggered when a block is scheduled.
	BlockScheduled *event.Event1[*blocks.Block]
	// BlockSkipped is triggered when a block in the buffer is accepted.
	// Skipping a block has the same effect as scheduling it, i.e., it is passed to tip manager and gossiped.
	BlockSkipped *event.Event1[*blocks.Block]
	// BlockDropped is triggered when a block in the buffer is dropped. Dropped blocks are not passed to tip manager and not gossiped.
	BlockDropped *event.Event2[*blocks.Block, error]

	event.Group[Events, *Events]
}

type Scheduler

type Scheduler interface {
	// AddBlock adds a block to the scheduling buffer.
	AddBlock(block *blocks.Block)
	// IsBlockIssuerReady returns true if the block issuer is ready to issuer a block, i.e., if the block issuer were to add a block to the scheduler, would it be scheduled.
	IsBlockIssuerReady(accountID iotago.AccountID, workScores ...iotago.WorkScore) bool
	// BasicBufferSize returns the current buffer size of the Scheduler as block count.
	BasicBufferSize() int
	// ValidatorBufferSize returns the current buffer size of the Scheduler as block count.
	ValidatorBufferSize() int
	// ReadyBlocksCount returns the number of ready blocks.
	ReadyBlocksCount() int
	// IssuerQueueBlockCount returns the queue size of the given issuer as block count.
	IssuerQueueBlockCount(issuerID iotago.AccountID) int
	// IssuerQueueWork returns the queue size of the given issuer in work units.
	IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore
	// ValidatorQueueBlockCount returns the queue size of the given validator as block count.
	ValidatorQueueBlockCount(validatorID iotago.AccountID) int
	// Reset resets the component to a clean state as if it was created at the last commitment.
	Reset()

	module.Module
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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