Documentation ¶
Index ¶
- type IndexEntry
- type NotifyGroup
- type StateRestore
- func (s *StateRestore) Abort()
- func (r *StateRestore) AllocRestore(alloc *structs.Allocation) error
- func (s *StateRestore) Commit()
- func (r *StateRestore) EvalRestore(eval *structs.Evaluation) error
- func (r *StateRestore) IndexRestore(idx *IndexEntry) error
- func (r *StateRestore) JobRestore(job *structs.Job) error
- func (r *StateRestore) JobSummaryRestore(jobSummary *structs.JobSummary) error
- func (r *StateRestore) NodeRestore(node *structs.Node) error
- func (r *StateRestore) PeriodicLaunchRestore(launch *structs.PeriodicLaunch) error
- type StateSnapshot
- type StateStore
- func (s *StateStore) AllocByID(id string) (*structs.Allocation, error)
- func (s *StateStore) Allocs() (memdb.ResultIterator, error)
- func (s *StateStore) AllocsByEval(evalID string) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByIDPrefix(id string) (memdb.ResultIterator, error)
- func (s *StateStore) AllocsByJob(jobID string) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByNode(node string) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByNodeTerminal(node string, terminal bool) ([]*structs.Allocation, error)
- func (s *StateStore) DeleteEval(index uint64, evals []string, allocs []string) error
- func (s *StateStore) DeleteJob(index uint64, jobID string) error
- func (s *StateStore) DeleteJobSummary(index uint64, id string) error
- func (s *StateStore) DeleteNode(index uint64, nodeID string) error
- func (s *StateStore) DeletePeriodicLaunch(index uint64, jobID string) error
- func (s *StateStore) EvalByID(id string) (*structs.Evaluation, error)
- func (s *StateStore) Evals() (memdb.ResultIterator, error)
- func (s *StateStore) EvalsByIDPrefix(id string) (memdb.ResultIterator, error)
- func (s *StateStore) EvalsByJob(jobID string) ([]*structs.Evaluation, error)
- func (s *StateStore) Index(name string) (uint64, error)
- func (s *StateStore) Indexes() (memdb.ResultIterator, error)
- func (s *StateStore) JobByID(id string) (*structs.Job, error)
- func (s *StateStore) JobSummaries() (memdb.ResultIterator, error)
- func (s *StateStore) JobSummaryByID(jobID string) (*structs.JobSummary, error)
- func (s *StateStore) JobSummaryByPrefix(id string) (memdb.ResultIterator, error)
- func (s *StateStore) Jobs() (memdb.ResultIterator, error)
- func (s *StateStore) JobsByGC(gc bool) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByIDPrefix(id string) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByPeriodic(periodic bool) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByScheduler(schedulerType string) (memdb.ResultIterator, error)
- func (s *StateStore) LatestIndex() (uint64, error)
- func (s *StateStore) NodeByID(nodeID string) (*structs.Node, error)
- func (s *StateStore) Nodes() (memdb.ResultIterator, error)
- func (s *StateStore) NodesByIDPrefix(nodeID string) (memdb.ResultIterator, error)
- func (s *StateStore) PeriodicLaunchByID(id string) (*structs.PeriodicLaunch, error)
- func (s *StateStore) PeriodicLaunches() (memdb.ResultIterator, error)
- func (s *StateStore) ReconcileJobSummaries(index uint64) error
- func (s *StateStore) RemoveIndex(name string) error
- func (s *StateStore) Restore() (*StateRestore, error)
- func (s *StateStore) Snapshot() (*StateSnapshot, error)
- func (s *StateStore) StopWatch(items watch.Items, notify chan struct{})
- func (s *StateStore) UpdateAllocsFromClient(index uint64, allocs []*structs.Allocation) error
- func (s *StateStore) UpdateNodeDrain(index uint64, nodeID string, drain bool) error
- func (s *StateStore) UpdateNodeStatus(index uint64, nodeID, status string) error
- func (s *StateStore) UpsertAllocs(index uint64, allocs []*structs.Allocation) error
- func (s *StateStore) UpsertEvals(index uint64, evals []*structs.Evaluation) error
- func (s *StateStore) UpsertJob(index uint64, job *structs.Job) error
- func (s *StateStore) UpsertJobSummary(index uint64, jobSummary *structs.JobSummary) error
- func (s *StateStore) UpsertNode(index uint64, node *structs.Node) error
- func (s *StateStore) UpsertPeriodicLaunch(index uint64, launch *structs.PeriodicLaunch) error
- func (s *StateStore) Watch(items watch.Items, notify chan struct{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IndexEntry ¶
IndexEntry is used with the "index" table for managing the latest Raft index affecting a table.
type NotifyGroup ¶
type NotifyGroup struct {
// contains filtered or unexported fields
}
NotifyGroup is used to allow a simple notification mechanism. Channels can be marked as waiting, and when notify is invoked, all the waiting channels get a message and are cleared from the notify list.
func (*NotifyGroup) Clear ¶
func (n *NotifyGroup) Clear(ch chan struct{})
Clear removes a channel from the notify group
func (*NotifyGroup) Empty ¶
func (n *NotifyGroup) Empty() bool
Empty checks if there are no channels to notify
func (*NotifyGroup) Notify ¶
func (n *NotifyGroup) Notify()
Notify will do a non-blocking send to all waiting channels, and clear the notify list
func (*NotifyGroup) Wait ¶
func (n *NotifyGroup) Wait(ch chan struct{})
Wait adds a channel to the notify group
func (*NotifyGroup) WaitCh ¶
func (n *NotifyGroup) WaitCh() chan struct{}
WaitCh allocates a channel that is subscribed to notifications
type StateRestore ¶
type StateRestore struct {
// contains filtered or unexported fields
}
StateRestore is used to optimize the performance when restoring state by only using a single large transaction instead of thousands of sub transactions
func (*StateRestore) Abort ¶
func (s *StateRestore) Abort()
Abort is used to abort the restore operation
func (*StateRestore) AllocRestore ¶
func (r *StateRestore) AllocRestore(alloc *structs.Allocation) error
AllocRestore is used to restore an allocation
func (*StateRestore) Commit ¶
func (s *StateRestore) Commit()
Commit is used to commit the restore operation
func (*StateRestore) EvalRestore ¶
func (r *StateRestore) EvalRestore(eval *structs.Evaluation) error
EvalRestore is used to restore an evaluation
func (*StateRestore) IndexRestore ¶
func (r *StateRestore) IndexRestore(idx *IndexEntry) error
IndexRestore is used to restore an index
func (*StateRestore) JobRestore ¶
func (r *StateRestore) JobRestore(job *structs.Job) error
JobRestore is used to restore a job
func (*StateRestore) JobSummaryRestore ¶ added in v0.4.1
func (r *StateRestore) JobSummaryRestore(jobSummary *structs.JobSummary) error
JobSummaryRestore is used to restore a job summary
func (*StateRestore) NodeRestore ¶
func (r *StateRestore) NodeRestore(node *structs.Node) error
NodeRestore is used to restore a node
func (*StateRestore) PeriodicLaunchRestore ¶ added in v0.3.0
func (r *StateRestore) PeriodicLaunchRestore(launch *structs.PeriodicLaunch) error
PeriodicLaunchRestore is used to restore a periodic launch.
type StateSnapshot ¶
type StateSnapshot struct {
StateStore
}
StateSnapshot is used to provide a point-in-time snapshot
type StateStore ¶
type StateStore struct {
// contains filtered or unexported fields
}
The StateStore is responsible for maintaining all the Nomad state. It is manipulated by the FSM which maintains consistency through the use of Raft. The goals of the StateStore are to provide high concurrency for read operations without blocking writes, and to provide write availability in the face of reads. EVERY object returned as a result of a read against the state store should be considered a constant and NEVER modified in place.
func NewStateStore ¶
func NewStateStore(logOutput io.Writer) (*StateStore, error)
NewStateStore is used to create a new state store
func (*StateStore) AllocByID ¶
func (s *StateStore) AllocByID(id string) (*structs.Allocation, error)
AllocByID is used to lookup an allocation by its ID
func (*StateStore) Allocs ¶
func (s *StateStore) Allocs() (memdb.ResultIterator, error)
Allocs returns an iterator over all the evaluations
func (*StateStore) AllocsByEval ¶
func (s *StateStore) AllocsByEval(evalID string) ([]*structs.Allocation, error)
AllocsByEval returns all the allocations by eval id
func (*StateStore) AllocsByIDPrefix ¶ added in v0.3.0
func (s *StateStore) AllocsByIDPrefix(id string) (memdb.ResultIterator, error)
AllocsByIDPrefix is used to lookup allocs by prefix
func (*StateStore) AllocsByJob ¶
func (s *StateStore) AllocsByJob(jobID string) ([]*structs.Allocation, error)
AllocsByJob returns all the allocations by job id
func (*StateStore) AllocsByNode ¶
func (s *StateStore) AllocsByNode(node string) ([]*structs.Allocation, error)
AllocsByNode returns all the allocations by node
func (*StateStore) AllocsByNodeTerminal ¶ added in v0.3.0
func (s *StateStore) AllocsByNodeTerminal(node string, terminal bool) ([]*structs.Allocation, error)
AllocsByNode returns all the allocations by node and terminal status
func (*StateStore) DeleteEval ¶
func (s *StateStore) DeleteEval(index uint64, evals []string, allocs []string) error
DeleteEval is used to delete an evaluation
func (*StateStore) DeleteJob ¶
func (s *StateStore) DeleteJob(index uint64, jobID string) error
DeleteJob is used to deregister a job
func (*StateStore) DeleteJobSummary ¶ added in v0.4.1
func (s *StateStore) DeleteJobSummary(index uint64, id string) error
DeleteJobSummary deletes the job summary with the given ID. This is for testing purposes only.
func (*StateStore) DeleteNode ¶
func (s *StateStore) DeleteNode(index uint64, nodeID string) error
DeleteNode is used to deregister a node
func (*StateStore) DeletePeriodicLaunch ¶ added in v0.3.0
func (s *StateStore) DeletePeriodicLaunch(index uint64, jobID string) error
DeletePeriodicLaunch is used to delete the periodic launch
func (*StateStore) EvalByID ¶
func (s *StateStore) EvalByID(id string) (*structs.Evaluation, error)
EvalByID is used to lookup an eval by its ID
func (*StateStore) Evals ¶
func (s *StateStore) Evals() (memdb.ResultIterator, error)
Evals returns an iterator over all the evaluations
func (*StateStore) EvalsByIDPrefix ¶ added in v0.3.0
func (s *StateStore) EvalsByIDPrefix(id string) (memdb.ResultIterator, error)
EvalsByIDPrefix is used to lookup evaluations by prefix
func (*StateStore) EvalsByJob ¶
func (s *StateStore) EvalsByJob(jobID string) ([]*structs.Evaluation, error)
EvalsByJob returns all the evaluations by job id
func (*StateStore) Index ¶
func (s *StateStore) Index(name string) (uint64, error)
Index finds the matching index value
func (*StateStore) Indexes ¶
func (s *StateStore) Indexes() (memdb.ResultIterator, error)
Indexes returns an iterator over all the indexes
func (*StateStore) JobByID ¶
func (s *StateStore) JobByID(id string) (*structs.Job, error)
JobByID is used to lookup a job by its ID
func (*StateStore) JobSummaries ¶ added in v0.4.1
func (s *StateStore) JobSummaries() (memdb.ResultIterator, error)
JobSummaries walks the entire job summary table and returns all the job summary objects
func (*StateStore) JobSummaryByID ¶ added in v0.4.1
func (s *StateStore) JobSummaryByID(jobID string) (*structs.JobSummary, error)
JobSummary returns a job summary object which matches a specific id.
func (*StateStore) JobSummaryByPrefix ¶ added in v0.4.1
func (s *StateStore) JobSummaryByPrefix(id string) (memdb.ResultIterator, error)
JobSummaryByPrefix is used to look up Job Summary by id prefix
func (*StateStore) Jobs ¶
func (s *StateStore) Jobs() (memdb.ResultIterator, error)
Jobs returns an iterator over all the jobs
func (*StateStore) JobsByGC ¶ added in v0.3.0
func (s *StateStore) JobsByGC(gc bool) (memdb.ResultIterator, error)
JobsByGC returns an iterator over all jobs eligible or uneligible for garbage collection.
func (*StateStore) JobsByIDPrefix ¶ added in v0.3.0
func (s *StateStore) JobsByIDPrefix(id string) (memdb.ResultIterator, error)
JobsByIDPrefix is used to lookup a job by prefix
func (*StateStore) JobsByPeriodic ¶ added in v0.3.0
func (s *StateStore) JobsByPeriodic(periodic bool) (memdb.ResultIterator, error)
JobsByPeriodic returns an iterator over all the periodic or non-periodic jobs.
func (*StateStore) JobsByScheduler ¶ added in v0.2.0
func (s *StateStore) JobsByScheduler(schedulerType string) (memdb.ResultIterator, error)
JobsByScheduler returns an iterator over all the jobs with the specific scheduler type.
func (*StateStore) LatestIndex ¶ added in v0.4.0
func (s *StateStore) LatestIndex() (uint64, error)
LastIndex returns the greatest index value for all indexes
func (*StateStore) NodeByID ¶
func (s *StateStore) NodeByID(nodeID string) (*structs.Node, error)
NodeByID is used to lookup a node by ID
func (*StateStore) Nodes ¶
func (s *StateStore) Nodes() (memdb.ResultIterator, error)
Nodes returns an iterator over all the nodes
func (*StateStore) NodesByIDPrefix ¶ added in v0.3.0
func (s *StateStore) NodesByIDPrefix(nodeID string) (memdb.ResultIterator, error)
NodesByIDPrefix is used to lookup nodes by prefix
func (*StateStore) PeriodicLaunchByID ¶ added in v0.3.0
func (s *StateStore) PeriodicLaunchByID(id string) (*structs.PeriodicLaunch, error)
PeriodicLaunchByID is used to lookup a periodic launch by the periodic job ID.
func (*StateStore) PeriodicLaunches ¶ added in v0.3.0
func (s *StateStore) PeriodicLaunches() (memdb.ResultIterator, error)
PeriodicLaunches returns an iterator over all the periodic launches
func (*StateStore) ReconcileJobSummaries ¶ added in v0.4.1
func (s *StateStore) ReconcileJobSummaries(index uint64) error
ReconcileJobSummaries re-creates summaries for all jobs present in the state store
func (*StateStore) RemoveIndex ¶ added in v0.4.1
func (s *StateStore) RemoveIndex(name string) error
RemoveIndex is a helper method to remove an index for testing purposes
func (*StateStore) Restore ¶
func (s *StateStore) Restore() (*StateRestore, error)
Restore is used to optimize the efficiency of rebuilding state by minimizing the number of transactions and checking overhead.
func (*StateStore) Snapshot ¶
func (s *StateStore) Snapshot() (*StateSnapshot, error)
Snapshot is used to create a point in time snapshot. Because we use MemDB, we just need to snapshot the state of the underlying database.
func (*StateStore) StopWatch ¶ added in v0.2.0
func (s *StateStore) StopWatch(items watch.Items, notify chan struct{})
StopWatch unsubscribes a channel from a set of watch items.
func (*StateStore) UpdateAllocsFromClient ¶ added in v0.3.0
func (s *StateStore) UpdateAllocsFromClient(index uint64, allocs []*structs.Allocation) error
from a client. While the schedulers are the authority on the allocation for most things, some updates are authoritative from the client. Specifically, the desired state comes from the schedulers, while the actual state comes from clients.
func (*StateStore) UpdateNodeDrain ¶
func (s *StateStore) UpdateNodeDrain(index uint64, nodeID string, drain bool) error
UpdateNodeDrain is used to update the drain of a node
func (*StateStore) UpdateNodeStatus ¶
func (s *StateStore) UpdateNodeStatus(index uint64, nodeID, status string) error
UpdateNodeStatus is used to update the status of a node
func (*StateStore) UpsertAllocs ¶
func (s *StateStore) UpsertAllocs(index uint64, allocs []*structs.Allocation) error
UpsertAllocs is used to evict a set of allocations and allocate new ones at the same time.
func (*StateStore) UpsertEvals ¶
func (s *StateStore) UpsertEvals(index uint64, evals []*structs.Evaluation) error
UpsertEvaluation is used to upsert an evaluation
func (*StateStore) UpsertJob ¶
func (s *StateStore) UpsertJob(index uint64, job *structs.Job) error
UpsertJob is used to register a job or update a job definition
func (*StateStore) UpsertJobSummary ¶ added in v0.4.1
func (s *StateStore) UpsertJobSummary(index uint64, jobSummary *structs.JobSummary) error
UpsertJobSummary upserts a job summary into the state store.
func (*StateStore) UpsertNode ¶
func (s *StateStore) UpsertNode(index uint64, node *structs.Node) error
UpsertNode is used to register a node or update a node definition This is assumed to be triggered by the client, so we retain the value of drain which is set by the scheduler.
func (*StateStore) UpsertPeriodicLaunch ¶ added in v0.3.0
func (s *StateStore) UpsertPeriodicLaunch(index uint64, launch *structs.PeriodicLaunch) error
UpsertPeriodicLaunch is used to register a launch or update it.
func (*StateStore) Watch ¶ added in v0.2.0
func (s *StateStore) Watch(items watch.Items, notify chan struct{})
Watch subscribes a channel to a set of watch items.