types

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

ErrKeyNotFound means the key did not exist in the cache

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

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

type ContextID struct {
	Space *did.DID
	Hash  mh.Multihash
}

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

type Match struct {
	Subject []did.DID
}

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 Query added in v1.0.0

type Query struct {
	Hashes []mh.Multihash
	Match  Match
}

Query is a query for several multihashes

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 Service added in v1.0.0

type Service interface {
	Getter
	Publisher
	Querier
}

Service is the core methods of the indexing service.

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

Jump to

Keyboard shortcuts

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