discoverspaces

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker returns a worker that will attempt to discover the configured Environ's spaces, and update the controller via the configured Facade. Names are sanitised with NewName, and any supplied Unlocker will be Unlock()ed when the first complete discovery and update succeeds.

Once that update completes, the worker just waits to be Kill()ed. We should probably poll for changes, really, but I'm making an effort to preserve existing behaviour where possible.

Types

type Config

type Config struct {

	// Facade exposes the capabilities of a controller.
	Facade Facade

	// Environ exposes the capabilities of a compute substrate.
	Environ environs.Environ

	// NewName is used to sanitise, and make unique, space names as
	// reported by an Environ (for use in juju, via the Facade). You
	// should probably set it to ConvertSpaceName.
	NewName NameFunc

	// Unlocker, if not nil, will be unlocked when the first discovery
	// attempt completes successfully.
	Unlocker gate.Unlocker
}

Config defines the operation of a space discovery worker.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if the config cannot be expected to drive a functional worker.

type Facade

Facade exposes the relevant capabilities of a *discoverspaces.API; it's a bit raw but at least it's easily mockable.

func NewFacade

func NewFacade(apiCaller base.APICaller) (Facade, error)

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string
	EnvironName   string
	UnlockerName  string

	NewFacade func(base.APICaller) (Facade, error)
	NewWorker func(Config) (worker.Worker, error)
}

type NameFunc

type NameFunc func(base string, used set.Strings) string

NameFunc returns a string derived from base that is not contained in used.

Jump to

Keyboard shortcuts

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