image

package
v0.0.0-...-91328e5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2013 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestVersion = 2
)
View Source
const (
	ManifestsFname = "manifests.json"
)

Variables

View Source
var FileExtensions = map[string]string{
	"bzip2": "bz2",
	"gzip":  "gz",
	"none":  "raw",
}

Functions

func MatchManifest

func MatchManifest(filters []Filter, m *Manifest) bool

Types

type FileMetadata

type FileMetadata struct {
	Md5sum []byte
	Size   int64
}

type Filter

type Filter func(*Manifest) bool

func GetFilter

func GetFilter(name, value string) (Filter, bool)

func NameFilter

func NameFilter(name string) Filter

func OsFilter

func OsFilter(os string) Filter

func OwnerFilter

func OwnerFilter(owner string) Filter

func PublicFilter

func PublicFilter(str string) Filter

func StateFilter

func StateFilter(str string) Filter

func TypeFilter

func TypeFilter(t string) Filter

func VersionFilter

func VersionFilter(version string) Filter

type ImageFile

type ImageFile struct {
	Sha1        string `json:"sha1"`
	Size        int64  `json:"size"`
	Compression string `json:"compression"`
}

type Manifest

type Manifest struct {
	// Required
	V           int           `json:"v"`
	Uuid        string        `json:"uuid"`
	Owner       string        `json:"owner"`
	Name        string        `json:"name"`
	Version     string        `json:"version"`
	State       ManifestState `json:"state"`
	Disabled    bool          `json:"disabled"`
	Public      bool          `json:"public"`
	PublishedAt string        `json:"published_at"`
	Type        string        `json:"type"`
	Os          string        `json:"os"`
	Files       []*ImageFile  `json:"files"`

	// Required if type == zvol
	NicDriver  string `json:"nic_driver"`
	DiskDriver string `json:"disk_driver"`
	CpuType    string `json:"cpu_type"`
	ImageSize  int64  `json:"image_size"`

	// Optional
	Description string `json:"description"`
}

type ManifestState

type ManifestState string
const (
	StateActive      ManifestState = "active"
	StateUnactivated ManifestState = "unactivated"
	StateDisabled    ManifestState = "disabled"
)

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewImagePool

func NewImagePool(imageDir string) *Pool

func (*Pool) Activate

func (self *Pool) Activate(uuid string) (*Manifest, errors.Error)

func (*Pool) AddFile

func (self *Pool) AddFile(uuid, compression string, reader io.Reader) (*Manifest, errors.Error)

func (*Pool) Create

func (self *Pool) Create(m *Manifest) errors.Error

func (*Pool) Delete

func (self *Pool) Delete(uuid string) errors.Error

func (*Pool) Get

func (self *Pool) Get(uuid string) (*Manifest, errors.Error)

func (*Pool) GetFile

func (self *Pool) GetFile(uuid string) (io.ReadCloser, *FileMetadata, errors.Error)

func (*Pool) List

func (self *Pool) List(filters []Filter) []*Manifest

func (*Pool) SetDisabled

func (self *Pool) SetDisabled(uuid string, disabled bool) (*Manifest, errors.Error)

Jump to

Keyboard shortcuts

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