Documentation ¶
Index ¶
- func NewProvider(opts ...options.Option[Scheduler]) module.Provider[*engine.Engine, scheduler.Scheduler]
- type BasicBuffer
- func (b *BasicBuffer) Clear()
- func (b *BasicBuffer) CreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
- func (b *BasicBuffer) Current() *IssuerQueue
- func (b *BasicBuffer) GetOrCreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
- func (b *BasicBuffer) IssuerIDs() []iotago.AccountID
- func (b *BasicBuffer) IssuerQueue(issuerID iotago.AccountID) *IssuerQueue
- func (b *BasicBuffer) IssuerQueueBlockCount(issuerID iotago.AccountID) int
- func (b *BasicBuffer) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore
- func (b *BasicBuffer) Next() *IssuerQueue
- func (b *BasicBuffer) NumActiveIssuers() int
- func (b *BasicBuffer) PopFront() *blocks.Block
- func (b *BasicBuffer) Ready(block *blocks.Block) bool
- func (b *BasicBuffer) ReadyBlocksCount() (readyBlocksCount int)
- func (b *BasicBuffer) RemoveIssuerQueue(issuerID iotago.AccountID)
- func (b *BasicBuffer) RemoveIssuerQueueIfEmpty(issuerID iotago.AccountID)
- func (b *BasicBuffer) Submit(blk *blocks.Block, issuerQueue *IssuerQueue, ...) ([]*blocks.Block, bool)
- func (b *BasicBuffer) TotalBlocksCount() (blocksCount int)
- type Deficit
- type IssuerQueue
- func (q *IssuerQueue) Clear()
- func (q *IssuerQueue) Front() *blocks.Block
- func (q *IssuerQueue) IDs() (ids []iotago.BlockID)
- func (q *IssuerQueue) IssuerID() iotago.AccountID
- func (q *IssuerQueue) PopFront() *blocks.Block
- func (q *IssuerQueue) Ready(block *blocks.Block) bool
- func (q *IssuerQueue) RemoveTail() *blocks.Block
- func (q *IssuerQueue) Size() int
- func (q *IssuerQueue) Submit(element *blocks.Block) bool
- func (q *IssuerQueue) Work() iotago.WorkScore
- type Scheduler
- func (s *Scheduler) AddBlock(block *blocks.Block)
- func (s *Scheduler) BasicBufferSize() int
- func (s *Scheduler) IsBlockIssuerReady(accountID iotago.AccountID, workScores ...iotago.WorkScore) bool
- func (s *Scheduler) IssuerQueueBlockCount(issuerID iotago.AccountID) int
- func (s *Scheduler) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore
- func (s *Scheduler) MaxBufferSize() int
- func (s *Scheduler) ReadyBlocksCount() int
- func (s *Scheduler) Reset()
- func (s *Scheduler) Start()
- func (s *Scheduler) ValidatorBufferSize() int
- func (s *Scheduler) ValidatorQueueBlockCount(issuerID iotago.AccountID) int
- type SubSlotIndex
- type ValidatorBuffer
- func (b *ValidatorBuffer) Clear()
- func (b *ValidatorBuffer) Delete(predicate func(element *ValidatorQueue) bool)
- func (b *ValidatorBuffer) ForEachValidatorQueue(consumer func(accountID iotago.AccountID, validatorQueue *ValidatorQueue) bool)
- func (b *ValidatorBuffer) Get(accountID iotago.AccountID) (*ValidatorQueue, bool)
- func (b *ValidatorBuffer) GetOrCreate(accountID iotago.AccountID, onCreateCallback func(*ValidatorQueue)) *ValidatorQueue
- func (b *ValidatorBuffer) Ready(block *blocks.Block)
- func (b *ValidatorBuffer) Size() int
- type ValidatorQueue
- func (q *ValidatorQueue) AccountID() iotago.AccountID
- func (q *ValidatorQueue) Clear()
- func (q *ValidatorQueue) PopFront() *blocks.Block
- func (q *ValidatorQueue) Ready(block *blocks.Block) bool
- func (q *ValidatorQueue) RemoveTail() *blocks.Block
- func (q *ValidatorQueue) ScheduleNext() bool
- func (q ValidatorQueue) Shutdown()
- func (q *ValidatorQueue) Size() int
- func (q *ValidatorQueue) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BasicBuffer ¶
type BasicBuffer struct {
// contains filtered or unexported fields
}
BasicBuffer represents a buffer of IssuerQueue.
func (*BasicBuffer) Clear ¶
func (b *BasicBuffer) Clear()
func (*BasicBuffer) CreateIssuerQueue ¶
func (b *BasicBuffer) CreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
func (*BasicBuffer) Current ¶
func (b *BasicBuffer) Current() *IssuerQueue
Current returns the current IssuerQueue in round-robin order.
func (*BasicBuffer) GetOrCreateIssuerQueue ¶
func (b *BasicBuffer) GetOrCreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
func (*BasicBuffer) IssuerIDs ¶
func (b *BasicBuffer) IssuerIDs() []iotago.AccountID
IssuerIDs returns the issuerIDs of all issuers.
func (*BasicBuffer) IssuerQueue ¶
func (b *BasicBuffer) IssuerQueue(issuerID iotago.AccountID) *IssuerQueue
IssuerQueue returns the queue for the corresponding issuer.
func (*BasicBuffer) IssuerQueueBlockCount ¶
func (b *BasicBuffer) IssuerQueueBlockCount(issuerID iotago.AccountID) int
IssuerQueueSize returns the number of blocks in the queue for the corresponding issuer.
func (*BasicBuffer) IssuerQueueWork ¶
func (b *BasicBuffer) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore
IssuerQueueWork returns the total WorkScore of block in the queue for the corresponding issuer.
func (*BasicBuffer) Next ¶
func (b *BasicBuffer) Next() *IssuerQueue
Next returns the next IssuerQueue in round-robin order.
func (*BasicBuffer) NumActiveIssuers ¶
func (b *BasicBuffer) NumActiveIssuers() int
NumActiveIssuers returns the number of active issuers in b.
func (*BasicBuffer) PopFront ¶
func (b *BasicBuffer) PopFront() *blocks.Block
PopFront removes the first ready block from the queue of the current issuer.
func (*BasicBuffer) Ready ¶
func (b *BasicBuffer) Ready(block *blocks.Block) bool
Ready marks a previously submitted block as ready to be scheduled.
func (*BasicBuffer) ReadyBlocksCount ¶
func (b *BasicBuffer) ReadyBlocksCount() (readyBlocksCount int)
ReadyBlocksCount returns the number of ready blocks in the buffer.
func (*BasicBuffer) RemoveIssuerQueue ¶
func (b *BasicBuffer) RemoveIssuerQueue(issuerID iotago.AccountID)
RemoveIssuerQueue removes all blocks (submitted and ready) for the given issuer and deletes the issuer queue.
func (*BasicBuffer) RemoveIssuerQueueIfEmpty ¶
func (b *BasicBuffer) RemoveIssuerQueueIfEmpty(issuerID iotago.AccountID)
RemoveIssuerQueueIfEmpty removes all blocks (submitted and ready) for the given issuer and deletes the issuer queue if it is empty.
func (*BasicBuffer) Submit ¶
func (b *BasicBuffer) Submit(blk *blocks.Block, issuerQueue *IssuerQueue, quantumFunc func(iotago.AccountID) Deficit, maxBuffer int) ([]*blocks.Block, bool)
Submit submits a block. Return blocks dropped from the scheduler to make room for the submitted block. The submitted block can also be returned as dropped if the issuer does not have enough mana.
func (*BasicBuffer) TotalBlocksCount ¶
func (b *BasicBuffer) TotalBlocksCount() (blocksCount int)
TotalBlocksCount returns the number of blocks in the buffer.
type IssuerQueue ¶
type IssuerQueue struct {
// contains filtered or unexported fields
}
IssuerQueue keeps the submitted blocks of an issuer.
func NewIssuerQueue ¶
func NewIssuerQueue(issuerID iotago.AccountID, sizeChangedCallback func(totalSizeDelta int64, readySizeDelta int64)) *IssuerQueue
NewIssuerQueue returns a new IssuerQueue.
func (*IssuerQueue) Front ¶
func (q *IssuerQueue) Front() *blocks.Block
Front returns the first ready block in the queue.
func (*IssuerQueue) IDs ¶
func (q *IssuerQueue) IDs() (ids []iotago.BlockID)
IDs returns the IDs of all submitted blocks (ready or not).
func (*IssuerQueue) IssuerID ¶
func (q *IssuerQueue) IssuerID() iotago.AccountID
IssuerID returns the ID of the issuer belonging to the queue.
func (*IssuerQueue) PopFront ¶
func (q *IssuerQueue) PopFront() *blocks.Block
PopFront removes the first ready block from the queue.
func (*IssuerQueue) Ready ¶
func (q *IssuerQueue) Ready(block *blocks.Block) bool
Ready marks a previously submitted block as ready to be scheduled.
func (*IssuerQueue) RemoveTail ¶
func (q *IssuerQueue) RemoveTail() *blocks.Block
RemoveTail removes the oldest block from the queue.
func (*IssuerQueue) Size ¶
func (q *IssuerQueue) Size() int
Size returns the total number of blocks in the queue. This function is thread-safe.
func (*IssuerQueue) Submit ¶
func (q *IssuerQueue) Submit(element *blocks.Block) bool
Submit submits a block for the queue. Return true if submitted and false if it was already submitted.
func (*IssuerQueue) Work ¶
func (q *IssuerQueue) Work() iotago.WorkScore
Work returns the total work of the blocks in the queue. This function is thread-safe.
type Scheduler ¶
func (*Scheduler) BasicBufferSize ¶
BasicBufferSize returns the current buffer size of the Scheduler as block count.
func (*Scheduler) IsBlockIssuerReady ¶
func (*Scheduler) IssuerQueueBlockCount ¶
IssuerQueueBlockCount returns the number of blocks in the queue of the given issuer.
func (*Scheduler) IssuerQueueWork ¶
IssuerQueueWork returns the queue size of the given issuer in work units.
func (*Scheduler) MaxBufferSize ¶
MaxBufferSize returns the max buffer size of the Scheduler as block count.
func (*Scheduler) ReadyBlocksCount ¶
ReadyBlocksCount returns the number of ready blocks.
func (*Scheduler) Reset ¶
func (s *Scheduler) Reset()
Reset resets the component to a clean state as if it was created at the last commitment.
func (*Scheduler) ValidatorBufferSize ¶
type SubSlotIndex ¶
type SubSlotIndex int
type ValidatorBuffer ¶
type ValidatorBuffer struct {
// contains filtered or unexported fields
}
func NewValidatorBuffer ¶
func NewValidatorBuffer() *ValidatorBuffer
func (*ValidatorBuffer) Clear ¶
func (b *ValidatorBuffer) Clear()
func (*ValidatorBuffer) Delete ¶
func (b *ValidatorBuffer) Delete(predicate func(element *ValidatorQueue) bool)
Delete removes all validator queues that match the predicate.
func (*ValidatorBuffer) ForEachValidatorQueue ¶
func (b *ValidatorBuffer) ForEachValidatorQueue(consumer func(accountID iotago.AccountID, validatorQueue *ValidatorQueue) bool)
ForEachValidatorQueue iterates over all validator queues.
func (*ValidatorBuffer) Get ¶
func (b *ValidatorBuffer) Get(accountID iotago.AccountID) (*ValidatorQueue, bool)
func (*ValidatorBuffer) GetOrCreate ¶
func (b *ValidatorBuffer) GetOrCreate(accountID iotago.AccountID, onCreateCallback func(*ValidatorQueue)) *ValidatorQueue
func (*ValidatorBuffer) Ready ¶
func (b *ValidatorBuffer) Ready(block *blocks.Block)
Ready marks a previously submitted block as ready to be scheduled.
func (*ValidatorBuffer) Size ¶
func (b *ValidatorBuffer) Size() int
type ValidatorQueue ¶
type ValidatorQueue struct {
// contains filtered or unexported fields
}
func NewValidatorQueue ¶
func NewValidatorQueue(accountID iotago.AccountID, sizeChangedCallback func(totalSizeDelta int64)) *ValidatorQueue
func (*ValidatorQueue) AccountID ¶
func (q *ValidatorQueue) AccountID() iotago.AccountID
func (*ValidatorQueue) Clear ¶
func (q *ValidatorQueue) Clear()
Clear removes all blocks from the queue.
func (*ValidatorQueue) PopFront ¶
func (q *ValidatorQueue) PopFront() *blocks.Block
PopFront removes the first ready block from the queue.
func (*ValidatorQueue) RemoveTail ¶
func (q *ValidatorQueue) RemoveTail() *blocks.Block
func (*ValidatorQueue) ScheduleNext ¶
func (q *ValidatorQueue) ScheduleNext() bool
ScheduleNext schedules the next block.
func (ValidatorQueue) Shutdown ¶
func (q ValidatorQueue) Shutdown()
Shutdown stops the queue and clears all blocks.
func (*ValidatorQueue) Size ¶
func (q *ValidatorQueue) Size() int