remotestate

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Debugf(message string, args ...interface{})
}

type RemoteStateWatcher

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

RemoteStateWatcher collects application information from separate state watchers, and updates a Snapshot which is sent on a channel upon change.

func NewWatcher

func NewWatcher(config WatcherConfig) (*RemoteStateWatcher, error)

NewWatcher returns a RemoteStateWatcher that handles state changes pertaining to the supplied application.

func (*RemoteStateWatcher) Kill

func (w *RemoteStateWatcher) Kill()

Kill is part of the worker.Worker interface.

func (*RemoteStateWatcher) RemoteStateChanged

func (w *RemoteStateWatcher) RemoteStateChanged() <-chan struct{}

func (*RemoteStateWatcher) Snapshot

func (w *RemoteStateWatcher) Snapshot() Snapshot

func (*RemoteStateWatcher) Wait

func (w *RemoteStateWatcher) Wait() error

Wait is part of the worker.Worker interface.

type Snapshot

type Snapshot struct {
	// CharmModifiedVersion is increased whenever the application's charm was
	// changed in some way.
	CharmModifiedVersion int

	// CharmURL is the charm URL that the unit is
	// expected to run.
	CharmURL *charm.URL

	// ForceCharmUpgrade reports whether the unit
	// should upgrade even in an error state.
	ForceCharmUpgrade bool
}

Snapshot is a snapshot of the remote state of the unit.

type Watcher

type Watcher interface {
	// RemoteStateChanged returns a channel which is signalled
	// whenever the remote state is changed.
	RemoteStateChanged() <-chan struct{}

	// Snapshot returns the current snapshot of the remote state.
	Snapshot() Snapshot

	worker.Worker
}

type WatcherConfig

type WatcherConfig struct {
	Logger             Logger
	Application        string
	CharmGetter        charmGetter
	ApplicationWatcher applicationWatcher
}

WatcherConfig holds configuration parameters for the remote state watcher.

Jump to

Keyboard shortcuts

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