Documentation ¶
Index ¶
- Constants
- func RegisterSchemaFactories(factories ...SchemaFactory)
- func TestInitState(t testing.T, state *StateStore)
- type IndexEntry
- type QueryFn
- type SchemaFactories
- type SchemaFactory
- type StateRestore
- func (r *StateRestore) ACLPolicyRestore(policy *structs.ACLPolicy) error
- func (r *StateRestore) ACLTokenRestore(token *structs.ACLToken) error
- func (s *StateRestore) Abort()
- func (r *StateRestore) AllocRestore(alloc *structs.Allocation) error
- func (s *StateRestore) Commit()
- func (r *StateRestore) DeploymentRestore(deployment *structs.Deployment) error
- 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) JobVersionRestore(version *structs.Job) error
- func (r *StateRestore) NodeRestore(node *structs.Node) error
- func (r *StateRestore) PeriodicLaunchRestore(launch *structs.PeriodicLaunch) error
- func (r *StateRestore) SchedulerConfigRestore(schedConfig *structs.SchedulerConfiguration) error
- func (r *StateRestore) VaultAccessorRestore(accessor *structs.VaultAccessor) error
- type StateSnapshot
- func (s *StateSnapshot) DenormalizeAllocationDiffSlice(allocDiffs []*structs.AllocationDiff) ([]*structs.Allocation, error)
- func (s *StateSnapshot) DenormalizeAllocationSlice(allocs []*structs.Allocation) ([]*structs.Allocation, error)
- func (s *StateSnapshot) DenormalizeAllocationsMap(nodeAllocations map[string][]*structs.Allocation) error
- type StateStore
- func (s *StateStore) ACLPolicies(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) ACLPolicyByName(ws memdb.WatchSet, name string) (*structs.ACLPolicy, error)
- func (s *StateStore) ACLPolicyByNamePrefix(ws memdb.WatchSet, prefix string) (memdb.ResultIterator, error)
- func (s *StateStore) ACLTokenByAccessorID(ws memdb.WatchSet, id string) (*structs.ACLToken, error)
- func (s *StateStore) ACLTokenByAccessorIDPrefix(ws memdb.WatchSet, prefix string) (memdb.ResultIterator, error)
- func (s *StateStore) ACLTokenBySecretID(ws memdb.WatchSet, secretID string) (*structs.ACLToken, error)
- func (s *StateStore) ACLTokens(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) ACLTokensByGlobal(ws memdb.WatchSet, globalVal bool) (memdb.ResultIterator, error)
- func (s *StateStore) Abandon()
- func (s *StateStore) AbandonCh() <-chan struct{}
- func (s *StateStore) AllocByID(ws memdb.WatchSet, id string) (*structs.Allocation, error)
- func (s *StateStore) Allocs(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) AllocsByDeployment(ws memdb.WatchSet, deploymentID string) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByEval(ws memdb.WatchSet, evalID string) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByIDPrefix(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
- func (s *StateStore) AllocsByJob(ws memdb.WatchSet, namespace, jobID string, all bool) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
- func (s *StateStore) AllocsByNode(ws memdb.WatchSet, node string) ([]*structs.Allocation, error)
- func (s *StateStore) AllocsByNodeTerminal(ws memdb.WatchSet, node string, terminal bool) ([]*structs.Allocation, error)
- func (s *StateStore) AutopilotCASConfig(idx, cidx uint64, config *structs.AutopilotConfig) (bool, error)
- func (s *StateStore) AutopilotConfig() (uint64, *structs.AutopilotConfig, error)
- func (s *StateStore) AutopilotSetConfig(idx uint64, config *structs.AutopilotConfig) error
- func (s *StateStore) BatchUpdateNodeDrain(index uint64, updatedAt int64, updates map[string]*structs.DrainUpdate, ...) error
- func (s *StateStore) BlockingQuery(query QueryFn, minIndex uint64, ctx context.Context) (resp interface{}, index uint64, err error)
- func (s *StateStore) BootstrapACLTokens(index, resetIndex uint64, token *structs.ACLToken) error
- func (s *StateStore) CanBootstrapACLToken() (bool, uint64, error)
- func (s *StateStore) Config() *StateStoreConfig
- func (s *StateStore) DeleteACLPolicies(index uint64, names []string) error
- func (s *StateStore) DeleteACLTokens(index uint64, ids []string) error
- func (s *StateStore) DeleteDeployment(index uint64, deploymentIDs []string) error
- func (s *StateStore) DeleteEval(index uint64, evals []string, allocs []string) error
- func (s *StateStore) DeleteJob(index uint64, namespace, jobID string) error
- func (s *StateStore) DeleteJobSummary(index uint64, namespace, id string) error
- func (s *StateStore) DeleteJobTxn(index uint64, namespace, jobID string, txn Txn) error
- func (s *StateStore) DeleteNode(index uint64, nodeID string) error
- func (s *StateStore) DeletePeriodicLaunch(index uint64, namespace, jobID string) error
- func (s *StateStore) DeletePeriodicLaunchTxn(index uint64, namespace, jobID string, txn Txn) error
- func (s *StateStore) DeleteVaultAccessors(index uint64, accessors []*structs.VaultAccessor) error
- func (s *StateStore) DeploymentByID(ws memdb.WatchSet, deploymentID string) (*structs.Deployment, error)
- func (s *StateStore) Deployments(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) DeploymentsByIDPrefix(ws memdb.WatchSet, namespace, deploymentID string) (memdb.ResultIterator, error)
- func (s *StateStore) DeploymentsByJobID(ws memdb.WatchSet, namespace, jobID string, all bool) ([]*structs.Deployment, error)
- func (s *StateStore) DeploymentsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
- func (s *StateStore) EvalByID(ws memdb.WatchSet, id string) (*structs.Evaluation, error)
- func (s *StateStore) Evals(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) EvalsByIDPrefix(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
- func (s *StateStore) EvalsByJob(ws memdb.WatchSet, namespace, jobID string) ([]*structs.Evaluation, error)
- func (s *StateStore) EvalsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
- func (s *StateStore) Index(name string) (uint64, error)
- func (s *StateStore) Indexes() (memdb.ResultIterator, error)
- func (s *StateStore) JobByID(ws memdb.WatchSet, namespace, id string) (*structs.Job, error)
- func (s *StateStore) JobByIDAndVersion(ws memdb.WatchSet, namespace, id string, version uint64) (*structs.Job, error)
- func (s *StateStore) JobByIDTxn(ws memdb.WatchSet, namespace, id string, txn Txn) (*structs.Job, error)
- func (s *StateStore) JobSummaries(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) JobSummaryByID(ws memdb.WatchSet, namespace, jobID string) (*structs.JobSummary, error)
- func (s *StateStore) JobSummaryByPrefix(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
- func (s *StateStore) JobVersions(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) JobVersionsByID(ws memdb.WatchSet, namespace, id string) ([]*structs.Job, error)
- func (s *StateStore) Jobs(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByGC(ws memdb.WatchSet, gc bool) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByIDPrefix(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByPeriodic(ws memdb.WatchSet, periodic bool) (memdb.ResultIterator, error)
- func (s *StateStore) JobsByScheduler(ws memdb.WatchSet, schedulerType string) (memdb.ResultIterator, error)
- func (s *StateStore) LatestDeploymentByJobID(ws memdb.WatchSet, namespace, jobID string) (*structs.Deployment, error)
- func (s *StateStore) LatestIndex() (uint64, error)
- func (s *StateStore) NodeByID(ws memdb.WatchSet, nodeID string) (*structs.Node, error)
- func (s *StateStore) NodeBySecretID(ws memdb.WatchSet, secretID string) (*structs.Node, error)
- func (s *StateStore) Nodes(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) NodesByIDPrefix(ws memdb.WatchSet, nodeID string) (memdb.ResultIterator, error)
- func (s *StateStore) PeriodicLaunchByID(ws memdb.WatchSet, namespace, id string) (*structs.PeriodicLaunch, error)
- func (s *StateStore) PeriodicLaunches(ws memdb.WatchSet) (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) SchedulerCASConfig(idx, cidx uint64, config *structs.SchedulerConfiguration) (bool, error)
- func (s *StateStore) SchedulerConfig() (uint64, *structs.SchedulerConfiguration, error)
- func (s *StateStore) SchedulerSetConfig(idx uint64, config *structs.SchedulerConfiguration) error
- func (s *StateStore) Snapshot() (*StateSnapshot, error)
- func (s *StateStore) SnapshotAfter(ctx context.Context, index uint64) (*StateSnapshot, error)
- func (s *StateStore) UpdateAllocsDesiredTransitions(index uint64, allocs map[string]*structs.DesiredTransition, ...) error
- func (s *StateStore) UpdateAllocsFromClient(index uint64, allocs []*structs.Allocation) error
- func (s *StateStore) UpdateDeploymentAllocHealth(index uint64, req *structs.ApplyDeploymentAllocHealthRequest) error
- func (s *StateStore) UpdateDeploymentPromotion(index uint64, req *structs.ApplyDeploymentPromoteRequest) error
- func (s *StateStore) UpdateDeploymentStatus(index uint64, req *structs.DeploymentStatusUpdateRequest) error
- func (s *StateStore) UpdateJobStability(index uint64, namespace, jobID string, jobVersion uint64, stable bool) error
- func (s *StateStore) UpdateNodeDrain(index uint64, nodeID string, drain *structs.DrainStrategy, markEligible bool, ...) error
- func (s *StateStore) UpdateNodeEligibility(index uint64, nodeID string, eligibility string, updatedAt int64, ...) error
- func (s *StateStore) UpdateNodeStatus(index uint64, nodeID, status string, updatedAt int64, event *structs.NodeEvent) error
- func (s *StateStore) UpsertACLPolicies(index uint64, policies []*structs.ACLPolicy) error
- func (s *StateStore) UpsertACLTokens(index uint64, tokens []*structs.ACLToken) error
- func (s *StateStore) UpsertAllocs(index uint64, allocs []*structs.Allocation) error
- func (s *StateStore) UpsertDeployment(index uint64, deployment *structs.Deployment) error
- func (s *StateStore) UpsertEvals(index uint64, evals []*structs.Evaluation) error
- func (s *StateStore) UpsertEvalsTxn(index uint64, evals []*structs.Evaluation, txn Txn) error
- func (s *StateStore) UpsertJob(index uint64, job *structs.Job) error
- func (s *StateStore) UpsertJobSummary(index uint64, jobSummary *structs.JobSummary) error
- func (s *StateStore) UpsertJobTxn(index uint64, job *structs.Job, txn Txn) error
- func (s *StateStore) UpsertNode(index uint64, node *structs.Node) error
- func (s *StateStore) UpsertNodeEvents(index uint64, nodeEvents map[string][]*structs.NodeEvent) error
- func (s *StateStore) UpsertPeriodicLaunch(index uint64, launch *structs.PeriodicLaunch) error
- func (s *StateStore) UpsertPlanResults(index uint64, results *structs.ApplyPlanResultsRequest) error
- func (s *StateStore) UpsertVaultAccessor(index uint64, accessors []*structs.VaultAccessor) error
- func (s *StateStore) VaultAccessor(ws memdb.WatchSet, accessor string) (*structs.VaultAccessor, error)
- func (s *StateStore) VaultAccessors(ws memdb.WatchSet) (memdb.ResultIterator, error)
- func (s *StateStore) VaultAccessorsByAlloc(ws memdb.WatchSet, allocID string) ([]*structs.VaultAccessor, error)
- func (s *StateStore) VaultAccessorsByNode(ws memdb.WatchSet, nodeID string) ([]*structs.VaultAccessor, error)
- func (s *StateStore) WithWriteTransaction(fn func(Txn) error) error
- type StateStoreConfig
- type Txn
Constants ¶
const ( // NodeRegisterEventReregistered is the message used when the node becomes // reregistered. NodeRegisterEventRegistered = "Node registered" // NodeRegisterEventReregistered is the message used when the node becomes // reregistered. NodeRegisterEventReregistered = "Node re-registered" )
Variables ¶
This section is empty.
Functions ¶
func RegisterSchemaFactories ¶ added in v0.7.0
func RegisterSchemaFactories(factories ...SchemaFactory)
RegisterSchemaFactories is used to register a table schema.
func TestInitState ¶ added in v0.7.0
func TestInitState(t testing.T, state *StateStore)
Types ¶
type IndexEntry ¶
IndexEntry is used with the "index" table for managing the latest Raft index affecting a table.
type QueryFn ¶ added in v0.7.0
type QueryFn func(memdb.WatchSet, *StateStore) (resp interface{}, index uint64, err error)
QueryFn is the definition of a function that can be used to implement a basic blocking query against the state store.
type SchemaFactories ¶ added in v0.7.0
type SchemaFactories []SchemaFactory
func GetFactories ¶ added in v0.7.0
func GetFactories() SchemaFactories
type SchemaFactory ¶ added in v0.7.0
type SchemaFactory func() *memdb.TableSchema
SchemaFactory is the factory method for returning a TableSchema
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) ACLPolicyRestore ¶ added in v0.7.0
func (r *StateRestore) ACLPolicyRestore(policy *structs.ACLPolicy) error
ACLPolicyRestore is used to restore an ACL policy
func (*StateRestore) ACLTokenRestore ¶ added in v0.7.0
func (r *StateRestore) ACLTokenRestore(token *structs.ACLToken) error
ACLTokenRestore is used to restore an ACL token
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) DeploymentRestore ¶ added in v0.6.0
func (r *StateRestore) DeploymentRestore(deployment *structs.Deployment) error
DeploymentRestore is used to restore a deployment
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) JobVersionRestore ¶ added in v0.6.0
func (r *StateRestore) JobVersionRestore(version *structs.Job) error
JobVersionRestore is used to restore a job version
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.
func (*StateRestore) SchedulerConfigRestore ¶ added in v0.9.0
func (r *StateRestore) SchedulerConfigRestore(schedConfig *structs.SchedulerConfiguration) error
func (*StateRestore) VaultAccessorRestore ¶ added in v0.5.0
func (r *StateRestore) VaultAccessorRestore(accessor *structs.VaultAccessor) error
VaultAccessorRestore is used to restore a vault accessor
type StateSnapshot ¶
type StateSnapshot struct {
StateStore
}
StateSnapshot is used to provide a point-in-time snapshot
func (*StateSnapshot) DenormalizeAllocationDiffSlice ¶ added in v0.9.2
func (s *StateSnapshot) DenormalizeAllocationDiffSlice(allocDiffs []*structs.AllocationDiff) ([]*structs.Allocation, error)
DenormalizeAllocationDiffSlice queries the Allocation for each AllocationDiff and merges the updated attributes with the existing Allocation, and attaches the Job provided.
This should only be called on terminal alloc, particularly stopped or preempted allocs
func (*StateSnapshot) DenormalizeAllocationSlice ¶ added in v0.9.2
func (s *StateSnapshot) DenormalizeAllocationSlice(allocs []*structs.Allocation) ([]*structs.Allocation, error)
DenormalizeAllocationSlice queries the Allocation for each allocation diff represented as an Allocation and merges the updated attributes with the existing Allocation, and attaches the Job provided.
func (*StateSnapshot) DenormalizeAllocationsMap ¶ added in v0.9.2
func (s *StateSnapshot) DenormalizeAllocationsMap(nodeAllocations map[string][]*structs.Allocation) error
DenormalizeAllocationsMap takes in a map of nodes to allocations, and queries the Allocation for each of the Allocation diffs and merges the updated attributes with the existing Allocation, and attaches the Job provided
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(config *StateStoreConfig) (*StateStore, error)
NewStateStore is used to create a new state store
func TestStateStore ¶ added in v0.7.0
func TestStateStore(t testing.T) *StateStore
func (*StateStore) ACLPolicies ¶ added in v0.7.0
func (s *StateStore) ACLPolicies(ws memdb.WatchSet) (memdb.ResultIterator, error)
ACLPolicies returns an iterator over all the acl policies
func (*StateStore) ACLPolicyByName ¶ added in v0.7.0
ACLPolicyByName is used to lookup a policy by name
func (*StateStore) ACLPolicyByNamePrefix ¶ added in v0.7.0
func (s *StateStore) ACLPolicyByNamePrefix(ws memdb.WatchSet, prefix string) (memdb.ResultIterator, error)
ACLPolicyByNamePrefix is used to lookup policies by prefix
func (*StateStore) ACLTokenByAccessorID ¶ added in v0.7.0
ACLTokenByAccessorID is used to lookup a token by accessor ID
func (*StateStore) ACLTokenByAccessorIDPrefix ¶ added in v0.7.0
func (s *StateStore) ACLTokenByAccessorIDPrefix(ws memdb.WatchSet, prefix string) (memdb.ResultIterator, error)
ACLTokenByAccessorIDPrefix is used to lookup tokens by prefix
func (*StateStore) ACLTokenBySecretID ¶ added in v0.7.0
func (s *StateStore) ACLTokenBySecretID(ws memdb.WatchSet, secretID string) (*structs.ACLToken, error)
ACLTokenBySecretID is used to lookup a token by secret ID
func (*StateStore) ACLTokens ¶ added in v0.7.0
func (s *StateStore) ACLTokens(ws memdb.WatchSet) (memdb.ResultIterator, error)
ACLTokens returns an iterator over all the tokens
func (*StateStore) ACLTokensByGlobal ¶ added in v0.7.0
func (s *StateStore) ACLTokensByGlobal(ws memdb.WatchSet, globalVal bool) (memdb.ResultIterator, error)
ACLTokensByGlobal returns an iterator over all the tokens filtered by global value
func (*StateStore) Abandon ¶ added in v0.5.5
func (s *StateStore) Abandon()
Abandon is used to signal that the given state store has been abandoned. Calling this more than one time will panic.
func (*StateStore) AbandonCh ¶ added in v0.5.5
func (s *StateStore) AbandonCh() <-chan struct{}
AbandonCh returns a channel you can wait on to know if the state store was abandoned.
func (*StateStore) AllocByID ¶
func (s *StateStore) AllocByID(ws memdb.WatchSet, id string) (*structs.Allocation, error)
AllocByID is used to lookup an allocation by its ID
func (*StateStore) Allocs ¶
func (s *StateStore) Allocs(ws memdb.WatchSet) (memdb.ResultIterator, error)
Allocs returns an iterator over all the evaluations
func (*StateStore) AllocsByDeployment ¶ added in v0.6.0
func (s *StateStore) AllocsByDeployment(ws memdb.WatchSet, deploymentID string) ([]*structs.Allocation, error)
AllocsByDeployment returns all the allocations by deployment id
func (*StateStore) AllocsByEval ¶
func (s *StateStore) AllocsByEval(ws memdb.WatchSet, 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(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
AllocsByIDPrefix is used to lookup allocs by prefix
func (*StateStore) AllocsByJob ¶
func (s *StateStore) AllocsByJob(ws memdb.WatchSet, namespace, jobID string, all bool) ([]*structs.Allocation, error)
AllocsByJob returns all the allocations by job id
func (*StateStore) AllocsByNamespace ¶ added in v0.7.0
func (s *StateStore) AllocsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
AllocsByNamespace returns an iterator over all the allocations in the namespace
func (*StateStore) AllocsByNode ¶
func (s *StateStore) AllocsByNode(ws memdb.WatchSet, node string) ([]*structs.Allocation, error)
AllocsByNode returns all the allocations by node
func (*StateStore) AllocsByNodeTerminal ¶ added in v0.3.0
func (s *StateStore) AllocsByNodeTerminal(ws memdb.WatchSet, node string, terminal bool) ([]*structs.Allocation, error)
AllocsByNode returns all the allocations by node and terminal status
func (*StateStore) AutopilotCASConfig ¶ added in v0.8.0
func (s *StateStore) AutopilotCASConfig(idx, cidx uint64, config *structs.AutopilotConfig) (bool, error)
AutopilotCASConfig is used to try updating the Autopilot configuration with a given Raft index. If the CAS index specified is not equal to the last observed index for the config, then the call is a noop,
func (*StateStore) AutopilotConfig ¶ added in v0.8.0
func (s *StateStore) AutopilotConfig() (uint64, *structs.AutopilotConfig, error)
AutopilotConfig is used to get the current Autopilot configuration.
func (*StateStore) AutopilotSetConfig ¶ added in v0.8.0
func (s *StateStore) AutopilotSetConfig(idx uint64, config *structs.AutopilotConfig) error
AutopilotSetConfig is used to set the current Autopilot configuration.
func (*StateStore) BatchUpdateNodeDrain ¶ added in v0.8.0
func (s *StateStore) BatchUpdateNodeDrain(index uint64, updatedAt int64, updates map[string]*structs.DrainUpdate, events map[string]*structs.NodeEvent) error
BatchUpdateNodeDrain is used to update the drain of a node set of nodes
func (*StateStore) BlockingQuery ¶ added in v0.7.0
func (s *StateStore) BlockingQuery(query QueryFn, minIndex uint64, ctx context.Context) ( resp interface{}, index uint64, err error)
BlockingQuery takes a query function and runs the function until the minimum query index is met or until the passed context is cancelled.
func (*StateStore) BootstrapACLTokens ¶ added in v0.7.0
func (s *StateStore) BootstrapACLTokens(index, resetIndex uint64, token *structs.ACLToken) error
BootstrapACLToken is used to create an initial ACL token
func (*StateStore) CanBootstrapACLToken ¶ added in v0.7.0
func (s *StateStore) CanBootstrapACLToken() (bool, uint64, error)
CanBootstrapACLToken checks if bootstrapping is possible and returns the reset index
func (*StateStore) Config ¶ added in v0.7.0
func (s *StateStore) Config() *StateStoreConfig
Config returns the state store configuration.
func (*StateStore) DeleteACLPolicies ¶ added in v0.7.0
func (s *StateStore) DeleteACLPolicies(index uint64, names []string) error
DeleteACLPolicies deletes the policies with the given names
func (*StateStore) DeleteACLTokens ¶ added in v0.7.0
func (s *StateStore) DeleteACLTokens(index uint64, ids []string) error
DeleteACLTokens deletes the tokens with the given accessor ids
func (*StateStore) DeleteDeployment ¶ added in v0.6.0
func (s *StateStore) DeleteDeployment(index uint64, deploymentIDs []string) error
DeleteDeployment is used to delete a set of deployments by ID
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, namespace, jobID string) error
DeleteJob is used to deregister a job
func (*StateStore) DeleteJobSummary ¶ added in v0.4.1
func (s *StateStore) DeleteJobSummary(index uint64, namespace, id string) error
DeleteJobSummary deletes the job summary with the given ID. This is for testing purposes only.
func (*StateStore) DeleteJobTxn ¶ added in v0.8.7
func (s *StateStore) DeleteJobTxn(index uint64, namespace, jobID string, txn Txn) error
DeleteJobTxn is used to deregister a job, like DeleteJob, but in a transaction. Useful for when making multiple modifications atomically
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, namespace, jobID string) error
DeletePeriodicLaunch is used to delete the periodic launch
func (*StateStore) DeletePeriodicLaunchTxn ¶ added in v0.8.7
func (s *StateStore) DeletePeriodicLaunchTxn(index uint64, namespace, jobID string, txn Txn) error
DeletePeriodicLaunchTxn is used to delete the periodic launch, like DeletePeriodicLaunch but in a transaction. Useful for when making multiple modifications atomically
func (*StateStore) DeleteVaultAccessors ¶ added in v0.5.0
func (s *StateStore) DeleteVaultAccessors(index uint64, accessors []*structs.VaultAccessor) error
DeleteVaultAccessors is used to delete a set of Vault Accessors
func (*StateStore) DeploymentByID ¶ added in v0.6.0
func (s *StateStore) DeploymentByID(ws memdb.WatchSet, deploymentID string) (*structs.Deployment, error)
func (*StateStore) Deployments ¶ added in v0.6.0
func (s *StateStore) Deployments(ws memdb.WatchSet) (memdb.ResultIterator, error)
func (*StateStore) DeploymentsByIDPrefix ¶ added in v0.6.0
func (s *StateStore) DeploymentsByIDPrefix(ws memdb.WatchSet, namespace, deploymentID string) (memdb.ResultIterator, error)
func (*StateStore) DeploymentsByJobID ¶ added in v0.6.0
func (s *StateStore) DeploymentsByJobID(ws memdb.WatchSet, namespace, jobID string, all bool) ([]*structs.Deployment, error)
func (*StateStore) DeploymentsByNamespace ¶ added in v0.7.0
func (s *StateStore) DeploymentsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
func (*StateStore) EvalByID ¶
func (s *StateStore) EvalByID(ws memdb.WatchSet, id string) (*structs.Evaluation, error)
EvalByID is used to lookup an eval by its ID
func (*StateStore) Evals ¶
func (s *StateStore) Evals(ws memdb.WatchSet) (memdb.ResultIterator, error)
Evals returns an iterator over all the evaluations
func (*StateStore) EvalsByIDPrefix ¶ added in v0.3.0
func (s *StateStore) EvalsByIDPrefix(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
EvalsByIDPrefix is used to lookup evaluations by prefix in a particular namespace
func (*StateStore) EvalsByJob ¶
func (s *StateStore) EvalsByJob(ws memdb.WatchSet, namespace, jobID string) ([]*structs.Evaluation, error)
EvalsByJob returns all the evaluations by job id
func (*StateStore) EvalsByNamespace ¶ added in v0.7.0
func (s *StateStore) EvalsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
EvalsByNamespace returns an iterator over all the evaluations in the given namespace
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 ¶
JobByID is used to lookup a job by its ID. JobByID returns the current/latest job version.
func (*StateStore) JobByIDAndVersion ¶ added in v0.6.0
func (s *StateStore) JobByIDAndVersion(ws memdb.WatchSet, namespace, id string, version uint64) (*structs.Job, error)
JobByIDAndVersion returns the job identified by its ID and Version. The passed watchset may be nil.
func (*StateStore) JobByIDTxn ¶ added in v0.8.7
func (s *StateStore) JobByIDTxn(ws memdb.WatchSet, namespace, id string, txn Txn) (*structs.Job, error)
JobByIDTxn is used to lookup a job by its ID, like JobByID. JobByID returns the job version accessible through in the transaction
func (*StateStore) JobSummaries ¶ added in v0.4.1
func (s *StateStore) JobSummaries(ws memdb.WatchSet) (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(ws memdb.WatchSet, namespace, 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(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
JobSummaryByPrefix is used to look up Job Summary by id prefix
func (*StateStore) JobVersions ¶ added in v0.6.0
func (s *StateStore) JobVersions(ws memdb.WatchSet) (memdb.ResultIterator, error)
func (*StateStore) JobVersionsByID ¶ added in v0.6.0
func (s *StateStore) JobVersionsByID(ws memdb.WatchSet, namespace, id string) ([]*structs.Job, error)
JobVersionsByID returns all the tracked versions of a job.
func (*StateStore) Jobs ¶
func (s *StateStore) Jobs(ws memdb.WatchSet) (memdb.ResultIterator, error)
Jobs returns an iterator over all the jobs
func (*StateStore) JobsByGC ¶ added in v0.3.0
func (s *StateStore) JobsByGC(ws memdb.WatchSet, 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(ws memdb.WatchSet, namespace, id string) (memdb.ResultIterator, error)
JobsByIDPrefix is used to lookup a job by prefix
func (*StateStore) JobsByNamespace ¶ added in v0.7.0
func (s *StateStore) JobsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error)
JobsByNamespace returns an iterator over all the jobs for the given namespace
func (*StateStore) JobsByPeriodic ¶ added in v0.3.0
func (s *StateStore) JobsByPeriodic(ws memdb.WatchSet, 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(ws memdb.WatchSet, schedulerType string) (memdb.ResultIterator, error)
JobsByScheduler returns an iterator over all the jobs with the specific scheduler type.
func (*StateStore) LatestDeploymentByJobID ¶ added in v0.6.0
func (s *StateStore) LatestDeploymentByJobID(ws memdb.WatchSet, namespace, jobID string) (*structs.Deployment, error)
LatestDeploymentByJobID returns the latest deployment for the given job. The latest is determined strictly by CreateIndex.
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) NodeBySecretID ¶ added in v0.7.0
NodeBySecretID is used to lookup a node by SecretID
func (*StateStore) Nodes ¶
func (s *StateStore) Nodes(ws memdb.WatchSet) (memdb.ResultIterator, error)
Nodes returns an iterator over all the nodes
func (*StateStore) NodesByIDPrefix ¶ added in v0.3.0
func (s *StateStore) NodesByIDPrefix(ws memdb.WatchSet, 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(ws memdb.WatchSet, namespace, 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(ws memdb.WatchSet) (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) SchedulerCASConfig ¶ added in v0.9.0
func (s *StateStore) SchedulerCASConfig(idx, cidx uint64, config *structs.SchedulerConfiguration) (bool, error)
SchedulerCASConfig is used to update the scheduler configuration with a given Raft index. If the CAS index specified is not equal to the last observed index for the config, then the call is a noop.
func (*StateStore) SchedulerConfig ¶ added in v0.9.0
func (s *StateStore) SchedulerConfig() (uint64, *structs.SchedulerConfiguration, error)
SchedulerConfig is used to get the current Scheduler configuration.
func (*StateStore) SchedulerSetConfig ¶ added in v0.9.0
func (s *StateStore) SchedulerSetConfig(idx uint64, config *structs.SchedulerConfiguration) error
SchedulerSetConfig is used to set the current Scheduler configuration.
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) SnapshotAfter ¶ added in v0.9.2
func (s *StateStore) SnapshotAfter(ctx context.Context, index uint64) (*StateSnapshot, error)
SnapshotAfter is used to create a point in time snapshot where the index is guaranteed to be greater than or equal to the index parameter.
Some server operations (such as scheduling) exchange objects via RPC concurrent with Raft log application, so they must ensure the state store snapshot they are operating on is at or after the index the objects retrieved via RPC were applied to the Raft log at.
Callers should maintain their own timer metric as the time this method blocks indicates Raft log application latency relative to scheduling.
func (*StateStore) UpdateAllocsDesiredTransitions ¶ added in v0.8.0
func (s *StateStore) UpdateAllocsDesiredTransitions(index uint64, allocs map[string]*structs.DesiredTransition, evals []*structs.Evaluation) error
UpdateAllocsDesiredTransitions is used to update a set of allocations desired transitions.
func (*StateStore) UpdateAllocsFromClient ¶ added in v0.3.0
func (s *StateStore) UpdateAllocsFromClient(index uint64, allocs []*structs.Allocation) error
UpdateAllocsFromClient is used to update an allocation based on input 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) UpdateDeploymentAllocHealth ¶ added in v0.6.0
func (s *StateStore) UpdateDeploymentAllocHealth(index uint64, req *structs.ApplyDeploymentAllocHealthRequest) error
UpdateDeploymentAllocHealth is used to update the health of allocations as part of the deployment and potentially make a evaluation
func (*StateStore) UpdateDeploymentPromotion ¶ added in v0.6.0
func (s *StateStore) UpdateDeploymentPromotion(index uint64, req *structs.ApplyDeploymentPromoteRequest) error
UpdateDeploymentPromotion is used to promote canaries in a deployment and potentially make a evaluation
func (*StateStore) UpdateDeploymentStatus ¶ added in v0.6.0
func (s *StateStore) UpdateDeploymentStatus(index uint64, req *structs.DeploymentStatusUpdateRequest) error
UpdateDeploymentStatus is used to make deployment status updates and potentially make a evaluation
func (*StateStore) UpdateJobStability ¶ added in v0.6.0
func (s *StateStore) UpdateJobStability(index uint64, namespace, jobID string, jobVersion uint64, stable bool) error
UpdateJobStability updates the stability of the given job and version to the desired status.
func (*StateStore) UpdateNodeDrain ¶
func (s *StateStore) UpdateNodeDrain(index uint64, nodeID string, drain *structs.DrainStrategy, markEligible bool, updatedAt int64, event *structs.NodeEvent) error
UpdateNodeDrain is used to update the drain of a node
func (*StateStore) UpdateNodeEligibility ¶ added in v0.8.0
func (s *StateStore) UpdateNodeEligibility(index uint64, nodeID string, eligibility string, updatedAt int64, event *structs.NodeEvent) error
UpdateNodeEligibility is used to update the scheduling eligibility of a node
func (*StateStore) UpdateNodeStatus ¶
func (s *StateStore) UpdateNodeStatus(index uint64, nodeID, status string, updatedAt int64, event *structs.NodeEvent) error
UpdateNodeStatus is used to update the status of a node
func (*StateStore) UpsertACLPolicies ¶ added in v0.7.0
func (s *StateStore) UpsertACLPolicies(index uint64, policies []*structs.ACLPolicy) error
UpsertACLPolicies is used to create or update a set of ACL policies
func (*StateStore) UpsertACLTokens ¶ added in v0.7.0
func (s *StateStore) UpsertACLTokens(index uint64, tokens []*structs.ACLToken) error
UpsertACLTokens is used to create or update a set of ACL tokens
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) UpsertDeployment ¶ added in v0.6.0
func (s *StateStore) UpsertDeployment(index uint64, deployment *structs.Deployment) error
UpsertDeployment is used to insert a new deployment. If cancelPrior is set to true, all prior deployments for the same job will be cancelled.
func (*StateStore) UpsertEvals ¶
func (s *StateStore) UpsertEvals(index uint64, evals []*structs.Evaluation) error
UpsertEvals is used to upsert a set of evaluations
func (*StateStore) UpsertEvalsTxn ¶ added in v0.8.7
func (s *StateStore) UpsertEvalsTxn(index uint64, evals []*structs.Evaluation, txn Txn) error
UpsertEvals is used to upsert a set of evaluations, like UpsertEvals but in a transaction. Useful for when making multiple modifications atomically
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) UpsertJobTxn ¶ added in v0.8.7
UpsertJobTxn is used to register a job or update a job definition, like UpsertJob, but in a transaction. Useful for when making multiple modifications atomically
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/eligibility which is set by the scheduler.
func (*StateStore) UpsertNodeEvents ¶ added in v0.8.0
func (s *StateStore) UpsertNodeEvents(index uint64, nodeEvents map[string][]*structs.NodeEvent) error
UpsertNodeEvents adds the node events to the nodes, rotating events as necessary.
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) UpsertPlanResults ¶ added in v0.6.0
func (s *StateStore) UpsertPlanResults(index uint64, results *structs.ApplyPlanResultsRequest) error
UpsertPlanResults is used to upsert the results of a plan.
func (*StateStore) UpsertVaultAccessor ¶ added in v0.5.0
func (s *StateStore) UpsertVaultAccessor(index uint64, accessors []*structs.VaultAccessor) error
UpsertVaultAccessors is used to register a set of Vault Accessors
func (*StateStore) VaultAccessor ¶ added in v0.5.0
func (s *StateStore) VaultAccessor(ws memdb.WatchSet, accessor string) (*structs.VaultAccessor, error)
VaultAccessor returns the given Vault accessor
func (*StateStore) VaultAccessors ¶ added in v0.5.0
func (s *StateStore) VaultAccessors(ws memdb.WatchSet) (memdb.ResultIterator, error)
VaultAccessors returns an iterator of Vault accessors.
func (*StateStore) VaultAccessorsByAlloc ¶ added in v0.5.0
func (s *StateStore) VaultAccessorsByAlloc(ws memdb.WatchSet, allocID string) ([]*structs.VaultAccessor, error)
VaultAccessorsByAlloc returns all the Vault accessors by alloc id
func (*StateStore) VaultAccessorsByNode ¶ added in v0.5.0
func (s *StateStore) VaultAccessorsByNode(ws memdb.WatchSet, nodeID string) ([]*structs.VaultAccessor, error)
VaultAccessorsByNode returns all the Vault accessors by node id
func (*StateStore) WithWriteTransaction ¶ added in v0.8.7
func (s *StateStore) WithWriteTransaction(fn func(Txn) error) error
WithWriteTransaction executes the passed function within a write transaction, and returns its result. If the invocation returns no error, the transaction is committed; otherwise, it's aborted.
type StateStoreConfig ¶ added in v0.7.0
type StateStoreConfig struct { // Logger is used to output the state store's logs Logger log.Logger // Region is the region of the server embedding the state store. Region string }
StateStoreConfig is used to configure a new state store