Documentation ¶
Index ¶
- func Cache(ctx context.Context, providerStore types.ProviderStore, provider peer.AddrInfo, ...) error
- type ContentToClaimsMapper
- type LegacyClaimsFinder
- type LegacyClaimsStore
- type NoResultsLegacyClaimsFinder
- type ProviderIndex
- type ProviderIndexService
- func (pi *ProviderIndexService) Cache(ctx context.Context, provider peer.AddrInfo, contextID string, ...) error
- func (pi *ProviderIndexService) Find(ctx context.Context, qk QueryKey) ([]model.ProviderResult, error)
- func (pi *ProviderIndexService) Publish(ctx context.Context, provider peer.AddrInfo, contextID string, ...) error
- type QueryKey
- type RemoteSyncer
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentToClaimsMapper ¶ added in v1.0.0
type ContentToClaimsMapper interface {
GetClaims(ctx context.Context, contentHash multihash.Multihash) (claimsCids []cid.Cid, err error)
}
ContentToClaimsMapper maps content hashes to claim cids
type LegacyClaimsFinder ¶ added in v1.0.0
type LegacyClaimsFinder interface { // Find returns a list of claims for a given content hash. // Implementations should return an empty slice and no error if no results are found. Find(ctx context.Context, contentHash multihash.Multihash) ([]model.ProviderResult, error) }
LegacyClaimsFinder is a read-only interface to find claims on a legacy system
type LegacyClaimsStore ¶ added in v1.0.0
type LegacyClaimsStore struct {
// contains filtered or unexported fields
}
LegacyClaimsStore allows finding claims on a legacy store
func NewLegacyClaimsStore ¶ added in v1.0.0
func NewLegacyClaimsStore(contentToClaimsMapper ContentToClaimsMapper, claimStore types.ContentClaimsStore, claimsUrl string) (LegacyClaimsStore, error)
func (LegacyClaimsStore) Find ¶ added in v1.0.0
func (ls LegacyClaimsStore) Find(ctx context.Context, contentHash multihash.Multihash) ([]model.ProviderResult, error)
Find looks for the corresponding claims for a given content hash in the mapper and then fetches the claims from the claims store
type NoResultsLegacyClaimsFinder ¶ added in v1.0.0
type NoResultsLegacyClaimsFinder struct{}
NoResultsLegacyClaimsFinder is a LegacyClaimsFinder that returns no results. It can be used when accessing claims in a legacy system is not required
func NewNoResultsLegacyClaimsFinder ¶ added in v1.0.0
func NewNoResultsLegacyClaimsFinder() NoResultsLegacyClaimsFinder
func (NoResultsLegacyClaimsFinder) Find ¶ added in v1.0.0
func (f NoResultsLegacyClaimsFinder) Find(ctx context.Context, contentHash multihash.Multihash) ([]model.ProviderResult, error)
Find always returns no results
type ProviderIndex ¶
type ProviderIndex interface { // Find should do the following // 1. Read from the IPNI Storage cache to get a list of providers // a. If there is no record in cache, query IPNI, filter out any non-content claims metadata, and store // the resulting records in the cache // b. the are no records in the cache or IPNI, it can attempt to read from legacy systems -- Dynamo tables & content claims storage, synthetically constructing provider results // 2. With returned provider results, filter additionally for claim type. If space dids are set, calculate an encodedcontextid's by hashing space DID and Hash, and filter for a matching context id // Future TODO: kick off a conversion task to update the recrds Find(context.Context, QueryKey) ([]model.ProviderResult, error) // Cache writes entries to the cache but does not publish/announce an // advertisement for them. Entries expire after a pre-determined time. Cache(ctx context.Context, provider peer.AddrInfo, contextID string, digests iter.Seq[multihash.Multihash], meta meta.Metadata) error // Publish should do the following: // 1. Write the entries to the cache with no expiration until publishing is complete // 2. Generate an advertisement for the advertised hashes and publish/announce it Publish(ctx context.Context, provider peer.AddrInfo, contextID string, digests iter.Seq[multihash.Multihash], meta meta.Metadata) error }
ProviderIndex is a read/write interface to a local cache of providers that falls back to legacy systems and IPNI
type ProviderIndexService ¶ added in v1.0.0
type ProviderIndexService struct {
// contains filtered or unexported fields
}
ProviderIndexService is a read/write interface to a local cache of providers that falls back to IPNI
func New ¶ added in v1.0.0
func New(providerStore types.ProviderStore, findClient ipnifind.Finder, publisher publisher.Publisher, legacyClaims LegacyClaimsFinder) *ProviderIndexService
func (*ProviderIndexService) Find ¶ added in v1.0.0
func (pi *ProviderIndexService) Find(ctx context.Context, qk QueryKey) ([]model.ProviderResult, error)
Find should do the following
- Read from the IPNI Storage cache to get a list of providers a. if there are no records in the cache, query IPNI, filtering out any non-content claims metadata b. if no records are found in IPNI, attempt to read claims from legacy systems -- Dynamo tables & content claims storage, synthetically constructing provider results c. finally, store the resulting records in the cache
- With returned provider results, filter additionally for claim type. If space dids are set, calculate an encodedcontextid's by hashing space DID and Hash, and filter for a matching context id Future TODO: kick off a conversion task to update the records
func (*ProviderIndexService) Publish ¶ added in v1.0.0
func (pi *ProviderIndexService) Publish(ctx context.Context, provider peer.AddrInfo, contextID string, digests iter.Seq[mh.Multihash], meta meta.Metadata) error
Publish should do the following: 1. Write the entries to the cache with no expiration until publishing is complete 2. Generate an advertisement for the advertised hashes and publish/announce it
type RemoteSyncer ¶ added in v1.0.0
type RemoteSyncer struct {
// contains filtered or unexported fields
}
func NewRemoteSyncer ¶ added in v1.0.0
func NewRemoteSyncer(providerStore types.ProviderStore, store Store) *RemoteSyncer
func (*RemoteSyncer) HandleRemoteSync ¶ added in v1.0.0
func (rs *RemoteSyncer) HandleRemoteSync(ctx context.Context, head, prev ipld.Link)
type Store ¶ added in v1.0.0
type Store interface { store.EntriesReadable store.AdvertReadable }