juju: github.com/wallyworld/juju/state/imagestorage Index | Files

package imagestorage

import "github.com/wallyworld/juju/state/imagestorage"


Package Files

image.go interface.go


const (

    // ImagesDB is the database used to store image blobs.
    ImagesDB = "osimages"

type ImageFilter Uses

type ImageFilter struct {
    Kind   string
    Series string
    Arch   string

ImageFilter is used to query image metadata.

type Metadata Uses

type Metadata struct {
    ModelUUID string
    Series    string
    Arch      string
    Kind      string
    Size      int64
    SHA256    string
    Created   time.Time
    SourceURL string

Metadata describes an image blob.

type Storage Uses

type Storage interface {
    // AddImage adds the image blob and metadata into state,
    // replacing existing metadata if any exists with the specified version.
    AddImage(io.Reader, *Metadata) error

    // DeleteImage deletes the image blob defined by metadata from state.
    DeleteImage(*Metadata) error

    // Image returns the Metadata and image blob contents
    // for the specified kind, series, arch if it exists, else an error
    // satisfying errors.IsNotFound.
    Image(kind, series, arch string) (*Metadata, io.ReadCloser, error)

    // ListImages returns the image metadata matching the specified filter.
    ListImages(filter ImageFilter) ([]*Metadata, error)

Storage provides methods for storing and retrieving images by kind, series, and arch.

func NewStorage Uses

func NewStorage(
    session *mgo.Session,
    modelUUID string,
) Storage

NewStorage constructs a new Storage that stores image blobs in an "osimages" database. Image metadata is also stored in this database in the "imagemetadata" collection.

Package imagestorage imports 11 packages (graph). Updated 2019-04-23. Refresh now. Tools for package owners.