Version: v0.0.0-...-4f11ef6 Latest Latest

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

Go to latest
Published: Sep 24, 2021 License: AGPL-3.0 Imports: 8 Imported by: 2




This section is empty.


View Source
var ErrModelCredentialChanged = errors.New("model cloud credential has changed")

ErrModelCredentialChanged indicates that a Worker has bounced because its model's cloud credential has changed.

View Source
var ErrValidityChanged = errors.New("cloud credential validity has changed")

ErrValidityChanged indicates that a Worker has bounced because its credential validity has changed: either a valid credential became invalid or invalid credential became valid.


func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold packages a Worker for use in a dependency.Engine.

func NewWorker

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

NewWorker returns a Worker that tracks the validity of the Model's cloud credential, as exposed by the Facade.


type Config

type Config struct {
	Facade Facade
	Logger Logger

Config holds the dependencies and configuration for a 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

type Facade interface {
	// ModelCredential gets model's cloud credential.
	// Models that are on the clouds that do not require auth will return
	// false to signify that credential was not set.
	ModelCredential() (base.StoredCredential, bool, error)

	// WatchCredential gets cloud credential watcher.
	WatchCredential(string) (watcher.NotifyWatcher, error)

	// WatchModelCredential gets model's cloud credential watcher.
	WatchModelCredential() (watcher.NotifyWatcher, error)

Facade exposes functionality required by a Worker to access and watch a cloud credential that a model uses.

func NewFacade

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

NewFacade creates a *credentialvalidator.Facade and returns it as a Facade.

type Logger

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

Logger represents the methods used by the worker to log details.

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName string

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

ManifoldConfig holds the dependencies and configuration for a Worker manifold.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate is called by start to check for bad configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL