Documentation ¶
Overview ¶
Package metadata captures the metadata types known by the index-provider.
The metadata is used to provide information about how to retrieve data blocks associated to multihashes advertised by a provider. It is represented as an array of bytes in the indexer protocol, starting with a varint ProtocolID that defines how to decode the remaining bytes.
Two metadata types are currently represented here: Bitswap and GraphsyncFilecoinV1.
Index ¶
- Constants
- Variables
- type Bitswap
- type ErrInvalidMetadata
- type GraphsyncFilecoinV1
- type IpfsGatewayHttp
- type Metadata
- func (m Metadata) Equal(other Metadata) bool
- func (m *Metadata) Get(protocol multicodec.Code) Protocol
- func (m *Metadata) Len() int
- func (m *Metadata) Less(one, other int) bool
- func (m *Metadata) MarshalBinary() ([]byte, error)
- func (m *Metadata) Protocols() []multicodec.Code
- func (m *Metadata) Swap(one, other int)
- func (m *Metadata) UnmarshalBinary(data []byte) error
- func (m *Metadata) Validate() error
- type MetadataContext
- type Protocol
- type Unknown
Constants ¶
const MaxMetadataSize = 1024
Variables ¶
var (
ErrTooLong = errors.New("too long")
)
Functions ¶
This section is empty.
Types ¶
type Bitswap ¶
type Bitswap struct { }
Bitswap represents the indexing metadata that uses multicodec.TransportBitswap.
func (Bitswap) MarshalBinary ¶
func (Bitswap) UnmarshalBinary ¶
type ErrInvalidMetadata ¶
type ErrInvalidMetadata struct {
Message string
}
func (ErrInvalidMetadata) Error ¶
func (e ErrInvalidMetadata) Error() string
type GraphsyncFilecoinV1 ¶
type GraphsyncFilecoinV1 struct { // PieceCID identifies the piece this data can be found in PieceCID cid.Cid // VerifiedDeal indicates if the deal is verified VerifiedDeal bool // FastRetrieval indicates whether the provider claims there is an unsealed copy FastRetrieval bool }
GraphsyncFilecoinV1 represents the indexing metadata for multicodec.TransportGraphsyncFilecoinv1.
func (*GraphsyncFilecoinV1) ID ¶
func (dtm *GraphsyncFilecoinV1) ID() multicodec.Code
func (*GraphsyncFilecoinV1) MarshalBinary ¶
func (dtm *GraphsyncFilecoinV1) MarshalBinary() ([]byte, error)
MarshalBinary implements encoding.BinaryMarshaler.
func (*GraphsyncFilecoinV1) ReadFrom ¶
func (dtm *GraphsyncFilecoinV1) ReadFrom(r io.Reader) (n int64, err error)
func (*GraphsyncFilecoinV1) UnmarshalBinary ¶
func (dtm *GraphsyncFilecoinV1) UnmarshalBinary(data []byte) error
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type IpfsGatewayHttp ¶ added in v0.0.8
type IpfsGatewayHttp struct { }
IpfsGatewayHttp represents the indexing metadata that uses multicodec.TransportIpfsGatewayHttp.
func (IpfsGatewayHttp) ID ¶ added in v0.0.8
func (b IpfsGatewayHttp) ID() multicodec.Code
func (IpfsGatewayHttp) MarshalBinary ¶ added in v0.0.8
func (b IpfsGatewayHttp) MarshalBinary() ([]byte, error)
func (IpfsGatewayHttp) ReadFrom ¶ added in v0.0.8
func (b IpfsGatewayHttp) ReadFrom(r io.Reader) (n int64, err error)
func (IpfsGatewayHttp) UnmarshalBinary ¶ added in v0.0.8
func (b IpfsGatewayHttp) UnmarshalBinary(data []byte) error
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata is data that provides information about how to retrieve the advertised content. Note that the content may be avaiable for retrieval over multiple protocols.
func (Metadata) Equal ¶
Equal checks whether this Metadata is equal with the other Metadata. The two are considered equal if they have the same transports with the same order.
func (*Metadata) Get ¶
Get determines if a given protocol is included in metadata, and if so returned the parsed protocol.
func (*Metadata) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*Metadata) Protocols ¶
func (m *Metadata) Protocols() []multicodec.Code
Protocols returns the transport protocols advertised in this metadata
func (*Metadata) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type MetadataContext ¶
type MetadataContext interface { WithProtocol(id multicodec.Code, factory func() Protocol) MetadataContext New(t ...Protocol) Metadata }
MetadataContext holds context for metadata serialization and deserialization.
var Default MetadataContext
type Protocol ¶
type Protocol interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler io.ReaderFrom // Implement io.ReaderFrom so that transport can be incrementally decoded. // ID is the multicodec of the transport protocol represented by this Protocol. ID() multicodec.Code }
Protocol represents the retrieval transport protocol of an advertisement.
type Unknown ¶
type Unknown struct { Code multicodec.Code Payload []byte }
Unknown represents an unparsed metadata payload