Documentation ¶
Index ¶
- Constants
- type Agent
- func (a *Agent) AbleToRun(j *job.Job) bool
- func (a *Agent) Bid(jobName string)
- func (a *Agent) BidForPossibleJobs()
- func (a *Agent) BidForPossiblePeers(jobName string)
- func (a *Agent) FetchJob(jobName string) *job.Job
- func (a *Agent) HasConflict(potentialJobName string, potentialConflicts []string) (bool, string)
- func (a *Agent) Heartbeat(ttl time.Duration, stop chan bool)
- func (a *Agent) HeartbeatJobs(ttl time.Duration, stop chan bool)
- func (a *Agent) LoadJob(j *job.Job)
- func (a *Agent) Machine() *machine.Machine
- func (a *Agent) MarshalJSON() ([]byte, error)
- func (a *Agent) Purge()
- func (a *Agent) ReportUnitState(jobName string, us *unit.UnitState)
- func (a *Agent) Run()
- func (a *Agent) StartJob(jobName string)
- func (a *Agent) Stop()
- func (a *Agent) StopJob(jobName string)
- func (a *Agent) UnloadJob(jobName string)
- func (a *Agent) VerifyJob(j *job.Job) bool
- type AgentState
- func (as *AgentState) GetJobsByPeer(peerName string) []string
- func (as *AgentState) GetOffersWithoutBids() []job.JobOffer
- func (as *AgentState) HasBid(name string) bool
- func (as *AgentState) LaunchedJobs() []string
- func (as *AgentState) Lock()
- func (as *AgentState) MarshalJSON() ([]byte, error)
- func (as *AgentState) PurgeJob(jobName string)
- func (as *AgentState) PurgeOffer(name string)
- func (as *AgentState) ScheduledHere(jobName string) bool
- func (as *AgentState) ScheduledJobs() []string
- func (as *AgentState) SetTargetState(jobName string, state job.JobState)
- func (as *AgentState) TrackBid(name string)
- func (as *AgentState) TrackJob(j *job.Job)
- func (as *AgentState) TrackOffer(offer job.JobOffer)
- func (as *AgentState) Unlock()
- type EventHandler
- func (eh *EventHandler) HandleCommandStartJob(ev event.Event)
- func (eh *EventHandler) HandleCommandStopJob(ev event.Event)
- func (eh *EventHandler) HandleEventJobDestroyed(ev event.Event)
- func (eh *EventHandler) HandleEventJobOffered(ev event.Event)
- func (eh *EventHandler) HandleEventJobScheduled(ev event.Event)
- func (eh *EventHandler) HandleEventJobUnscheduled(ev event.Event)
- func (eh *EventHandler) HandleEventUnitStateUpdated(ev event.Event)
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 ¶
type Agent struct {
// contains filtered or unexported fields
}
The Agent owns all of the coordination between the Registry, the local Machine, and the local SystemdManager.
func (*Agent) BidForPossibleJobs ¶
func (a *Agent) BidForPossibleJobs()
Submit all possible bids for unresolved offers
func (*Agent) BidForPossiblePeers ¶
Submit all possible bids for known peers of the provided job
func (*Agent) HasConflict ¶ added in v0.3.0
HasConflict determines whether there are any known conflicts with the given argument
func (*Agent) Heartbeat ¶
Periodically report to the Registry at an interval equal to half of the provided ttl. Stop reporting when the provided channel is closed. Failed attempts to report state to the Registry are retried twice before moving on to the next reporting interval.
func (*Agent) HeartbeatJobs ¶ added in v0.3.0
func (*Agent) MarshalJSON ¶ added in v0.2.0
func (*Agent) ReportUnitState ¶ added in v0.3.0
Persist the state of the given Job into the Registry
type AgentState ¶
type AgentState struct { // index of local payload conflicts to the job they belong to Conflicts map[string][]string // contains filtered or unexported fields }
func NewState ¶
func NewState() *AgentState
func (*AgentState) GetJobsByPeer ¶
func (as *AgentState) GetJobsByPeer(peerName string) []string
Retrieve all Jobs that share a given Peer
func (*AgentState) GetOffersWithoutBids ¶ added in v0.1.1
func (as *AgentState) GetOffersWithoutBids() []job.JobOffer
GetOffersWithoutBids returns all tracked JobOffers that have no corresponding JobBid tracked in the same AgentState object.
func (*AgentState) HasBid ¶
func (as *AgentState) HasBid(name string) bool
func (*AgentState) LaunchedJobs ¶ added in v0.3.0
func (as *AgentState) LaunchedJobs() []string
func (*AgentState) Lock ¶
func (as *AgentState) Lock()
func (*AgentState) MarshalJSON ¶ added in v0.2.0
func (as *AgentState) MarshalJSON() ([]byte, error)
func (*AgentState) PurgeJob ¶ added in v0.3.0
func (as *AgentState) PurgeJob(jobName string)
PurgeJob removes all state tracked on behalf of a given job
func (*AgentState) PurgeOffer ¶ added in v0.3.0
func (as *AgentState) PurgeOffer(name string)
func (*AgentState) ScheduledHere ¶ added in v0.3.0
func (as *AgentState) ScheduledHere(jobName string) bool
func (*AgentState) ScheduledJobs ¶ added in v0.3.0
func (as *AgentState) ScheduledJobs() []string
func (*AgentState) SetTargetState ¶ added in v0.3.0
func (as *AgentState) SetTargetState(jobName string, state job.JobState)
func (*AgentState) TrackBid ¶
func (as *AgentState) TrackBid(name string)
func (*AgentState) TrackJob ¶ added in v0.3.0
func (as *AgentState) TrackJob(j *job.Job)
TrackJob extracts and stores information about the given job for later reference
func (*AgentState) TrackOffer ¶
func (as *AgentState) TrackOffer(offer job.JobOffer)
func (*AgentState) Unlock ¶
func (as *AgentState) Unlock()
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewEventHandler ¶
func NewEventHandler(agent *Agent) *EventHandler
func (*EventHandler) HandleCommandStartJob ¶ added in v0.3.0
func (eh *EventHandler) HandleCommandStartJob(ev event.Event)
func (*EventHandler) HandleCommandStopJob ¶ added in v0.3.0
func (eh *EventHandler) HandleCommandStopJob(ev event.Event)
func (*EventHandler) HandleEventJobDestroyed ¶ added in v0.3.0
func (eh *EventHandler) HandleEventJobDestroyed(ev event.Event)
func (*EventHandler) HandleEventJobOffered ¶
func (eh *EventHandler) HandleEventJobOffered(ev event.Event)
func (*EventHandler) HandleEventJobScheduled ¶
func (eh *EventHandler) HandleEventJobScheduled(ev event.Event)
func (*EventHandler) HandleEventJobUnscheduled ¶ added in v0.3.0
func (eh *EventHandler) HandleEventJobUnscheduled(ev event.Event)
func (*EventHandler) HandleEventUnitStateUpdated ¶ added in v0.3.0
func (eh *EventHandler) HandleEventUnitStateUpdated(ev event.Event)