Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataTransferNetwork ¶
type DataTransferNetwork interface {
Protect(id peer.ID, tag string)
Unprotect(id peer.ID, tag string) bool
// SendMessage sends a GraphSync message to a peer.
SendMessage(
context.Context,
peer.ID,
datatransfer.Message) error
// SetDelegate registers the Reciver to handle messages received from the
// network.
SetDelegate(Receiver)
// ConnectTo establishes a connection to the given peer
ConnectTo(context.Context, peer.ID) error
// ConnectWithRetry establishes a connection to the given peer, retrying if
// necessary, and opens a stream on the data-transfer protocol to verify
// the peer will accept messages on the protocol
ConnectWithRetry(ctx context.Context, p peer.ID) error
// ID returns the peer id of this libp2p host
ID() peer.ID
// Protocol returns the protocol version of the peer, connecting to
// the peer if necessary
Protocol(context.Context, peer.ID) (protocol.ID, error)
}
DataTransferNetwork provides network connectivity for GraphSync.
func NewFromLibp2pHost ¶
func NewFromLibp2pHost(host host.Host, options ...Option) DataTransferNetwork
NewFromLibp2pHost returns a GraphSyncNetwork supported by underlying Libp2p host.
type Option ¶ added in v0.9.0
type Option func(*libp2pDataTransferNetwork)
Option is an option for configuring the libp2p storage market network
func DataTransferProtocols ¶ added in v0.9.0
DataTransferProtocols OVERWRITES the default libp2p protocols we use for data transfer with the given protocols.
type Receiver ¶
type Receiver interface {
ReceiveRequest(
ctx context.Context,
sender peer.ID,
incoming datatransfer.Request)
ReceiveResponse(
ctx context.Context,
sender peer.ID,
incoming datatransfer.Response)
ReceiveRestartExistingChannelRequest(ctx context.Context, sender peer.ID, incoming datatransfer.Request)
ReceiveError(error)
}
Receiver is an interface for receiving messages from the GraphSyncNetwork.
Click to show internal directories.
Click to hide internal directories.