peerresponsemanager

package
v0.0.6-0...-9dfb6b8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerMessageHandler

type PeerMessageHandler interface {
	SendResponse(peer.ID, []gsmsg.GraphSyncResponse, []blocks.Block) <-chan struct{}
}

PeerMessageHandler is an interface that can send a response for a given peer across the network.

type PeerResponseManager

type PeerResponseManager struct {
	*peermanager.PeerManager
}

PeerResponseManager manages message queues for peers

func New

func New(ctx context.Context, createPeerSender PeerSenderFactory) *PeerResponseManager

New generates a new peer manager for sending responses

func (*PeerResponseManager) SenderForPeer

func (prm *PeerResponseManager) SenderForPeer(p peer.ID) PeerResponseSender

SenderForPeer returns a response sender to use with the given peer

type PeerResponseSender

type PeerResponseSender interface {
	peermanager.PeerProcess
	SendResponse(
		requestID graphsync.RequestID,
		link ipld.Link,
		data []byte,
	)
	SendExtensionData(graphsync.RequestID, graphsync.ExtensionData)
	FinishRequest(requestID graphsync.RequestID)
	FinishWithError(requestID graphsync.RequestID, status graphsync.ResponseStatusCode)
}

PeerResponseSender handles batching, deduping, and sending responses for a given peer across multiple requests.

func NewResponseSender

func NewResponseSender(ctx context.Context, p peer.ID, peerHandler PeerMessageHandler, ipldBridge ipldbridge.IPLDBridge) PeerResponseSender

NewResponseSender generates a new PeerResponseSender for the given context, peer ID, using the given peer message handler and bridge to IPLD.

type PeerSenderFactory

type PeerSenderFactory func(ctx context.Context, p peer.ID) PeerResponseSender

PeerSenderFactory provides a function that will create a PeerResponseSender.

Jump to

Keyboard shortcuts

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