context

package
v0.0.0-...-4bd6544 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2016 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const HookContextFacade = "ResourcesHookContext"

HookContextFacade is the name of the API facade for resources in the uniter.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	// GetResource returns the resource info and content for the given
	// name (and unit-implied application).
	GetResource(resourceName string) (resource.Resource, io.ReadCloser, error)
}

APIClient exposes the uniter API functionality needed for resources.

type Context

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

Content is the resources portion of a uniter hook context.

func NewContextAPI

func NewContextAPI(apiClient APIClient, dataDir string) *Context

NewContextAPI returns a new Content for the given API client and data dir.

func (*Context) Download

func (c *Context) Download(name string) (string, error)

Download downloads the named resource and returns the path to which it was downloaded. If the resource does not exist or has not been uploaded yet then errors.NotFound is returned.

Note that the downloaded file is checked for correctness.

func (*Context) Flush

func (c *Context) Flush() error

Flush implements jujuc.Context.

type FingerprintMatcher

type FingerprintMatcher struct {
	// Open opens the identified file. It defaults to os.Open.
	Open func(filename string) (io.ReadCloser, error)

	// GenerateFingerprint produces the fingerprint that corresponds
	// to the content of the provided reader. It defaults to
	// charmresource.GenerateFingerprint.
	GenerateFingerprint func(io.Reader) (charmresource.Fingerprint, error)
}

FingerprintMatcher supports verifying a file's fingerprint.

func (FingerprintMatcher) FingerprintMatches

func (fpm FingerprintMatcher) FingerprintMatches(filename string, expected charmresource.Fingerprint) (bool, error)

FingerprintMatches determines whether or not the identified file's fingerprint matches the expected fingerprint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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