machineundertaker

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that runs a machine undertaker.

func NewWorker

func NewWorker(api Facade, env environs.Environ) (worker.Worker, error)

NewWorker returns a machine undertaker worker that will watch for machines that need to be removed and remove them, cleaning up any necessary provider-level resources first.

Types

type AddressReleaser

type AddressReleaser interface {
	ReleaseContainerAddresses([]network.ProviderInterfaceInfo) error
}

AddressReleaser defines the interface we need from the environment networking.

type Facade

type Facade interface {
	WatchMachineRemovals() (watcher.NotifyWatcher, error)
	AllMachineRemovals() ([]names.MachineTag, error)
	GetProviderInterfaceInfo(names.MachineTag) ([]network.ProviderInterfaceInfo, error)
	CompleteRemoval(names.MachineTag) error
}

Facade defines the interface we require from the machine undertaker facade.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string
	EnvironName   string

	NewWorker func(Facade, environs.Environ) (worker.Worker, error)
}

ManifoldConfig defines the machine undertaker's configuration and dependencies.

type Undertaker

type Undertaker struct {
	API      Facade
	Releaser AddressReleaser
}

MachineUndertaker is responsible for doing any provider-level cleanup needed and then removing the machine.

func (*Undertaker) Handle

func (u *Undertaker) Handle(<-chan struct{}) error

Handle (part of watcher.NotifyHandler) cleans up provider resources and removes machines that have been marked for removal.

func (*Undertaker) MaybeReleaseAddresses

func (u *Undertaker) MaybeReleaseAddresses(machine names.MachineTag) error

MaybeReleaseAddresses releases any addresses that have been allocated to this machine by the provider (if the provider supports that).

func (*Undertaker) SetUp

func (u *Undertaker) SetUp() (watcher.NotifyWatcher, error)

Setup (part of watcher.NotifyHandler) starts watching for machine removals.

func (*Undertaker) TearDown

func (u *Undertaker) TearDown() error

Teardown (part of watcher.NotifyHandler) is an opportunity to stop or release any resources created in SetUp other than the watcher, which watcher.NotifyWorker takes care of for us.

Jump to

Keyboard shortcuts

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