Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound means the key did not exist in the cache
var ErrNoRootBlock = errors.New("query root block not found in car")
ErrNoRootBlock indicates a root that is specified but not found in a CAR file
var ErrWrongRootCount = errors.New("query result should have exactly one root")
ErrWrongRootCount indicates a car file with multiple roots being unable to interpret as a query result
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[Key, Value any] interface { Set(ctx context.Context, key Key, value Value, expires bool) error SetExpirable(ctx context.Context, key Key, expires bool) error Get(ctx context.Context, key Key) (Value, error) }
Cache describes a generic cache interface
type ContentClaimsCache ¶ added in v1.0.0
type ContentClaimsCache Cache[cid.Cid, delegation.Delegation]
ContentClaimsCache caches fetched content claims
type ContentClaimsStore ¶
type ContentClaimsStore Store[ipld.Link, delegation.Delegation]
ContentClaimsStore stores published content claims
type ContextID ¶
ContextID describes the data used to calculate a context id for IPNI
func (ContextID) ToEncoded ¶
func (c ContextID) ToEncoded() (EncodedContextID, error)
ToEncoded canonically encodes ContextID data
type EncodedContextID ¶
type EncodedContextID []byte
EncodedContextID is the encoded form of context id data that is actually stored in IPNI
type Getter ¶ added in v1.0.0
type Getter interface { // Get retrieves a claim that has been published or cached by the // indexing service. No external sources are consulted. Get(ctx context.Context, claim ipld.Link) (delegation.Delegation, error) }
type Match ¶ added in v1.0.0
Match narrows parameters for locating providers/claims for a set of multihashes
type ProviderStore ¶
type ProviderStore Cache[mh.Multihash, []model.ProviderResult]
ProviderStore caches queries to IPNI
type Publisher ¶ added in v1.0.0
type Publisher interface { // Cache caches a claim with the service temporarily. Cache(ctx context.Context, provider peer.AddrInfo, claim delegation.Delegation) error // Publish writes a claim to permanent storage, adds it to an IPNI // advertisement, annnounces it to IPNI nodes and caches it. Publish(ctx context.Context, claim delegation.Delegation) error }
type Querier ¶ added in v1.0.0
type Querier interface { // Query allows claims to be queried by their subject (content CID). It // returns claims as well as any relevant indexes. Query(ctx context.Context, q Query) (QueryResult, error) }
type QueryResult ¶ added in v1.0.0
type QueryResult interface { ipld.View // Claims is a list of links to the root bock of claims that can be found in this message Claims() []ipld.Link // Indexes is a list of links to the CID hash of archived sharded dag indexes that can be found in this // message Indexes() []ipld.Link }
QueryResult is an encodable result of a query
type ShardedDagIndexStore ¶
type ShardedDagIndexStore Cache[EncodedContextID, blobindex.ShardedDagIndexView]
ShardedDagIndexStore caches fetched sharded dag indexes
type Store ¶ added in v1.0.0
type Store[Key, Value any] interface { // Put adds (or replaces) an item in the store. Put(ctx context.Context, key Key, value Value) error // Get retrieves an existing item from the store. If the item does not exist, // it should return [ErrKeyNotFound]. Get(ctx context.Context, key Key) (Value, error) }
Store describes a generic storage interface