Documentation ¶
Index ¶
Constants ¶
const RoutingErrorProtocol = multicodec.ReservedEnd
RoutingErrorProtocol is the protocol identity for conveying a routing error
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Routing ¶
type Routing interface {
FindProviders(context.Context, cid.Cid, ...RoutingOptions) <-chan RoutingRecord
}
The Routing interface is an evolution of the ContentRouting interface found in [libp2p](https://github.com/libp2p/go-libp2p-core/blob/master/routing/routing.go#L26).
Routing focuses only on the retrieval half of the interface: how do I located content given a content identifier?
The returned channel of RoutingRecords must be consumed until closed by the Caller. The same instance of a provider may block if previous calls have left un-drained records. The provider will close the channel once complete or once the context is canceled.
type RoutingError ¶
RoutingError is a RoutingRecord used for signalling an underlying error
func (*RoutingError) Payload ¶
func (r *RoutingError) Payload() interface{}
Payload is the underlying error
func (*RoutingError) Protocol ¶
func (r *RoutingError) Protocol() multicodec.Code
Protocol indicates that this record is an error
func (*RoutingError) Request ¶
func (r *RoutingError) Request() cid.Cid
Request is the Cid that triggered this routing error
type RoutingOptions ¶
type RoutingOptions func()
RoutingOptions further specify a content routing request
type RoutingRecord ¶
type RoutingRecord interface { Request() cid.Cid Protocol() multicodec.Code Provider() interface{} Payload() interface{} }
A RoutingRecord is an abstract record of a content routing response.
func RecordError ¶
func RecordError(c cid.Cid, err error) RoutingRecord
RecordError returns a RoutingRecord indicating a specified error