registry

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2014 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultKeyPrefix = "/_coreos.com/fleet/"

Variables

This section is empty.

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

func (r *EtcdRegistry) Bids(jo *job.JobOffer) ([]job.JobBid, error)

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) (*job.Job, 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) Jobs added in v0.5.1

func (r *EtcdRegistry) Jobs() ([]job.Job, error)

Jobs lists all Jobs known by the Registry, ordered by job name

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) LeaseRole added in v0.5.4

func (r *EtcdRegistry) LeaseRole(role, machID string, period time.Duration) (Lease, error)

LeaseRole acquires a lease of a role only if there are no outstanding leases. If a Lease cannot be acquired, a nil Lease object is returned. An error is returned only if there is a failure communicating with the Registry.

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, error)

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)

func (*EventStream) Stream

func (es *EventStream) Stream(idx uint64, sendFunc func(*event.Event), stop chan bool)

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) Bids added in v0.4.0

func (f *FakeRegistry) Bids(jo *job.JobOffer) ([]job.JobBid, error)

func (*FakeRegistry) CreateJob added in v0.4.0

func (f *FakeRegistry) CreateJob(j *job.Job) error

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) Jobs added in v0.5.1

func (f *FakeRegistry) Jobs() ([]job.Job, 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) ScheduleJob added in v0.5.2

func (f *FakeRegistry) ScheduleJob(name string, machID string) error

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 Lease added in v0.5.4

type Lease interface {
	Renew(time.Duration) error
	Release() error
}

type LegacyJobPayload added in v0.3.0

type LegacyJobPayload struct {
	Name string
	Unit unit.Unit
}

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)
	LatestVersion() (*semver.Version, error)
	LeaseRole(role, machID string, period time.Duration) (Lease, error)
	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, error)
}

func New

func New(client etcd.Client, keyPrefix string) (registry Registry)

New creates a new EtcdRegistry with the given parameters

Jump to

Keyboard shortcuts

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