drr

package
v1.0.0-alpha.13 Latest Latest
Warning

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

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

Documentation

Index

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 NewBufferQueue

func NewBufferQueue() *BufferQueue

NewBufferQueue returns a new BufferQueue.

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.

func (*BufferQueue) Unsubmit

func (b *BufferQueue) Unsubmit(block *blocks.Block) bool

Unsubmit removes a block from the submitted blocks. If that block is already marked as ready, Unsubmit has no effect.

type Deficit

type Deficit int64

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

type Scheduler struct {
	module.Module
	// contains filtered or unexported fields
}

func New

func New(subModule module.Module, apiProvider iotago.APIProvider, opts ...options.Option[Scheduler]) *Scheduler

func (*Scheduler) AddBlock

func (s *Scheduler) AddBlock(block *blocks.Block)

func (*Scheduler) BasicBufferSize

func (s *Scheduler) BasicBufferSize() int

BasicBufferSize returns the current buffer size of the Scheduler as block count.

func (*Scheduler) IsBlockIssuerReady

func (s *Scheduler) IsBlockIssuerReady(accountID iotago.AccountID, workScores ...iotago.WorkScore) bool

func (*Scheduler) IssuerQueueBlockCount

func (s *Scheduler) IssuerQueueBlockCount(issuerID iotago.AccountID) int

IssuerQueueBlockCount returns the number of blocks in the queue of the given issuer.

func (*Scheduler) IssuerQueueWork

func (s *Scheduler) IssuerQueueWork(issuerID iotago.AccountID) iotago.WorkScore

IssuerQueueWork returns the queue size of the given issuer in work units.

func (*Scheduler) MaxBufferSize

func (s *Scheduler) MaxBufferSize() int

MaxBufferSize returns the max buffer size of the Scheduler as block count.

func (*Scheduler) ReadyBlocksCount

func (s *Scheduler) ReadyBlocksCount() int

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

func (s *Scheduler) Start()

Start starts the scheduler.

func (*Scheduler) ValidatorBufferSize

func (s *Scheduler) ValidatorBufferSize() int

func (*Scheduler) ValidatorQueueBlockCount

func (s *Scheduler) ValidatorQueueBlockCount(issuerID iotago.AccountID) int

ValidatorQueueBlockCount returns the number of validation blocks in the validator queue of the given issuer.

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

func (*ValidatorBuffer) Submit

func (b *ValidatorBuffer) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool)

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

func (q *ValidatorQueue) Ready(block *blocks.Block) bool

func (*ValidatorQueue) RemoveTail

func (q *ValidatorQueue) RemoveTail() *blocks.Block

func (*ValidatorQueue) Size

func (q *ValidatorQueue) Size() int

func (*ValidatorQueue) Submit

func (q *ValidatorQueue) Submit(block *blocks.Block, maxBuffer int) (*blocks.Block, bool)

func (*ValidatorQueue) Unsubmit

func (q *ValidatorQueue) Unsubmit(block *blocks.Block) bool

Jump to

Keyboard shortcuts

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