Documentation ¶
Overview ¶
Package metadata implements protocols for publishing content claims on IPNI The goal is to enable partial publishing of content claims to IPNI The rules for publishing content claims records to IPNI are as follows: Content claims should be published to IPNI by the original issuer of the content claim. The ContextID for the content claim should be the cid of the content the claim is about, except in the case of a location commitment, where the content ID should be: hash(audience public key, content cid multihash) The claim record MUST be able to be looked up on IPNI from the content cid multihash (or double encryption thereof) The claim MAY be able to be looked up by additional multihashes, particularly in the case of the IndexClaim, where the record should be accessible from any multihash inside the index The metadata for the claim is structured to maximize utility of the record while minimizing size To generally respect the 100 byte maximum size for IPNI records, we do not encode the claim itself, but rather its CID. The full claim must be retrievable through an http multiaddr of the provider which contains path segments of the form `{claim}`. To retrieve the claim, replace every `{claim}` with the string encoding of the claim CID For a location commitment, the content must retrievable through an http multiaddr of the provider which contains path segments of the form `{shard}`. To retrieve the claim, replace every `{shard}` with the string encoding of the shard cid in the metadata, or if not present, the CIDv1 encoding using RAW codec of the multihash used to lookup the record Additionally, if a Range parameter is present in the metadata, it should be translated into a range HTTP header when retrieving content However, in order to enable faster chaining of requests and general processing, we add additional fields to encode specific information from the full claim. This enables a client to quickly read the record and take action based on information in the claim before it has retrieved the full claim
Index ¶
- Constants
- Variables
- type EqualsClaimMetadata
- type HasClaim
- type IndexClaimMetadata
- type LocationCommitmentMetadata
- func (l *LocationCommitmentMetadata) GetClaim() cid.Cid
- func (l *LocationCommitmentMetadata) ID() multicodec.Code
- func (l *LocationCommitmentMetadata) MarshalBinary() ([]byte, error)
- func (l *LocationCommitmentMetadata) ReadFrom(r io.Reader) (n int64, err error)
- func (l *LocationCommitmentMetadata) UnmarshalBinary(data []byte) error
- type Range
Constants ¶
View Source
const EqualsClaimID = 0x3E0001
EqualsClaimID is the multicodec for equals claims
View Source
const IndexClaimID = 0x3E0000
IndexClaimID is the multicodec for index claims
View Source
const LocationCommitmentID = 0x3E0002
LocationCommitmentID is the multicodec for location commitments
Variables ¶
View Source
var MetadataContext ipnimd.MetadataContext
Functions ¶
This section is empty.
Types ¶
type EqualsClaimMetadata ¶
type EqualsClaimMetadata struct { // Equals represents an equivalent cid to the content cid that was used for lookup Equals cid.Cid // Expiration as unix epoch in seconds Expiration int64 // Claim indicates the cid of the claim - the claim should be fetchable by combining the http multiaddr of the provider with the claim cid Claim cid.Cid }
EqualsClaimMetadata represents metadata for an equals claim
func (*EqualsClaimMetadata) GetClaim ¶
func (e *EqualsClaimMetadata) GetClaim() cid.Cid
func (*EqualsClaimMetadata) ID ¶
func (e *EqualsClaimMetadata) ID() multicodec.Code
func (*EqualsClaimMetadata) MarshalBinary ¶
func (e *EqualsClaimMetadata) MarshalBinary() ([]byte, error)
func (*EqualsClaimMetadata) ReadFrom ¶
func (e *EqualsClaimMetadata) ReadFrom(r io.Reader) (n int64, err error)
func (*EqualsClaimMetadata) UnmarshalBinary ¶
func (e *EqualsClaimMetadata) UnmarshalBinary(data []byte) error
type IndexClaimMetadata ¶
type IndexClaimMetadata struct { // Index represents the cid of the index for this claim Index cid.Cid // Expiration as unix epoch in seconds Expiration int64 // Claim indicates the cid of the claim - the claim should be fetchable by combining the http multiaddr of the provider with the claim cid Claim cid.Cid }
IndexClaimMetadata represents metadata for an index claim Index claim metadata
func (*IndexClaimMetadata) GetClaim ¶
func (i *IndexClaimMetadata) GetClaim() cid.Cid
func (*IndexClaimMetadata) ID ¶
func (i *IndexClaimMetadata) ID() multicodec.Code
func (*IndexClaimMetadata) MarshalBinary ¶
func (i *IndexClaimMetadata) MarshalBinary() ([]byte, error)
func (*IndexClaimMetadata) ReadFrom ¶
func (i *IndexClaimMetadata) ReadFrom(r io.Reader) (n int64, err error)
func (*IndexClaimMetadata) UnmarshalBinary ¶
func (i *IndexClaimMetadata) UnmarshalBinary(data []byte) error
type LocationCommitmentMetadata ¶
type LocationCommitmentMetadata struct { // Shard is an optional alternate cid to use to lookup this location -- if the looked up shard is part of a larger shard Shard *cid.Cid // Range is an optional byte range within a shard Range *Range // Expiration as unix epoch in seconds Expiration int64 // Claim indicates the cid of the claim - the claim should be fetchable by combining the http multiaddr of the provider with the claim cid Claim cid.Cid }
LocationCommitmentMetadata represents metadata for an equals claim
func (*LocationCommitmentMetadata) GetClaim ¶
func (l *LocationCommitmentMetadata) GetClaim() cid.Cid
func (*LocationCommitmentMetadata) ID ¶
func (l *LocationCommitmentMetadata) ID() multicodec.Code
func (*LocationCommitmentMetadata) MarshalBinary ¶
func (l *LocationCommitmentMetadata) MarshalBinary() ([]byte, error)
func (*LocationCommitmentMetadata) ReadFrom ¶
func (l *LocationCommitmentMetadata) ReadFrom(r io.Reader) (n int64, err error)
func (*LocationCommitmentMetadata) UnmarshalBinary ¶
func (l *LocationCommitmentMetadata) UnmarshalBinary(data []byte) error
Click to show internal directories.
Click to hide internal directories.