Documentation ¶
Index ¶
- Variables
- type BlockReceivedEvent
- type Events
- type LoadBlockFunc
- type Manager
- func (m *Manager) BlockRequestWorkerPoolStatus() (name string, load uint64)
- func (m *Manager) BlockRequestsRateLimiter() *ratelimiter.PeerRateLimiter
- func (m *Manager) BlockWorkerPoolStatus() (name string, load uint64)
- func (m *Manager) BlocksRateLimiter() *ratelimiter.PeerRateLimiter
- func (m *Manager) RequestBlock(blockID []byte, to ...identity.ID)
- func (m *Manager) SendBlock(blkData []byte, to ...identity.ID)
- func (m *Manager) Stop()
- type ManagerOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotRunning is returned when a neighbor is added to a stopped or not yet started gossip manager. ErrNotRunning = errors.New("manager not running") )
Functions ¶
This section is empty.
Types ¶
type BlockReceivedEvent ¶ added in v0.9.2
type BlockReceivedEvent struct { // The raw block. Data []byte // The sender of the block. Peer *peer.Peer }
BlockReceivedEvent holds data about a block received event.
type Events ¶
type Events struct { // Fired when a new block was received via the gossip protocol. BlockReceived *event.Event[*BlockReceivedEvent] }
Events defines all the events related to the gossip protocol.
type LoadBlockFunc ¶ added in v0.9.2
LoadBlockFunc defines a function that returns the block for the given id.
type Manager ¶
type Manager struct { Events *Events // contains filtered or unexported fields }
The Manager handles the connected neighbors.
func NewManager ¶
func NewManager(p2pManager *p2p.Manager, f LoadBlockFunc, log *logger.Logger, opts ...ManagerOption) *Manager
NewManager creates a new Manager.
func (*Manager) BlockRequestWorkerPoolStatus ¶ added in v0.9.2
BlockRequestWorkerPoolStatus returns the name and the load of the workerpool.
func (*Manager) BlockRequestsRateLimiter ¶ added in v0.9.2
func (m *Manager) BlockRequestsRateLimiter() *ratelimiter.PeerRateLimiter
BlockRequestsRateLimiter returns the block requests rate limiter instance used in the gossip manager.
func (*Manager) BlockWorkerPoolStatus ¶ added in v0.9.2
BlockWorkerPoolStatus returns the name and the load of the workerpool.
func (*Manager) BlocksRateLimiter ¶ added in v0.9.2
func (m *Manager) BlocksRateLimiter() *ratelimiter.PeerRateLimiter
BlocksRateLimiter returns the blocks rate limiter instance used in the gossip manager.
func (*Manager) RequestBlock ¶ added in v0.9.2
RequestBlock requests the block with the given id from the neighbors. If no peer is provided, all neighbors are queried.
type ManagerOption ¶ added in v0.8.6
type ManagerOption func(m *Manager)
ManagerOption configures the Manager instance.
func WithBlockRequestsRateLimiter ¶ added in v0.9.2
func WithBlockRequestsRateLimiter(prl *ratelimiter.PeerRateLimiter) ManagerOption
WithBlockRequestsRateLimiter allows to set a PeerRateLimiter instance to be used as blocks requests rate limiter in the gossip manager.
func WithBlocksRateLimiter ¶ added in v0.9.2
func WithBlocksRateLimiter(prl *ratelimiter.PeerRateLimiter) ManagerOption
WithBlocksRateLimiter allows to set a PeerRateLimiter instance to be used as blocks rate limiter in the gossip manager.