Documentation
¶
Index ¶
- func StatBlocks(ctx context.Context, id principal.Signer, ...) iter.Seq2[BlockStat, error]
- func VerifyDAGRetrieval(ctx context.Context, id principal.Signer, ...) iter.Seq2[VerifiedBlock, error]
- type AuthorizeIndexerRetrievalFunc
- type BlockStat
- type ContentRetrieveProofGetterFunc
- type IndexCache
- type Indexer
- type IndexingServiceClient
- type Location
- type LocationCache
- type Origin
- type ShardFinder
- type Slice
- type VerifiedBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatBlocks ¶
func StatBlocks(ctx context.Context, id principal.Signer, getProofs ContentRetrieveProofGetterFunc, indexer ShardFinder, links []cid.Cid) iter.Seq2[BlockStat, error]
StatBlocks retrieves block statistics for the given CIDs using the provided indexer. It also performs integrity checks on the retrieved blocks. Note: the getProofs function can be nil, in which case no authorization will be sent for retrievals.
func VerifyDAGRetrieval ¶
func VerifyDAGRetrieval( ctx context.Context, id principal.Signer, getProofs ContentRetrieveProofGetterFunc, indexer ShardFinder, root cid.Cid, ) iter.Seq2[VerifiedBlock, error]
VerifyDAGRetrieval verifies the retrieval of a DAG starting from the given root CID. It uses the provided indexer to find shards and locations, and retrieves blocks while verifying their integrity. The function returns a sequence of VerifiedBlock results. Note: the getProofs function can be nil, in which case no authorization will be sent for retrievals.
Types ¶
type AuthorizeIndexerRetrievalFunc ¶
type AuthorizeIndexerRetrievalFunc func() (delegation.Delegation, error)
AuthorizeIndexerRetrievalFunc is a function that authorizes retrievals from the indexer by returning a delegation that can be used for retrieval.
type BlockStat ¶
type BlockStat struct {
Codec uint64 // IPLD codec that was used to decode the block.
Size uint64 // Size of the block in bytes.
Digest multihash.Multihash // Multihash digest of the block.
Links []cid.Cid // CIDs linked from this block, deduped.
Origin Origin // Where the block was retrieved from.
}
type ContentRetrieveProofGetterFunc ¶
type ContentRetrieveProofGetterFunc func(space did.DID) ([]delegation.Proof, error)
ContentRetrieveProofGetterFunc is a function that obtains proofs for content retrieval in a given space.
type IndexCache ¶
type IndexCache struct {
// contains filtered or unexported fields
}
func NewIndexCache ¶
func NewIndexCache() *IndexCache
func (*IndexCache) Add ¶
func (c *IndexCache) Add(root cid.Cid, index blobindex.ShardedDagIndex)
func (*IndexCache) IndexForSlice ¶
func (c *IndexCache) IndexForSlice(slice multihash.Multihash) (blobindex.ShardedDagIndex, bool)
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
func NewIndexer ¶
func NewIndexer(client IndexingServiceClient, authorize AuthorizeIndexerRetrievalFunc) *Indexer
NewIndexer creates a new Indexer with the given indexing service client and authorization function. Note: the authorize function can be nil, in which case no authorization will be sent for indexer queries.
func (*Indexer) FindLocations ¶
FindLocations finds at least 1 location for the given shard or returns an error.
type IndexingServiceClient ¶
type IndexingServiceClient interface {
QueryClaims(ctx context.Context, query types.Query) (types.QueryResult, error)
}
IndexingServiceClient is the interface for querying the indexing service.
type Location ¶
type Location struct {
Commitment delegation.Delegation
// Caveats are the decoded caveats from the commitment delegation.
Caveats assert.LocationCaveats
}
type LocationCache ¶
type LocationCache struct {
// contains filtered or unexported fields
}
func NewLocationCache ¶
func NewLocationCache() *LocationCache
func (*LocationCache) Add ¶
func (c *LocationCache) Add(commitment delegation.Delegation)
func (*LocationCache) LocationsForShard ¶
func (c *LocationCache) LocationsForShard(shard multihash.Multihash) []Location
type ShardFinder ¶
type ShardFinder interface {
FindShard(ctx context.Context, slice multihash.Multihash) (multihash.Multihash, blobindex.Position, error)
FindLocations(ctx context.Context, shard multihash.Multihash) ([]Location, error)
}
ShardFinder finds shards and their locations for content retrieval.
type VerifiedBlock ¶
type VerifiedBlock struct {
Stat BlockStat
}