imagedownloads

package
v0.0.0-...-a0d7459 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package imagedownloads implements image-downloads metadata from simplestreams.

Index

Constants

View Source
const (
	// DataType is the simplestreams datatype.
	DataType = "image-downloads"
)

Variables

This section is empty.

Functions

func DefaultSource

func DefaultSource() simplestreams.DataSource

DefaultSource creates a new signed simplestreams datasource for use with the image-downloads datatype.

func Filter

Filter collects only matching products. Series and Arch are filtered by imagemetadata.ImageConstraints. So this really only let's us filter on a file type.

func NewDataSource

func NewDataSource(baseURL string) simplestreams.DataSource

NewDataSource returns a new simplestreams.DataSource from the provided baseURL. baseURL MUST include the image stream.

func Sort

func Sort(metadata []*Metadata)

Sort sorts a slice of ImageMetadata in ascending order of their id in order to ensure the results of Fetch are ordered deterministically.

Types

type Metadata

type Metadata struct {
	Arch string `json:"arch,omitempty"`
	// For testing.
	// TODO(ro) 2016-12-07 BaseURL was jammed on to allow for testing in
	// juju/container/kvm/sync_internal_test. Refactor to pass it in rather
	// than setting it on an otherwise unecessecarily exported member.
	BaseURL string `json:"-"`
	Release string `json:"release,omitempty"`
	Version string `json:"version,omitempty"`
	FType   string `json:"ftype,omitempty"`
	SHA256  string `json:"sha256,omitempty"`
	Path    string `json:"path,omitempty"`
	Size    int64  `json:"size,omitempty"`
}

Metadata models the inforamtion about a particular cloud image download product.

func Fetch

Fetch gets product results as Metadata from the provided datasources, given some constraints and an optional filter function.

func One

func One(arch, release, ftype string, src func() simplestreams.DataSource) (*Metadata, error)

One gets Metadata for one content download item -- the most recent of 'series', for architecture, 'arch', of the format 'ftype'. 'src' exists to pass in a data source for testing.

func (*Metadata) DownloadURL

func (m *Metadata) DownloadURL() (*url.URL, error)

DownloadURL returns the URL representing the image.

Jump to

Keyboard shortcuts

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