Documentation ¶
Index ¶
- Constants
- Variables
- type EtcdRegistry
- func (r *EtcdRegistry) Bids(jo *job.JobOffer) ([]job.JobBid, error)
- func (r *EtcdRegistry) CheckJobPulse(jobName string) (string, bool)
- func (r *EtcdRegistry) ClearJobHeartbeat(jobName string)
- func (r *EtcdRegistry) ClearJobTarget(jobName, machID string) error
- func (r *EtcdRegistry) CreateJob(j *job.Job) (err error)
- func (r *EtcdRegistry) CreateJobOffer(jo *job.JobOffer) error
- func (r *EtcdRegistry) CreateSignatureSet(ss *sign.SignatureSet) error
- func (r *EtcdRegistry) DestroyJob(jobName string) error
- func (r *EtcdRegistry) DestroySignatureSet(tag string)
- func (r *EtcdRegistry) Job(jobName string) (j *job.Job, err error)
- func (r *EtcdRegistry) JobHeartbeat(jobName, agentMachID string, ttl time.Duration) error
- func (r *EtcdRegistry) JobSignatureSet(name string) (*sign.SignatureSet, error)
- func (r *EtcdRegistry) JobTarget(jobName string) (string, error)
- func (r *EtcdRegistry) JobTargetState(jobName string) (*job.JobState, error)
- func (r *EtcdRegistry) Jobs() ([]job.Job, error)
- func (r *EtcdRegistry) LatestVersion() (*semver.Version, error)
- func (r *EtcdRegistry) LockJob(jobName, context string) *TimedResourceMutex
- func (r *EtcdRegistry) LockJobOffer(jobName, context string) *TimedResourceMutex
- func (r *EtcdRegistry) LockMachine(machID, context string) *TimedResourceMutex
- func (r *EtcdRegistry) Machines() (machines []machine.MachineState, err error)
- func (r *EtcdRegistry) RemoveMachineState(machID string) error
- func (r *EtcdRegistry) RemoveUnitState(jobName string) error
- func (r *EtcdRegistry) ResolveJobOffer(jobName string) error
- func (r *EtcdRegistry) SaveUnitState(jobName string, unitState *unit.UnitState)
- func (r *EtcdRegistry) ScheduleJob(jobName string, machID string) error
- func (r *EtcdRegistry) SetJobTargetState(jobName string, state job.JobState) error
- func (r *EtcdRegistry) SetMachineState(ms machine.MachineState, ttl time.Duration) (uint64, error)
- func (r *EtcdRegistry) SubmitJobBid(jb *job.JobBid)
- func (r *EtcdRegistry) UnresolvedJobOffers() []job.JobOffer
- type EventStream
- type FakeRegistry
- func (f *FakeRegistry) Bids(jo *job.JobOffer) ([]job.JobBid, error)
- func (f *FakeRegistry) CreateJob(j *job.Job) error
- func (f *FakeRegistry) DestroyJob(name string) error
- func (f *FakeRegistry) Job(name string) (*job.Job, error)
- func (f *FakeRegistry) JobTarget(name string) (string, error)
- func (f *FakeRegistry) JobTargetState(jobName string) (*job.JobState, error)
- func (f *FakeRegistry) Jobs() ([]job.Job, error)
- func (f *FakeRegistry) LatestVersion() (*semver.Version, error)
- func (f *FakeRegistry) Machines() ([]machine.MachineState, error)
- func (f *FakeRegistry) SaveUnitState(jobName string, unitState *unit.UnitState)
- func (f *FakeRegistry) SetJobTargetState(name string, target job.JobState) error
- func (f *FakeRegistry) SetJobs(jobs []job.Job)
- func (f *FakeRegistry) SetLatestVersion(v semver.Version)
- func (f *FakeRegistry) SetMachines(machines []machine.MachineState)
- func (f *FakeRegistry) SetUnitStates(jobStates map[string]*unit.UnitState)
- func (f *FakeRegistry) SetUnits(units []unit.Unit)
- func (f *FakeRegistry) SubmitJobBid(jb *job.JobBid)
- type LegacyJobPayload
- type Registry
- type TimedResourceMutex
Constants ¶
const DefaultKeyPrefix = "/_coreos.com/fleet/"
Variables ¶
var ( // ResourceMutexTTL is the duration of time to allow a mutex to be held on a resource ResourceMutexTTL = 10 * time.Second )
Functions ¶
This section is empty.
Types ¶
type EtcdRegistry ¶ added in v0.3.1
type EtcdRegistry struct {
// contains filtered or unexported fields
}
EtcdRegistry fulfils the Registry interface and uses etcd as a backend
func (*EtcdRegistry) Bids ¶ added in v0.3.1
Bids returns a list of JobBids that have been submitted for the given JobOffer
func (*EtcdRegistry) CheckJobPulse ¶ added in v0.3.1
func (r *EtcdRegistry) CheckJobPulse(jobName string) (string, bool)
func (*EtcdRegistry) ClearJobHeartbeat ¶ added in v0.3.1
func (r *EtcdRegistry) ClearJobHeartbeat(jobName string)
func (*EtcdRegistry) ClearJobTarget ¶ added in v0.3.1
func (r *EtcdRegistry) ClearJobTarget(jobName, machID string) error
func (*EtcdRegistry) CreateJob ¶ added in v0.3.1
func (r *EtcdRegistry) CreateJob(j *job.Job) (err error)
CreateJob attempts to store a Job and its associated Unit in the registry
func (*EtcdRegistry) CreateJobOffer ¶ added in v0.3.1
func (r *EtcdRegistry) CreateJobOffer(jo *job.JobOffer) error
CreateJobOffer attempts to store a JobOffer and a reference to its associated Job in the repository
func (*EtcdRegistry) CreateSignatureSet ¶ added in v0.3.1
func (r *EtcdRegistry) CreateSignatureSet(ss *sign.SignatureSet) error
CreateSignatureSet stores the given SignatureSet in the repository
func (*EtcdRegistry) DestroyJob ¶ added in v0.3.1
func (r *EtcdRegistry) DestroyJob(jobName string) error
DestroyJob removes a Job object from the repository, along with any legacy associated Payload and SignatureSet. It does not yet remove underlying Units from the repository.
func (*EtcdRegistry) DestroySignatureSet ¶ added in v0.3.1
func (r *EtcdRegistry) DestroySignatureSet(tag string)
DestroySignatureSet destroys the SignatureSet associated with the given tag
func (*EtcdRegistry) Job ¶ added in v0.5.1
func (r *EtcdRegistry) Job(jobName string) (j *job.Job, err error)
Job looks for a Job of the given name in the Registry. It returns a fully hydrated Job on success, or nil on any kind of failure.
func (*EtcdRegistry) JobHeartbeat ¶ added in v0.3.1
func (r *EtcdRegistry) JobHeartbeat(jobName, agentMachID string, ttl time.Duration) error
func (*EtcdRegistry) JobSignatureSet ¶ added in v0.5.1
func (r *EtcdRegistry) JobSignatureSet(name string) (*sign.SignatureSet, error)
JobSignatureSet retrieves the SignatureSet associated with the given job, or nil if none can be found
func (*EtcdRegistry) JobTarget ¶ added in v0.5.1
func (r *EtcdRegistry) JobTarget(jobName string) (string, error)
GetJobTarget looks up where the given job is scheduled. If the job has been scheduled, the ID the target machine is returned. Otherwise, an empty string is returned.
func (*EtcdRegistry) JobTargetState ¶ added in v0.5.1
func (r *EtcdRegistry) JobTargetState(jobName string) (*job.JobState, error)
func (*EtcdRegistry) Jobs ¶ added in v0.5.1
func (r *EtcdRegistry) Jobs() ([]job.Job, error)
Jobs lists all Jobs known by the Registry
func (*EtcdRegistry) LatestVersion ¶ added in v0.5.1
func (r *EtcdRegistry) LatestVersion() (*semver.Version, error)
LatestVersion attempts to retrieve the latest version of fleet that has been registered in the Registry. It returns the version if it can be determined (or nil otherwise), and any error encountered.
func (*EtcdRegistry) LockJob ¶ added in v0.3.1
func (r *EtcdRegistry) LockJob(jobName, context string) *TimedResourceMutex
func (*EtcdRegistry) LockJobOffer ¶ added in v0.3.1
func (r *EtcdRegistry) LockJobOffer(jobName, context string) *TimedResourceMutex
func (*EtcdRegistry) LockMachine ¶ added in v0.3.1
func (r *EtcdRegistry) LockMachine(machID, context string) *TimedResourceMutex
Attempt to acquire a lock on a given machine for a given amount of time
func (*EtcdRegistry) Machines ¶ added in v0.5.1
func (r *EtcdRegistry) Machines() (machines []machine.MachineState, err error)
func (*EtcdRegistry) RemoveMachineState ¶ added in v0.3.1
func (r *EtcdRegistry) RemoveMachineState(machID string) error
func (*EtcdRegistry) RemoveUnitState ¶ added in v0.3.1
func (r *EtcdRegistry) RemoveUnitState(jobName string) error
Delete the state from the Registry for the given Job's Unit
func (*EtcdRegistry) ResolveJobOffer ¶ added in v0.3.1
func (r *EtcdRegistry) ResolveJobOffer(jobName string) error
func (*EtcdRegistry) SaveUnitState ¶ added in v0.3.1
func (r *EtcdRegistry) SaveUnitState(jobName string, unitState *unit.UnitState)
Persist the changes in a provided Machine's Job
func (*EtcdRegistry) ScheduleJob ¶ added in v0.3.1
func (r *EtcdRegistry) ScheduleJob(jobName string, machID string) error
func (*EtcdRegistry) SetJobTargetState ¶ added in v0.3.1
func (r *EtcdRegistry) SetJobTargetState(jobName string, state job.JobState) error
func (*EtcdRegistry) SetMachineState ¶ added in v0.3.1
func (r *EtcdRegistry) SetMachineState(ms machine.MachineState, ttl time.Duration) (uint64, error)
func (*EtcdRegistry) SubmitJobBid ¶ added in v0.3.1
func (r *EtcdRegistry) SubmitJobBid(jb *job.JobBid)
func (*EtcdRegistry) UnresolvedJobOffers ¶ added in v0.3.1
func (r *EtcdRegistry) UnresolvedJobOffers() []job.JobOffer
UnresolvedJobOffers returns a list of hydrated JobOffers from the Registry
type EventStream ¶
type EventStream struct {
// contains filtered or unexported fields
}
func NewEventStream ¶
func NewEventStream(client etcd.Client, registry Registry) (*EventStream, error)
type FakeRegistry ¶ added in v0.4.0
type FakeRegistry struct { // Not all methods of required by the Registry interface are implemented // by the TestRegistry. Any calls to these unimplemented methods will // result in a panic. Registry sync.RWMutex // contains filtered or unexported fields }
func NewFakeRegistry ¶ added in v0.4.0
func NewFakeRegistry() *FakeRegistry
func (*FakeRegistry) DestroyJob ¶ added in v0.4.0
func (f *FakeRegistry) DestroyJob(name string) error
func (*FakeRegistry) Job ¶ added in v0.5.1
func (f *FakeRegistry) Job(name string) (*job.Job, error)
func (*FakeRegistry) JobTarget ¶ added in v0.5.1
func (f *FakeRegistry) JobTarget(name string) (string, error)
func (*FakeRegistry) JobTargetState ¶ added in v0.5.1
func (f *FakeRegistry) JobTargetState(jobName string) (*job.JobState, error)
func (*FakeRegistry) LatestVersion ¶ added in v0.5.1
func (f *FakeRegistry) LatestVersion() (*semver.Version, error)
func (*FakeRegistry) Machines ¶ added in v0.5.1
func (f *FakeRegistry) Machines() ([]machine.MachineState, error)
func (*FakeRegistry) SaveUnitState ¶ added in v0.4.0
func (f *FakeRegistry) SaveUnitState(jobName string, unitState *unit.UnitState)
func (*FakeRegistry) SetJobTargetState ¶ added in v0.4.0
func (f *FakeRegistry) SetJobTargetState(name string, target job.JobState) error
func (*FakeRegistry) SetJobs ¶ added in v0.4.0
func (f *FakeRegistry) SetJobs(jobs []job.Job)
func (*FakeRegistry) SetLatestVersion ¶ added in v0.4.0
func (f *FakeRegistry) SetLatestVersion(v semver.Version)
func (*FakeRegistry) SetMachines ¶ added in v0.4.0
func (f *FakeRegistry) SetMachines(machines []machine.MachineState)
func (*FakeRegistry) SetUnitStates ¶ added in v0.4.0
func (f *FakeRegistry) SetUnitStates(jobStates map[string]*unit.UnitState)
func (*FakeRegistry) SetUnits ¶ added in v0.4.0
func (f *FakeRegistry) SetUnits(units []unit.Unit)
func (*FakeRegistry) SubmitJobBid ¶ added in v0.4.0
func (f *FakeRegistry) SubmitJobBid(jb *job.JobBid)
type LegacyJobPayload ¶ added in v0.3.0
LegacyJobPayload deals with the legacy concept of a "JobPayload" (deprecated by Units). The associated marshaling/unmarshaling methods deal with Payloads encoded in this legacy format.
func (*LegacyJobPayload) UnmarshalJSON ¶ added in v0.3.0
func (ljp *LegacyJobPayload) UnmarshalJSON(data []byte) error
type Registry ¶
type Registry interface { Bids(jb *job.JobOffer) ([]job.JobBid, error) CheckJobPulse(jobName string) (string, bool) ClearJobHeartbeat(jobName string) ClearJobTarget(jobName, machID string) error CreateJob(j *job.Job) (err error) CreateJobOffer(jo *job.JobOffer) error CreateSignatureSet(ss *sign.SignatureSet) error DestroyJob(jobName string) error DestroySignatureSet(tag string) Job(jobName string) (j *job.Job, err error) JobHeartbeat(jobName, agentMachID string, ttl time.Duration) error Jobs() ([]job.Job, error) JobSignatureSet(name string) (*sign.SignatureSet, error) JobTarget(jobName string) (string, error) JobTargetState(jobName string) (*job.JobState, error) LatestVersion() (*semver.Version, error) LockJob(jobName, context string) *TimedResourceMutex LockJobOffer(jobName, context string) *TimedResourceMutex LockMachine(machID, context string) *TimedResourceMutex Machines() ([]machine.MachineState, error) RemoveMachineState(machID string) error RemoveUnitState(jobName string) error ResolveJobOffer(jobName string) error SaveUnitState(jobName string, unitState *unit.UnitState) ScheduleJob(jobName string, machID string) error SetJobTargetState(jobName string, state job.JobState) error SetMachineState(ms machine.MachineState, ttl time.Duration) (uint64, error) SubmitJobBid(jb *job.JobBid) UnresolvedJobOffers() []job.JobOffer }
type TimedResourceMutex ¶ added in v0.1.2
type TimedResourceMutex struct {
// contains filtered or unexported fields
}
TimedResourceMutex is a proxy to an auto-expiring mutex stored in the Registry. It assumes the mutex creator has initialized a timer.
func (*TimedResourceMutex) Unlock ¶ added in v0.1.2
func (t *TimedResourceMutex) Unlock() error
Unlock will attempt to remove the lock held on the mutex in the Registry.