agent

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2014 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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 New

func New(reg *registry.Registry, eStream *registry.EventStream, mach *machine.Machine, ttl string, verifier *sign.SignatureVerifier) (*Agent, error)

func (*Agent) AbleToRun

func (a *Agent) AbleToRun(j *job.Job) bool

Determine if the Agent can run the provided Job

func (*Agent) Bid

func (a *Agent) Bid(jobName string)

Submit a bid for the given Job

func (*Agent) BidForPossibleJobs

func (a *Agent) BidForPossibleJobs()

Submit all possible bids for unresolved offers

func (*Agent) BidForPossiblePeers

func (a *Agent) BidForPossiblePeers(jobName string)

Submit all possible bids for known peers of the provided job

func (*Agent) FetchJob

func (a *Agent) FetchJob(jobName string) *job.Job

Pull a Job and its payload from the Registry

func (*Agent) HasConflict added in v0.3.0

func (a *Agent) HasConflict(potentialJobName string, potentialConflicts []string) (bool, string)

HasConflict determines whether there are any known conflicts with the given argument

func (*Agent) Heartbeat

func (a *Agent) Heartbeat(ttl time.Duration, stop chan bool)

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 (a *Agent) HeartbeatJobs(ttl time.Duration, stop chan bool)

func (*Agent) LoadJob added in v0.3.0

func (a *Agent) LoadJob(j *job.Job)

func (*Agent) Machine

func (a *Agent) Machine() *machine.Machine

Access Agent's machine field

func (*Agent) MarshalJSON added in v0.2.0

func (a *Agent) MarshalJSON() ([]byte, error)

func (*Agent) Purge

func (a *Agent) Purge()

Purge removes the Agent's state from the Registry

func (*Agent) ReportUnitState added in v0.3.0

func (a *Agent) ReportUnitState(jobName string, us *unit.UnitState)

Persist the state of the given Job into the Registry

func (*Agent) Run

func (a *Agent) Run()

Trigger all async processes the Agent intends to run

func (*Agent) StartJob

func (a *Agent) StartJob(jobName string)

func (*Agent) Stop

func (a *Agent) Stop()

Stop all async processes the Agent is running

func (*Agent) StopJob

func (a *Agent) StopJob(jobName string)

func (*Agent) UnloadJob added in v0.3.0

func (a *Agent) UnloadJob(jobName string)

func (*Agent) VerifyJob added in v0.2.0

func (a *Agent) VerifyJob(j *job.Job) bool

VerifyJob attempts to verify the integrity of the given Job by checking the signature against a SignatureSet stored in its repository.

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL