juju: github.com/wallyworld/juju/worker/uniter/remotestate Index | Files

package remotestate

import "github.com/wallyworld/juju/worker/uniter/remotestate"


Package Files

interface.go relationunits.go snapshot.go state.go storagewatcher.go watcher.go

type Application Uses

type Application interface {
    // CharmModifiedVersion returns a revision number for the charm that
    // increments whenever the charm or a resource for the charm changes.
    CharmModifiedVersion() (int, error)
    // CharmURL returns the url for the charm for this application.
    CharmURL() (*charm.URL, bool, error)
    // Life returns whether the application is alive.
    Life() life.Value
    // Refresh syncs this value with the api server.
    Refresh() error
    // Tag returns the tag for this application.
    Tag() names.ApplicationTag
    // Watch returns a watcher that fires when this application changes.
    Watch() (watcher.NotifyWatcher, error)
    // WatchLeadershipSettings returns a watcher that fires when the leadership
    // settings for this application change.
    WatchLeadershipSettings() (watcher.NotifyWatcher, error)

type Charm Uses

type Charm interface {
    // LXDProfileRequired returns true if this charm has an lxdprofile.yaml
    LXDProfileRequired() (bool, error)

type ContainerRunningStatus Uses

type ContainerRunningStatus struct {
    PodName          string
    Initialising     bool
    InitialisingTime time.Time
    Running          bool

ContainerRunningStatus is used on CAAS models to upgrade charms/block actions.

type ContainerRunningStatusFunc Uses

type ContainerRunningStatusFunc func(providerID string) (*ContainerRunningStatus, error)

ContainerRunningStatusFunc is used by the RemoteStateWatcher in a CAAS model to determine if the unit is running and ready to execute actions.

type Logger Uses

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

Logger represents the logging methods used in this package.

type Relation Uses

type Relation interface {
    Id() int
    Tag() names.RelationTag
    Life() life.Value
    Suspended() bool

type RelationSnapshot Uses

type RelationSnapshot struct {
    // Life indicates whether this relation is active, stopping or dead
    Life life.Value

    // Suspended is used by cross-model relations to indicate the offer has
    // disabled the relation, but has not removed it entirely.
    Suspended bool

    // Members tracks the Change version of each member's data bag
    Members map[string]int64

    // ApplicationMembers tracks the Change version of each member's application data bag
    ApplicationMembers map[string]int64

RelationSnapshot tracks the state of a relationship from the viewpoint of the local unit.

type RemoteStateWatcher Uses

type RemoteStateWatcher struct {
    // contains filtered or unexported fields

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

func NewWatcher Uses

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

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

func (*RemoteStateWatcher) ClearResolvedMode Uses

func (w *RemoteStateWatcher) ClearResolvedMode()

func (*RemoteStateWatcher) CommandCompleted Uses

func (w *RemoteStateWatcher) CommandCompleted(completed string)

func (*RemoteStateWatcher) Kill Uses

func (w *RemoteStateWatcher) Kill()

Kill is part of the worker.Worker interface.

func (*RemoteStateWatcher) RemoteStateChanged Uses

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

func (*RemoteStateWatcher) Snapshot Uses

func (w *RemoteStateWatcher) Snapshot() Snapshot

func (*RemoteStateWatcher) Wait Uses

func (w *RemoteStateWatcher) Wait() error

Wait is part of the worker.Worker interface.

type Snapshot Uses

type Snapshot struct {
    // Life is the lifecycle state of the unit.
    Life life.Value

    // Relations contains the lifecycle states of
    // each of the application's relations, keyed by
    // relation IDs.
    Relations map[int]RelationSnapshot

    // Storage contains the lifecycle and attached
    // states of each of the unit's storage attachments.
    Storage map[names.StorageTag]StorageSnapshot

    // 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

    // ResolvedMode reports the method of resolving
    // hook execution errors.
    ResolvedMode params.ResolvedMode

    // ProviderID is the cloud container's provider ID.
    ProviderID string

    // RetryHookVersion increments each time a failed
    // hook is meant to be retried if ResolvedMode is
    // set to ResolvedNone.
    RetryHookVersion int

    // ConfigHash is a hash of the last published version of the
    // unit's config settings.
    ConfigHash string

    // TrustHash is a hash of the last published version of the unit's
    // trust settings.
    TrustHash string

    // AddressesHash is a hash of the last published addresses for the
    // unit's machine/container.
    AddressesHash string

    // Leader indicates whether or not the unit is the
    // elected leader.
    Leader bool

    // LeaderSettingsVersion is the last published
    // version of the leader settings for the application.
    LeaderSettingsVersion int

    // UpdateStatusVersion increments each time an
    // update-status hook is supposed to run.
    UpdateStatusVersion int

    // ActionsPending is the list of pending actions to
    // be performed by this unit.
    ActionsPending []string

    // ActionChanged contains a monotonically incrementing
    // integer to signify changes in the Action's remote state.
    ActionChanged map[string]int

    // ActionsBlocked is true on CAAS when actions cannot be run due to
    // pod initialization.
    ActionsBlocked bool

    // Commands is the list of IDs of commands to be
    // executed by this unit.
    Commands []string

    // UpgradeSeriesStatus is the preparation status of any currently running
    // series upgrade
    UpgradeSeriesStatus model.UpgradeSeriesStatus

    // ContainerRunningStatus is set on CAAS models for remote init/upgrade of charm.
    ContainerRunningStatus *ContainerRunningStatus

    // LXDProfileName is the name of the lxd profile applied to the unit's
    // machine for the current charm version.
    LXDProfileName string

    // CharmProfileRequired is true if the charm has a lxdprofile.yaml.
    CharmProfileRequired bool

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

type State Uses

type State interface {
    Charm(*charm.URL) (Charm, error)
    Relation(names.RelationTag) (Relation, error)
    StorageAttachment(names.StorageTag, names.UnitTag) (params.StorageAttachment, error)
    StorageAttachmentLife([]params.StorageAttachmentId) ([]params.LifeResult, error)
    Unit(names.UnitTag) (Unit, error)
    WatchRelationUnits(names.RelationTag, names.UnitTag) (watcher.RelationUnitsWatcher, error)
    WatchStorageAttachment(names.StorageTag, names.UnitTag) (watcher.NotifyWatcher, error)
    WatchUpdateStatusHookInterval() (watcher.NotifyWatcher, error)
    UpdateStatusHookInterval() (time.Duration, error)

func NewAPIState Uses

func NewAPIState(st *uniter.State) State

type StorageAccessor Uses

type StorageAccessor interface {
    // StorageAttachment returns the storage attachment with the specified
    // unit and storage tags.
    StorageAttachment(names.StorageTag, names.UnitTag) (params.StorageAttachment, error)

type StorageSnapshot Uses

type StorageSnapshot struct {
    Kind     params.StorageKind
    Life     life.Value
    Attached bool
    Location string

StorageSnapshot has information relating to a storage instance belonging to a unit.

type Unit Uses

type Unit interface {
    Life() life.Value
    LXDProfileName() (string, error)
    Refresh() error
    ProviderID() string
    Resolved() params.ResolvedMode
    Application() (Application, error)
    Tag() names.UnitTag
    Watch() (watcher.NotifyWatcher, error)
    WatchAddressesHash() (watcher.StringsWatcher, error)
    WatchConfigSettingsHash() (watcher.StringsWatcher, error)
    WatchTrustConfigSettingsHash() (watcher.StringsWatcher, error)
    WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
    WatchInstanceData() (watcher.NotifyWatcher, error)
    WatchStorage() (watcher.StringsWatcher, error)
    WatchActionNotifications() (watcher.StringsWatcher, error)
    // WatchRelation returns a watcher that fires when relations
    // relevant for this unit change.
    WatchRelations() (watcher.StringsWatcher, error)
    UpgradeSeriesStatus() (model.UpgradeSeriesStatus, error)

type UpdateStatusTimerFunc Uses

type UpdateStatusTimerFunc func(time.Duration) Waiter

type Waiter Uses

type Waiter interface {
    After() <-chan time.Time

type Watcher Uses

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


type WatcherConfig Uses

type WatcherConfig struct {
    State                         State
    LeadershipTracker             leadership.Tracker
    UpdateStatusChannel           UpdateStatusTimerFunc
    CommandChannel                <-chan string
    RetryHookChannel              watcher.NotifyChannel
    ApplicationChannel            watcher.NotifyChannel
    ContainerRunningStatusChannel watcher.NotifyChannel
    ContainerRunningStatusFunc    ContainerRunningStatusFunc
    UnitTag                       names.UnitTag
    ModelType                     model.ModelType
    Logger                        Logger
    CanApplyCharmProfile          bool

WatcherConfig holds configuration parameters for the remote state watcher.

Package remotestate imports 14 packages (graph). Updated 2020-08-15. Refresh now. Tools for package owners.