Documentation
¶
Index ¶
- Variables
- func Cache(ctx context.Context, providerStore types.ProviderStore, provider peer.AddrInfo, ...) error
- type ContentToClaimsMapper
- type LegacyClaimsFinder
- type LegacyClaimsStore
- type MockContentToClaimsMapper
- type MockContentToClaimsMapper_Expecter
- type MockContentToClaimsMapper_GetClaims_Call
- func (_c *MockContentToClaimsMapper_GetClaims_Call) Return(claimsCids []cid.Cid, err error) *MockContentToClaimsMapper_GetClaims_Call
- func (_c *MockContentToClaimsMapper_GetClaims_Call) Run(run func(ctx context.Context, contentHash multihash.Multihash)) *MockContentToClaimsMapper_GetClaims_Call
- func (_c *MockContentToClaimsMapper_GetClaims_Call) RunAndReturn(run func(context.Context, multihash.Multihash) ([]cid.Cid, error)) *MockContentToClaimsMapper_GetClaims_Call
- type MockLegacyClaimsFinder
- type MockLegacyClaimsFinder_Expecter
- type MockLegacyClaimsFinder_Find_Call
- func (_c *MockLegacyClaimsFinder_Find_Call) Return(_a0 []model.ProviderResult, _a1 error) *MockLegacyClaimsFinder_Find_Call
- func (_c *MockLegacyClaimsFinder_Find_Call) Run(run func(ctx context.Context, contentHash multihash.Multihash, ...)) *MockLegacyClaimsFinder_Find_Call
- func (_c *MockLegacyClaimsFinder_Find_Call) RunAndReturn(...) *MockLegacyClaimsFinder_Find_Call
- type MockProviderIndex
- func (_m *MockProviderIndex) Cache(ctx context.Context, provider peer.AddrInfo, contextID string, ...) error
- func (_m *MockProviderIndex) EXPECT() *MockProviderIndex_Expecter
- func (_m *MockProviderIndex) Find(_a0 context.Context, _a1 QueryKey) ([]model.ProviderResult, error)
- func (_m *MockProviderIndex) Publish(ctx context.Context, provider peer.AddrInfo, contextID string, ...) error
- type MockProviderIndex_Cache_Call
- func (_c *MockProviderIndex_Cache_Call) Return(_a0 error) *MockProviderIndex_Cache_Call
- func (_c *MockProviderIndex_Cache_Call) Run(run func(ctx context.Context, provider peer.AddrInfo, contextID string, ...)) *MockProviderIndex_Cache_Call
- func (_c *MockProviderIndex_Cache_Call) RunAndReturn(...) *MockProviderIndex_Cache_Call
- type MockProviderIndex_Expecter
- func (_e *MockProviderIndex_Expecter) Cache(ctx interface{}, provider interface{}, contextID interface{}, ...) *MockProviderIndex_Cache_Call
- func (_e *MockProviderIndex_Expecter) Find(_a0 interface{}, _a1 interface{}) *MockProviderIndex_Find_Call
- func (_e *MockProviderIndex_Expecter) Publish(ctx interface{}, provider interface{}, contextID interface{}, ...) *MockProviderIndex_Publish_Call
- type MockProviderIndex_Find_Call
- func (_c *MockProviderIndex_Find_Call) Return(_a0 []model.ProviderResult, _a1 error) *MockProviderIndex_Find_Call
- func (_c *MockProviderIndex_Find_Call) Run(run func(_a0 context.Context, _a1 QueryKey)) *MockProviderIndex_Find_Call
- func (_c *MockProviderIndex_Find_Call) RunAndReturn(run func(context.Context, QueryKey) ([]model.ProviderResult, error)) *MockProviderIndex_Find_Call
- type MockProviderIndex_Publish_Call
- func (_c *MockProviderIndex_Publish_Call) Return(_a0 error) *MockProviderIndex_Publish_Call
- func (_c *MockProviderIndex_Publish_Call) Run(run func(ctx context.Context, provider peer.AddrInfo, contextID string, ...)) *MockProviderIndex_Publish_Call
- func (_c *MockProviderIndex_Publish_Call) RunAndReturn(...) *MockProviderIndex_Publish_Call
- 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 ¶
var ErrIgnoreFiltered = errors.New("claim type is not in list of target claims")
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, targetClaims []multicodec.Code) ([]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(contentToClaimsMappers []ContentToClaimsMapper, claimStore contentclaims.Finder, claimsUrl string) (LegacyClaimsStore, error)
NewLegacyClaimsStore builds a new store able to find claims in legacy services.
It uses a series of mappers to fetch claims from. Mappers will be consulted in order, so their positions in the list define their priority, with the first position being the top priority. This is important because the claims returned by Find will be the ones coming from the first mapper that returns relevant claims.
func (LegacyClaimsStore) Find ¶ added in v1.0.0
func (ls LegacyClaimsStore) Find(ctx context.Context, contentHash multihash.Multihash, targetClaims []multicodec.Code) ([]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. Find will look for relevant claims (as indicated by targetClaims) in content-to-claims mappers in the order they were specified when this LegacyClaimsStore was created (see NewLegacyClaimsStore). As soon as a mapper returns relevant claims, these will be returned and no more mappers will be checked.
type MockContentToClaimsMapper ¶ added in v1.2.1
MockContentToClaimsMapper is an autogenerated mock type for the ContentToClaimsMapper type
func NewMockContentToClaimsMapper ¶ added in v1.2.1
func NewMockContentToClaimsMapper(t interface { mock.TestingT Cleanup(func()) }) *MockContentToClaimsMapper
NewMockContentToClaimsMapper creates a new instance of MockContentToClaimsMapper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockContentToClaimsMapper) EXPECT ¶ added in v1.2.1
func (_m *MockContentToClaimsMapper) EXPECT() *MockContentToClaimsMapper_Expecter
type MockContentToClaimsMapper_Expecter ¶ added in v1.2.1
type MockContentToClaimsMapper_Expecter struct {
// contains filtered or unexported fields
}
func (*MockContentToClaimsMapper_Expecter) GetClaims ¶ added in v1.2.1
func (_e *MockContentToClaimsMapper_Expecter) GetClaims(ctx interface{}, contentHash interface{}) *MockContentToClaimsMapper_GetClaims_Call
GetClaims is a helper method to define mock.On call
- ctx context.Context
- contentHash multihash.Multihash
type MockContentToClaimsMapper_GetClaims_Call ¶ added in v1.2.1
MockContentToClaimsMapper_GetClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClaims'
func (*MockContentToClaimsMapper_GetClaims_Call) Return ¶ added in v1.2.1
func (_c *MockContentToClaimsMapper_GetClaims_Call) Return(claimsCids []cid.Cid, err error) *MockContentToClaimsMapper_GetClaims_Call
func (*MockContentToClaimsMapper_GetClaims_Call) Run ¶ added in v1.2.1
func (_c *MockContentToClaimsMapper_GetClaims_Call) Run(run func(ctx context.Context, contentHash multihash.Multihash)) *MockContentToClaimsMapper_GetClaims_Call
func (*MockContentToClaimsMapper_GetClaims_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockContentToClaimsMapper_GetClaims_Call) RunAndReturn(run func(context.Context, multihash.Multihash) ([]cid.Cid, error)) *MockContentToClaimsMapper_GetClaims_Call
type MockLegacyClaimsFinder ¶ added in v1.2.1
MockLegacyClaimsFinder is an autogenerated mock type for the LegacyClaimsFinder type
func NewMockLegacyClaimsFinder ¶ added in v1.2.1
func NewMockLegacyClaimsFinder(t interface { mock.TestingT Cleanup(func()) }) *MockLegacyClaimsFinder
NewMockLegacyClaimsFinder creates a new instance of MockLegacyClaimsFinder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockLegacyClaimsFinder) EXPECT ¶ added in v1.2.1
func (_m *MockLegacyClaimsFinder) EXPECT() *MockLegacyClaimsFinder_Expecter
func (*MockLegacyClaimsFinder) Find ¶ added in v1.2.1
func (_m *MockLegacyClaimsFinder) Find(ctx context.Context, contentHash multihash.Multihash, targetClaims []multicodec.Code) ([]model.ProviderResult, error)
Find provides a mock function with given fields: ctx, contentHash, targetClaims
type MockLegacyClaimsFinder_Expecter ¶ added in v1.2.1
type MockLegacyClaimsFinder_Expecter struct {
// contains filtered or unexported fields
}
func (*MockLegacyClaimsFinder_Expecter) Find ¶ added in v1.2.1
func (_e *MockLegacyClaimsFinder_Expecter) Find(ctx interface{}, contentHash interface{}, targetClaims interface{}) *MockLegacyClaimsFinder_Find_Call
Find is a helper method to define mock.On call
- ctx context.Context
- contentHash multihash.Multihash
- targetClaims []multicodec.Code
type MockLegacyClaimsFinder_Find_Call ¶ added in v1.2.1
MockLegacyClaimsFinder_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'
func (*MockLegacyClaimsFinder_Find_Call) Return ¶ added in v1.2.1
func (_c *MockLegacyClaimsFinder_Find_Call) Return(_a0 []model.ProviderResult, _a1 error) *MockLegacyClaimsFinder_Find_Call
func (*MockLegacyClaimsFinder_Find_Call) Run ¶ added in v1.2.1
func (_c *MockLegacyClaimsFinder_Find_Call) Run(run func(ctx context.Context, contentHash multihash.Multihash, targetClaims []multicodec.Code)) *MockLegacyClaimsFinder_Find_Call
func (*MockLegacyClaimsFinder_Find_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockLegacyClaimsFinder_Find_Call) RunAndReturn(run func(context.Context, multihash.Multihash, []multicodec.Code) ([]model.ProviderResult, error)) *MockLegacyClaimsFinder_Find_Call
type MockProviderIndex ¶ added in v1.2.1
MockProviderIndex is an autogenerated mock type for the ProviderIndex type
func NewMockProviderIndex ¶ added in v1.2.1
func NewMockProviderIndex(t interface { mock.TestingT Cleanup(func()) }) *MockProviderIndex
NewMockProviderIndex creates a new instance of MockProviderIndex. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockProviderIndex) Cache ¶ added in v1.2.1
func (_m *MockProviderIndex) Cache(ctx context.Context, provider peer.AddrInfo, contextID string, digests iter.Seq[multihash.Multihash], meta metadata.Metadata) error
Cache provides a mock function with given fields: ctx, provider, contextID, digests, meta
func (*MockProviderIndex) EXPECT ¶ added in v1.2.1
func (_m *MockProviderIndex) EXPECT() *MockProviderIndex_Expecter
func (*MockProviderIndex) Find ¶ added in v1.2.1
func (_m *MockProviderIndex) Find(_a0 context.Context, _a1 QueryKey) ([]model.ProviderResult, error)
Find provides a mock function with given fields: _a0, _a1
func (*MockProviderIndex) Publish ¶ added in v1.2.1
func (_m *MockProviderIndex) Publish(ctx context.Context, provider peer.AddrInfo, contextID string, digests iter.Seq[multihash.Multihash], meta metadata.Metadata) error
Publish provides a mock function with given fields: ctx, provider, contextID, digests, meta
type MockProviderIndex_Cache_Call ¶ added in v1.2.1
MockProviderIndex_Cache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cache'
func (*MockProviderIndex_Cache_Call) Return ¶ added in v1.2.1
func (_c *MockProviderIndex_Cache_Call) Return(_a0 error) *MockProviderIndex_Cache_Call
type MockProviderIndex_Expecter ¶ added in v1.2.1
type MockProviderIndex_Expecter struct {
// contains filtered or unexported fields
}
func (*MockProviderIndex_Expecter) Cache ¶ added in v1.2.1
func (_e *MockProviderIndex_Expecter) Cache(ctx interface{}, provider interface{}, contextID interface{}, digests interface{}, meta interface{}) *MockProviderIndex_Cache_Call
Cache is a helper method to define mock.On call
- ctx context.Context
- provider peer.AddrInfo
- contextID string
- digests iter.Seq[multihash.Multihash]
- meta metadata.Metadata
func (*MockProviderIndex_Expecter) Find ¶ added in v1.2.1
func (_e *MockProviderIndex_Expecter) Find(_a0 interface{}, _a1 interface{}) *MockProviderIndex_Find_Call
Find is a helper method to define mock.On call
- _a0 context.Context
- _a1 QueryKey
func (*MockProviderIndex_Expecter) Publish ¶ added in v1.2.1
func (_e *MockProviderIndex_Expecter) Publish(ctx interface{}, provider interface{}, contextID interface{}, digests interface{}, meta interface{}) *MockProviderIndex_Publish_Call
Publish is a helper method to define mock.On call
- ctx context.Context
- provider peer.AddrInfo
- contextID string
- digests iter.Seq[multihash.Multihash]
- meta metadata.Metadata
type MockProviderIndex_Find_Call ¶ added in v1.2.1
MockProviderIndex_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'
func (*MockProviderIndex_Find_Call) Return ¶ added in v1.2.1
func (_c *MockProviderIndex_Find_Call) Return(_a0 []model.ProviderResult, _a1 error) *MockProviderIndex_Find_Call
func (*MockProviderIndex_Find_Call) Run ¶ added in v1.2.1
func (_c *MockProviderIndex_Find_Call) Run(run func(_a0 context.Context, _a1 QueryKey)) *MockProviderIndex_Find_Call
func (*MockProviderIndex_Find_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockProviderIndex_Find_Call) RunAndReturn(run func(context.Context, QueryKey) ([]model.ProviderResult, error)) *MockProviderIndex_Find_Call
type MockProviderIndex_Publish_Call ¶ added in v1.2.1
MockProviderIndex_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
func (*MockProviderIndex_Publish_Call) Return ¶ added in v1.2.1
func (_c *MockProviderIndex_Publish_Call) Return(_a0 error) *MockProviderIndex_Publish_Call
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, targetClaims []multicodec.Code) ([]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 }