contentclaims

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: Apache-2.0, MIT Imports: 31 Imported by: 0

Documentation

Index

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 NewUCANServer(id principal.Signer, service types.Publisher, options ...server.Option) (server.ServerView, error)

func NewUCANService added in v1.0.0

func NewUCANService(service types.Publisher) map[ucan.Ability]server.ServiceMethod[ok.Unit]

Types

type ClaimService added in v1.0.0

type ClaimService struct {
	// contains filtered or unexported fields
}

func New added in v1.0.0

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

type Failure struct {
	Name    string
	Message string
}

func NewMissingClaimError added in v1.0.0

func NewMissingClaimError() Failure

func (Failure) Error added in v1.0.0

func (f Failure) Error() string

func (Failure) ToIPLD added in v1.0.0

func (f Failure) ToIPLD() (datamodel.Node, error)

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

func NewSimpleFinder(httpClient *http.Client) Finder

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

func WithIdentityCids(finder Finder) Finder

WithIdentityCids augments a ClaimFinder with claims retrieved automatically whenever an identity CID is used

func WithStore added in v1.0.0

func WithStore(finder Finder, store types.ContentClaimsStore) Finder

WithStore augments a ClaimFinder with claims retrieved from a claim store

type MockContentClaimsFinder added in v1.2.1

type MockContentClaimsFinder struct {
	mock.Mock
}

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 (*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

type MockContentClaimsFinder_Find_Call struct {
	*mock.Call
}

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 (*MockContentClaimsFinder_Find_Call) Run added in v1.2.1

func (*MockContentClaimsFinder_Find_Call) RunAndReturn added in v1.2.1

type MockContentClaimsService added in v1.2.1

type MockContentClaimsService struct {
	mock.Mock
}

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

Cache provides a mock function with given fields: ctx, claim

func (*MockContentClaimsService) EXPECT added in v1.2.1

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

Get provides a mock function with given fields: ctx, claim

func (*MockContentClaimsService) Publish added in v1.2.1

Publish provides a mock function with given fields: ctx, claim

type MockContentClaimsService_Cache_Call added in v1.2.1

type MockContentClaimsService_Cache_Call struct {
	*mock.Call
}

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 (*MockContentClaimsService_Cache_Call) Run added in v1.2.1

func (*MockContentClaimsService_Cache_Call) RunAndReturn added in v1.2.1

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

type MockContentClaimsService_Find_Call struct {
	*mock.Call
}

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 (*MockContentClaimsService_Find_Call) Run added in v1.2.1

func (*MockContentClaimsService_Find_Call) RunAndReturn added in v1.2.1

type MockContentClaimsService_Get_Call added in v1.2.1

type MockContentClaimsService_Get_Call struct {
	*mock.Call
}

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 (*MockContentClaimsService_Get_Call) Run added in v1.2.1

func (*MockContentClaimsService_Get_Call) RunAndReturn added in v1.2.1

type MockContentClaimsService_Publish_Call added in v1.2.1

type MockContentClaimsService_Publish_Call struct {
	*mock.Call
}

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 (*MockContentClaimsService_Publish_Call) Run added in v1.2.1

func (*MockContentClaimsService_Publish_Call) RunAndReturn added in v1.2.1

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
}

Jump to

Keyboard shortcuts

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