Documentation
¶
Index ¶
- func NewStoreFromBucket(bucket store.Store) types.ContentClaimsStore
- func NewStoreFromDatastore(ds datastore.Datastore) types.ContentClaimsStore
- func NewUCANServer(id principal.Signer, service types.Publisher, options ...server.Option) (server.ServerView, error)
- func NewUCANService(service types.Publisher) map[ucan.Ability]server.ServiceMethod[ok.Unit]
- type ClaimService
- func (cs *ClaimService) Cache(ctx context.Context, claim delegation.Delegation) error
- func (cs *ClaimService) Find(ctx context.Context, claim ipld.Link, url *url.URL) (delegation.Delegation, error)
- func (cs *ClaimService) Get(ctx context.Context, claim ipld.Link) (delegation.Delegation, error)
- func (cs *ClaimService) Publish(ctx context.Context, claim delegation.Delegation) error
- type Failure
- type Finder
- type MockContentClaimsFinder
- type MockContentClaimsFinder_Expecter
- type MockContentClaimsFinder_Find_Call
- func (_c *MockContentClaimsFinder_Find_Call) Return(_a0 delegation.Delegation, _a1 error) *MockContentClaimsFinder_Find_Call
- func (_c *MockContentClaimsFinder_Find_Call) Run(run func(ctx context.Context, claim ipld.Link, fetchURL *url.URL)) *MockContentClaimsFinder_Find_Call
- func (_c *MockContentClaimsFinder_Find_Call) RunAndReturn(run func(context.Context, ipld.Link, *url.URL) (delegation.Delegation, error)) *MockContentClaimsFinder_Find_Call
- type MockContentClaimsService
- func (_m *MockContentClaimsService) Cache(ctx context.Context, claim delegation.Delegation) error
- func (_m *MockContentClaimsService) EXPECT() *MockContentClaimsService_Expecter
- func (_m *MockContentClaimsService) Find(ctx context.Context, claim ipld.Link, fetchURL *url.URL) (delegation.Delegation, error)
- func (_m *MockContentClaimsService) Get(ctx context.Context, claim ipld.Link) (delegation.Delegation, error)
- func (_m *MockContentClaimsService) Publish(ctx context.Context, claim delegation.Delegation) error
- type MockContentClaimsService_Cache_Call
- func (_c *MockContentClaimsService_Cache_Call) Return(_a0 error) *MockContentClaimsService_Cache_Call
- func (_c *MockContentClaimsService_Cache_Call) Run(run func(ctx context.Context, claim delegation.Delegation)) *MockContentClaimsService_Cache_Call
- func (_c *MockContentClaimsService_Cache_Call) RunAndReturn(run func(context.Context, delegation.Delegation) error) *MockContentClaimsService_Cache_Call
- type MockContentClaimsService_Expecter
- func (_e *MockContentClaimsService_Expecter) Cache(ctx interface{}, claim interface{}) *MockContentClaimsService_Cache_Call
- func (_e *MockContentClaimsService_Expecter) Find(ctx interface{}, claim interface{}, fetchURL interface{}) *MockContentClaimsService_Find_Call
- func (_e *MockContentClaimsService_Expecter) Get(ctx interface{}, claim interface{}) *MockContentClaimsService_Get_Call
- func (_e *MockContentClaimsService_Expecter) Publish(ctx interface{}, claim interface{}) *MockContentClaimsService_Publish_Call
- type MockContentClaimsService_Find_Call
- func (_c *MockContentClaimsService_Find_Call) Return(_a0 delegation.Delegation, _a1 error) *MockContentClaimsService_Find_Call
- func (_c *MockContentClaimsService_Find_Call) Run(run func(ctx context.Context, claim ipld.Link, fetchURL *url.URL)) *MockContentClaimsService_Find_Call
- func (_c *MockContentClaimsService_Find_Call) RunAndReturn(run func(context.Context, ipld.Link, *url.URL) (delegation.Delegation, error)) *MockContentClaimsService_Find_Call
- type MockContentClaimsService_Get_Call
- func (_c *MockContentClaimsService_Get_Call) Return(_a0 delegation.Delegation, _a1 error) *MockContentClaimsService_Get_Call
- func (_c *MockContentClaimsService_Get_Call) Run(run func(ctx context.Context, claim ipld.Link)) *MockContentClaimsService_Get_Call
- func (_c *MockContentClaimsService_Get_Call) RunAndReturn(run func(context.Context, ipld.Link) (delegation.Delegation, error)) *MockContentClaimsService_Get_Call
- type MockContentClaimsService_Publish_Call
- func (_c *MockContentClaimsService_Publish_Call) Return(_a0 error) *MockContentClaimsService_Publish_Call
- func (_c *MockContentClaimsService_Publish_Call) Run(run func(ctx context.Context, claim delegation.Delegation)) *MockContentClaimsService_Publish_Call
- func (_c *MockContentClaimsService_Publish_Call) RunAndReturn(run func(context.Context, delegation.Delegation) error) *MockContentClaimsService_Publish_Call
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStoreFromBucket ¶ added in v1.0.0
func NewStoreFromBucket(bucket store.Store) types.ContentClaimsStore
NewStoreFromBucket creates a claims store from a bucket style interface.
func NewStoreFromDatastore ¶ added in v1.0.0
func NewStoreFromDatastore(ds datastore.Datastore) types.ContentClaimsStore
func NewUCANServer ¶ added in v1.0.0
func NewUCANService ¶ added in v1.0.0
Types ¶
type ClaimService ¶ added in v1.0.0
type ClaimService struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.0.0
func New(store types.ContentClaimsStore, cache types.ContentClaimsCache, finder Finder) *ClaimService
func (*ClaimService) Cache ¶ added in v1.0.0
func (cs *ClaimService) Cache(ctx context.Context, claim delegation.Delegation) error
func (*ClaimService) Find ¶ added in v1.0.0
func (cs *ClaimService) Find(ctx context.Context, claim ipld.Link, url *url.URL) (delegation.Delegation, error)
func (*ClaimService) Get ¶ added in v1.0.0
func (cs *ClaimService) Get(ctx context.Context, claim ipld.Link) (delegation.Delegation, error)
func (*ClaimService) Publish ¶ added in v1.0.0
func (cs *ClaimService) Publish(ctx context.Context, claim delegation.Delegation) error
type Failure ¶ added in v1.0.0
func NewMissingClaimError ¶ added in v1.0.0
func NewMissingClaimError() Failure
type Finder ¶ added in v1.0.0
type Finder interface { // Find and retrieve a claim via URL. Find(ctx context.Context, claim ipld.Link, fetchURL *url.URL) (delegation.Delegation, error) }
func NewNotFoundFinder ¶ added in v1.1.0
func NewNotFoundFinder() Finder
NewNotFoundFinder returns a finder that always errors
func NewSimpleFinder ¶ added in v1.0.0
NewSimpleFinder creates a new Finder with the provided HTTP client.
func WithCache ¶ added in v1.0.0
func WithCache(finder Finder, cache types.ContentClaimsCache) Finder
WithCache augments a ClaimFinder with cached claims from a claim cache
func WithIdentityCids ¶ added in v1.1.0
WithIdentityCids augments a ClaimFinder with claims retrieved automatically whenever an identity CID is used
type MockContentClaimsFinder ¶ added in v1.2.1
MockContentClaimsFinder is an autogenerated mock type for the Finder type
func NewMockContentClaimsFinder ¶ added in v1.2.1
func NewMockContentClaimsFinder(t interface { mock.TestingT Cleanup(func()) }) *MockContentClaimsFinder
NewMockContentClaimsFinder creates a new instance of MockContentClaimsFinder. 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 (*MockContentClaimsFinder) EXPECT ¶ added in v1.2.1
func (_m *MockContentClaimsFinder) EXPECT() *MockContentClaimsFinder_Expecter
func (*MockContentClaimsFinder) Find ¶ added in v1.2.1
func (_m *MockContentClaimsFinder) Find(ctx context.Context, claim ipld.Link, fetchURL *url.URL) (delegation.Delegation, error)
Find provides a mock function with given fields: ctx, claim, fetchURL
type MockContentClaimsFinder_Expecter ¶ added in v1.2.1
type MockContentClaimsFinder_Expecter struct {
// contains filtered or unexported fields
}
func (*MockContentClaimsFinder_Expecter) Find ¶ added in v1.2.1
func (_e *MockContentClaimsFinder_Expecter) Find(ctx interface{}, claim interface{}, fetchURL interface{}) *MockContentClaimsFinder_Find_Call
Find is a helper method to define mock.On call
- ctx context.Context
- claim ipld.Link
- fetchURL *url.URL
type MockContentClaimsFinder_Find_Call ¶ added in v1.2.1
MockContentClaimsFinder_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'
func (*MockContentClaimsFinder_Find_Call) Return ¶ added in v1.2.1
func (_c *MockContentClaimsFinder_Find_Call) Return(_a0 delegation.Delegation, _a1 error) *MockContentClaimsFinder_Find_Call
func (*MockContentClaimsFinder_Find_Call) Run ¶ added in v1.2.1
func (_c *MockContentClaimsFinder_Find_Call) Run(run func(ctx context.Context, claim ipld.Link, fetchURL *url.URL)) *MockContentClaimsFinder_Find_Call
func (*MockContentClaimsFinder_Find_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockContentClaimsFinder_Find_Call) RunAndReturn(run func(context.Context, ipld.Link, *url.URL) (delegation.Delegation, error)) *MockContentClaimsFinder_Find_Call
type MockContentClaimsService ¶ added in v1.2.1
MockContentClaimsService is an autogenerated mock type for the Service type
func NewMockContentClaimsService ¶ added in v1.2.1
func NewMockContentClaimsService(t interface { mock.TestingT Cleanup(func()) }) *MockContentClaimsService
NewMockContentClaimsService creates a new instance of MockContentClaimsService. 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 (*MockContentClaimsService) Cache ¶ added in v1.2.1
func (_m *MockContentClaimsService) Cache(ctx context.Context, claim delegation.Delegation) error
Cache provides a mock function with given fields: ctx, claim
func (*MockContentClaimsService) EXPECT ¶ added in v1.2.1
func (_m *MockContentClaimsService) EXPECT() *MockContentClaimsService_Expecter
func (*MockContentClaimsService) Find ¶ added in v1.2.1
func (_m *MockContentClaimsService) Find(ctx context.Context, claim ipld.Link, fetchURL *url.URL) (delegation.Delegation, error)
Find provides a mock function with given fields: ctx, claim, fetchURL
func (*MockContentClaimsService) Get ¶ added in v1.2.1
func (_m *MockContentClaimsService) Get(ctx context.Context, claim ipld.Link) (delegation.Delegation, error)
Get provides a mock function with given fields: ctx, claim
func (*MockContentClaimsService) Publish ¶ added in v1.2.1
func (_m *MockContentClaimsService) Publish(ctx context.Context, claim delegation.Delegation) error
Publish provides a mock function with given fields: ctx, claim
type MockContentClaimsService_Cache_Call ¶ added in v1.2.1
MockContentClaimsService_Cache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cache'
func (*MockContentClaimsService_Cache_Call) Return ¶ added in v1.2.1
func (_c *MockContentClaimsService_Cache_Call) Return(_a0 error) *MockContentClaimsService_Cache_Call
func (*MockContentClaimsService_Cache_Call) Run ¶ added in v1.2.1
func (_c *MockContentClaimsService_Cache_Call) Run(run func(ctx context.Context, claim delegation.Delegation)) *MockContentClaimsService_Cache_Call
func (*MockContentClaimsService_Cache_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockContentClaimsService_Cache_Call) RunAndReturn(run func(context.Context, delegation.Delegation) error) *MockContentClaimsService_Cache_Call
type MockContentClaimsService_Expecter ¶ added in v1.2.1
type MockContentClaimsService_Expecter struct {
// contains filtered or unexported fields
}
func (*MockContentClaimsService_Expecter) Cache ¶ added in v1.2.1
func (_e *MockContentClaimsService_Expecter) Cache(ctx interface{}, claim interface{}) *MockContentClaimsService_Cache_Call
Cache is a helper method to define mock.On call
- ctx context.Context
- claim delegation.Delegation
func (*MockContentClaimsService_Expecter) Find ¶ added in v1.2.1
func (_e *MockContentClaimsService_Expecter) Find(ctx interface{}, claim interface{}, fetchURL interface{}) *MockContentClaimsService_Find_Call
Find is a helper method to define mock.On call
- ctx context.Context
- claim ipld.Link
- fetchURL *url.URL
func (*MockContentClaimsService_Expecter) Get ¶ added in v1.2.1
func (_e *MockContentClaimsService_Expecter) Get(ctx interface{}, claim interface{}) *MockContentClaimsService_Get_Call
Get is a helper method to define mock.On call
- ctx context.Context
- claim ipld.Link
func (*MockContentClaimsService_Expecter) Publish ¶ added in v1.2.1
func (_e *MockContentClaimsService_Expecter) Publish(ctx interface{}, claim interface{}) *MockContentClaimsService_Publish_Call
Publish is a helper method to define mock.On call
- ctx context.Context
- claim delegation.Delegation
type MockContentClaimsService_Find_Call ¶ added in v1.2.1
MockContentClaimsService_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find'
func (*MockContentClaimsService_Find_Call) Return ¶ added in v1.2.1
func (_c *MockContentClaimsService_Find_Call) Return(_a0 delegation.Delegation, _a1 error) *MockContentClaimsService_Find_Call
func (*MockContentClaimsService_Find_Call) Run ¶ added in v1.2.1
func (_c *MockContentClaimsService_Find_Call) Run(run func(ctx context.Context, claim ipld.Link, fetchURL *url.URL)) *MockContentClaimsService_Find_Call
func (*MockContentClaimsService_Find_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockContentClaimsService_Find_Call) RunAndReturn(run func(context.Context, ipld.Link, *url.URL) (delegation.Delegation, error)) *MockContentClaimsService_Find_Call
type MockContentClaimsService_Get_Call ¶ added in v1.2.1
MockContentClaimsService_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
func (*MockContentClaimsService_Get_Call) Return ¶ added in v1.2.1
func (_c *MockContentClaimsService_Get_Call) Return(_a0 delegation.Delegation, _a1 error) *MockContentClaimsService_Get_Call
func (*MockContentClaimsService_Get_Call) Run ¶ added in v1.2.1
func (_c *MockContentClaimsService_Get_Call) Run(run func(ctx context.Context, claim ipld.Link)) *MockContentClaimsService_Get_Call
func (*MockContentClaimsService_Get_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockContentClaimsService_Get_Call) RunAndReturn(run func(context.Context, ipld.Link) (delegation.Delegation, error)) *MockContentClaimsService_Get_Call
type MockContentClaimsService_Publish_Call ¶ added in v1.2.1
MockContentClaimsService_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
func (*MockContentClaimsService_Publish_Call) Return ¶ added in v1.2.1
func (_c *MockContentClaimsService_Publish_Call) Return(_a0 error) *MockContentClaimsService_Publish_Call
func (*MockContentClaimsService_Publish_Call) Run ¶ added in v1.2.1
func (_c *MockContentClaimsService_Publish_Call) Run(run func(ctx context.Context, claim delegation.Delegation)) *MockContentClaimsService_Publish_Call
func (*MockContentClaimsService_Publish_Call) RunAndReturn ¶ added in v1.2.1
func (_c *MockContentClaimsService_Publish_Call) RunAndReturn(run func(context.Context, delegation.Delegation) error) *MockContentClaimsService_Publish_Call
type Service ¶ added in v1.0.0
type Service interface { // Get reads the claim from the cache, or from storage if not found. Get(ctx context.Context, claim ipld.Link) (delegation.Delegation, error) // Find attempts to read the claim from the cache, falling back to retrieving // it from storage and finally, if still not found, fetching it from the // provided URL. The result is stored in the cache. Find(ctx context.Context, claim ipld.Link, fetchURL *url.URL) (delegation.Delegation, error) // Cache writes the claim to the cache with default expiry. Cache(ctx context.Context, claim delegation.Delegation) error // Publish writes the claim to the cache, and adds it to storage. Publish(ctx context.Context, claim delegation.Delegation) error }