Documentation ¶
Index ¶
Constants ¶
const (
// TTL to use with all state pushed to Registry
DefaultTTL = "30s"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
func (*Agent) Heartbeat ¶
Heartbeat updates the Registry periodically with an acknowledgement of the Jobs this Agent is expected to be running.
func (*Agent) MarshalJSON ¶
type AgentReconciler ¶
type AgentReconciler struct {
// contains filtered or unexported fields
}
func NewReconciler ¶
func NewReconciler(reg registry.Registry, rStream pkg.EventStream) *AgentReconciler
func (*AgentReconciler) Purge ¶
func (ar *AgentReconciler) Purge(a *Agent)
Purge attempts to unload all Units that have been loaded locally
func (*AgentReconciler) Reconcile ¶
func (ar *AgentReconciler) Reconcile(a *Agent)
Reconcile drives the local Agent's state towards the desired state stored in the Registry.
func (*AgentReconciler) Run ¶
func (ar *AgentReconciler) Run(a *Agent, stop chan bool)
Run periodically attempts to reconcile the provided Agent until the stop channel is closed. Run will also reconcile in reaction to events on the AgentReconciler's rStream.
type AgentState ¶
type AgentState struct { MState *machine.MachineState Units map[string]*job.Unit }
func NewAgentState ¶
func NewAgentState(ms *machine.MachineState) *AgentState
func (*AgentState) AbleToRun ¶
func (as *AgentState) AbleToRun(j *job.Job) (bool, string)
AbleToRun determines if an Agent can run the provided Job based on the Agent's current state. A boolean indicating whether this is the case or not is returned. The following criteria is used:
- Agent must meet the Job's machine target requirement (if any)
- Agent must have all of the Job's required metadata (if any)
- Agent must have all required Peers of the Job scheduled locally (if any)
- Job must not conflict with any other Units scheduled to the agent
type UnitStatePublisher ¶
type UnitStatePublisher struct {
// contains filtered or unexported fields
}
func NewUnitStatePublisher ¶
func (*UnitStatePublisher) MarshalJSON ¶
func (p *UnitStatePublisher) MarshalJSON() ([]byte, error)
func (*UnitStatePublisher) Purge ¶
func (p *UnitStatePublisher) Purge()
Purge ensures that the UnitStates for all Units known in the UnitStatePublisher's cache are removed from the registry.
func (*UnitStatePublisher) Run ¶
func (p *UnitStatePublisher) Run(beatchan <-chan *unit.UnitStateHeartbeat, stop chan bool)
Run caches all of the heartbeat objects from the provided channel, publishing them to the Registry every 5s. Heartbeat objects are also published as they are received on the channel.