Documentation ¶
Index ¶
- func NewProvider(opts ...options.Option[Scheduler]) module.Provider[*engine.Engine, scheduler.Scheduler]
- type BufferQueue
- func (b *BufferQueue) Clear()
- func (b *BufferQueue) CreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
- func (b *BufferQueue) Current() *IssuerQueue
- func (b *BufferQueue) GetOrCreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
- func (b *BufferQueue) IssuerIDs() []iotago.AccountID
- func (b *BufferQueue) IssuerQueue(issuerID iotago.AccountID) *IssuerQueue
- func (b *BufferQueue) IssuerQueueBlockCount(issuerID iotago.AccountID) int
- func (b *BufferQueue) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore
- func (b *BufferQueue) Next() *IssuerQueue
- func (b *BufferQueue) NumActiveIssuers() int
- func (b *BufferQueue) PopFront() *blocks.Block
- func (b *BufferQueue) Ready(block *blocks.Block) bool
- func (b *BufferQueue) ReadyBlocksCount() (readyBlocksCount int)
- func (b *BufferQueue) RemoveIssuerQueue(issuerID iotago.AccountID)
- func (b *BufferQueue) RemoveIssuerQueueIfEmpty(issuerID iotago.AccountID)
- func (b *BufferQueue) Size() int
- func (b *BufferQueue) Submit(blk *blocks.Block, issuerQueue *IssuerQueue, ...) ([]*blocks.Block, bool)
- func (b *BufferQueue) TotalBlocksCount() (blocksCount int)
- func (b *BufferQueue) Unsubmit(block *blocks.Block) bool
- type Deficit
- type IssuerQueue
- 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) Unsubmit(block *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, blocks ...*blocks.Block) 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) Shutdown()
- 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(accountID iotago.AccountID)
- func (b *ValidatorBuffer) Get(accountID iotago.AccountID) (*ValidatorQueue, bool)
- func (b *ValidatorBuffer) Set(accountID iotago.AccountID, validatorQueue *ValidatorQueue) bool
- func (b *ValidatorBuffer) Size() int
- func (b *ValidatorBuffer) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool)
- type ValidatorQueue
- func (q *ValidatorQueue) AccountID() iotago.AccountID
- func (q *ValidatorQueue) PopFront() *blocks.Block
- func (q *ValidatorQueue) Ready(block *blocks.Block) bool
- func (q *ValidatorQueue) RemoveTail() *blocks.Block
- func (q *ValidatorQueue) Size() int
- func (q *ValidatorQueue) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool)
- func (q *ValidatorQueue) Unsubmit(block *blocks.Block) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufferQueue ¶
type BufferQueue struct {
// contains filtered or unexported fields
}
BufferQueue represents a buffer of IssuerQueue.
func (*BufferQueue) Clear ¶
func (b *BufferQueue) Clear()
func (*BufferQueue) CreateIssuerQueue ¶
func (b *BufferQueue) CreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
func (*BufferQueue) Current ¶
func (b *BufferQueue) Current() *IssuerQueue
Current returns the current IssuerQueue in round-robin order.
func (*BufferQueue) GetOrCreateIssuerQueue ¶
func (b *BufferQueue) GetOrCreateIssuerQueue(issuerID iotago.AccountID) *IssuerQueue
func (*BufferQueue) IssuerIDs ¶
func (b *BufferQueue) IssuerIDs() []iotago.AccountID
IssuerIDs returns the issuerIDs of all issuers.
func (*BufferQueue) IssuerQueue ¶
func (b *BufferQueue) IssuerQueue(issuerID iotago.AccountID) *IssuerQueue
IssuerQueue returns the queue for the corresponding issuer.
func (*BufferQueue) IssuerQueueBlockCount ¶
func (b *BufferQueue) IssuerQueueBlockCount(issuerID iotago.AccountID) int
IssuerQueueSize returns the number of blocks in the queue for the corresponding issuer.
func (*BufferQueue) IssuerQueueWork ¶
func (b *BufferQueue) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore
IssuerQueueWork returns the total WorkScore of block in the queue for the corresponding issuer.
func (*BufferQueue) Next ¶
func (b *BufferQueue) Next() *IssuerQueue
Next returns the next IssuerQueue in round-robin order.
func (*BufferQueue) NumActiveIssuers ¶
func (b *BufferQueue) NumActiveIssuers() int
NumActiveIssuers returns the number of active issuers in b.
func (*BufferQueue) PopFront ¶
func (b *BufferQueue) PopFront() *blocks.Block
PopFront removes the first ready block from the queue of the current issuer.
func (*BufferQueue) Ready ¶
func (b *BufferQueue) Ready(block *blocks.Block) bool
Ready marks a previously submitted block as ready to be scheduled.
func (*BufferQueue) ReadyBlocksCount ¶
func (b *BufferQueue) ReadyBlocksCount() (readyBlocksCount int)
ReadyBlocksCount returns the number of ready blocks in the buffer.
func (*BufferQueue) RemoveIssuerQueue ¶
func (b *BufferQueue) RemoveIssuerQueue(issuerID iotago.AccountID)
RemoveIssuerQueue removes all blocks (submitted and ready) for the given issuer and deletes the issuer queue.
func (*BufferQueue) RemoveIssuerQueueIfEmpty ¶
func (b *BufferQueue) 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 (*BufferQueue) Size ¶
func (b *BufferQueue) Size() int
Size returns the total number of blocks in BufferQueue.
func (*BufferQueue) Submit ¶
func (b *BufferQueue) 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 (*BufferQueue) TotalBlocksCount ¶
func (b *BufferQueue) 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) *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
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.
func (*IssuerQueue) Unsubmit ¶
func (q *IssuerQueue) Unsubmit(block *blocks.Block) bool
Unsubmit removes a previously submitted block from the queue.
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(accountID iotago.AccountID)
func (*ValidatorBuffer) Get ¶
func (b *ValidatorBuffer) Get(accountID iotago.AccountID) (*ValidatorQueue, bool)
func (*ValidatorBuffer) Set ¶
func (b *ValidatorBuffer) Set(accountID iotago.AccountID, validatorQueue *ValidatorQueue) bool
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) *ValidatorQueue
func (*ValidatorQueue) AccountID ¶
func (q *ValidatorQueue) AccountID() iotago.AccountID
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) Size ¶
func (q *ValidatorQueue) Size() int