Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultCacheSize = 2000
DefaultCacheSize is the default amount of blocks above the current height which are stored in the queue.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blockqueuer ¶
type Blockqueuer interface { AddBlock(block *block.Block) error AddHeaders(...*block.Header) error BlockHeight() uint32 }
Blockqueuer is an interface for a block queue.
type OperationMode ¶ added in v0.107.0
type OperationMode byte
OperationMode is the mode of operation for the block queue. Could be either Blocking or NonBlocking.
const ( // NonBlocking means that PutBlock will return immediately if the queue is full. NonBlocking OperationMode = 0 // Blocking means that PutBlock will wait until there is enough space in the queue. Blocking OperationMode = 1 )
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is the block queue.
func New ¶
func New(bc Blockqueuer, log *zap.Logger, relayer func(*block.Block), cacheSize int, lenMetricsUpdater func(l int), mode OperationMode) *Queue
New creates an instance of BlockQueue.
func (*Queue) Discard ¶
func (bq *Queue) Discard()
Discard stops the queue and prevents it from accepting more blocks to enqueue.
func (*Queue) LastQueued ¶
LastQueued returns the index of the last queued block and the queue's capacity left.
Click to show internal directories.
Click to hide internal directories.