blenc

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDynamicLinkUpdateFailed           = errors.New("could not prepare dynamic link update")
	ErrDynamicLinkUpdateFailedWriterInfo = fmt.Errorf("%w: invalid writer info", ErrDynamicLinkUpdateFailed)
	ErrDynamicLinkUpdateFailedWrongKey   = fmt.Errorf("%w: encryption key mismatch", ErrDynamicLinkUpdateFailed)
	ErrDynamicLinkUpdateFailedWrongName  = fmt.Errorf("%w: blob name mismatch", ErrDynamicLinkUpdateFailed)
)
View Source
var (
	ErrCanNotUpdateStaticBlob = errors.New("blob update is not supported for static blobs")
)
View Source
var (
	ErrNotFound = datastore.ErrNotFound
)

Functions

This section is empty.

Types

type AuthInfo

type AuthInfo = []byte

AuthInfo is an opaque data that is necessary to perform update of a blob with the same name

type BE

type BE interface {

	// Open opens given blob data for reading.
	//
	// If returned error is not nil, the reader must be nil. Otherwise it is required to
	// close the reader once done working with it.
	Open(ctx context.Context, name *common.BlobName, key *common.BlobKey) (io.ReadCloser, error)

	// Create completely new blob with given dataset, as a result, the blob name and optional
	// AuthInfo that allows blob's update is returned
	Create(ctx context.Context, blobType common.BlobType, r io.Reader) (*common.BlobName, *common.BlobKey, *common.AuthInfo, error)

	// Update updates given blob type with new data,
	// The update must happen within a single blob name (i.e. it can not end up with blob with different name)
	// and may not be available for certain blob types such as static blobs.
	// A valid auth info is necessary to ensure a correct new content can be created
	Update(ctx context.Context, name *common.BlobName, ai *common.AuthInfo, key *common.BlobKey, r io.Reader) error

	// Exists does check whether blob of given name exists. It forwards the call
	// to underlying datastore.
	Exists(ctx context.Context, name *common.BlobName) (bool, error)

	// Delete tries to remove blob with given name. It forwards the call to
	// underlying datastore.
	Delete(ctx context.Context, name *common.BlobName) error
}

BE interface describes functionality exposed by Blob Encryption layer implementation

func FromDatastore

func FromDatastore(ds datastore.DS) BE

FromDatastore creates Blob Encoder using given datastore implementation as the storage layer

Jump to

Keyboard shortcuts

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