imagestorage

package
v0.0.0-...-be26699 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2015 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

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

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageFilter

type ImageFilter struct {
	Kind   string
	Series string
	Arch   string
}

ImageFilter is used to query image metadata.

type Metadata

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

Metadata describes an image blob.

type Storage

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

func NewStorage(
	session *mgo.Session,
	envUUID 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.

Jump to

Keyboard shortcuts

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