registry

package
v0.3.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultKeyPrefix = "/_coreos.com/fleet/"
View Source
const (
	// ResourceMutexTTL is the number of seconds to allow a mutex to be held on a resource
	ResourceMutexTTL = 10
)

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) GetActiveMachines added in v0.3.1

func (r *EtcdRegistry) GetActiveMachines() (machines []machine.MachineState, err error)

Describe all active Machines

func (*EtcdRegistry) GetAllJobs added in v0.3.1

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

GetAllJobs lists all Jobs known by the Registry

func (*EtcdRegistry) GetDebugInfo added in v0.3.1

func (r *EtcdRegistry) GetDebugInfo() (string, error)

func (*EtcdRegistry) GetJob added in v0.3.1

func (r *EtcdRegistry) GetJob(jobName string) (j *job.Job, err error)

GetJob 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) GetJobTarget added in v0.3.1

func (r *EtcdRegistry) GetJobTarget(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) GetJobTargetState added in v0.3.1

func (r *EtcdRegistry) GetJobTargetState(jobName string) (*job.JobState, error)

func (*EtcdRegistry) GetMachineState added in v0.3.1

func (r *EtcdRegistry) GetMachineState(machID string) (*machine.MachineState, error)

Get Machine object from etcd

func (*EtcdRegistry) GetSignatureSet added in v0.3.1

func (r *EtcdRegistry) GetSignatureSet(tag string) *sign.SignatureSet

GetSignatureSet returns the SignatureSet associated with the given tag

func (*EtcdRegistry) GetSignatureSetOfJob added in v0.3.1

func (r *EtcdRegistry) GetSignatureSetOfJob(name string) (*sign.SignatureSet, error)

GetSignatureSetOfJob retrieves the SignatureSet associated with the given job, or nil if none can be found

func (*EtcdRegistry) JobHeartbeat added in v0.3.1

func (r *EtcdRegistry) JobHeartbeat(jobName, agentMachID string, ttl time.Duration) error

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) RemoveMachineState added in v0.3.1

func (r *EtcdRegistry) RemoveMachineState(machID string) error

Remove Machine object from etcd

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)

Push Machine object to etcd

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)

func (*EventStream) Stream

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

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)
	GetActiveMachines() ([]machine.MachineState, error)
	GetAllJobs() ([]job.Job, error)
	GetDebugInfo() (string, error)
	GetJob(jobName string) (j *job.Job, err error)
	GetJobTarget(jobName string) (string, error)
	GetJobTargetState(jobName string) (*job.JobState, error)
	GetMachineState(machID string) (*machine.MachineState, error)
	GetSignatureSetOfJob(name string) (*sign.SignatureSet, error)
	GetSignatureSet(tag string) *sign.SignatureSet
	JobHeartbeat(jobName, agentMachID string, ttl time.Duration) error
	LockJob(jobName, context string) *TimedResourceMutex
	LockJobOffer(jobName, context string) *TimedResourceMutex
	LockMachine(machID, context string) *TimedResourceMutex
	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
}

func New

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

New creates a new EtcdRegistry with the given parameters

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.

Jump to

Keyboard shortcuts

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