metadata

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FilecoinV1 is the current filecoin retrieval protocol
	FilecoinV1 ExchangeFormat = 0x00

	// GraphSyncV1 is the graphsync libp2p protocol
	GraphSyncV1 TransportProtocol = 0x00
)
View Source
const (
	// BitswapMetadataV1 is the 2021-era ipfs-bitswap transport protocol
	BitswapMetadataV1 = 0x3E0000
)

Variables

View Source
var BitswapMetadata = stiapi.Metadata{
	ProtocolID: BitswapMetadataV1,
	Data:       []byte{},
}

BitswapMetadata is a signalling indicator for the bitswap transport

Functions

func DataTransferMulticodec

func DataTransferMulticodec(ef ExchangeFormat, tp TransportProtocol) multicodec.Code

DataTransferMulticodec writes a new data transfer protocol multicodec from the given exchange format and transport protocol

func IsDataTransferProtocol

func IsDataTransferProtocol(c multicodec.Code) bool

IsDataTransferProtocol indicates whether or not a multicodec is in the reserved range for a data transfer protocols Data transfer protocols reserve the range 0x3F0000 to 0x3FFFFF After the 2 largest order bytes (3F) the first two remaining bytes indicate the exchange format and the next indicate the transport so for 0x3F6704, 67 would indicate the exchange format and 04 would be the transfport

Types

type DataTransferMetadata

type DataTransferMetadata struct {

	// FormatData is opaque bytes that can be decoded once you know the format type
	Data []byte
	// contains filtered or unexported fields
}

DataTransferMetadata is simply a structured form of Metadata that deciphers ExchangeFormat and TransportProtocol

func FromIndexerMetadata

func FromIndexerMetadata(m stiapi.Metadata) (DataTransferMetadata, error)

FromIndexerMetadata converts indexer Metadata format to DataTransferMetadata if the multicodec falls in the DataTransferMetadata range

func (DataTransferMetadata) ExchangeFormat

func (dtm DataTransferMetadata) ExchangeFormat() ExchangeFormat

ExchangeFormat indicates the type of exchange format used for sending vouchers in this data transfer

func (DataTransferMetadata) ToIndexerMetadata

func (dtm DataTransferMetadata) ToIndexerMetadata() stiapi.Metadata

ToIndexerMetadata converts DataTransferMetadata information into indexer Metadata format

func (DataTransferMetadata) TransportProtocol

func (dtm DataTransferMetadata) TransportProtocol() TransportProtocol

TransportProtocol indicates the type of transport protocol used for this data transfer

type ErrNotDataTransfer

type ErrNotDataTransfer struct {
	// contains filtered or unexported fields
}

ErrNotDataTransfer indicates a protocol is not a data transfer protocol

func (ErrNotDataTransfer) Error

func (e ErrNotDataTransfer) Error() string

type ErrNotFilecoinV1

type ErrNotFilecoinV1 struct {
	// contains filtered or unexported fields
}

ErrNotFilecoinV1 indicates a protocol does not use filecoin v1 exchange

func (ErrNotFilecoinV1) Error

func (e ErrNotFilecoinV1) Error() string

type ExchangeFormat

type ExchangeFormat byte

ExchangeFormat identifies the type of vouchers taht will be exchanged

type FilecoinV1Data

type FilecoinV1Data 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
}

FilecoinV1Data is the information encoded in Data for FilecoinGraphsyncV1

func DecodeFilecoinV1Data

func DecodeFilecoinV1Data(dtm DataTransferMetadata) (*FilecoinV1Data, error)

DecodeFilecoinV1Data decodes a new FilecoinV1Data instance from DataTransferMetadata if the format and protocol match

func (*FilecoinV1Data) Encode

func (fd *FilecoinV1Data) Encode(transportProtocol TransportProtocol) (DataTransferMetadata, error)

Encode serialized FilecoinV1 data and then wraps it into a DataTransferMetadata struct

type TransportProtocol

type TransportProtocol byte

TransportProtocol indicates the underlying protocol (for now, always graphsync)

Jump to

Keyboard shortcuts

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