contentclaims

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0, MIT Imports: 28 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 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 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 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