store

package
v0.0.0-...-efc9231 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fingerprint

type Fingerprint struct {
	hash.Fingerprint
}

Fingerprint represents the unique fingerprint value of a resource's data.

func NewFingerprint

func NewFingerprint(f hash.Fingerprint) Fingerprint

NewFingerprint returns a resource store Fingerprint for the given hash Fingerprint.

type ID

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

ID is the ID of the stored blob in the database, this can be used for adding referential integrity from the resource to the stored blob. This can be an object store metadata UUID or a container image metadata storage key. It is only one, never both.

func NewContainerImageMetadataResourceID

func NewContainerImageMetadataResourceID(id string) (ID, error)

NewContainerImageMetadataResourceID creates a new storage ID for a container image metadata resource.

func NewFileResourceID

func NewFileResourceID(uuid objectstore.UUID) (ID, error)

NewFileResourceID creates a new storage ID for a file resource.

func (ID) ContainerImageMetadataStoreID

func (id ID) ContainerImageMetadataStoreID() (string, error)

ContainerImageMetadataStoreID returns the container image metadata store ID or an error if it is not set.

func (ID) IsContainerImageMetadataID

func (id ID) IsContainerImageMetadataID() bool

IsContainerImageMetadataID returns true if the type contains a container image metadata store ID.

func (ID) IsObjectStoreUUID

func (id ID) IsObjectStoreUUID() bool

IsObjectStoreUUID returns true if the type contains an object store UUID.

func (ID) IsZero

func (id ID) IsZero() bool

IsZero is true if ID has not been set.

func (ID) ObjectStoreUUID

func (id ID) ObjectStoreUUID() (objectstore.UUID, error)

ObjectStoreUUID returns the object store UUID or an error if it is not set.

type ResourceStore

type ResourceStore interface {
	// Get returns an io.ReadCloser for a resource in the resource store.
	Get(
		ctx context.Context,
		storageKey string,
	) (r io.ReadCloser, size int64, err error)

	// Put stores data from io.Reader in the resource store using the storage
	// key.
	Put(
		ctx context.Context,
		storageKey string,
		r io.Reader,
		size int64,
		fingerprint Fingerprint,
	) (ID, error)

	// Remove removes a resource from storage.
	Remove(
		ctx context.Context,
		storageKey string,
	) error
}

ResourceStore provides a list of methods necessary for interacting with a store for the resource.

type ResourceStoreGetter

type ResourceStoreGetter func() ResourceStore

ResourceStoreGetter is a function which returns a ResourceStore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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