Documentation ¶
Index ¶
- Constants
- func ErrStoppedf(format string, args ...interface{}) error
- func IsErrStopped(err error) bool
- func NewErrStopped() error
- type ActionInfo
- type AnnotationInfo
- type ApplicationInfo
- type ApplicationOfferInfo
- type BlockInfo
- type BranchInfo
- type CharmInfo
- type CharmRelation
- type Delta
- type Endpoint
- type EntityID
- type EntityInfo
- type Factory
- type ItemChange
- type Logger
- type MachineInfo
- type ModelInfo
- type ModelSLAInfo
- type PodSpec
- type Profile
- type RelationInfo
- type RemoteApplicationUpdate
- type StatusInfo
- type Store
- type UnitInfo
- type Watcher
Constants ¶
const ( ActionKind = "action" AnnotationKind = "annotation" // the annotations should really be parts of the other entities ApplicationKind = "application" ApplicationOfferKind = "applicationOffer" BlockKind = "block" BranchKind = "branch" CharmKind = "charm" MachineKind = "machine" ModelKind = "model" RelationKind = "relation" RemoteApplicationKind = "remoteApplication" UnitKind = "unit" )
The kind constants are there to stop typos when switching on kinds.
Variables ¶
This section is empty.
Functions ¶
func ErrStoppedf ¶
ErrStoppedf returns an error which satisfies IsErrStopped().
func IsErrStopped ¶
IsErrStopped reports whether the error was created with ErrStoppedf() or NewErrStopped().
func NewErrStopped ¶
func NewErrStopped() error
NewErrStopped returns an error which wraps err and satisfies IsErrStopped().
Types ¶
type ActionInfo ¶
type ActionInfo struct { ModelUUID string ID string Receiver string Name string Parameters map[string]interface{} Parallel bool ExecutionGroup string Status string Message string Results map[string]interface{} Enqueued time.Time Started time.Time Completed time.Time }
ActionInfo holds the information about an action that is tracked by multiwatcherStore.
func (*ActionInfo) Clone ¶
func (i *ActionInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*ActionInfo) EntityID ¶
func (i *ActionInfo) EntityID() EntityID
EntityID returns a unique identifier for an action across models.
type AnnotationInfo ¶
AnnotationInfo holds the information about an annotation that is tracked by multiwatcherStore.
func (*AnnotationInfo) Clone ¶
func (i *AnnotationInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*AnnotationInfo) EntityID ¶
func (i *AnnotationInfo) EntityID() EntityID
EntityID returns a unique identifier for an annotation across models.
type ApplicationInfo ¶
type ApplicationInfo struct { ModelUUID string Name string Exposed bool CharmURL string OwnerTag string Life life.Value MinUnits int Constraints constraints.Value Annotations map[string]string Config map[string]interface{} Subordinate bool Status StatusInfo OperatorStatus StatusInfo // For CAAS models. WorkloadVersion string PodSpec *PodSpec // For CAAS models. }
ApplicationInfo holds the information about an application that is tracked by multiwatcherStore.
func (*ApplicationInfo) Clone ¶
func (i *ApplicationInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*ApplicationInfo) EntityID ¶
func (i *ApplicationInfo) EntityID() EntityID
EntityID returns a unique identifier for an application across models.
type ApplicationOfferInfo ¶
type ApplicationOfferInfo struct { ModelUUID string OfferName string OfferUUID string ApplicationName string CharmName string TotalConnectedCount int ActiveConnectedCount int }
ApplicationOfferInfo holds the information about an application offer that is tracked by multiwatcherStore.
func (*ApplicationOfferInfo) Clone ¶
func (i *ApplicationOfferInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*ApplicationOfferInfo) EntityID ¶
func (i *ApplicationOfferInfo) EntityID() EntityID
EntityID returns a unique identifier for an application offer across models.
type BlockInfo ¶
BlockInfo holds the information about a block that is tracked by multiwatcherStore.
func (*BlockInfo) Clone ¶
func (i *BlockInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
type BranchInfo ¶
type BranchInfo struct { ModelUUID string ID string Name string AssignedUnits map[string][]string Config map[string][]ItemChange Created int64 CreatedBy string Completed int64 CompletedBy string GenerationID int }
BranchInfo holds data about a model branch that is tracked by multiwatcherStore.
func (*BranchInfo) Clone ¶
func (i *BranchInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*BranchInfo) EntityID ¶
func (i *BranchInfo) EntityID() EntityID
EntityID returns a unique identifier for a generation.
type CharmInfo ¶
type CharmInfo struct { ModelUUID string CharmURL string CharmVersion string Life life.Value LXDProfile *Profile // DefaultConfig is derived from state-stored *charm.Config. DefaultConfig map[string]interface{} }
CharmInfo holds the information about a charm that is tracked by the multiwatcher.
func (*CharmInfo) Clone ¶
func (i *CharmInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
type CharmRelation ¶
type CharmRelation struct { Name string Role string Interface string Optional bool Limit int Scope string }
CharmRelation mirrors charm.Relation.
type Delta ¶
type Delta struct { // If Removed is true, the entity has been removed; // otherwise it has been created or changed. Removed bool // Entity holds data about the entity that has changed. Entity EntityInfo }
Delta holds details of a change to the model.
type Endpoint ¶
type Endpoint struct { ApplicationName string Relation CharmRelation }
Endpoint holds an application-relation pair.
type EntityInfo ¶
type EntityInfo interface { // EntityID returns an identifier that will uniquely // identify the entity within its kind EntityID() EntityID // Clone returns a clone of the EntityInfo. Clone() EntityInfo }
EntityInfo is implemented by all entity Info types.
type Factory ¶
type Factory interface { // TODO: WatchUsersModels to filter just the user's models WatchModel(modelUUID string) Watcher WatchController() Watcher }
Factory is used to create multiwatchers.
type ItemChange ¶
ItemChange is the multiwatcher representation of a core settings ItemChange.
type Logger ¶
type Logger interface { IsTraceEnabled() bool Tracef(string, ...interface{}) Errorf(string, ...interface{}) Criticalf(string, ...interface{}) }
Logger describes the logging methods used in this package by the worker.
type MachineInfo ¶
type MachineInfo struct { ModelUUID string ID string InstanceID string AgentStatus StatusInfo InstanceStatus StatusInfo Life life.Value Annotations map[string]string Config map[string]interface{} Base string ContainerType string IsManual bool SupportedContainers []instance.ContainerType SupportedContainersKnown bool HardwareCharacteristics *instance.HardwareCharacteristics CharmProfiles []string Jobs []model.MachineJob Addresses []network.ProviderAddress HasVote bool WantsVote bool // The preferred public and preferred private address are // only stored on the machine info to populate the unit info. PreferredPublicAddress network.SpaceAddress PreferredPrivateAddress network.SpaceAddress // The machine's hostname reported by the machine agent when it started. Hostname string }
MachineInfo holds the information about a machine that is tracked by multiwatcherStore.
func (*MachineInfo) Clone ¶
func (i *MachineInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*MachineInfo) EntityID ¶
func (i *MachineInfo) EntityID() EntityID
EntityID returns a unique identifier for a machine across models.
type ModelInfo ¶
type ModelInfo struct { ModelUUID string Type model.ModelType Name string Life life.Value Owner string ControllerUUID string IsController bool Cloud string CloudRegion string CloudCredential string Annotations map[string]string Config map[string]interface{} Status StatusInfo Constraints constraints.Value SLA ModelSLAInfo UserPermissions map[string]permission.Access }
ModelInfo holds the information about a model that is tracked by multiwatcherStore.
func (*ModelInfo) Clone ¶
func (i *ModelInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
type ModelSLAInfo ¶
ModelSLAInfo describes the SLA info for a model.
type PodSpec ¶
PodSpec is used to determine whether or not a CAAS application has called the command to set the pod spec.
type Profile ¶
type Profile struct { Config map[string]string Description string Devices map[string]map[string]string }
Profile is a representation of charm.v6 LXDProfile
type RelationInfo ¶
RelationInfo holds the information about a relation that is tracked by multiwatcherStore.
func (*RelationInfo) Clone ¶
func (i *RelationInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*RelationInfo) EntityID ¶
func (i *RelationInfo) EntityID() EntityID
EntityID returns a unique identifier for a relation across models.
type RemoteApplicationUpdate ¶
type RemoteApplicationUpdate struct { ModelUUID string Name string OfferURL string Life life.Value Status StatusInfo }
RemoteApplicationUpdate holds the information about a remote application that is tracked by multiwatcherStore.
func (*RemoteApplicationUpdate) Clone ¶
func (i *RemoteApplicationUpdate) Clone() EntityInfo
Clone returns a clone of the EntityInfo.
func (*RemoteApplicationUpdate) EntityID ¶
func (i *RemoteApplicationUpdate) EntityID() EntityID
EntityID returns a unique identifier for a remote application across models.
type StatusInfo ¶
type StatusInfo struct { Err error Current status.Status Message string Since *time.Time Version string Data map[string]interface{} }
StatusInfo holds the unit and machine status information. It is used by ApplicationInfo and UnitInfo.
func NewStatusInfo ¶
func NewStatusInfo(s status.StatusInfo, err error) StatusInfo
NewStatusInfo return a new multiwatcher StatusInfo from a status StatusInfo.
type Store ¶
type Store interface { All() []EntityInfo // ChangesSince takes revno. A zero implies that this is the first call for changes. // A slice of changes is returned along with the latest revno that the store has seen. ChangesSince(revno int64) ([]Delta, int64) // AddReference and DecReference are used for internal reference counting for the // watchers that have been notified. // TODO: determine if this is actually useful, and whether this is the right place for it. AddReference(revno int64) DecReference(revno int64) Get(id EntityID) EntityInfo Update(info EntityInfo) Remove(id EntityID) // Size returns the internal size of the store's list. // Used only for tests and metrics. Size() int }
Store stores the current entities to use as a basis for the multiwatcher notifications.
type UnitInfo ¶
type UnitInfo struct { ModelUUID string Name string Application string Base string CharmURL string Life life.Value Annotations map[string]string PublicAddress string PrivateAddress string MachineID string OpenPortRangesByEndpoint network.GroupedPortRanges Principal string Subordinate bool // Workload and agent state are modelled separately. WorkloadStatus StatusInfo AgentStatus StatusInfo ContainerStatus StatusInfo // For CAAS models. }
UnitInfo holds the information about a unit that is tracked by multiwatcherStore.
func (*UnitInfo) Clone ¶
func (i *UnitInfo) Clone() EntityInfo
Clone returns a clone of the EntityInfo.