undertaker

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

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

Go to latest
Published: Nov 26, 2024 License: AGPL-3.0 Imports: 20 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 worker responsible for shepherding a Dying model into Dead and ultimate removal.

func NewWorker

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

NewWorker creates a worker.Worker from a Config, by calling the local constructor that returns a more specific type.

Types

type Config

type Config struct {
	Facade                Facade
	CredentialAPI         common.CredentialAPI
	Logger                Logger
	Clock                 clock.Clock
	NewCloudDestroyerFunc func(context.Context, environs.OpenParams) (environs.CloudDestroyer, error)
}

Config holds the resources and configuration necessary to run an undertaker worker.

func (Config) Validate

func (config Config) Validate() error

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

type Facade

type Facade interface {
	environs.EnvironConfigGetter
	ModelInfo() (params.UndertakerModelInfoResult, error)
	WatchModelResources() (watcher.NotifyWatcher, error)
	WatchModel() (watcher.NotifyWatcher, error)
	ProcessDyingModel() error
	RemoveModel() error
	SetStatus(status status.Status, message string, data map[string]interface{}) error
}

Facade covers the parts of the api/undertaker.UndertakerClient that we need for the worker. It's more than a little raw, but we'll survive.

func NewFacade

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

NewFacade creates a Facade from a base.APICaller, by calling the constructor in api/undertaker that returns a more specific type.

type Logger

type Logger interface {
	Errorf(string, ...interface{})
	Infof(string, ...interface{})
	Debugf(string, ...interface{})
	Tracef(string, ...interface{})
	Warningf(string, ...interface{})
}

Logger defines a way to report non-fatal errors.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string

	Logger                       Logger
	Clock                        clock.Clock
	NewFacade                    func(base.APICaller) (Facade, error)
	NewWorker                    func(Config) (worker.Worker, error)
	NewCredentialValidatorFacade func(base.APICaller) (common.CredentialAPI, error)
	NewCloudDestroyerFunc        func(context.Context, environs.OpenParams) (environs.CloudDestroyer, error)
}

ManifoldConfig holds the names of the resources used by, and the additional dependencies of, an undertaker worker.

type Undertaker

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

func NewUndertaker

func NewUndertaker(config Config) (*Undertaker, error)

NewUndertaker returns a worker which processes a dying model.

func (*Undertaker) Kill

func (u *Undertaker) Kill()

Kill is part of the worker.Worker interface.

func (*Undertaker) Wait

func (u *Undertaker) Wait() error

Wait is part of the worker.Worker interface.

Jump to

Keyboard shortcuts

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