juju: github.com/wallyworld/juju/worker/instancepoller Index | Files | Directories

package instancepoller

import "github.com/wallyworld/juju/worker/instancepoller"


Package Files

manifold.go worker.go


var (
    ShortPoll        = 3 * time.Second
    ShortPollBackoff = 2.0
    ShortPollCap     = 1 * time.Minute
    LongPoll         = 15 * time.Minute

ShortPoll and LongPoll hold the polling intervals for the instance updater. When a machine has no address or is not started, it will be polled at ShortPoll intervals until it does, exponentially backing off with an exponent of ShortPollBackoff until a maximum of ShortPollCap is reached.

When a machine has an address and is started LongPoll will be used to check that the instance address or status has not changed.

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a Manifold that encapsulates the instancepoller worker.

func NewWorker Uses

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

NewWorker returns a worker that keeps track of the machines in the state and polls their instance addresses and status periodically to keep them up to date.

type Config Uses

type Config struct {
    Clock   clock.Clock
    Facade  FacadeAPI
    Environ Environ
    Logger  Logger

    CredentialAPI common.CredentialAPI

Config encapsulates the configuration options for instantiating a new instance poller worker.

func (Config) Validate Uses

func (config Config) Validate() error

Validate checks whether the worker configuration settings are valid.

type Environ Uses

type Environ interface {
    Instances(ctx context.ProviderCallContext, ids []instance.Id) ([]instances.Instance, error)
    NetworkInterfaces(ctx context.ProviderCallContext, ids []instance.Id) ([]network.InterfaceInfos, error)

Environ specifies the provider-specific methods needed by the instance poller.

type FacadeAPI Uses

type FacadeAPI interface {
    WatchModelMachines() (watcher.StringsWatcher, error)
    Machine(tag names.MachineTag) (Machine, error)

FacadeAPI specifies the api-server methods needed by the instance poller.

type Logger Uses

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

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

type Machine Uses

type Machine interface {
    Id() string
    InstanceId() (instance.Id, error)
    SetProviderNetworkConfig(network.InterfaceInfos) (network.ProviderAddresses, bool, error)
    InstanceStatus() (params.StatusResult, error)
    SetInstanceStatus(status.Status, string, map[string]interface{}) error
    String() string
    Refresh() error
    Status() (params.StatusResult, error)
    Life() life.Value
    IsManual() (bool, error)

Machine specifies an interface for machine instances processed by the instance poller.

type ManifoldConfig Uses

type ManifoldConfig struct {
    APICallerName string
    ClockName     string
    EnvironName   string
    Logger        Logger

    NewCredentialValidatorFacade func(base.APICaller) (common.CredentialAPI, error)

ManifoldConfig describes the resources used by the instancepoller worker.


mocksPackage mocks is a generated GoMock package.

Package instancepoller imports 19 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.