caasbroker

package
v0.0.0-...-298751d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates a *Tracker and exposes it as a caas.Broker resource.

Types

type Config

type Config struct {
	ConfigAPI              ConfigAPI
	NewContainerBrokerFunc caas.NewContainerBrokerFunc
	Logger                 Logger
}

Config describes the dependencies of a Tracker.

It's arguable that it should be called TrackerConfig, because of the heavy use of model config in this package.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if the config cannot be used to start a Tracker.

type ConfigAPI

type ConfigAPI interface {
	CloudSpec() (environscloudspec.CloudSpec, error)
	ModelConfig() (*config.Config, error)
	ControllerConfig() (controller.Config, error)
	WatchForModelConfigChanges() (watcher.NotifyWatcher, error)
	WatchCloudSpecChanges() (watcher.NotifyWatcher, error)
}

ConfigAPI exposes a model configuration and a watch constructor that allows clients to be informed of changes to the configuration.

type Logger

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

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

type ManifoldConfig

type ManifoldConfig struct {
	APICallerName          string
	NewContainerBrokerFunc caas.NewContainerBrokerFunc
	Logger                 Logger
}

ManifoldConfig describes the resources used by a Tracker.

type Tracker

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

Tracker loads a caas broker, makes it available to clients, and updates the broker in response to config changes until it is killed.

func NewTracker

func NewTracker(config Config) (*Tracker, error)

NewTracker returns a new Tracker, or an error if anything goes wrong. If a tracker is returned, its Broker() method is immediately usable.

The caller is responsible for Kill()ing the returned Tracker and Wait()ing for any errors it might return.

func (*Tracker) Broker

func (t *Tracker) Broker() caas.Broker

Broker returns the encapsulated Broker. It will continue to be updated in the background for as long as the Tracker continues to run.

func (*Tracker) Kill

func (t *Tracker) Kill()

Kill is part of the worker.Worker interface.

func (*Tracker) Wait

func (t *Tracker) 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