Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ManagedStorage ¶
type ManagedStorage interface {
// Get returns a reader for data at path, namespaced to the bucket.
// If the data is still being uploaded and is not fully written yet,
// an ErrUploadPending error is returned. This means the path is valid but
// the caller should try again to retrieve the data.
Get(ctx context.Context, path string) (r io.ReadCloser, length int64, err error)
// Put stores data from reader at path, namespaced to the bucket.
Put(ctx context.Context, path string, r io.Reader, length int64) (objectstore.UUID, error)
// Remove deletes data at path, namespaced to the bucket.
Remove(ctx context.Context, path string) error
}
ManagedStorage instances persist data for a bucket, for a user, or globally. (Only bucket storage is currently implemented).
type Storage ¶
type Storage interface {
// Add adds the binary file and metadata into state, replacing existing
// metadata if any exists with the specified version.
Add(context.Context, io.Reader, Metadata) error
// Open returns the Metadata and binary file contents for the specified
// version if it exists, else an error satisfying errors.IsNotFound.
Open(ctx context.Context, version string) (Metadata, io.ReadCloser, error)
// AllMetadata returns metadata for the full list of binary files in the
// catalogue.
AllMetadata() ([]Metadata, error)
// Metadata returns the Metadata for the specified version if it exists,
// else an error satisfying errors.IsNotFound.
Metadata(version string) (Metadata, error)
}
Storage provides methods for storing and retrieving binary files by version.
func New ¶
func New( managedStorage ManagedStorage, metadataCollection mongo.Collection, runner jujutxn.Runner, ) Storage
New constructs a new Storage that stores binary files in the provided ManagedStorage, and metadata in the provided collection using the provided transaction runner.
type StorageCloser ¶
StorageCloser extends the Storage interface with a Close method.
Click to show internal directories.
Click to hide internal directories.