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) Heartbeat(ttl time.Duration, stop chan bool)
- func (a *Agent) Machine() *machine.Machine
- func (a *Agent) OfferResolved(jobName string)
- func (a *Agent) Purge()
- func (a *Agent) ReportJobState(jobName string, jobState *job.JobState)
- func (a *Agent) RescheduleJob(j *job.Job)
- func (a *Agent) Run()
- func (a *Agent) StartJob(j *job.Job)
- func (a *Agent) Stop()
- func (a *Agent) StopJob(jobName string)
- func (a *Agent) TrackOffer(jo job.JobOffer)
- func (a *Agent) UnresolvedJobOffers() []job.JobOffer
- type AgentState
- func (self *AgentState) DropBid(name string)
- func (self *AgentState) DropJobConflicts(jobName string)
- func (self *AgentState) DropOffer(name string)
- func (self *AgentState) DropPeersJob(jobName string)
- func (self *AgentState) GetJobsByPeer(peerName string) []string
- func (self *AgentState) GetOffer(name string) (job.JobOffer, bool)
- func (self *AgentState) GetOffersWithoutBids() []job.JobOffer
- func (self *AgentState) HasBid(name string) bool
- func (self *AgentState) HasConflict(potentialJobName string, potentialConflicts []string) (bool, string)
- func (self *AgentState) Lock()
- func (self *AgentState) TrackBid(name string)
- func (self *AgentState) TrackJobConflicts(jobName string, conflicts []string)
- func (self *AgentState) TrackJobPeers(jobName string, peers []string)
- func (self *AgentState) TrackOffer(offer job.JobOffer)
- func (self *AgentState) Unlock()
- type EventHandler
- func (eh *EventHandler) HandleEventJobOffered(ev event.Event)
- func (eh *EventHandler) HandleEventJobScheduled(ev event.Event)
- func (eh *EventHandler) HandleEventJobStateUpdated(ev event.Event)
- func (eh *EventHandler) HandleEventJobStopped(ev event.Event)
- func (eh *EventHandler) HandleEventMachineCreated(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) Heartbeat ¶
Periodically report to the Registry at an interval equal to half of the provided ttl. Stop reporting when the provided channel is closed.
func (*Agent) OfferResolved ¶
Instruct the Agent that the given offer has been resolved and may be ignored in future conflict calculations
func (*Agent) ReportJobState ¶
Persist the state of the given Job into the Registry
func (*Agent) RescheduleJob ¶
Inform the Registry that a Job must be rescheduled
func (*Agent) TrackOffer ¶
Instruct the Agent that an offer has been created and must be tracked until it is resolved
func (*Agent) UnresolvedJobOffers ¶
type AgentState ¶
type AgentState struct {
// contains filtered or unexported fields
}
func NewState ¶
func NewState() *AgentState
func (*AgentState) DropBid ¶
func (self *AgentState) DropBid(name string)
func (*AgentState) DropJobConflicts ¶
func (self *AgentState) DropJobConflicts(jobName string)
Purge all tracked conflicts for a given Job
func (*AgentState) DropOffer ¶
func (self *AgentState) DropOffer(name string)
func (*AgentState) DropPeersJob ¶
func (self *AgentState) DropPeersJob(jobName string)
Remove all references to a given Job from all Peer indexes
func (*AgentState) GetJobsByPeer ¶
func (self *AgentState) GetJobsByPeer(peerName string) []string
Retrieve all Jobs that share a given Peer
func (*AgentState) GetOffersWithoutBids ¶ added in v0.1.1
func (self *AgentState) GetOffersWithoutBids() []job.JobOffer
GetOffersWithoutBids returns all tracked JobOffers that have no corresponding JobBid tracked in the same AgentState object.
func (*AgentState) HasBid ¶
func (self *AgentState) HasBid(name string) bool
func (*AgentState) HasConflict ¶
func (self *AgentState) HasConflict(potentialJobName string, potentialConflicts []string) (bool, string)
Determine whether there are any known conflicts with the given argument
func (*AgentState) Lock ¶
func (self *AgentState) Lock()
func (*AgentState) TrackBid ¶
func (self *AgentState) TrackBid(name string)
func (*AgentState) TrackJobConflicts ¶
func (self *AgentState) TrackJobConflicts(jobName string, conflicts []string)
Store a list of conflicts on behalf of a given Job
func (*AgentState) TrackJobPeers ¶
func (self *AgentState) TrackJobPeers(jobName string, peers []string)
Store a relation of 1 Job -> N Peers
func (*AgentState) TrackOffer ¶
func (self *AgentState) TrackOffer(offer job.JobOffer)
func (*AgentState) Unlock ¶
func (self *AgentState) Unlock()
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewEventHandler ¶
func NewEventHandler(agent *Agent) *EventHandler
func (*EventHandler) HandleEventJobOffered ¶
func (eh *EventHandler) HandleEventJobOffered(ev event.Event)
func (*EventHandler) HandleEventJobScheduled ¶
func (eh *EventHandler) HandleEventJobScheduled(ev event.Event)
func (*EventHandler) HandleEventJobStateUpdated ¶
func (eh *EventHandler) HandleEventJobStateUpdated(ev event.Event)
func (*EventHandler) HandleEventJobStopped ¶
func (eh *EventHandler) HandleEventJobStopped(ev event.Event)
func (*EventHandler) HandleEventMachineCreated ¶
func (eh *EventHandler) HandleEventMachineCreated(ev event.Event)