service

package
v0.0.0-...-1f8c1e5 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: AGPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service provides the API for working with the objectstore.

func NewService

func NewService(st State) *Service

NewService returns a new service reference wrapping the input state.

func (*Service) GetMetadata

func (s *Service) GetMetadata(ctx context.Context, path string) (objectstore.Metadata, error)

GetMetadata returns the persistence metadata for the specified path.

func (*Service) GetMetadataBySHA256

func (s *Service) GetMetadataBySHA256(ctx context.Context, sha256 string) (objectstore.Metadata, error)

GetMetadataBySHA256 returns the persistence metadata for the object with SHA256 starting with the provided prefix.

func (*Service) GetMetadataBySHA256Prefix

func (s *Service) GetMetadataBySHA256Prefix(ctx context.Context, sha256Prefix string) (objectstore.Metadata, error)

GetMetadataBySHA256Prefix returns the persistence metadata for the object with SHA256 starting with the provided prefix.

func (*Service) ListMetadata

func (s *Service) ListMetadata(ctx context.Context) ([]objectstore.Metadata, error)

ListMetadata returns the persistence metadata for all paths.

func (*Service) PutMetadata

func (s *Service) PutMetadata(ctx context.Context, metadata objectstore.Metadata) (objectstore.UUID, error)

PutMetadata adds a new specified path for the persistence metadata. If any hash is missing, a objectstoreerrors.ErrMissingHash error is returned. It is expected that the caller supplies both hashes or none and they should be consistent with the object. That's the caller's responsibility.

func (*Service) RemoveMetadata

func (s *Service) RemoveMetadata(ctx context.Context, path string) error

RemoveMetadata removes the specified path for the persistence metadata.

type State

type State interface {
	// GetMetadata returns the persistence metadata for the specified path.
	GetMetadata(ctx context.Context, path string) (objectstore.Metadata, error)

	// GetMetadataBySHA256 returns the persistence metadata for the object
	// with SHA256.
	GetMetadataBySHA256(ctx context.Context, sha256 string) (objectstore.Metadata, error)

	// GetMetadataBySHA256Prefix returns the persistence metadata for the object
	// with SHA256 starting with the provided prefix.
	GetMetadataBySHA256Prefix(ctx context.Context, sha256 string) (objectstore.Metadata, error)

	// PutMetadata adds a new specified path for the persistence metadata.
	PutMetadata(ctx context.Context, metadata objectstore.Metadata) (objectstore.UUID, error)

	// ListMetadata returns the persistence metadata for all paths.
	ListMetadata(ctx context.Context) ([]objectstore.Metadata, error)

	// RemoveMetadata removes the specified path for the persistence metadata.
	RemoveMetadata(ctx context.Context, path string) error

	// InitialWatchStatement returns the table and the initial watch statement
	// for the persistence metadata.
	InitialWatchStatement() (string, string)
}

State describes retrieval and persistence methods for the objectstore.

type WatchableService

type WatchableService struct {
	Service
	// contains filtered or unexported fields
}

WatchableService provides the API for working with the objectstore and the ability to create watchers.

func NewWatchableService

func NewWatchableService(st State, watcherFactory WatcherFactory) *WatchableService

NewWatchableService returns a new service reference wrapping the input state.

func (*WatchableService) Watch

Watch returns a watcher that emits the path changes that either have been added or removed.

type WatcherFactory

type WatcherFactory interface {
	// NewNamespaceWatcher returns a new namespace watcher
	// for events based on the input change mask.
	NewNamespaceWatcher(string, changestream.ChangeType, eventsource.NamespaceQuery) (watcher.StringsWatcher, error)
}

WatcherFactory describes methods for creating watchers.

Jump to

Keyboard shortcuts

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