juju: github.com/juju/juju/state/binarystorage Index | Files

package binarystorage

import "github.com/juju/juju/state/binarystorage"

Index

Package Files

binarystorage.go interface.go layered.go

type Metadata Uses

type Metadata struct {
    Version string
    Size    int64
    SHA256  string
}

Metadata describes a binary file stored in the storage.

type Storage Uses

type Storage interface {
    // Add adds the binary file and metadata into state, replacing existing
    // metadata if any exists with the specified version.
    Add(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(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 Uses

func New(
    modelUUID string,
    managedStorage blobstore.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.

func NewLayeredStorage Uses

func NewLayeredStorage(s ...Storage) (Storage, error)

NewLayeredStorage wraps multiple Storages such all of their metadata can be listed and fetched. The later entries in the list have lower precedence than the earlier ones. The first entry in the list is always used for mutating operations.

type StorageCloser Uses

type StorageCloser interface {
    Storage
    Close() error
}

StorageCloser extends the Storage interface with a Close method.

Package binarystorage imports 11 packages (graph) and is imported by 122 packages. Updated 2019-08-22. Refresh now. Tools for package owners.