cloudimagemetadata

package
v0.0.0-...-a002913 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2015 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore interface {

	// RunTransaction runs desired transactions against this data source..
	RunTransaction(jujutxn.TransactionSource) error

	// GetCollection retrieves desired collection from this data source.
	GetCollection(name string) (collection mongo.Collection, closer func())
}

DataStore exposes data store operations for use by the cloud image metadata package.

type Metadata

type Metadata struct {
	MetadataAttributes

	// ImageId contains image identifier.
	ImageId string
}

Metadata describes a cloud image metadata.

type MetadataAttributes

type MetadataAttributes struct {
	// Stream contains reference to a particular stream,
	// for e.g. "daily" or "released"
	Stream string

	// Region is the name of cloud region associated with the image.
	Region string

	// Series is Os version, for e.g. "quantal".
	Series string

	// Arch is the architecture for this cloud image, for e.g. "amd64"
	Arch string

	// VirtType contains virtualisation type of the cloud image, for e.g. "pv", "hvm". "kvm".
	VirtType string

	// RootStorageType contains type of root storage, for e.g. "ebs", "instance".
	RootStorageType string

	// RootStorageSize contains size of root storage in gigabytes (GB).
	RootStorageSize *uint64

	// Source describes where this image is coming from: is it public? custom?
	Source SourceType
}

MetadataAttributes contains cloud image metadata attributes.

type MetadataFilter

type MetadataFilter struct {
	// Region stores metadata region.
	Region string `json:"region,omitempty"`

	// Series stores all desired series.
	Series []string `json:"series,omitempty"`

	// Arches stores all desired architectures.
	Arches []string `json:"arches,omitempty"`

	// Stream can be "" or "released" for the default "released" stream,
	// or "daily" for daily images, or any other stream that the available
	// simplestreams metadata supports.
	Stream string `json:"stream,omitempty"`

	// VirtType stores virtualisation type.
	VirtType string `json:"virt_type,omitempty"`

	// RootStorageType stores storage type.
	RootStorageType string `json:"root-storage-type,omitempty"`
}

MetadataFilter contains all metadata attributes that alow to find a particular cloud image metadata. Since size and source are not discriminating attributes for cloud image metadata, they are not included in search criteria.

type SourceType

type SourceType string

SourceType values define source type.

const (
	// Public type identifies image as public.
	Public SourceType = "public"

	// Custom type identifies image as custom.
	Custom SourceType = "custom"
)

type Storage

type Storage interface {
	// SaveMetadata adds cloud images metadata into state if it's new or
	// updates metadata if it already exists,
	SaveMetadata(Metadata) error

	// FindMetadata returns all Metadata that match specified
	// criteria or a "not found" error if none match.
	// Empty criteria will return all cloud image metadata.
	// Returned result is grouped by source type and ordered by date created.
	FindMetadata(criteria MetadataFilter) (map[SourceType][]Metadata, error)
}

Storage provides methods for storing and retrieving cloud image metadata.

func NewStorage

func NewStorage(envuuid, collectionName string, store DataStore) Storage

NewStorage constructs a new Storage that stores image metadata in the provided data store.

Jump to

Keyboard shortcuts

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