Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fingerprint ¶
type Fingerprint struct {
hash.Fingerprint
}
Fingerprint represents the unique fingerprint value of a resource's data.
func GenerateFingerprint ¶
func GenerateFingerprint(reader io.Reader) (Fingerprint, error)
GenerateFingerprint returns the fingerprint for the provided data.
func NewFingerprint ¶
func NewFingerprint(raw []byte) (Fingerprint, error)
NewFingerprint returns wraps the provided raw fingerprint bytes. This function roundtrips with Fingerprint.Bytes().
func ParseFingerprint ¶
func ParseFingerprint(raw string) (Fingerprint, error)
ParseFingerprint returns wraps the provided raw fingerprint string. This function roundtrips with Fingerprint.String().
type FingerprintHash ¶
Fingerprint is a hash that may be used to generate fingerprints.
func NewFingerprintHash ¶
func NewFingerprintHash() *FingerprintHash
NewFingerprintHash returns a hash that may be used to create fingerprints.
func (FingerprintHash) Fingerprint ¶
func (fph FingerprintHash) Fingerprint() Fingerprint
Fingerprint returns the current fingerprint of the hash.
type Meta ¶
type Meta struct {
// Name identifies the resource.
Name string
// Type identifies the type of resource (e.g. "file").
Type Type
// Path is the relative path of the file or directory where the
// resource will be stored under the unit's data directory. The path
// is resolved against a subdirectory assigned to the resource. For
// example, given an application named "spam", a resource "eggs", and a
// path "eggs.tgz", the fully resolved storage path for the resource
// would be:
// /var/lib/juju/agent/spam-0/resources/eggs/eggs.tgz
Path string
// Description holds optional user-facing info for the resource.
Description string
}
Meta holds the information about a resource, as stored in a charm's metadata.
type Origin ¶
type Origin int
Origin identifies where a charm's resource comes from.
const ( OriginUpload Origin OriginStore )
These are the valid resource origins.
func ParseOrigin ¶
ParseOrigin converts the provided string into an Origin. If it is not a known origin then an error is returned.
type Resource ¶
type Resource struct {
Meta
// Origin identifies where the resource will come from.
Origin Origin
// Revision is the charm store revision of the resource.
Revision int
// Fingerprint is the SHA-384 checksum for the resource blob.
Fingerprint Fingerprint
// Size is the size of the resource, in bytes.
Size int64
}
Resource describes a charm's resource in the charm store.
type Type ¶
type Type int
Type enumerates the recognized resource types.
const ( TypeFile Type TypeContainerImage )
These are the valid resource types (except for unknown).
func ParseType ¶
ParseType converts a string to a Type. If the given value does not match a recognized type then an error is returned.