network

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0, MIT Imports: 14 Imported by: 2

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

	// ID returns the peer id of this libp2p host
	ID() peer.ID
}

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

type Option func(*libp2pDataTransferNetwork)

Option is an option for configuring the libp2p storage market network

func DataTransferProtocols

func DataTransferProtocols(protocols []protocol.ID) Option

DataTransferProtocols OVERWRITES the default libp2p protocols we use for data transfer with the given protocols.

func RetryParameters

func RetryParameters(minDuration time.Duration, maxDuration time.Duration, attempts float64, backoffFactor float64) Option

RetryParameters changes the default parameters around connection reopening

func SendMessageParameters

func SendMessageParameters(openStreamTimeout time.Duration, sendMessageTimeout time.Duration) Option

SendMessageParameters changes the default parameters around sending messages

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.

Jump to

Keyboard shortcuts

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