Documentation ¶
Overview ¶
Package network providers an abstraction over a libp2p host for managing retrieval's Libp2p protocols:
network.go - defines the interfaces that must be implemented to serve as a retrieval network deal-stream.go - implements the `RetrievalDealStream` interface, a data stream for retrieval deal traffic only query-stream.go - implements the `RetrievalQueryStream` interface, a data stream for retrieval query traffic only libp2p_impl.go - provides the production implementation of the `RetrievalMarketNetwork` interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*libp2pRetrievalMarketNetwork)
Option is an option for configuring the libp2p storage market network
func RetryParameters ¶
func RetryParameters(minDuration time.Duration, maxDuration time.Duration, attempts float64, backoffFactor float64) Option
RetryParameters changes the default parameters around connection reopening
func SupportedProtocols ¶
SupportedProtocols sets what protocols this network instances listens on
type RetrievalMarketNetwork ¶
type RetrievalMarketNetwork interface { // NewQueryStream creates a new RetrievalQueryStream implementer using the provided peer.ID NewQueryStream(peer.ID) (RetrievalQueryStream, error) // SetDelegate sets a RetrievalReceiver implementer to handle stream data SetDelegate(RetrievalReceiver) error // StopHandlingRequests unsets the RetrievalReceiver and would perform any other necessary // shutdown logic. StopHandlingRequests() error // ID returns the peer id of the host for this network ID() peer.ID // AddAddrs adds the given multi-addrs to the peerstore for the passed peer ID AddAddrs(peer.ID, []ma.Multiaddr) }
RetrievalMarketNetwork is the API for creating query and deal streams and delegating responders to those streams.
func NewFromLibp2pHost ¶
func NewFromLibp2pHost(h host.Host, options ...Option) RetrievalMarketNetwork
NewFromLibp2pHost constructs a new instance of the RetrievalMarketNetwork from a libp2p host
type RetrievalQueryStream ¶
type RetrievalQueryStream interface { ReadQuery() (retrievalmarket.Query, error) WriteQuery(retrievalmarket.Query) error ReadQueryResponse() (retrievalmarket.QueryResponse, error) WriteQueryResponse(retrievalmarket.QueryResponse) error Close() error RemotePeer() peer.ID }
RetrievalQueryStream is the API needed to send and receive retrieval query data over data-transfer network.
type RetrievalReceiver ¶
type RetrievalReceiver interface { // HandleQueryStream sends and receives data-transfer data via the // RetrievalQueryStream provided HandleQueryStream(RetrievalQueryStream) }
RetrievalReceiver is the API for handling data coming in on both query and deal streams