Documentation ¶
Overview ¶
Package presence works on the premise that an agent it alive if it has a current connection to one of the API servers.
This package handles all of the logic around collecting an organising the information around all the connections made to the API servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connections ¶
type Connections interface { // ForModel will return the connections just for the specified model UUID. ForModel(model string) Connections // ForServer will return just the connections for agents connected to the specified // server. The server is a stringified machine tag for the API server. ForServer(server string) Connections // ForAgent returns the connections for the specified agent in the model. // The agent is the stringified machine or unit tag. ForAgent(agent string) Connections // Count returns the number of connections. Count() int // Models returns all the model UUIDs that have connections. Models() []string // Servers returns all the API servers that have connections in this // collection. Servers() []string // Agents returns all the stringified agent tags that have connections // in this collection. Agents() []string // For a given non controller agent, return the Status for that agent. AgentStatus(agent string) (Status, error) // Values returns the connection information for this collection. Values() []Value }
Connections provides a way to slice the full presence understanding across various axis like server, model and agent.
type Recorder ¶
type Recorder interface { // Disable clears the entries and marks the recorder as disabled. Note // that all agents will have a recorder, but they are only enabled for // API server agents. Disable() // Enable marks the recorder as enabled. Enable() // IsEnabled returns whether or not the recorder is enabled. IsEnabled() bool // Connect adds an entry for the specified agent. // The server and agent strings are the stringified machine and unit tags. // The model is the UUID for the model. Connect(server, model, agent string, id uint64, controllerAgent bool, userData string) // Disconnect removes the entry for the specified connection id. Disconnect(server string, id uint64) // Activity updates the last seen timestamp for the connection specified. Activity(server string, id uint64) // ServerDown marks all connections on the specified server as unknown. ServerDown(server string) // UpdateServer replaces all known connections for the specified server // with the connections specified. If any of the connections are not for // the specified server, an error is returned. UpdateServer(server string, connections []Value) error // Connections returns all connections info that the recorder has. Connections() Connections }
Recorder records the presence status of every apiserver connection for the agents.
type Value ¶
type Value struct { // Model is the model UUID. Model string // Server is the stringified machine tag of the API server. Server string // Agent is the stringified machine, unit, or application tag of the agent. Agent string // ControllerAgent is true if the agent is in the controller model. ControllerAgent bool // ConnectionID is the unique identifier given by the API server. ConnectionID uint64 // Status is either Missing or Alive. Status Status // UserData is the user data provided with the Login API call. UserData string // LastSeen is the timestamp when the connection was added using // Connect, or the last time Activity was called. LastSeen time.Time }
Value holds the information about a single agent connection to an apiserver machine.
Click to show internal directories.
Click to hide internal directories.