Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotExist is an error value which may be tested against to determine // whether a method invocation from a Store instance failed due to being // called on an object which did not exist. ErrNotExist = fs.ErrNotExist // ErrReadOnly is an error returned when attempting to create an object in // a read-only store. ErrReadOnly = errors.New("read only object store") )
Functions ¶
func AppendTags ¶
Types ¶
type Filter ¶
Filter represents a predicate applicated to objects to determine whether they are part of the result of a ListObject operation.
type Store ¶
type Store interface {
// Creates an object with the given name, initializing its content to the
// data read from the given io.Reader.
//
// The creation of objects is atomic, the store must be left unchanged if
// an error occurs that would cause the object to be only partially created.
CreateObject(ctx context.Context, name string, data io.Reader, tags ...Tag) error
// Reads an existing object from the store, returning a reader exposing its
// content.
ReadObject(ctx context.Context, name string) (io.ReadSeekCloser, error)
// Retrieves information about an object in the store.
StatObject(ctx context.Context, name string) (Info, error)
// Lists existing objects.
//
// Objects that are being created by a call to CreateObject are not visible
// until the creation completed.
ListObjects(ctx context.Context, prefix string, filters ...Filter) stream.ReadCloser[Info]
// Deletes and object from the store.
//
// The deletion is idempotent, deleting an object which does not exist does
// not cause the method to return an error.
DeleteObject(ctx context.Context, name string) error
}
Store is an interface abstracting an object storage layer.
Once created, objects are immutable, the store does not need to offer a mechanism for updating the object content or metadata.
Store instances must be safe to use concurrently from multiple goroutines.
func DirStore ¶
DirStore constructs an object store from a directory entry at the given path.
The function converts the directory location to an absolute path to decouple the store from a change of the current working directory.
The directory is not created if it does not exist.
func EmptyStore ¶
func EmptyStore() Store
EmptyStore returns a Store instance representing an empty, read-only object store.