registry

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2014 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Occurs when any Job's target is touched
	JobTargetChangeEvent = pkg.Event("JobTargetChangeEvent")
	// Occurs when any Job's target state is touched
	JobTargetStateChangeEvent = pkg.Event("JobTargetStateChangeEvent")
)
View Source
const DefaultKeyPrefix = "/_coreos.com/fleet/"

Variables

This section is empty.

Functions

func NewEtcdEventStream added in v0.7.0

func NewEtcdEventStream(client etcd.Client, rootPrefix string) pkg.EventStream

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) ClearUnitHeartbeat added in v0.7.0

func (r *EtcdRegistry) ClearUnitHeartbeat(name string)

func (*EtcdRegistry) CreateUnit added in v0.7.0

func (r *EtcdRegistry) CreateUnit(u *job.Unit) (err error)

CreateUnit attempts to store a Unit and its associated unit file in the registry

func (*EtcdRegistry) DestroyUnit added in v0.7.0

func (r *EtcdRegistry) DestroyUnit(name string) error

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

func (r *EtcdRegistry) SaveUnitState(jobName string, unitState *unit.UnitState, ttl time.Duration)

SaveUnitState persists the given UnitState to the Registry

func (*EtcdRegistry) Schedule added in v0.7.0

func (r *EtcdRegistry) Schedule() ([]job.ScheduledUnit, error)

Schedule returns all ScheduledUnits known by fleet, ordered by name

func (*EtcdRegistry) ScheduleUnit added in v0.7.0

func (r *EtcdRegistry) ScheduleUnit(name string, machID string) error

func (*EtcdRegistry) ScheduledUnit added in v0.7.0

func (r *EtcdRegistry) ScheduledUnit(name string) (*job.ScheduledUnit, error)

ScheduledUnit retrieves the ScheduledUnit by the given name from the Registry. Returns nil if no such ScheduledUnit exists, and any error encountered.

func (*EtcdRegistry) SetMachineState added in v0.3.1

func (r *EtcdRegistry) SetMachineState(ms machine.MachineState, ttl time.Duration) (uint64, error)

func (*EtcdRegistry) SetUnitTargetState added in v0.7.0

func (r *EtcdRegistry) SetUnitTargetState(name string, state job.JobState) error

func (*EtcdRegistry) Unit added in v0.7.0

func (r *EtcdRegistry) Unit(name string) (*job.Unit, error)

Unit retrieves the Unit by the given name from the Registry. Returns nil if no such Unit exists, and any error encountered.

func (*EtcdRegistry) UnitHeartbeat added in v0.7.0

func (r *EtcdRegistry) UnitHeartbeat(name, machID string, ttl time.Duration) error

func (*EtcdRegistry) UnitStates added in v0.7.0

func (r *EtcdRegistry) UnitStates() (states []*unit.UnitState, err error)

UnitStates returns a list of all UnitStates stored in the registry, sorted by unit name and then machine ID.

func (*EtcdRegistry) Units added in v0.7.0

func (r *EtcdRegistry) Units() ([]job.Unit, error)

Units lists all Units stored in the Registry, ordered by name. This includes both global and non-global units.

func (*EtcdRegistry) UnscheduleUnit added in v0.7.0

func (r *EtcdRegistry) UnscheduleUnit(name, machID string) error

type FakeRegistry added in v0.4.0

type FakeRegistry struct {
	// Not all methods required by the Registry interface are implemented
	// by the FakeRegistry. 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) ClearUnitHeartbeat added in v0.7.0

func (f *FakeRegistry) ClearUnitHeartbeat(string)

func (*FakeRegistry) CreateUnit added in v0.7.0

func (f *FakeRegistry) CreateUnit(u *job.Unit) error

func (*FakeRegistry) DestroyUnit added in v0.7.0

func (f *FakeRegistry) DestroyUnit(name string) 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) RemoveUnitState added in v0.6.0

func (f *FakeRegistry) RemoveUnitState(jobName string) error

func (*FakeRegistry) SaveUnitState added in v0.4.0

func (f *FakeRegistry) SaveUnitState(jobName string, unitState *unit.UnitState, ttl time.Duration)

func (*FakeRegistry) Schedule added in v0.7.0

func (f *FakeRegistry) Schedule() ([]job.ScheduledUnit, error)

func (*FakeRegistry) ScheduleUnit added in v0.7.0

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

func (*FakeRegistry) ScheduledUnit added in v0.7.0

func (f *FakeRegistry) ScheduledUnit(name string) (*job.ScheduledUnit, 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(states []unit.UnitState)

func (*FakeRegistry) SetUnitTargetState added in v0.7.0

func (f *FakeRegistry) SetUnitTargetState(name string, target job.JobState) error

func (*FakeRegistry) Unit added in v0.7.0

func (f *FakeRegistry) Unit(name string) (*job.Unit, error)

func (*FakeRegistry) UnitHeartbeat added in v0.7.0

func (f *FakeRegistry) UnitHeartbeat(name, machID string, ttl time.Duration) error

func (*FakeRegistry) UnitStates added in v0.7.0

func (f *FakeRegistry) UnitStates() ([]*unit.UnitState, error)

func (*FakeRegistry) Units added in v0.7.0

func (f *FakeRegistry) Units() ([]job.Unit, error)

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.UnitFile
}

LegacyJobPayload deals with the legacy concept of a "JobPayload" (deprecated by UnitFiles). 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 MUSKey added in v0.7.0

type MUSKey struct {
	// contains filtered or unexported fields
}

MUSKey is used to index UnitStates by name + machineID

type MUSKeys added in v0.7.0

type MUSKeys []MUSKey

MUSKeys provides for sorting of UnitStates by their MUSKey

func (MUSKeys) Len added in v0.7.0

func (mk MUSKeys) Len() int

func (MUSKeys) Less added in v0.7.0

func (mk MUSKeys) Less(i, j int) bool

func (MUSKeys) Swap added in v0.7.0

func (mk MUSKeys) Swap(i, j int)

type Registry

type Registry interface {
	ClearUnitHeartbeat(name string)
	CreateUnit(*job.Unit) error
	DestroyUnit(string) error
	UnitHeartbeat(name, machID string, ttl time.Duration) 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
	SaveUnitState(jobName string, unitState *unit.UnitState, ttl time.Duration)
	ScheduleUnit(name, machID string) error
	SetUnitTargetState(name string, state job.JobState) error
	SetMachineState(ms machine.MachineState, ttl time.Duration) (uint64, error)
	UnscheduleUnit(name, machID string) error

	UnitRegistry
}

func New

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

New creates a new EtcdRegistry with the given parameters

type UnitRegistry added in v0.7.0

type UnitRegistry interface {
	Schedule() ([]job.ScheduledUnit, error)
	ScheduledUnit(name string) (*job.ScheduledUnit, error)
	Unit(name string) (*job.Unit, error)
	Units() ([]job.Unit, error)
	UnitStates() ([]*unit.UnitState, error)
}

Jump to

Keyboard shortcuts

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