bqueue

package
v0.101.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const CacheSize = 2000

CacheSize is the 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 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), lenMetricsUpdater func(l int)) *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

func (bq *Queue) LastQueued() (uint32, int)

LastQueued returns the index of the last queued block and the queue's capacity left.

func (*Queue) PutBlock

func (bq *Queue) PutBlock(block *block.Block) error

PutBlock enqueues block to be added to the chain.

func (*Queue) Run

func (bq *Queue) Run()

Run runs the BlockQueue queueing loop. It must be called in a separate routine.

Jump to

Keyboard shortcuts

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