network

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0, MIT Imports: 14 Imported by: 68

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProtocolGraphsync is the protocol identifier for graphsync messages
	ProtocolGraphsync_2_0_0 protocol.ID = "/ipfs/graphsync/2.0.0"
)

Functions

This section is empty.

Types

type ConnManager added in v0.10.0

type ConnManager interface {
	Protect(peer.ID, string)
	Unprotect(peer.ID, string) bool
}

ConnManager provides the methods needed to protect and unprotect connections

type GraphSyncNetwork

type GraphSyncNetwork interface {

	// SendMessage sends a GraphSync message to a peer.
	SendMessage(
		context.Context,
		peer.ID,
		gsmsg.GraphSyncMessage) error

	// SetDelegate registers the Receiver to handle messages received from the
	// network.
	SetDelegate(Receiver)

	// ConnectTo establishes a connection to the given peer
	ConnectTo(context.Context, peer.ID) error

	NewMessageSender(context.Context, peer.ID, MessageSenderOpts) (MessageSender, error)

	ConnectionManager() ConnManager
}

GraphSyncNetwork provides network connectivity for GraphSync.

func NewFromLibp2pHost

func NewFromLibp2pHost(host host.Host, options ...Option) GraphSyncNetwork

NewFromLibp2pHost returns a GraphSyncNetwork supported by underlying Libp2p host.

type MessageSender

type MessageSender interface {
	SendMsg(context.Context, gsmsg.GraphSyncMessage) error
	Close() error
	Reset() error
}

MessageSender is an interface to send messages to a peer

type MessageSenderOpts added in v0.10.3

type MessageSenderOpts struct {
	SendTimeout time.Duration
}

MessageSenderOpts sets parameters for a message sender

type Option added in v0.13.0

type Option func(*libp2pGraphSyncNetwork)

Option is an option for configuring the libp2p storage market network

func GraphsyncProtocols added in v0.13.0

func GraphsyncProtocols(protocols []protocol.ID) Option

DataTransferProtocols OVERWRITES the default libp2p protocols we use for graphsync with the specified protocols

func PanicCallback added in v0.13.2

func PanicCallback(callbackFn panics.CallBackFn) Option

PanicCallback allows calling code to receive information about panics that Graphsync recovers from. Graphsync recovers panics that occur during message handling in order to keep the over all system running, although they are still treated as standard errors in normal execution flow.

type Receiver

type Receiver interface {
	ReceiveMessage(
		ctx context.Context,
		sender peer.ID,
		incoming gsmsg.GraphSyncMessage)

	ReceiveError(p peer.ID, err error)

	Connected(p peer.ID)
	Disconnected(p peer.ID)
}

Receiver is an interface for receiving messages from the GraphSyncNetwork.

Jump to

Keyboard shortcuts

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