dispatcher

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultInQueueSize = 5

DefaultInQueueSize is the bucketSize of the channel used for receiving targets from producers.

View Source
const DefaultWorkQueueSize = 15

DefaultWorkQueueSize is the bucketSize of the work queue

View Source
const LocalIncoming = "incoming"

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher receives, sorts and dispatches targets to the catchupSyncer to control chain syncing.

New targets arrive over the incoming channel. The dispatcher then puts them into the workTracker which sorts them by their claimed chain height. The dispatcher pops the highest priority target from the queue and then attempts to sync the target using its internal catchupSyncer.

The dispatcher has a simple control channel. It reads this for external controls. Currently there is only one kind of control message. It registers a callback that the dispatcher will call after every non-erroring sync.

func NewDispatcher

func NewDispatcher(catchupSyncer dispatchSyncer, chainStore *chain.Store) *Dispatcher

NewDispatcher creates a new syncing dispatcher with default queue sizes.

func NewDispatcherWithSizes

func NewDispatcherWithSizes(syncer dispatchSyncer, chainStore *chain.Store, workQueueSize, inQueueSize int) *Dispatcher

NewDispatcherWithSizes creates a new syncing dispatcher.

func (*Dispatcher) Concurrent added in v0.9.4

func (d *Dispatcher) Concurrent() int64

Concurrent get current max syncing goroutine

func (*Dispatcher) IncomingBlocks added in v1.14.0

func (d *Dispatcher) IncomingBlocks(ctx context.Context) (<-chan *types2.BlockHeader, error)

func (*Dispatcher) RegisterCallback

func (d *Dispatcher) RegisterCallback(cb func(*types.Target, error))

RegisterCallback registers a callback on the dispatcher that will fire after every successful target sync.

func (*Dispatcher) SendGossipBlock

func (d *Dispatcher) SendGossipBlock(ci *types2.ChainInfo) error

SendGossipBlock handles chain info from new blocks sent on pubsub

func (*Dispatcher) SendHello

func (d *Dispatcher) SendHello(ci *types2.ChainInfo) error

SendHello handles chain information from bootstrap peers.

func (*Dispatcher) SendOwnBlock

func (d *Dispatcher) SendOwnBlock(ci *types2.ChainInfo) error

SendOwnBlock handles chain info from a node's own mining system

func (*Dispatcher) SetConcurrent added in v0.9.1

func (d *Dispatcher) SetConcurrent(number int64)

SetConcurrent set the max goroutine to syncing target

func (*Dispatcher) Start

func (d *Dispatcher) Start(syncingCtx context.Context)

Start launches the business logic for the syncing subsystem.

func (*Dispatcher) SyncCheckpoint added in v1.17.0

func (d *Dispatcher) SyncCheckpoint(ctx context.Context, tsk types2.TipSetKey) error

func (*Dispatcher) SyncTracker

func (d *Dispatcher) SyncTracker() *types.TargetTracker

SyncTracker returnss the target tracker of syncing

Jump to

Keyboard shortcuts

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