warpsync

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: Apache-2.0, BSD-2-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBlockBatchSize

func WithBlockBatchSize(blockBatchSize int) options.Option[Manager]

WithBlockBatchSize allows to set the size of the block batch returned as part of slot blocks response.

func WithConcurrency

func WithConcurrency(concurrency int) options.Option[Manager]

WithConcurrency allows to set how many slots can be requested at once.

Types

type LoadBlockFunc

type LoadBlockFunc func(models.BlockID) (*models.Block, bool)

LoadBlockFunc defines a function that returns the block for the given id.

type Manager

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

The Manager handles the connected neighbors.

func NewManager

func NewManager(blockLoaderFunc LoadBlockFunc, blockProcessorFunc ProcessBlockFunc, log *logger.Logger, opts ...options.Option[Manager]) *Manager

NewManager creates a new Manager.

func (*Manager) IsStopped

func (m *Manager) IsStopped() bool

IsStopped returns true if the manager is stopped.

func (*Manager) Stop

func (m *Manager) Stop()

Stop stops the manager and closes all established connections.

type ProcessBlockFunc

type ProcessBlockFunc func(*p2p.Neighbor, *models.Block)

ProcessBlockFunc defines a function that processes block's bytes from a given peer.

Jump to

Keyboard shortcuts

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