apiaddressupdater

package
v0.0.0-...-56cb166 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: AGPL-3.0 Imports: 16 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 an API address updater worker, using the resource names defined in the supplied config.

func NewAPIAddressUpdater

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

NewAPIAddressUpdater returns a worker.Worker that watches for changes to API addresses and then sets them on the APIAddressSetter.

Types

type APIAddressSetter

type APIAddressSetter interface {
	SetAPIHostPorts(servers []corenetwork.HostPorts) error
}

APIAddressSetter is an interface that is provided to NewAPIAddressUpdater whose SetAPIHostPorts method will be invoked whenever address changes occur.

type APIAddressUpdater

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

APIAddressUpdater is responsible for propagating API addresses.

In practice, APIAddressUpdater is used by a machine agent to watch API addresses in state and write the changes to the agent's config file.

func (*APIAddressUpdater) Handle

func (c *APIAddressUpdater) Handle(ctx context.Context) error

Handle is part of the watcher.NotifyHandler interface.

func (*APIAddressUpdater) Report

func (c *APIAddressUpdater) Report() map[string]interface{}

Report shows up in the dependency engine report.

func (*APIAddressUpdater) SetUp

SetUp is part of the watcher.NotifyHandler interface.

func (*APIAddressUpdater) TearDown

func (c *APIAddressUpdater) TearDown() error

TearDown is part of the watcher.NotifyHandler interface.

type APIAddresser

type APIAddresser interface {
	APIHostPorts(context.Context) ([]corenetwork.ProviderHostPorts, error)
	WatchAPIHostPorts(context.Context) (watcher.NotifyWatcher, error)
}

APIAddresser is an interface that is provided to NewAPIAddressUpdater which can be used to watch for API address changes.

type Config

type Config struct {
	Addresser APIAddresser
	Setter    APIAddressSetter
	Logger    logger.Logger
}

Config defines the operation of a Worker.

func (Config) Validate

func (config Config) Validate() error

Validate returns an error if config cannot drive a Worker.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName     string
	APICallerName string
	Logger        logger.Logger
}

ManifoldConfig defines the names of the manifolds on which a Manifold will depend.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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