contentrouting

package
v0.0.0-...-de8e8a8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: MIT, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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

type RoutingError struct {
	cid.Cid
	Error error
}

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) Provider

func (r *RoutingError) Provider() interface{}

Provider is empty

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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