warpsync

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0, BSD-2-Clause Imports: 23 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 epoch blocks response.

func WithConcurrency

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

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

Types

type LoadBlockFunc

type LoadBlockFunc func(blockId mesh_old.BlockID) (*mesh_old.Block, error)

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(p2pManager *p2p.Manager, 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.

func (*Manager) WarpRange

func (m *Manager) WarpRange(ctx context.Context, start, end epoch.Index, startEC epoch.EC, endPrevEC epoch.EC) (err error)

type ProcessBlockFunc

type ProcessBlockFunc func(blk *mesh_old.Block, peer *peer.Peer)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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