network

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 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_1_0_0 protocol.ID = "/ipfs/graphsync/1.0.0"
	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

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