id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
132,000
hashicorp/nomad
nomad/worker.go
dequeueEvaluation
func (w *Worker) dequeueEvaluation(timeout time.Duration) ( eval *structs.Evaluation, token string, waitIndex uint64, shutdown bool) { // Setup the request req := structs.EvalDequeueRequest{ Schedulers: w.srv.config.EnabledSchedulers, Timeout: timeout, SchedulerVersion: scheduler.SchedulerVersio...
go
func (w *Worker) dequeueEvaluation(timeout time.Duration) ( eval *structs.Evaluation, token string, waitIndex uint64, shutdown bool) { // Setup the request req := structs.EvalDequeueRequest{ Schedulers: w.srv.config.EnabledSchedulers, Timeout: timeout, SchedulerVersion: scheduler.SchedulerVersio...
[ "func", "(", "w", "*", "Worker", ")", "dequeueEvaluation", "(", "timeout", "time", ".", "Duration", ")", "(", "eval", "*", "structs", ".", "Evaluation", ",", "token", "string", ",", "waitIndex", "uint64", ",", "shutdown", "bool", ")", "{", "// Setup the re...
// dequeueEvaluation is used to fetch the next ready evaluation. // This blocks until an evaluation is available or a timeout is reached.
[ "dequeueEvaluation", "is", "used", "to", "fetch", "the", "next", "ready", "evaluation", ".", "This", "blocks", "until", "an", "evaluation", "is", "available", "or", "a", "timeout", "is", "reached", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L142-L194
132,001
hashicorp/nomad
nomad/worker.go
sendAck
func (w *Worker) sendAck(evalID, token string, ack bool) { defer metrics.MeasureSince([]string{"nomad", "worker", "send_ack"}, time.Now()) // Setup the request req := structs.EvalAckRequest{ EvalID: evalID, Token: token, WriteRequest: structs.WriteRequest{ Region: w.srv.config.Region, }, } var resp str...
go
func (w *Worker) sendAck(evalID, token string, ack bool) { defer metrics.MeasureSince([]string{"nomad", "worker", "send_ack"}, time.Now()) // Setup the request req := structs.EvalAckRequest{ EvalID: evalID, Token: token, WriteRequest: structs.WriteRequest{ Region: w.srv.config.Region, }, } var resp str...
[ "func", "(", "w", "*", "Worker", ")", "sendAck", "(", "evalID", ",", "token", "string", ",", "ack", "bool", ")", "{", "defer", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ",", ...
// sendAck makes a best effort to ack or nack the evaluation. // Any errors are logged but swallowed.
[ "sendAck", "makes", "a", "best", "effort", "to", "ack", "or", "nack", "the", "evaluation", ".", "Any", "errors", "are", "logged", "but", "swallowed", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L198-L225
132,002
hashicorp/nomad
nomad/worker.go
invokeScheduler
func (w *Worker) invokeScheduler(eval *structs.Evaluation, token string) error { defer metrics.MeasureSince([]string{"nomad", "worker", "invoke_scheduler", eval.Type}, time.Now()) // Store the evaluation token w.evalToken = token // Snapshot the current state snap, err := w.srv.fsm.State().Snapshot() if err != n...
go
func (w *Worker) invokeScheduler(eval *structs.Evaluation, token string) error { defer metrics.MeasureSince([]string{"nomad", "worker", "invoke_scheduler", eval.Type}, time.Now()) // Store the evaluation token w.evalToken = token // Snapshot the current state snap, err := w.srv.fsm.State().Snapshot() if err != n...
[ "func", "(", "w", "*", "Worker", ")", "invokeScheduler", "(", "eval", "*", "structs", ".", "Evaluation", ",", "token", "string", ")", "error", "{", "defer", "metrics", ".", "MeasureSince", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",...
// invokeScheduler is used to invoke the business logic of the scheduler
[ "invokeScheduler", "is", "used", "to", "invoke", "the", "business", "logic", "of", "the", "scheduler" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L265-L299
132,003
hashicorp/nomad
nomad/worker.go
SubmitPlan
func (w *Worker) SubmitPlan(plan *structs.Plan) (*structs.PlanResult, scheduler.State, error) { // Check for a shutdown before plan submission if w.srv.IsShutdown() { return nil, nil, fmt.Errorf("shutdown while planning") } defer metrics.MeasureSince([]string{"nomad", "worker", "submit_plan"}, time.Now()) // Ad...
go
func (w *Worker) SubmitPlan(plan *structs.Plan) (*structs.PlanResult, scheduler.State, error) { // Check for a shutdown before plan submission if w.srv.IsShutdown() { return nil, nil, fmt.Errorf("shutdown while planning") } defer metrics.MeasureSince([]string{"nomad", "worker", "submit_plan"}, time.Now()) // Ad...
[ "func", "(", "w", "*", "Worker", ")", "SubmitPlan", "(", "plan", "*", "structs", ".", "Plan", ")", "(", "*", "structs", ".", "PlanResult", ",", "scheduler", ".", "State", ",", "error", ")", "{", "// Check for a shutdown before plan submission", "if", "w", ...
// SubmitPlan is used to submit a plan for consideration. This allows // the worker to act as the planner for the scheduler.
[ "SubmitPlan", "is", "used", "to", "submit", "a", "plan", "for", "consideration", ".", "This", "allows", "the", "worker", "to", "act", "as", "the", "planner", "for", "the", "scheduler", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L303-L369
132,004
hashicorp/nomad
nomad/worker.go
UpdateEval
func (w *Worker) UpdateEval(eval *structs.Evaluation) error { // Check for a shutdown before plan submission if w.srv.IsShutdown() { return fmt.Errorf("shutdown while planning") } defer metrics.MeasureSince([]string{"nomad", "worker", "update_eval"}, time.Now()) // Store the snapshot index in the eval eval.Sna...
go
func (w *Worker) UpdateEval(eval *structs.Evaluation) error { // Check for a shutdown before plan submission if w.srv.IsShutdown() { return fmt.Errorf("shutdown while planning") } defer metrics.MeasureSince([]string{"nomad", "worker", "update_eval"}, time.Now()) // Store the snapshot index in the eval eval.Sna...
[ "func", "(", "w", "*", "Worker", ")", "UpdateEval", "(", "eval", "*", "structs", ".", "Evaluation", ")", "error", "{", "// Check for a shutdown before plan submission", "if", "w", ".", "srv", ".", "IsShutdown", "(", ")", "{", "return", "fmt", ".", "Errorf", ...
// UpdateEval is used to submit an updated evaluation. This allows // the worker to act as the planner for the scheduler.
[ "UpdateEval", "is", "used", "to", "submit", "an", "updated", "evaluation", ".", "This", "allows", "the", "worker", "to", "act", "as", "the", "planner", "for", "the", "scheduler", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L373-L406
132,005
hashicorp/nomad
nomad/worker.go
ReblockEval
func (w *Worker) ReblockEval(eval *structs.Evaluation) error { // Check for a shutdown before plan submission if w.srv.IsShutdown() { return fmt.Errorf("shutdown while planning") } defer metrics.MeasureSince([]string{"nomad", "worker", "reblock_eval"}, time.Now()) // Update the evaluation if the queued jobs is ...
go
func (w *Worker) ReblockEval(eval *structs.Evaluation) error { // Check for a shutdown before plan submission if w.srv.IsShutdown() { return fmt.Errorf("shutdown while planning") } defer metrics.MeasureSince([]string{"nomad", "worker", "reblock_eval"}, time.Now()) // Update the evaluation if the queued jobs is ...
[ "func", "(", "w", "*", "Worker", ")", "ReblockEval", "(", "eval", "*", "structs", ".", "Evaluation", ")", "error", "{", "// Check for a shutdown before plan submission", "if", "w", ".", "srv", ".", "IsShutdown", "(", ")", "{", "return", "fmt", ".", "Errorf",...
// ReblockEval is used to reinsert a blocked evaluation into the blocked eval // tracker. This allows the worker to act as the planner for the scheduler.
[ "ReblockEval", "is", "used", "to", "reinsert", "a", "blocked", "evaluation", "into", "the", "blocked", "eval", "tracker", ".", "This", "allows", "the", "worker", "to", "act", "as", "the", "planner", "for", "the", "scheduler", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L447-L504
132,006
hashicorp/nomad
nomad/worker.go
shouldResubmit
func (w *Worker) shouldResubmit(err error) bool { s := err.Error() switch { case strings.Contains(s, "No cluster leader"): return true case strings.Contains(s, "plan queue is disabled"): return true default: return false } }
go
func (w *Worker) shouldResubmit(err error) bool { s := err.Error() switch { case strings.Contains(s, "No cluster leader"): return true case strings.Contains(s, "plan queue is disabled"): return true default: return false } }
[ "func", "(", "w", "*", "Worker", ")", "shouldResubmit", "(", "err", "error", ")", "bool", "{", "s", ":=", "err", ".", "Error", "(", ")", "\n", "switch", "{", "case", "strings", ".", "Contains", "(", "s", ",", "\"", "\"", ")", ":", "return", "true...
// shouldResubmit checks if a given error should be swallowed and the plan // resubmitted after a backoff. Usually these are transient errors that // the cluster should heal from quickly.
[ "shouldResubmit", "checks", "if", "a", "given", "error", "should", "be", "swallowed", "and", "the", "plan", "resubmitted", "after", "a", "backoff", ".", "Usually", "these", "are", "transient", "errors", "that", "the", "cluster", "should", "heal", "from", "quic...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L509-L519
132,007
hashicorp/nomad
nomad/worker.go
backoffErr
func (w *Worker) backoffErr(base, limit time.Duration) bool { backoff := (1 << (2 * w.failures)) * base if backoff > limit { backoff = limit } else { w.failures++ } select { case <-time.After(backoff): return false case <-w.srv.shutdownCh: return true } }
go
func (w *Worker) backoffErr(base, limit time.Duration) bool { backoff := (1 << (2 * w.failures)) * base if backoff > limit { backoff = limit } else { w.failures++ } select { case <-time.After(backoff): return false case <-w.srv.shutdownCh: return true } }
[ "func", "(", "w", "*", "Worker", ")", "backoffErr", "(", "base", ",", "limit", "time", ".", "Duration", ")", "bool", "{", "backoff", ":=", "(", "1", "<<", "(", "2", "*", "w", ".", "failures", ")", ")", "*", "base", "\n", "if", "backoff", ">", "...
// backoffErr is used to do an exponential back off on error. This is // maintained statefully for the worker. Returns if attempts should be // abandoned due to shutdown.
[ "backoffErr", "is", "used", "to", "do", "an", "exponential", "back", "off", "on", "error", ".", "This", "is", "maintained", "statefully", "for", "the", "worker", ".", "Returns", "if", "attempts", "should", "be", "abandoned", "due", "to", "shutdown", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/worker.go#L524-L537
132,008
hashicorp/nomad
client/fingerprint_manager.go
NewFingerprintManager
func NewFingerprintManager( singletonLoader loader.PluginCatalog, getConfig func() *config.Config, node *structs.Node, shutdownCh chan struct{}, updateNodeAttributes func(*fingerprint.FingerprintResponse) *structs.Node, logger log.Logger) *FingerprintManager { return &FingerprintManager{ singletonLoader: ...
go
func NewFingerprintManager( singletonLoader loader.PluginCatalog, getConfig func() *config.Config, node *structs.Node, shutdownCh chan struct{}, updateNodeAttributes func(*fingerprint.FingerprintResponse) *structs.Node, logger log.Logger) *FingerprintManager { return &FingerprintManager{ singletonLoader: ...
[ "func", "NewFingerprintManager", "(", "singletonLoader", "loader", ".", "PluginCatalog", ",", "getConfig", "func", "(", ")", "*", "config", ".", "Config", ",", "node", "*", "structs", ".", "Node", ",", "shutdownCh", "chan", "struct", "{", "}", ",", "updateNo...
// NewFingerprintManager is a constructor that creates and returns an instance // of FingerprintManager
[ "NewFingerprintManager", "is", "a", "constructor", "that", "creates", "and", "returns", "an", "instance", "of", "FingerprintManager" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/client/fingerprint_manager.go#L32-L48
132,009
hashicorp/nomad
client/fingerprint_manager.go
setNode
func (fm *FingerprintManager) setNode(node *structs.Node) { fm.nodeLock.Lock() defer fm.nodeLock.Unlock() fm.node = node }
go
func (fm *FingerprintManager) setNode(node *structs.Node) { fm.nodeLock.Lock() defer fm.nodeLock.Unlock() fm.node = node }
[ "func", "(", "fm", "*", "FingerprintManager", ")", "setNode", "(", "node", "*", "structs", ".", "Node", ")", "{", "fm", ".", "nodeLock", ".", "Lock", "(", ")", "\n", "defer", "fm", ".", "nodeLock", ".", "Unlock", "(", ")", "\n", "fm", ".", "node", ...
// setNode updates the current client node
[ "setNode", "updates", "the", "current", "client", "node" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/client/fingerprint_manager.go#L51-L55
132,010
hashicorp/nomad
client/fingerprint_manager.go
setupFingerprinters
func (fm *FingerprintManager) setupFingerprinters(fingerprints []string) error { var appliedFingerprints []string for _, name := range fingerprints { f, err := fingerprint.NewFingerprint(name, fm.logger) if err != nil { fm.logger.Error("error fingerprinting", "error", err, "fingerprinter", name) return er...
go
func (fm *FingerprintManager) setupFingerprinters(fingerprints []string) error { var appliedFingerprints []string for _, name := range fingerprints { f, err := fingerprint.NewFingerprint(name, fm.logger) if err != nil { fm.logger.Error("error fingerprinting", "error", err, "fingerprinter", name) return er...
[ "func", "(", "fm", "*", "FingerprintManager", ")", "setupFingerprinters", "(", "fingerprints", "[", "]", "string", ")", "error", "{", "var", "appliedFingerprints", "[", "]", "string", "\n\n", "for", "_", ",", "name", ":=", "range", "fingerprints", "{", "f", ...
// setupFingerprints is used to fingerprint the node to see if these attributes are // supported
[ "setupFingerprints", "is", "used", "to", "fingerprint", "the", "node", "to", "see", "if", "these", "attributes", "are", "supported" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/client/fingerprint_manager.go#L108-L137
132,011
hashicorp/nomad
client/fingerprint_manager.go
runFingerprint
func (fm *FingerprintManager) runFingerprint(f fingerprint.Fingerprint, period time.Duration, name string) { fm.logger.Debug("fingerprinting periodically", "fingerprinter", name, "period", period) timer := time.NewTimer(period) defer timer.Stop() for { select { case <-timer.C: timer.Reset(period) _, er...
go
func (fm *FingerprintManager) runFingerprint(f fingerprint.Fingerprint, period time.Duration, name string) { fm.logger.Debug("fingerprinting periodically", "fingerprinter", name, "period", period) timer := time.NewTimer(period) defer timer.Stop() for { select { case <-timer.C: timer.Reset(period) _, er...
[ "func", "(", "fm", "*", "FingerprintManager", ")", "runFingerprint", "(", "f", "fingerprint", ".", "Fingerprint", ",", "period", "time", ".", "Duration", ",", "name", "string", ")", "{", "fm", ".", "logger", ".", "Debug", "(", "\"", "\"", ",", "\"", "\...
// runFingerprint runs each fingerprinter individually on an ongoing basis
[ "runFingerprint", "runs", "each", "fingerprinter", "individually", "on", "an", "ongoing", "basis" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/client/fingerprint_manager.go#L140-L161
132,012
hashicorp/nomad
client/fingerprint_manager.go
fingerprint
func (fm *FingerprintManager) fingerprint(name string, f fingerprint.Fingerprint) (bool, error) { var response fingerprint.FingerprintResponse fm.nodeLock.Lock() request := &fingerprint.FingerprintRequest{Config: fm.getConfig(), Node: fm.node} err := f.Fingerprint(request, &response) fm.nodeLock.Unlock() if err...
go
func (fm *FingerprintManager) fingerprint(name string, f fingerprint.Fingerprint) (bool, error) { var response fingerprint.FingerprintResponse fm.nodeLock.Lock() request := &fingerprint.FingerprintRequest{Config: fm.getConfig(), Node: fm.node} err := f.Fingerprint(request, &response) fm.nodeLock.Unlock() if err...
[ "func", "(", "fm", "*", "FingerprintManager", ")", "fingerprint", "(", "name", "string", ",", "f", "fingerprint", ".", "Fingerprint", ")", "(", "bool", ",", "error", ")", "{", "var", "response", "fingerprint", ".", "FingerprintResponse", "\n\n", "fm", ".", ...
// fingerprint does an initial fingerprint of the client. If the fingerprinter // is meant to be run continuously, a process is launched to perform this // fingerprint on an ongoing basis in the background.
[ "fingerprint", "does", "an", "initial", "fingerprint", "of", "the", "client", ".", "If", "the", "fingerprinter", "is", "meant", "to", "be", "run", "continuously", "a", "process", "is", "launched", "to", "perform", "this", "fingerprint", "on", "an", "ongoing", ...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/client/fingerprint_manager.go#L166-L183
132,013
hashicorp/nomad
e2e/framework/framework.go
New
func New() *Framework { env := Environment{ Name: *fEnv, Provider: *fProvider, OS: *fOS, Arch: *fArch, Tags: map[string]struct{}{}, } for _, tag := range strings.Split(*fTags, ",") { env.Tags[tag] = struct{}{} } return &Framework{ provisioner: DefaultProvisioner, env: env,...
go
func New() *Framework { env := Environment{ Name: *fEnv, Provider: *fProvider, OS: *fOS, Arch: *fArch, Tags: map[string]struct{}{}, } for _, tag := range strings.Split(*fTags, ",") { env.Tags[tag] = struct{}{} } return &Framework{ provisioner: DefaultProvisioner, env: env,...
[ "func", "New", "(", ")", "*", "Framework", "{", "env", ":=", "Environment", "{", "Name", ":", "*", "fEnv", ",", "Provider", ":", "*", "fProvider", ",", "OS", ":", "*", "fOS", ",", "Arch", ":", "*", "fArch", ",", "Tags", ":", "map", "[", "string",...
// New creates a Framework
[ "New", "creates", "a", "Framework" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/e2e/framework/framework.go#L52-L70
132,014
hashicorp/nomad
e2e/framework/framework.go
AddSuites
func (f *Framework) AddSuites(s ...*TestSuite) *Framework { f.suites = append(f.suites, s...) return f }
go
func (f *Framework) AddSuites(s ...*TestSuite) *Framework { f.suites = append(f.suites, s...) return f }
[ "func", "(", "f", "*", "Framework", ")", "AddSuites", "(", "s", "...", "*", "TestSuite", ")", "*", "Framework", "{", "f", ".", "suites", "=", "append", "(", "f", ".", "suites", ",", "s", "...", ")", "\n", "return", "f", "\n", "}" ]
// AddSuites adds a set of test suites to a Framework
[ "AddSuites", "adds", "a", "set", "of", "test", "suites", "to", "a", "Framework" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/e2e/framework/framework.go#L73-L76
132,015
hashicorp/nomad
e2e/framework/framework.go
Run
func (f *Framework) Run(t *testing.T) { for _, s := range f.suites { t.Run(s.Component, func(t *testing.T) { skip, err := f.runSuite(t, s) if skip { t.Skipf("skipping suite '%s': %v", s.Component, err) return } if err != nil { t.Errorf("error starting suite '%s': %v", s.Component, err) } ...
go
func (f *Framework) Run(t *testing.T) { for _, s := range f.suites { t.Run(s.Component, func(t *testing.T) { skip, err := f.runSuite(t, s) if skip { t.Skipf("skipping suite '%s': %v", s.Component, err) return } if err != nil { t.Errorf("error starting suite '%s': %v", s.Component, err) } ...
[ "func", "(", "f", "*", "Framework", ")", "Run", "(", "t", "*", "testing", ".", "T", ")", "{", "for", "_", ",", "s", ":=", "range", "f", ".", "suites", "{", "t", ".", "Run", "(", "s", ".", "Component", ",", "func", "(", "t", "*", "testing", ...
// Run starts the test framework, running each TestSuite
[ "Run", "starts", "the", "test", "framework", "running", "each", "TestSuite" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/e2e/framework/framework.go#L85-L99
132,016
hashicorp/nomad
e2e/framework/framework.go
runSuite
func (f *Framework) runSuite(t *testing.T, s *TestSuite) (skip bool, err error) { // If -forceRun is set, skip all constraint checks if !f.force { // If this is a local run, check that the suite supports running locally if !s.CanRunLocal && f.isLocalRun { return true, fmt.Errorf("local run detected and suite ...
go
func (f *Framework) runSuite(t *testing.T, s *TestSuite) (skip bool, err error) { // If -forceRun is set, skip all constraint checks if !f.force { // If this is a local run, check that the suite supports running locally if !s.CanRunLocal && f.isLocalRun { return true, fmt.Errorf("local run detected and suite ...
[ "func", "(", "f", "*", "Framework", ")", "runSuite", "(", "t", "*", "testing", ".", "T", ",", "s", "*", "TestSuite", ")", "(", "skip", "bool", ",", "err", "error", ")", "{", "// If -forceRun is set, skip all constraint checks", "if", "!", "f", ".", "forc...
// runSuite is called from Framework.Run inside of a sub test for each TestSuite. // If skip is returned as true, the test suite is skipped with the error text added // to the Skip reason // If skip is false and an error is returned, the test suite is failed.
[ "runSuite", "is", "called", "from", "Framework", ".", "Run", "inside", "of", "a", "sub", "test", "for", "each", "TestSuite", ".", "If", "skip", "is", "returned", "as", "true", "the", "test", "suite", "is", "skipped", "with", "the", "error", "text", "adde...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/e2e/framework/framework.go#L110-L201
132,017
hashicorp/nomad
nomad/eval_broker.go
NewEvalBroker
func NewEvalBroker(timeout, initialNackDelay, subsequentNackDelay time.Duration, deliveryLimit int) (*EvalBroker, error) { if timeout < 0 { return nil, fmt.Errorf("timeout cannot be negative") } b := &EvalBroker{ nackTimeout: timeout, deliveryLimit: deliveryLimit, enabled: false,...
go
func NewEvalBroker(timeout, initialNackDelay, subsequentNackDelay time.Duration, deliveryLimit int) (*EvalBroker, error) { if timeout < 0 { return nil, fmt.Errorf("timeout cannot be negative") } b := &EvalBroker{ nackTimeout: timeout, deliveryLimit: deliveryLimit, enabled: false,...
[ "func", "NewEvalBroker", "(", "timeout", ",", "initialNackDelay", ",", "subsequentNackDelay", "time", ".", "Duration", ",", "deliveryLimit", "int", ")", "(", "*", "EvalBroker", ",", "error", ")", "{", "if", "timeout", "<", "0", "{", "return", "nil", ",", "...
// NewEvalBroker creates a new evaluation broker. This is parameterized // with the timeout used for messages that are not acknowledged before we // assume a Nack and attempt to redeliver as well as the deliveryLimit // which prevents a failing eval from being endlessly delivered. The // initialNackDelay is the delay b...
[ "NewEvalBroker", "creates", "a", "new", "evaluation", "broker", ".", "This", "is", "parameterized", "with", "the", "timeout", "used", "for", "messages", "that", "are", "not", "acknowledged", "before", "we", "assume", "a", "Nack", "and", "attempt", "to", "redel...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L126-L151
132,018
hashicorp/nomad
nomad/eval_broker.go
SetEnabled
func (b *EvalBroker) SetEnabled(enabled bool) { b.l.Lock() prevEnabled := b.enabled b.enabled = enabled if !prevEnabled && enabled { // start the go routine for delayed evals ctx, cancel := context.WithCancel(context.Background()) b.delayedEvalCancelFunc = cancel go b.runDelayedEvalsWatcher(ctx, b.delayedEv...
go
func (b *EvalBroker) SetEnabled(enabled bool) { b.l.Lock() prevEnabled := b.enabled b.enabled = enabled if !prevEnabled && enabled { // start the go routine for delayed evals ctx, cancel := context.WithCancel(context.Background()) b.delayedEvalCancelFunc = cancel go b.runDelayedEvalsWatcher(ctx, b.delayedEv...
[ "func", "(", "b", "*", "EvalBroker", ")", "SetEnabled", "(", "enabled", "bool", ")", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "prevEnabled", ":=", "b", ".", "enabled", "\n", "b", ".", "enabled", "=", "enabled", "\n", "if", "!", "prevEnabled...
// SetEnabled is used to control if the broker is enabled. The broker // should only be enabled on the active leader.
[ "SetEnabled", "is", "used", "to", "control", "if", "the", "broker", "is", "enabled", ".", "The", "broker", "should", "only", "be", "enabled", "on", "the", "active", "leader", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L162-L176
132,019
hashicorp/nomad
nomad/eval_broker.go
Enqueue
func (b *EvalBroker) Enqueue(eval *structs.Evaluation) { b.l.Lock() defer b.l.Unlock() b.processEnqueue(eval, "") }
go
func (b *EvalBroker) Enqueue(eval *structs.Evaluation) { b.l.Lock() defer b.l.Unlock() b.processEnqueue(eval, "") }
[ "func", "(", "b", "*", "EvalBroker", ")", "Enqueue", "(", "eval", "*", "structs", ".", "Evaluation", ")", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "l", ".", "Unlock", "(", ")", "\n", "b", ".", "processEnqueue", "(", "...
// Enqueue is used to enqueue a new evaluation
[ "Enqueue", "is", "used", "to", "enqueue", "a", "new", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L179-L183
132,020
hashicorp/nomad
nomad/eval_broker.go
processWaitingEnqueue
func (b *EvalBroker) processWaitingEnqueue(eval *structs.Evaluation) { timer := time.AfterFunc(eval.Wait, func() { b.enqueueWaiting(eval) }) b.timeWait[eval.ID] = timer b.stats.TotalWaiting += 1 }
go
func (b *EvalBroker) processWaitingEnqueue(eval *structs.Evaluation) { timer := time.AfterFunc(eval.Wait, func() { b.enqueueWaiting(eval) }) b.timeWait[eval.ID] = timer b.stats.TotalWaiting += 1 }
[ "func", "(", "b", "*", "EvalBroker", ")", "processWaitingEnqueue", "(", "eval", "*", "structs", ".", "Evaluation", ")", "{", "timer", ":=", "time", ".", "AfterFunc", "(", "eval", ".", "Wait", ",", "func", "(", ")", "{", "b", ".", "enqueueWaiting", "(",...
// processWaitingEnqueue waits the given duration on the evaluation before // enqueuing.
[ "processWaitingEnqueue", "waits", "the", "given", "duration", "on", "the", "evaluation", "before", "enqueuing", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L250-L256
132,021
hashicorp/nomad
nomad/eval_broker.go
enqueueWaiting
func (b *EvalBroker) enqueueWaiting(eval *structs.Evaluation) { b.l.Lock() defer b.l.Unlock() delete(b.timeWait, eval.ID) b.stats.TotalWaiting -= 1 b.enqueueLocked(eval, eval.Type) }
go
func (b *EvalBroker) enqueueWaiting(eval *structs.Evaluation) { b.l.Lock() defer b.l.Unlock() delete(b.timeWait, eval.ID) b.stats.TotalWaiting -= 1 b.enqueueLocked(eval, eval.Type) }
[ "func", "(", "b", "*", "EvalBroker", ")", "enqueueWaiting", "(", "eval", "*", "structs", ".", "Evaluation", ")", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "l", ".", "Unlock", "(", ")", "\n", "delete", "(", "b", ".", "t...
// enqueueWaiting is used to enqueue a waiting evaluation
[ "enqueueWaiting", "is", "used", "to", "enqueue", "a", "waiting", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L259-L265
132,022
hashicorp/nomad
nomad/eval_broker.go
enqueueLocked
func (b *EvalBroker) enqueueLocked(eval *structs.Evaluation, queue string) { // Do nothing if not enabled if !b.enabled { return } // Check if there is an evaluation for this JobID pending namespacedID := structs.NamespacedID{ ID: eval.JobID, Namespace: eval.Namespace, } pendingEval := b.jobEvals[n...
go
func (b *EvalBroker) enqueueLocked(eval *structs.Evaluation, queue string) { // Do nothing if not enabled if !b.enabled { return } // Check if there is an evaluation for this JobID pending namespacedID := structs.NamespacedID{ ID: eval.JobID, Namespace: eval.Namespace, } pendingEval := b.jobEvals[n...
[ "func", "(", "b", "*", "EvalBroker", ")", "enqueueLocked", "(", "eval", "*", "structs", ".", "Evaluation", ",", "queue", "string", ")", "{", "// Do nothing if not enabled", "if", "!", "b", ".", "enabled", "{", "return", "\n", "}", "\n\n", "// Check if there ...
// enqueueLocked is used to enqueue with the lock held
[ "enqueueLocked", "is", "used", "to", "enqueue", "with", "the", "lock", "held" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L268-L317
132,023
hashicorp/nomad
nomad/eval_broker.go
scanForSchedulers
func (b *EvalBroker) scanForSchedulers(schedulers []string) (*structs.Evaluation, string, error) { b.l.Lock() defer b.l.Unlock() // Do nothing if not enabled if !b.enabled { return nil, "", fmt.Errorf("eval broker disabled") } // Scan for eligible work var eligibleSched []string var eligiblePriority int fo...
go
func (b *EvalBroker) scanForSchedulers(schedulers []string) (*structs.Evaluation, string, error) { b.l.Lock() defer b.l.Unlock() // Do nothing if not enabled if !b.enabled { return nil, "", fmt.Errorf("eval broker disabled") } // Scan for eligible work var eligibleSched []string var eligiblePriority int fo...
[ "func", "(", "b", "*", "EvalBroker", ")", "scanForSchedulers", "(", "schedulers", "[", "]", "string", ")", "(", "*", "structs", ".", "Evaluation", ",", "string", ",", "error", ")", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".",...
// scanForSchedulers scans for work on any of the schedulers. The highest priority work // is dequeued first. This may return nothing if there is no work waiting.
[ "scanForSchedulers", "scans", "for", "work", "on", "any", "of", "the", "schedulers", ".", "The", "highest", "priority", "work", "is", "dequeued", "first", ".", "This", "may", "return", "nothing", "if", "there", "is", "no", "work", "waiting", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L357-L411
132,024
hashicorp/nomad
nomad/eval_broker.go
dequeueForSched
func (b *EvalBroker) dequeueForSched(sched string) (*structs.Evaluation, string, error) { // Get the pending queue pending := b.ready[sched] raw := heap.Pop(&pending) b.ready[sched] = pending eval := raw.(*structs.Evaluation) // Generate a UUID for the token token := uuid.Generate() // Setup Nack timer nackT...
go
func (b *EvalBroker) dequeueForSched(sched string) (*structs.Evaluation, string, error) { // Get the pending queue pending := b.ready[sched] raw := heap.Pop(&pending) b.ready[sched] = pending eval := raw.(*structs.Evaluation) // Generate a UUID for the token token := uuid.Generate() // Setup Nack timer nackT...
[ "func", "(", "b", "*", "EvalBroker", ")", "dequeueForSched", "(", "sched", "string", ")", "(", "*", "structs", ".", "Evaluation", ",", "string", ",", "error", ")", "{", "// Get the pending queue", "pending", ":=", "b", ".", "ready", "[", "sched", "]", "\...
// dequeueForSched is used to dequeue the next work item for a given scheduler. // This assumes locks are held and that this scheduler has work
[ "dequeueForSched", "is", "used", "to", "dequeue", "the", "next", "work", "item", "for", "a", "given", "scheduler", ".", "This", "assumes", "locks", "are", "held", "and", "that", "this", "scheduler", "has", "work" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L415-L448
132,025
hashicorp/nomad
nomad/eval_broker.go
waitForSchedulers
func (b *EvalBroker) waitForSchedulers(schedulers []string, timeoutCh <-chan time.Time) bool { doneCh := make(chan struct{}) readyCh := make(chan struct{}, 1) defer close(doneCh) // Start all the watchers b.l.Lock() for _, sched := range schedulers { waitCh, ok := b.waiting[sched] if !ok { waitCh = make(c...
go
func (b *EvalBroker) waitForSchedulers(schedulers []string, timeoutCh <-chan time.Time) bool { doneCh := make(chan struct{}) readyCh := make(chan struct{}, 1) defer close(doneCh) // Start all the watchers b.l.Lock() for _, sched := range schedulers { waitCh, ok := b.waiting[sched] if !ok { waitCh = make(c...
[ "func", "(", "b", "*", "EvalBroker", ")", "waitForSchedulers", "(", "schedulers", "[", "]", "string", ",", "timeoutCh", "<-", "chan", "time", ".", "Time", ")", "bool", "{", "doneCh", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "readyCh", ...
// waitForSchedulers is used to wait for work on any of the scheduler or until a timeout. // Returns if there is work waiting potentially.
[ "waitForSchedulers", "is", "used", "to", "wait", "for", "work", "on", "any", "of", "the", "scheduler", "or", "until", "a", "timeout", ".", "Returns", "if", "there", "is", "work", "waiting", "potentially", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L452-L489
132,026
hashicorp/nomad
nomad/eval_broker.go
Outstanding
func (b *EvalBroker) Outstanding(evalID string) (string, bool) { b.l.RLock() defer b.l.RUnlock() unack, ok := b.unack[evalID] if !ok { return "", false } return unack.Token, true }
go
func (b *EvalBroker) Outstanding(evalID string) (string, bool) { b.l.RLock() defer b.l.RUnlock() unack, ok := b.unack[evalID] if !ok { return "", false } return unack.Token, true }
[ "func", "(", "b", "*", "EvalBroker", ")", "Outstanding", "(", "evalID", "string", ")", "(", "string", ",", "bool", ")", "{", "b", ".", "l", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "l", ".", "RUnlock", "(", ")", "\n", "unack", ",", "ok"...
// Outstanding checks if an EvalID has been delivered but not acknowledged // and returns the associated token for the evaluation.
[ "Outstanding", "checks", "if", "an", "EvalID", "has", "been", "delivered", "but", "not", "acknowledged", "and", "returns", "the", "associated", "token", "for", "the", "evaluation", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L493-L501
132,027
hashicorp/nomad
nomad/eval_broker.go
OutstandingReset
func (b *EvalBroker) OutstandingReset(evalID, token string) error { b.l.RLock() defer b.l.RUnlock() unack, ok := b.unack[evalID] if !ok { return ErrNotOutstanding } if unack.Token != token { return ErrTokenMismatch } if !unack.NackTimer.Reset(b.nackTimeout) { return ErrNackTimeoutReached } return nil }
go
func (b *EvalBroker) OutstandingReset(evalID, token string) error { b.l.RLock() defer b.l.RUnlock() unack, ok := b.unack[evalID] if !ok { return ErrNotOutstanding } if unack.Token != token { return ErrTokenMismatch } if !unack.NackTimer.Reset(b.nackTimeout) { return ErrNackTimeoutReached } return nil }
[ "func", "(", "b", "*", "EvalBroker", ")", "OutstandingReset", "(", "evalID", ",", "token", "string", ")", "error", "{", "b", ".", "l", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "l", ".", "RUnlock", "(", ")", "\n", "unack", ",", "ok", ":=",...
// OutstandingReset resets the Nack timer for the EvalID if the // token matches and the eval is outstanding
[ "OutstandingReset", "resets", "the", "Nack", "timer", "for", "the", "EvalID", "if", "the", "token", "matches", "and", "the", "eval", "is", "outstanding" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L505-L519
132,028
hashicorp/nomad
nomad/eval_broker.go
Ack
func (b *EvalBroker) Ack(evalID, token string) error { b.l.Lock() defer b.l.Unlock() // Always delete the requeued evaluation. Either the Ack is successful and // we requeue it or it isn't and we want to remove it. defer delete(b.requeue, token) // Lookup the unack'd eval unack, ok := b.unack[evalID] if !ok {...
go
func (b *EvalBroker) Ack(evalID, token string) error { b.l.Lock() defer b.l.Unlock() // Always delete the requeued evaluation. Either the Ack is successful and // we requeue it or it isn't and we want to remove it. defer delete(b.requeue, token) // Lookup the unack'd eval unack, ok := b.unack[evalID] if !ok {...
[ "func", "(", "b", "*", "EvalBroker", ")", "Ack", "(", "evalID", ",", "token", "string", ")", "error", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "l", ".", "Unlock", "(", ")", "\n\n", "// Always delete the requeued evaluation. E...
// Ack is used to positively acknowledge handling an evaluation
[ "Ack", "is", "used", "to", "positively", "acknowledge", "handling", "an", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L522-L583
132,029
hashicorp/nomad
nomad/eval_broker.go
Nack
func (b *EvalBroker) Nack(evalID, token string) error { b.l.Lock() defer b.l.Unlock() // Always delete the requeued evaluation since the Nack means the requeue is // invalid. delete(b.requeue, token) // Lookup the unack'd eval unack, ok := b.unack[evalID] if !ok { return fmt.Errorf("Evaluation ID not found"...
go
func (b *EvalBroker) Nack(evalID, token string) error { b.l.Lock() defer b.l.Unlock() // Always delete the requeued evaluation since the Nack means the requeue is // invalid. delete(b.requeue, token) // Lookup the unack'd eval unack, ok := b.unack[evalID] if !ok { return fmt.Errorf("Evaluation ID not found"...
[ "func", "(", "b", "*", "EvalBroker", ")", "Nack", "(", "evalID", ",", "token", "string", ")", "error", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "l", ".", "Unlock", "(", ")", "\n\n", "// Always delete the requeued evaluation s...
// Nack is used to negatively acknowledge handling an evaluation
[ "Nack", "is", "used", "to", "negatively", "acknowledge", "handling", "an", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L586-L631
132,030
hashicorp/nomad
nomad/eval_broker.go
nackReenqueueDelay
func (b *EvalBroker) nackReenqueueDelay(eval *structs.Evaluation, prevDequeues int) time.Duration { switch { case prevDequeues <= 0: return 0 case prevDequeues == 1: return b.initialNackDelay default: // For each subsequent nack compound a delay return time.Duration(prevDequeues-1) * b.subsequentNackDelay ...
go
func (b *EvalBroker) nackReenqueueDelay(eval *structs.Evaluation, prevDequeues int) time.Duration { switch { case prevDequeues <= 0: return 0 case prevDequeues == 1: return b.initialNackDelay default: // For each subsequent nack compound a delay return time.Duration(prevDequeues-1) * b.subsequentNackDelay ...
[ "func", "(", "b", "*", "EvalBroker", ")", "nackReenqueueDelay", "(", "eval", "*", "structs", ".", "Evaluation", ",", "prevDequeues", "int", ")", "time", ".", "Duration", "{", "switch", "{", "case", "prevDequeues", "<=", "0", ":", "return", "0", "\n", "ca...
// nackReenqueueDelay is used to determine the delay that should be applied on // the evaluation given the number of previous attempts
[ "nackReenqueueDelay", "is", "used", "to", "determine", "the", "delay", "that", "should", "be", "applied", "on", "the", "evaluation", "given", "the", "number", "of", "previous", "attempts" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L635-L645
132,031
hashicorp/nomad
nomad/eval_broker.go
PauseNackTimeout
func (b *EvalBroker) PauseNackTimeout(evalID, token string) error { b.l.RLock() defer b.l.RUnlock() unack, ok := b.unack[evalID] if !ok { return ErrNotOutstanding } if unack.Token != token { return ErrTokenMismatch } if !unack.NackTimer.Stop() { return ErrNackTimeoutReached } return nil }
go
func (b *EvalBroker) PauseNackTimeout(evalID, token string) error { b.l.RLock() defer b.l.RUnlock() unack, ok := b.unack[evalID] if !ok { return ErrNotOutstanding } if unack.Token != token { return ErrTokenMismatch } if !unack.NackTimer.Stop() { return ErrNackTimeoutReached } return nil }
[ "func", "(", "b", "*", "EvalBroker", ")", "PauseNackTimeout", "(", "evalID", ",", "token", "string", ")", "error", "{", "b", ".", "l", ".", "RLock", "(", ")", "\n", "defer", "b", ".", "l", ".", "RUnlock", "(", ")", "\n", "unack", ",", "ok", ":=",...
// PauseNackTimeout is used to pause the Nack timeout for an eval that is making // progress but is in a potentially unbounded operation such as the plan queue.
[ "PauseNackTimeout", "is", "used", "to", "pause", "the", "Nack", "timeout", "for", "an", "eval", "that", "is", "making", "progress", "but", "is", "in", "a", "potentially", "unbounded", "operation", "such", "as", "the", "plan", "queue", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L649-L663
132,032
hashicorp/nomad
nomad/eval_broker.go
ResumeNackTimeout
func (b *EvalBroker) ResumeNackTimeout(evalID, token string) error { b.l.Lock() defer b.l.Unlock() unack, ok := b.unack[evalID] if !ok { return ErrNotOutstanding } if unack.Token != token { return ErrTokenMismatch } unack.NackTimer.Reset(b.nackTimeout) return nil }
go
func (b *EvalBroker) ResumeNackTimeout(evalID, token string) error { b.l.Lock() defer b.l.Unlock() unack, ok := b.unack[evalID] if !ok { return ErrNotOutstanding } if unack.Token != token { return ErrTokenMismatch } unack.NackTimer.Reset(b.nackTimeout) return nil }
[ "func", "(", "b", "*", "EvalBroker", ")", "ResumeNackTimeout", "(", "evalID", ",", "token", "string", ")", "error", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "l", ".", "Unlock", "(", ")", "\n", "unack", ",", "ok", ":=", ...
// ResumeNackTimeout is used to resume the Nack timeout for an eval that was // paused. It should be resumed after leaving an unbounded operation.
[ "ResumeNackTimeout", "is", "used", "to", "resume", "the", "Nack", "timeout", "for", "an", "eval", "that", "was", "paused", ".", "It", "should", "be", "resumed", "after", "leaving", "an", "unbounded", "operation", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L667-L679
132,033
hashicorp/nomad
nomad/eval_broker.go
flush
func (b *EvalBroker) flush() { b.l.Lock() defer b.l.Unlock() // Unblock any waiters for _, waitCh := range b.waiting { close(waitCh) } b.waiting = make(map[string]chan struct{}) // Cancel any Nack timers for _, unack := range b.unack { unack.NackTimer.Stop() } // Cancel any time wait evals for _, wait...
go
func (b *EvalBroker) flush() { b.l.Lock() defer b.l.Unlock() // Unblock any waiters for _, waitCh := range b.waiting { close(waitCh) } b.waiting = make(map[string]chan struct{}) // Cancel any Nack timers for _, unack := range b.unack { unack.NackTimer.Stop() } // Cancel any time wait evals for _, wait...
[ "func", "(", "b", "*", "EvalBroker", ")", "flush", "(", ")", "{", "b", ".", "l", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "l", ".", "Unlock", "(", ")", "\n\n", "// Unblock any waiters", "for", "_", ",", "waitCh", ":=", "range", "b", ".", ...
// Flush is used to clear the state of the broker
[ "Flush", "is", "used", "to", "clear", "the", "state", "of", "the", "broker" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L682-L723
132,034
hashicorp/nomad
nomad/eval_broker.go
runDelayedEvalsWatcher
func (b *EvalBroker) runDelayedEvalsWatcher(ctx context.Context, updateCh <-chan struct{}) { var timerChannel <-chan time.Time var delayTimer *time.Timer for { eval, waitUntil := b.nextDelayedEval() if waitUntil.IsZero() { timerChannel = nil } else { launchDur := waitUntil.Sub(time.Now().UTC()) if del...
go
func (b *EvalBroker) runDelayedEvalsWatcher(ctx context.Context, updateCh <-chan struct{}) { var timerChannel <-chan time.Time var delayTimer *time.Timer for { eval, waitUntil := b.nextDelayedEval() if waitUntil.IsZero() { timerChannel = nil } else { launchDur := waitUntil.Sub(time.Now().UTC()) if del...
[ "func", "(", "b", "*", "EvalBroker", ")", "runDelayedEvalsWatcher", "(", "ctx", "context", ".", "Context", ",", "updateCh", "<-", "chan", "struct", "{", "}", ")", "{", "var", "timerChannel", "<-", "chan", "time", ".", "Time", "\n", "var", "delayTimer", "...
// runDelayedEvalsWatcher is a long-lived function that waits till a time deadline is met for // pending evaluations before enqueuing them
[ "runDelayedEvalsWatcher", "is", "a", "long", "-", "lived", "function", "that", "waits", "till", "a", "time", "deadline", "is", "met", "for", "pending", "evaluations", "before", "enqueuing", "them" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L744-L775
132,035
hashicorp/nomad
nomad/eval_broker.go
nextDelayedEval
func (b *EvalBroker) nextDelayedEval() (*structs.Evaluation, time.Time) { b.l.RLock() // If there is nothing wait for an update. if b.delayHeap.Length() == 0 { b.l.RUnlock() return nil, time.Time{} } nextEval := b.delayHeap.Peek() b.l.RUnlock() if nextEval == nil { return nil, time.Time{} } eval := nextE...
go
func (b *EvalBroker) nextDelayedEval() (*structs.Evaluation, time.Time) { b.l.RLock() // If there is nothing wait for an update. if b.delayHeap.Length() == 0 { b.l.RUnlock() return nil, time.Time{} } nextEval := b.delayHeap.Peek() b.l.RUnlock() if nextEval == nil { return nil, time.Time{} } eval := nextE...
[ "func", "(", "b", "*", "EvalBroker", ")", "nextDelayedEval", "(", ")", "(", "*", "structs", ".", "Evaluation", ",", "time", ".", "Time", ")", "{", "b", ".", "l", ".", "RLock", "(", ")", "\n", "// If there is nothing wait for an update.", "if", "b", ".", ...
// nextDelayedEval returns the next delayed eval to launch and when it should be enqueued. // This peeks at the heap to return the top. If the heap is empty, this returns nil and zero time.
[ "nextDelayedEval", "returns", "the", "next", "delayed", "eval", "to", "launch", "and", "when", "it", "should", "be", "enqueued", ".", "This", "peeks", "at", "the", "heap", "to", "return", "the", "top", ".", "If", "the", "heap", "is", "empty", "this", "re...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L779-L793
132,036
hashicorp/nomad
nomad/eval_broker.go
Stats
func (b *EvalBroker) Stats() *BrokerStats { // Allocate a new stats struct stats := new(BrokerStats) stats.ByScheduler = make(map[string]*SchedulerStats) b.l.RLock() defer b.l.RUnlock() // Copy all the stats stats.TotalReady = b.stats.TotalReady stats.TotalUnacked = b.stats.TotalUnacked stats.TotalBlocked = ...
go
func (b *EvalBroker) Stats() *BrokerStats { // Allocate a new stats struct stats := new(BrokerStats) stats.ByScheduler = make(map[string]*SchedulerStats) b.l.RLock() defer b.l.RUnlock() // Copy all the stats stats.TotalReady = b.stats.TotalReady stats.TotalUnacked = b.stats.TotalUnacked stats.TotalBlocked = ...
[ "func", "(", "b", "*", "EvalBroker", ")", "Stats", "(", ")", "*", "BrokerStats", "{", "// Allocate a new stats struct", "stats", ":=", "new", "(", "BrokerStats", ")", "\n", "stats", ".", "ByScheduler", "=", "make", "(", "map", "[", "string", "]", "*", "S...
// Stats is used to query the state of the broker
[ "Stats", "is", "used", "to", "query", "the", "state", "of", "the", "broker" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L796-L815
132,037
hashicorp/nomad
nomad/eval_broker.go
Less
func (p PendingEvaluations) Less(i, j int) bool { if p[i].JobID != p[j].JobID && p[i].Priority != p[j].Priority { return !(p[i].Priority < p[j].Priority) } return p[i].CreateIndex < p[j].CreateIndex }
go
func (p PendingEvaluations) Less(i, j int) bool { if p[i].JobID != p[j].JobID && p[i].Priority != p[j].Priority { return !(p[i].Priority < p[j].Priority) } return p[i].CreateIndex < p[j].CreateIndex }
[ "func", "(", "p", "PendingEvaluations", ")", "Less", "(", "i", ",", "j", "int", ")", "bool", "{", "if", "p", "[", "i", "]", ".", "JobID", "!=", "p", "[", "j", "]", ".", "JobID", "&&", "p", "[", "i", "]", ".", "Priority", "!=", "p", "[", "j"...
// Less is for the sorting interface. We flip the check // so that the "min" in the min-heap is the element with the // highest priority
[ "Less", "is", "for", "the", "sorting", "interface", ".", "We", "flip", "the", "check", "so", "that", "the", "min", "in", "the", "min", "-", "heap", "is", "the", "element", "with", "the", "highest", "priority" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L861-L866
132,038
hashicorp/nomad
nomad/eval_broker.go
Push
func (p *PendingEvaluations) Push(e interface{}) { *p = append(*p, e.(*structs.Evaluation)) }
go
func (p *PendingEvaluations) Push(e interface{}) { *p = append(*p, e.(*structs.Evaluation)) }
[ "func", "(", "p", "*", "PendingEvaluations", ")", "Push", "(", "e", "interface", "{", "}", ")", "{", "*", "p", "=", "append", "(", "*", "p", ",", "e", ".", "(", "*", "structs", ".", "Evaluation", ")", ")", "\n", "}" ]
// Push is used to add a new evaluation to the slice
[ "Push", "is", "used", "to", "add", "a", "new", "evaluation", "to", "the", "slice" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_broker.go#L874-L876
132,039
hashicorp/nomad
nomad/acl_endpoint.go
UpsertPolicies
func (a *ACL) UpsertPolicies(args *structs.ACLPolicyUpsertRequest, reply *structs.GenericResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } args.Region = a.srv.config.AuthoritativeRegion if done, err ...
go
func (a *ACL) UpsertPolicies(args *structs.ACLPolicyUpsertRequest, reply *structs.GenericResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } args.Region = a.srv.config.AuthoritativeRegion if done, err ...
[ "func", "(", "a", "*", "ACL", ")", "UpsertPolicies", "(", "args", "*", "structs", ".", "ACLPolicyUpsertRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "// Ensure ACLs are enabled, and always flow modification requests to the authoritativ...
// UpsertPolicies is used to create or update a set of policies
[ "UpsertPolicies", "is", "used", "to", "create", "or", "update", "a", "set", "of", "policies" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L37-L78
132,040
hashicorp/nomad
nomad/acl_endpoint.go
DeletePolicies
func (a *ACL) DeletePolicies(args *structs.ACLPolicyDeleteRequest, reply *structs.GenericResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } args.Region = a.srv.config.AuthoritativeRegion if done, err ...
go
func (a *ACL) DeletePolicies(args *structs.ACLPolicyDeleteRequest, reply *structs.GenericResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } args.Region = a.srv.config.AuthoritativeRegion if done, err ...
[ "func", "(", "a", "*", "ACL", ")", "DeletePolicies", "(", "args", "*", "structs", ".", "ACLPolicyDeleteRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "// Ensure ACLs are enabled, and always flow modification requests to the authoritativ...
// DeletePolicies is used to delete policies
[ "DeletePolicies", "is", "used", "to", "delete", "policies" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L81-L114
132,041
hashicorp/nomad
nomad/acl_endpoint.go
ListPolicies
func (a *ACL) ListPolicies(args *structs.ACLPolicyListRequest, reply *structs.ACLPolicyListResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.ListPolicies", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "list_pol...
go
func (a *ACL) ListPolicies(args *structs.ACLPolicyListRequest, reply *structs.ACLPolicyListResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.ListPolicies", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "list_pol...
[ "func", "(", "a", "*", "ACL", ")", "ListPolicies", "(", "args", "*", "structs", ".", "ACLPolicyListRequest", ",", "reply", "*", "structs", ".", "ACLPolicyListResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", "{",...
// ListPolicies is used to list the policies
[ "ListPolicies", "is", "used", "to", "list", "the", "policies" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L117-L202
132,042
hashicorp/nomad
nomad/acl_endpoint.go
GetPolicy
func (a *ACL) GetPolicy(args *structs.ACLPolicySpecificRequest, reply *structs.SingleACLPolicyResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetPolicy", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_poli...
go
func (a *ACL) GetPolicy(args *structs.ACLPolicySpecificRequest, reply *structs.SingleACLPolicyResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetPolicy", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_poli...
[ "func", "(", "a", "*", "ACL", ")", "GetPolicy", "(", "args", "*", "structs", ".", "ACLPolicySpecificRequest", ",", "reply", "*", "structs", ".", "SingleACLPolicyResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", "...
// GetPolicy is used to get a specific policy
[ "GetPolicy", "is", "used", "to", "get", "a", "specific", "policy" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L205-L277
132,043
hashicorp/nomad
nomad/acl_endpoint.go
GetPolicies
func (a *ACL) GetPolicies(args *structs.ACLPolicySetRequest, reply *structs.ACLPolicySetResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetPolicies", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_policies...
go
func (a *ACL) GetPolicies(args *structs.ACLPolicySetRequest, reply *structs.ACLPolicySetResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetPolicies", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_policies...
[ "func", "(", "a", "*", "ACL", ")", "GetPolicies", "(", "args", "*", "structs", ".", "ACLPolicySetRequest", ",", "reply", "*", "structs", ".", "ACLPolicySetResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", "{", ...
// GetPolicies is used to get a set of policies
[ "GetPolicies", "is", "used", "to", "get", "a", "set", "of", "policies" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L280-L339
132,044
hashicorp/nomad
nomad/acl_endpoint.go
Bootstrap
func (a *ACL) Bootstrap(args *structs.ACLTokenBootstrapRequest, reply *structs.ACLTokenUpsertResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } args.Region = a.srv.config.AuthoritativeRegion if done, ...
go
func (a *ACL) Bootstrap(args *structs.ACLTokenBootstrapRequest, reply *structs.ACLTokenUpsertResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } args.Region = a.srv.config.AuthoritativeRegion if done, ...
[ "func", "(", "a", "*", "ACL", ")", "Bootstrap", "(", "args", "*", "structs", ".", "ACLTokenBootstrapRequest", ",", "reply", "*", "structs", ".", "ACLTokenUpsertResponse", ")", "error", "{", "// Ensure ACLs are enabled, and always flow modification requests to the authorit...
// Bootstrap is used to bootstrap the initial token
[ "Bootstrap", "is", "used", "to", "bootstrap", "the", "initial", "token" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L342-L414
132,045
hashicorp/nomad
nomad/acl_endpoint.go
DeleteTokens
func (a *ACL) DeleteTokens(args *structs.ACLTokenDeleteRequest, reply *structs.GenericResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } // Validate non-zero set of tokens if len(args.AccessorIDs) == ...
go
func (a *ACL) DeleteTokens(args *structs.ACLTokenDeleteRequest, reply *structs.GenericResponse) error { // Ensure ACLs are enabled, and always flow modification requests to the authoritative region if !a.srv.config.ACLEnabled { return aclDisabled } // Validate non-zero set of tokens if len(args.AccessorIDs) == ...
[ "func", "(", "a", "*", "ACL", ")", "DeleteTokens", "(", "args", "*", "structs", ".", "ACLTokenDeleteRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "// Ensure ACLs are enabled, and always flow modification requests to the authoritative r...
// DeleteTokens is used to delete tokens
[ "DeleteTokens", "is", "used", "to", "delete", "tokens" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L552-L629
132,046
hashicorp/nomad
nomad/acl_endpoint.go
ListTokens
func (a *ACL) ListTokens(args *structs.ACLTokenListRequest, reply *structs.ACLTokenListResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.ListTokens", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "list_tokens"},...
go
func (a *ACL) ListTokens(args *structs.ACLTokenListRequest, reply *structs.ACLTokenListResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.ListTokens", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "list_tokens"},...
[ "func", "(", "a", "*", "ACL", ")", "ListTokens", "(", "args", "*", "structs", ".", "ACLTokenListRequest", ",", "reply", "*", "structs", ".", "ACLTokenListResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", "{", "...
// ListTokens is used to list the tokens
[ "ListTokens", "is", "used", "to", "list", "the", "tokens" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L632-L687
132,047
hashicorp/nomad
nomad/acl_endpoint.go
GetToken
func (a *ACL) GetToken(args *structs.ACLTokenSpecificRequest, reply *structs.SingleACLTokenResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetToken", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_token"},...
go
func (a *ACL) GetToken(args *structs.ACLTokenSpecificRequest, reply *structs.SingleACLTokenResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetToken", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_token"},...
[ "func", "(", "a", "*", "ACL", ")", "GetToken", "(", "args", "*", "structs", ".", "ACLTokenSpecificRequest", ",", "reply", "*", "structs", ".", "SingleACLTokenResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", "{",...
// GetToken is used to get a specific token
[ "GetToken", "is", "used", "to", "get", "a", "specific", "token" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L690-L748
132,048
hashicorp/nomad
nomad/acl_endpoint.go
GetTokens
func (a *ACL) GetTokens(args *structs.ACLTokenSetRequest, reply *structs.ACLTokenSetResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetTokens", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_tokens"}, time...
go
func (a *ACL) GetTokens(args *structs.ACLTokenSetRequest, reply *structs.ACLTokenSetResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.GetTokens", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "get_tokens"}, time...
[ "func", "(", "a", "*", "ACL", ")", "GetTokens", "(", "args", "*", "structs", ".", "ACLTokenSetRequest", ",", "reply", "*", "structs", ".", "ACLTokenSetResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", "{", "ret...
// GetTokens is used to get a set of token
[ "GetTokens", "is", "used", "to", "get", "a", "set", "of", "token" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L751-L795
132,049
hashicorp/nomad
nomad/acl_endpoint.go
ResolveToken
func (a *ACL) ResolveToken(args *structs.ResolveACLTokenRequest, reply *structs.ResolveACLTokenResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.ResolveToken", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "reso...
go
func (a *ACL) ResolveToken(args *structs.ResolveACLTokenRequest, reply *structs.ResolveACLTokenResponse) error { if !a.srv.config.ACLEnabled { return aclDisabled } if done, err := a.srv.forward("ACL.ResolveToken", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "acl", "reso...
[ "func", "(", "a", "*", "ACL", ")", "ResolveToken", "(", "args", "*", "structs", ".", "ResolveACLTokenRequest", ",", "reply", "*", "structs", ".", "ResolveACLTokenResponse", ")", "error", "{", "if", "!", "a", ".", "srv", ".", "config", ".", "ACLEnabled", ...
// ResolveToken is used to lookup a specific token by a secret ID. This is used for enforcing ACLs by clients.
[ "ResolveToken", "is", "used", "to", "lookup", "a", "specific", "token", "by", "a", "secret", "ID", ".", "This", "is", "used", "for", "enforcing", "ACLs", "by", "clients", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/acl_endpoint.go#L798-L835
132,050
hashicorp/nomad
scheduler/feasible.go
NewStaticIterator
func NewStaticIterator(ctx Context, nodes []*structs.Node) *StaticIterator { iter := &StaticIterator{ ctx: ctx, nodes: nodes, } return iter }
go
func NewStaticIterator(ctx Context, nodes []*structs.Node) *StaticIterator { iter := &StaticIterator{ ctx: ctx, nodes: nodes, } return iter }
[ "func", "NewStaticIterator", "(", "ctx", "Context", ",", "nodes", "[", "]", "*", "structs", ".", "Node", ")", "*", "StaticIterator", "{", "iter", ":=", "&", "StaticIterator", "{", "ctx", ":", "ctx", ",", "nodes", ":", "nodes", ",", "}", "\n", "return",...
// NewStaticIterator constructs a random iterator from a list of nodes
[ "NewStaticIterator", "constructs", "a", "random", "iterator", "from", "a", "list", "of", "nodes" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L51-L57
132,051
hashicorp/nomad
scheduler/feasible.go
NewRandomIterator
func NewRandomIterator(ctx Context, nodes []*structs.Node) *StaticIterator { // shuffle with the Fisher-Yates algorithm shuffleNodes(nodes) // Create a static iterator return NewStaticIterator(ctx, nodes) }
go
func NewRandomIterator(ctx Context, nodes []*structs.Node) *StaticIterator { // shuffle with the Fisher-Yates algorithm shuffleNodes(nodes) // Create a static iterator return NewStaticIterator(ctx, nodes) }
[ "func", "NewRandomIterator", "(", "ctx", "Context", ",", "nodes", "[", "]", "*", "structs", ".", "Node", ")", "*", "StaticIterator", "{", "// shuffle with the Fisher-Yates algorithm", "shuffleNodes", "(", "nodes", ")", "\n\n", "// Create a static iterator", "return", ...
// NewRandomIterator constructs a static iterator from a list of nodes // after applying the Fisher-Yates algorithm for a random shuffle. This // is applied in-place
[ "NewRandomIterator", "constructs", "a", "static", "iterator", "from", "a", "list", "of", "nodes", "after", "applying", "the", "Fisher", "-", "Yates", "algorithm", "for", "a", "random", "shuffle", ".", "This", "is", "applied", "in", "-", "place" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L91-L97
132,052
hashicorp/nomad
scheduler/feasible.go
NewDriverChecker
func NewDriverChecker(ctx Context, drivers map[string]struct{}) *DriverChecker { return &DriverChecker{ ctx: ctx, drivers: drivers, } }
go
func NewDriverChecker(ctx Context, drivers map[string]struct{}) *DriverChecker { return &DriverChecker{ ctx: ctx, drivers: drivers, } }
[ "func", "NewDriverChecker", "(", "ctx", "Context", ",", "drivers", "map", "[", "string", "]", "struct", "{", "}", ")", "*", "DriverChecker", "{", "return", "&", "DriverChecker", "{", "ctx", ":", "ctx", ",", "drivers", ":", "drivers", ",", "}", "\n", "}...
// NewDriverChecker creates a DriverChecker from a set of drivers
[ "NewDriverChecker", "creates", "a", "DriverChecker", "from", "a", "set", "of", "drivers" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L107-L112
132,053
hashicorp/nomad
scheduler/feasible.go
hasDrivers
func (c *DriverChecker) hasDrivers(option *structs.Node) bool { for driver := range c.drivers { driverStr := fmt.Sprintf("driver.%s", driver) // COMPAT: Remove in 0.10: As of Nomad 0.8, nodes have a DriverInfo that // corresponds with every driver. As a Nomad server might be on a later // version than a Nomad...
go
func (c *DriverChecker) hasDrivers(option *structs.Node) bool { for driver := range c.drivers { driverStr := fmt.Sprintf("driver.%s", driver) // COMPAT: Remove in 0.10: As of Nomad 0.8, nodes have a DriverInfo that // corresponds with every driver. As a Nomad server might be on a later // version than a Nomad...
[ "func", "(", "c", "*", "DriverChecker", ")", "hasDrivers", "(", "option", "*", "structs", ".", "Node", ")", "bool", "{", "for", "driver", ":=", "range", "c", ".", "drivers", "{", "driverStr", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "driver...
// hasDrivers is used to check if the node has all the appropriate // drivers for this task group. Drivers are registered as node attribute // like "driver.docker=1" with their corresponding version.
[ "hasDrivers", "is", "used", "to", "check", "if", "the", "node", "has", "all", "the", "appropriate", "drivers", "for", "this", "task", "group", ".", "Drivers", "are", "registered", "as", "node", "attribute", "like", "driver", ".", "docker", "=", "1", "with"...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L130-L163
132,054
hashicorp/nomad
scheduler/feasible.go
NewDistinctHostsIterator
func NewDistinctHostsIterator(ctx Context, source FeasibleIterator) *DistinctHostsIterator { return &DistinctHostsIterator{ ctx: ctx, source: source, } }
go
func NewDistinctHostsIterator(ctx Context, source FeasibleIterator) *DistinctHostsIterator { return &DistinctHostsIterator{ ctx: ctx, source: source, } }
[ "func", "NewDistinctHostsIterator", "(", "ctx", "Context", ",", "source", "FeasibleIterator", ")", "*", "DistinctHostsIterator", "{", "return", "&", "DistinctHostsIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ",", "}", "\n", "}" ]
// NewDistinctHostsIterator creates a DistinctHostsIterator from a source.
[ "NewDistinctHostsIterator", "creates", "a", "DistinctHostsIterator", "from", "a", "source", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L181-L186
132,055
hashicorp/nomad
scheduler/feasible.go
satisfiesDistinctHosts
func (iter *DistinctHostsIterator) satisfiesDistinctHosts(option *structs.Node) bool { // Check if there is no constraint set. if !(iter.jobDistinctHosts || iter.tgDistinctHosts) { return true } // Get the proposed allocations proposed, err := iter.ctx.ProposedAllocs(option.ID) if err != nil { iter.ctx.Logge...
go
func (iter *DistinctHostsIterator) satisfiesDistinctHosts(option *structs.Node) bool { // Check if there is no constraint set. if !(iter.jobDistinctHosts || iter.tgDistinctHosts) { return true } // Get the proposed allocations proposed, err := iter.ctx.ProposedAllocs(option.ID) if err != nil { iter.ctx.Logge...
[ "func", "(", "iter", "*", "DistinctHostsIterator", ")", "satisfiesDistinctHosts", "(", "option", "*", "structs", ".", "Node", ")", "bool", "{", "// Check if there is no constraint set.", "if", "!", "(", "iter", ".", "jobDistinctHosts", "||", "iter", ".", "tgDistin...
// satisfiesDistinctHosts checks if the node satisfies a distinct_hosts // constraint either specified at the job level or the TaskGroup level.
[ "satisfiesDistinctHosts", "checks", "if", "the", "node", "satisfies", "a", "distinct_hosts", "constraint", "either", "specified", "at", "the", "job", "level", "or", "the", "TaskGroup", "level", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L232-L258
132,056
hashicorp/nomad
scheduler/feasible.go
NewDistinctPropertyIterator
func NewDistinctPropertyIterator(ctx Context, source FeasibleIterator) *DistinctPropertyIterator { return &DistinctPropertyIterator{ ctx: ctx, source: source, groupPropertySets: make(map[string][]*propertySet), } }
go
func NewDistinctPropertyIterator(ctx Context, source FeasibleIterator) *DistinctPropertyIterator { return &DistinctPropertyIterator{ ctx: ctx, source: source, groupPropertySets: make(map[string][]*propertySet), } }
[ "func", "NewDistinctPropertyIterator", "(", "ctx", "Context", ",", "source", "FeasibleIterator", ")", "*", "DistinctPropertyIterator", "{", "return", "&", "DistinctPropertyIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ",", "groupPropertySets", ":"...
// NewDistinctPropertyIterator creates a DistinctPropertyIterator from a source.
[ "NewDistinctPropertyIterator", "creates", "a", "DistinctPropertyIterator", "from", "a", "source", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L279-L285
132,057
hashicorp/nomad
scheduler/feasible.go
satisfiesProperties
func (iter *DistinctPropertyIterator) satisfiesProperties(option *structs.Node, set []*propertySet) bool { for _, ps := range set { if satisfies, reason := ps.SatisfiesDistinctProperties(option, iter.tg.Name); !satisfies { iter.ctx.Metrics().FilterNode(option, reason) return false } } return true }
go
func (iter *DistinctPropertyIterator) satisfiesProperties(option *structs.Node, set []*propertySet) bool { for _, ps := range set { if satisfies, reason := ps.SatisfiesDistinctProperties(option, iter.tg.Name); !satisfies { iter.ctx.Metrics().FilterNode(option, reason) return false } } return true }
[ "func", "(", "iter", "*", "DistinctPropertyIterator", ")", "satisfiesProperties", "(", "option", "*", "structs", ".", "Node", ",", "set", "[", "]", "*", "propertySet", ")", "bool", "{", "for", "_", ",", "ps", ":=", "range", "set", "{", "if", "satisfies",...
// satisfiesProperties returns whether the option satisfies the set of // properties. If not it will be filtered.
[ "satisfiesProperties", "returns", "whether", "the", "option", "satisfies", "the", "set", "of", "properties", ".", "If", "not", "it", "will", "be", "filtered", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L344-L353
132,058
hashicorp/nomad
scheduler/feasible.go
NewConstraintChecker
func NewConstraintChecker(ctx Context, constraints []*structs.Constraint) *ConstraintChecker { return &ConstraintChecker{ ctx: ctx, constraints: constraints, } }
go
func NewConstraintChecker(ctx Context, constraints []*structs.Constraint) *ConstraintChecker { return &ConstraintChecker{ ctx: ctx, constraints: constraints, } }
[ "func", "NewConstraintChecker", "(", "ctx", "Context", ",", "constraints", "[", "]", "*", "structs", ".", "Constraint", ")", "*", "ConstraintChecker", "{", "return", "&", "ConstraintChecker", "{", "ctx", ":", "ctx", ",", "constraints", ":", "constraints", ",",...
// NewConstraintChecker creates a ConstraintChecker for a set of constraints
[ "NewConstraintChecker", "creates", "a", "ConstraintChecker", "for", "a", "set", "of", "constraints" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L378-L383
132,059
hashicorp/nomad
scheduler/feasible.go
resolveTarget
func resolveTarget(target string, node *structs.Node) (interface{}, bool) { // If no prefix, this must be a literal value if !strings.HasPrefix(target, "${") { return target, true } // Handle the interpolations switch { case "${node.unique.id}" == target: return node.ID, true case "${node.datacenter}" == t...
go
func resolveTarget(target string, node *structs.Node) (interface{}, bool) { // If no prefix, this must be a literal value if !strings.HasPrefix(target, "${") { return target, true } // Handle the interpolations switch { case "${node.unique.id}" == target: return node.ID, true case "${node.datacenter}" == t...
[ "func", "resolveTarget", "(", "target", "string", ",", "node", "*", "structs", ".", "Node", ")", "(", "interface", "{", "}", ",", "bool", ")", "{", "// If no prefix, this must be a literal value", "if", "!", "strings", ".", "HasPrefix", "(", "target", ",", "...
// resolveTarget is used to resolve the LTarget and RTarget of a Constraint.
[ "resolveTarget", "is", "used", "to", "resolve", "the", "LTarget", "and", "RTarget", "of", "a", "Constraint", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L411-L444
132,060
hashicorp/nomad
scheduler/feasible.go
checkConstraint
func checkConstraint(ctx Context, operand string, lVal, rVal interface{}, lFound, rFound bool) bool { // Check for constraints not handled by this checker. switch operand { case structs.ConstraintDistinctHosts, structs.ConstraintDistinctProperty: return true default: break } switch operand { case "=", "==",...
go
func checkConstraint(ctx Context, operand string, lVal, rVal interface{}, lFound, rFound bool) bool { // Check for constraints not handled by this checker. switch operand { case structs.ConstraintDistinctHosts, structs.ConstraintDistinctProperty: return true default: break } switch operand { case "=", "==",...
[ "func", "checkConstraint", "(", "ctx", "Context", ",", "operand", "string", ",", "lVal", ",", "rVal", "interface", "{", "}", ",", "lFound", ",", "rFound", "bool", ")", "bool", "{", "// Check for constraints not handled by this checker.", "switch", "operand", "{", ...
// checkConstraint checks if a constraint is satisfied. The lVal and rVal // interfaces may be nil.
[ "checkConstraint", "checks", "if", "a", "constraint", "is", "satisfied", ".", "The", "lVal", "and", "rVal", "interfaces", "may", "be", "nil", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L448-L479
132,061
hashicorp/nomad
scheduler/feasible.go
checkAffinity
func checkAffinity(ctx Context, operand string, lVal, rVal interface{}, lFound, rFound bool) bool { return checkConstraint(ctx, operand, lVal, rVal, lFound, rFound) }
go
func checkAffinity(ctx Context, operand string, lVal, rVal interface{}, lFound, rFound bool) bool { return checkConstraint(ctx, operand, lVal, rVal, lFound, rFound) }
[ "func", "checkAffinity", "(", "ctx", "Context", ",", "operand", "string", ",", "lVal", ",", "rVal", "interface", "{", "}", ",", "lFound", ",", "rFound", "bool", ")", "bool", "{", "return", "checkConstraint", "(", "ctx", ",", "operand", ",", "lVal", ",", ...
// checkAffinity checks if a specific affinity is satisfied
[ "checkAffinity", "checks", "if", "a", "specific", "affinity", "is", "satisfied" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L482-L484
132,062
hashicorp/nomad
scheduler/feasible.go
checkAttributeAffinity
func checkAttributeAffinity(ctx Context, operand string, lVal, rVal *psstructs.Attribute, lFound, rFound bool) bool { return checkAttributeConstraint(ctx, operand, lVal, rVal, lFound, rFound) }
go
func checkAttributeAffinity(ctx Context, operand string, lVal, rVal *psstructs.Attribute, lFound, rFound bool) bool { return checkAttributeConstraint(ctx, operand, lVal, rVal, lFound, rFound) }
[ "func", "checkAttributeAffinity", "(", "ctx", "Context", ",", "operand", "string", ",", "lVal", ",", "rVal", "*", "psstructs", ".", "Attribute", ",", "lFound", ",", "rFound", "bool", ")", "bool", "{", "return", "checkAttributeConstraint", "(", "ctx", ",", "o...
// checkAttributeAffinity checks if an affinity is satisfied
[ "checkAttributeAffinity", "checks", "if", "an", "affinity", "is", "satisfied" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L487-L489
132,063
hashicorp/nomad
scheduler/feasible.go
checkLexicalOrder
func checkLexicalOrder(op string, lVal, rVal interface{}) bool { // Ensure the values are strings lStr, ok := lVal.(string) if !ok { return false } rStr, ok := rVal.(string) if !ok { return false } switch op { case "<": return lStr < rStr case "<=": return lStr <= rStr case ">": return lStr > rStr...
go
func checkLexicalOrder(op string, lVal, rVal interface{}) bool { // Ensure the values are strings lStr, ok := lVal.(string) if !ok { return false } rStr, ok := rVal.(string) if !ok { return false } switch op { case "<": return lStr < rStr case "<=": return lStr <= rStr case ">": return lStr > rStr...
[ "func", "checkLexicalOrder", "(", "op", "string", ",", "lVal", ",", "rVal", "interface", "{", "}", ")", "bool", "{", "// Ensure the values are strings", "lStr", ",", "ok", ":=", "lVal", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "fals...
// checkLexicalOrder is used to check for lexical ordering
[ "checkLexicalOrder", "is", "used", "to", "check", "for", "lexical", "ordering" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L492-L515
132,064
hashicorp/nomad
scheduler/feasible.go
checkVersionMatch
func checkVersionMatch(ctx Context, lVal, rVal interface{}) bool { // Parse the version var versionStr string switch v := lVal.(type) { case string: versionStr = v case int: versionStr = fmt.Sprintf("%d", v) default: return false } // Parse the version vers, err := version.NewVersion(versionStr) if err...
go
func checkVersionMatch(ctx Context, lVal, rVal interface{}) bool { // Parse the version var versionStr string switch v := lVal.(type) { case string: versionStr = v case int: versionStr = fmt.Sprintf("%d", v) default: return false } // Parse the version vers, err := version.NewVersion(versionStr) if err...
[ "func", "checkVersionMatch", "(", "ctx", "Context", ",", "lVal", ",", "rVal", "interface", "{", "}", ")", "bool", "{", "// Parse the version", "var", "versionStr", "string", "\n", "switch", "v", ":=", "lVal", ".", "(", "type", ")", "{", "case", "string", ...
// checkVersionMatch is used to compare a version on the // left hand side with a set of constraints on the right hand side
[ "checkVersionMatch", "is", "used", "to", "compare", "a", "version", "on", "the", "left", "hand", "side", "with", "a", "set", "of", "constraints", "on", "the", "right", "hand", "side" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L519-L558
132,065
hashicorp/nomad
scheduler/feasible.go
checkAttributeVersionMatch
func checkAttributeVersionMatch(ctx Context, lVal, rVal *psstructs.Attribute) bool { // Parse the version var versionStr string if s, ok := lVal.GetString(); ok { versionStr = s } else if i, ok := lVal.GetInt(); ok { versionStr = fmt.Sprintf("%d", i) } else { return false } // Parse the version vers, err...
go
func checkAttributeVersionMatch(ctx Context, lVal, rVal *psstructs.Attribute) bool { // Parse the version var versionStr string if s, ok := lVal.GetString(); ok { versionStr = s } else if i, ok := lVal.GetInt(); ok { versionStr = fmt.Sprintf("%d", i) } else { return false } // Parse the version vers, err...
[ "func", "checkAttributeVersionMatch", "(", "ctx", "Context", ",", "lVal", ",", "rVal", "*", "psstructs", ".", "Attribute", ")", "bool", "{", "// Parse the version", "var", "versionStr", "string", "\n", "if", "s", ",", "ok", ":=", "lVal", ".", "GetString", "(...
// checkAttributeVersionMatch is used to compare a version on the // left hand side with a set of constraints on the right hand side
[ "checkAttributeVersionMatch", "is", "used", "to", "compare", "a", "version", "on", "the", "left", "hand", "side", "with", "a", "set", "of", "constraints", "on", "the", "right", "hand", "side" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L562-L600
132,066
hashicorp/nomad
scheduler/feasible.go
checkRegexpMatch
func checkRegexpMatch(ctx Context, lVal, rVal interface{}) bool { // Ensure left-hand is string lStr, ok := lVal.(string) if !ok { return false } // Regexp must be a string regexpStr, ok := rVal.(string) if !ok { return false } // Check the cache cache := ctx.RegexpCache() re := cache[regexpStr] // P...
go
func checkRegexpMatch(ctx Context, lVal, rVal interface{}) bool { // Ensure left-hand is string lStr, ok := lVal.(string) if !ok { return false } // Regexp must be a string regexpStr, ok := rVal.(string) if !ok { return false } // Check the cache cache := ctx.RegexpCache() re := cache[regexpStr] // P...
[ "func", "checkRegexpMatch", "(", "ctx", "Context", ",", "lVal", ",", "rVal", "interface", "{", "}", ")", "bool", "{", "// Ensure left-hand is string", "lStr", ",", "ok", ":=", "lVal", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "false"...
// checkRegexpMatch is used to compare a value on the // left hand side with a regexp on the right hand side
[ "checkRegexpMatch", "is", "used", "to", "compare", "a", "value", "on", "the", "left", "hand", "side", "with", "a", "regexp", "on", "the", "right", "hand", "side" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L604-L633
132,067
hashicorp/nomad
scheduler/feasible.go
checkSetContainsAll
func checkSetContainsAll(ctx Context, lVal, rVal interface{}) bool { // Ensure left-hand is string lStr, ok := lVal.(string) if !ok { return false } // Regexp must be a string rStr, ok := rVal.(string) if !ok { return false } input := strings.Split(lStr, ",") lookup := make(map[string]struct{}, len(inpu...
go
func checkSetContainsAll(ctx Context, lVal, rVal interface{}) bool { // Ensure left-hand is string lStr, ok := lVal.(string) if !ok { return false } // Regexp must be a string rStr, ok := rVal.(string) if !ok { return false } input := strings.Split(lStr, ",") lookup := make(map[string]struct{}, len(inpu...
[ "func", "checkSetContainsAll", "(", "ctx", "Context", ",", "lVal", ",", "rVal", "interface", "{", "}", ")", "bool", "{", "// Ensure left-hand is string", "lStr", ",", "ok", ":=", "lVal", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "fal...
// checkSetContainsAll is used to see if the left hand side contains the // string on the right hand side
[ "checkSetContainsAll", "is", "used", "to", "see", "if", "the", "left", "hand", "side", "contains", "the", "string", "on", "the", "right", "hand", "side" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L637-L665
132,068
hashicorp/nomad
scheduler/feasible.go
NewFeasibilityWrapper
func NewFeasibilityWrapper(ctx Context, source FeasibleIterator, jobCheckers, tgCheckers []FeasibilityChecker) *FeasibilityWrapper { return &FeasibilityWrapper{ ctx: ctx, source: source, jobCheckers: jobCheckers, tgCheckers: tgCheckers, } }
go
func NewFeasibilityWrapper(ctx Context, source FeasibleIterator, jobCheckers, tgCheckers []FeasibilityChecker) *FeasibilityWrapper { return &FeasibilityWrapper{ ctx: ctx, source: source, jobCheckers: jobCheckers, tgCheckers: tgCheckers, } }
[ "func", "NewFeasibilityWrapper", "(", "ctx", "Context", ",", "source", "FeasibleIterator", ",", "jobCheckers", ",", "tgCheckers", "[", "]", "FeasibilityChecker", ")", "*", "FeasibilityWrapper", "{", "return", "&", "FeasibilityWrapper", "{", "ctx", ":", "ctx", ",",...
// NewFeasibilityWrapper returns a FeasibleIterator based on the passed source // and FeasibilityCheckers.
[ "NewFeasibilityWrapper", "returns", "a", "FeasibleIterator", "based", "on", "the", "passed", "source", "and", "FeasibilityCheckers", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L712-L720
132,069
hashicorp/nomad
scheduler/feasible.go
Next
func (w *FeasibilityWrapper) Next() *structs.Node { evalElig := w.ctx.Eligibility() metrics := w.ctx.Metrics() OUTER: for { // Get the next option from the source option := w.source.Next() if option == nil { return nil } // Check if the job has been marked as eligible or ineligible. jobEscaped, jobU...
go
func (w *FeasibilityWrapper) Next() *structs.Node { evalElig := w.ctx.Eligibility() metrics := w.ctx.Metrics() OUTER: for { // Get the next option from the source option := w.source.Next() if option == nil { return nil } // Check if the job has been marked as eligible or ineligible. jobEscaped, jobU...
[ "func", "(", "w", "*", "FeasibilityWrapper", ")", "Next", "(", ")", "*", "structs", ".", "Node", "{", "evalElig", ":=", "w", ".", "ctx", ".", "Eligibility", "(", ")", "\n", "metrics", ":=", "w", ".", "ctx", ".", "Metrics", "(", ")", "\n\n", "OUTER"...
// Next returns an eligible node, only running the FeasibilityCheckers as needed // based on the sources computed node class.
[ "Next", "returns", "an", "eligible", "node", "only", "running", "the", "FeasibilityCheckers", "as", "needed", "based", "on", "the", "sources", "computed", "node", "class", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L732-L813
132,070
hashicorp/nomad
scheduler/feasible.go
nodeDeviceMatches
func nodeDeviceMatches(ctx Context, d *structs.NodeDeviceResource, req *structs.RequestedDevice) bool { if !d.ID().Matches(req.ID()) { return false } // There are no constraints to consider if len(req.Constraints) == 0 { return true } for _, c := range req.Constraints { // Resolve the targets lVal, lOk ...
go
func nodeDeviceMatches(ctx Context, d *structs.NodeDeviceResource, req *structs.RequestedDevice) bool { if !d.ID().Matches(req.ID()) { return false } // There are no constraints to consider if len(req.Constraints) == 0 { return true } for _, c := range req.Constraints { // Resolve the targets lVal, lOk ...
[ "func", "nodeDeviceMatches", "(", "ctx", "Context", ",", "d", "*", "structs", ".", "NodeDeviceResource", ",", "req", "*", "structs", ".", "RequestedDevice", ")", "bool", "{", "if", "!", "d", ".", "ID", "(", ")", ".", "Matches", "(", "req", ".", "ID", ...
// nodeDeviceMatches checks if the device matches the request and its // constraints. It doesn't check the count.
[ "nodeDeviceMatches", "checks", "if", "the", "device", "matches", "the", "request", "and", "its", "constraints", ".", "It", "doesn", "t", "check", "the", "count", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L922-L944
132,071
hashicorp/nomad
scheduler/feasible.go
resolveDeviceTarget
func resolveDeviceTarget(target string, d *structs.NodeDeviceResource) (*psstructs.Attribute, bool) { // If no prefix, this must be a literal value if !strings.HasPrefix(target, "${") { return psstructs.ParseAttribute(target), true } // Handle the interpolations switch { case "${device.model}" == target: ret...
go
func resolveDeviceTarget(target string, d *structs.NodeDeviceResource) (*psstructs.Attribute, bool) { // If no prefix, this must be a literal value if !strings.HasPrefix(target, "${") { return psstructs.ParseAttribute(target), true } // Handle the interpolations switch { case "${device.model}" == target: ret...
[ "func", "resolveDeviceTarget", "(", "target", "string", ",", "d", "*", "structs", ".", "NodeDeviceResource", ")", "(", "*", "psstructs", ".", "Attribute", ",", "bool", ")", "{", "// If no prefix, this must be a literal value", "if", "!", "strings", ".", "HasPrefix...
// resolveDeviceTarget is used to resolve the LTarget and RTarget of a Constraint // when used on a device
[ "resolveDeviceTarget", "is", "used", "to", "resolve", "the", "LTarget", "and", "RTarget", "of", "a", "Constraint", "when", "used", "on", "a", "device" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L948-L974
132,072
hashicorp/nomad
scheduler/feasible.go
checkAttributeConstraint
func checkAttributeConstraint(ctx Context, operand string, lVal, rVal *psstructs.Attribute, lFound, rFound bool) bool { // Check for constraints not handled by this checker. switch operand { case structs.ConstraintDistinctHosts, structs.ConstraintDistinctProperty: return true default: break } switch operand ...
go
func checkAttributeConstraint(ctx Context, operand string, lVal, rVal *psstructs.Attribute, lFound, rFound bool) bool { // Check for constraints not handled by this checker. switch operand { case structs.ConstraintDistinctHosts, structs.ConstraintDistinctProperty: return true default: break } switch operand ...
[ "func", "checkAttributeConstraint", "(", "ctx", "Context", ",", "operand", "string", ",", "lVal", ",", "rVal", "*", "psstructs", ".", "Attribute", ",", "lFound", ",", "rFound", "bool", ")", "bool", "{", "// Check for constraints not handled by this checker.", "switc...
// checkAttributeConstraint checks if a constraint is satisfied. nil equality // comparisons are considered to be false.
[ "checkAttributeConstraint", "checks", "if", "a", "constraint", "is", "satisfied", ".", "nil", "equality", "comparisons", "are", "considered", "to", "be", "false", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/feasible.go#L978-L1081
132,073
hashicorp/nomad
scheduler/rank.go
NewFeasibleRankIterator
func NewFeasibleRankIterator(ctx Context, source FeasibleIterator) *FeasibleRankIterator { iter := &FeasibleRankIterator{ ctx: ctx, source: source, } return iter }
go
func NewFeasibleRankIterator(ctx Context, source FeasibleIterator) *FeasibleRankIterator { iter := &FeasibleRankIterator{ ctx: ctx, source: source, } return iter }
[ "func", "NewFeasibleRankIterator", "(", "ctx", "Context", ",", "source", "FeasibleIterator", ")", "*", "FeasibleRankIterator", "{", "iter", ":=", "&", "FeasibleRankIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ",", "}", "\n", "return", "iter...
// NewFeasibleRankIterator is used to return a new FeasibleRankIterator // from a FeasibleIterator source.
[ "NewFeasibleRankIterator", "is", "used", "to", "return", "a", "new", "FeasibleRankIterator", "from", "a", "FeasibleIterator", "source", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L80-L86
132,074
hashicorp/nomad
scheduler/rank.go
NewStaticRankIterator
func NewStaticRankIterator(ctx Context, nodes []*RankedNode) *StaticRankIterator { iter := &StaticRankIterator{ ctx: ctx, nodes: nodes, } return iter }
go
func NewStaticRankIterator(ctx Context, nodes []*RankedNode) *StaticRankIterator { iter := &StaticRankIterator{ ctx: ctx, nodes: nodes, } return iter }
[ "func", "NewStaticRankIterator", "(", "ctx", "Context", ",", "nodes", "[", "]", "*", "RankedNode", ")", "*", "StaticRankIterator", "{", "iter", ":=", "&", "StaticRankIterator", "{", "ctx", ":", "ctx", ",", "nodes", ":", "nodes", ",", "}", "\n", "return", ...
// NewStaticRankIterator returns a new static rank iterator over the given nodes
[ "NewStaticRankIterator", "returns", "a", "new", "static", "rank", "iterator", "over", "the", "given", "nodes" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L113-L119
132,075
hashicorp/nomad
scheduler/rank.go
NewBinPackIterator
func NewBinPackIterator(ctx Context, source RankIterator, evict bool, priority int) *BinPackIterator { iter := &BinPackIterator{ ctx: ctx, source: source, evict: evict, priority: priority, } return iter }
go
func NewBinPackIterator(ctx Context, source RankIterator, evict bool, priority int) *BinPackIterator { iter := &BinPackIterator{ ctx: ctx, source: source, evict: evict, priority: priority, } return iter }
[ "func", "NewBinPackIterator", "(", "ctx", "Context", ",", "source", "RankIterator", ",", "evict", "bool", ",", "priority", "int", ")", "*", "BinPackIterator", "{", "iter", ":=", "&", "BinPackIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ...
// NewBinPackIterator returns a BinPackIterator which tries to fit tasks // potentially evicting other tasks based on a given priority.
[ "NewBinPackIterator", "returns", "a", "BinPackIterator", "which", "tries", "to", "fit", "tasks", "potentially", "evicting", "other", "tasks", "based", "on", "a", "given", "priority", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L156-L164
132,076
hashicorp/nomad
scheduler/rank.go
NewJobAntiAffinityIterator
func NewJobAntiAffinityIterator(ctx Context, source RankIterator, jobID string) *JobAntiAffinityIterator { iter := &JobAntiAffinityIterator{ ctx: ctx, source: source, jobID: jobID, } return iter }
go
func NewJobAntiAffinityIterator(ctx Context, source RankIterator, jobID string) *JobAntiAffinityIterator { iter := &JobAntiAffinityIterator{ ctx: ctx, source: source, jobID: jobID, } return iter }
[ "func", "NewJobAntiAffinityIterator", "(", "ctx", "Context", ",", "source", "RankIterator", ",", "jobID", "string", ")", "*", "JobAntiAffinityIterator", "{", "iter", ":=", "&", "JobAntiAffinityIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ",",...
// NewJobAntiAffinityIterator is used to create a JobAntiAffinityIterator that // applies the given penalty for co-placement with allocs from this job.
[ "NewJobAntiAffinityIterator", "is", "used", "to", "create", "a", "JobAntiAffinityIterator", "that", "applies", "the", "given", "penalty", "for", "co", "-", "placement", "with", "allocs", "from", "this", "job", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L412-L419
132,077
hashicorp/nomad
scheduler/rank.go
NewNodeReschedulingPenaltyIterator
func NewNodeReschedulingPenaltyIterator(ctx Context, source RankIterator) *NodeReschedulingPenaltyIterator { iter := &NodeReschedulingPenaltyIterator{ ctx: ctx, source: source, } return iter }
go
func NewNodeReschedulingPenaltyIterator(ctx Context, source RankIterator) *NodeReschedulingPenaltyIterator { iter := &NodeReschedulingPenaltyIterator{ ctx: ctx, source: source, } return iter }
[ "func", "NewNodeReschedulingPenaltyIterator", "(", "ctx", "Context", ",", "source", "RankIterator", ")", "*", "NodeReschedulingPenaltyIterator", "{", "iter", ":=", "&", "NodeReschedulingPenaltyIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ",", "}"...
// NewNodeReschedulingPenaltyIterator is used to create a NodeReschedulingPenaltyIterator that // applies the given scoring penalty for placement onto nodes in penaltyNodes
[ "NewNodeReschedulingPenaltyIterator", "is", "used", "to", "create", "a", "NodeReschedulingPenaltyIterator", "that", "applies", "the", "given", "scoring", "penalty", "for", "placement", "onto", "nodes", "in", "penaltyNodes" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L480-L486
132,078
hashicorp/nomad
scheduler/rank.go
NewNodeAffinityIterator
func NewNodeAffinityIterator(ctx Context, source RankIterator) *NodeAffinityIterator { return &NodeAffinityIterator{ ctx: ctx, source: source, } }
go
func NewNodeAffinityIterator(ctx Context, source RankIterator) *NodeAffinityIterator { return &NodeAffinityIterator{ ctx: ctx, source: source, } }
[ "func", "NewNodeAffinityIterator", "(", "ctx", "Context", ",", "source", "RankIterator", ")", "*", "NodeAffinityIterator", "{", "return", "&", "NodeAffinityIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", ",", "}", "\n", "}" ]
// NewNodeAffinityIterator is used to create a NodeAffinityIterator that // applies a weighted score according to whether nodes match any // affinities in the job or task group.
[ "NewNodeAffinityIterator", "is", "used", "to", "create", "a", "NodeAffinityIterator", "that", "applies", "a", "weighted", "score", "according", "to", "whether", "nodes", "match", "any", "affinities", "in", "the", "job", "or", "task", "group", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L527-L532
132,079
hashicorp/nomad
scheduler/rank.go
NewScoreNormalizationIterator
func NewScoreNormalizationIterator(ctx Context, source RankIterator) *ScoreNormalizationIterator { return &ScoreNormalizationIterator{ ctx: ctx, source: source} }
go
func NewScoreNormalizationIterator(ctx Context, source RankIterator) *ScoreNormalizationIterator { return &ScoreNormalizationIterator{ ctx: ctx, source: source} }
[ "func", "NewScoreNormalizationIterator", "(", "ctx", "Context", ",", "source", "RankIterator", ")", "*", "ScoreNormalizationIterator", "{", "return", "&", "ScoreNormalizationIterator", "{", "ctx", ":", "ctx", ",", "source", ":", "source", "}", "\n", "}" ]
// NewScoreNormalizationIterator is used to create a ScoreNormalizationIterator that // averages scores from various iterators into a final score.
[ "NewScoreNormalizationIterator", "is", "used", "to", "create", "a", "ScoreNormalizationIterator", "that", "averages", "scores", "from", "various", "iterators", "into", "a", "final", "score", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/scheduler/rank.go#L614-L618
132,080
hashicorp/nomad
helper/tlsutil/config.go
RegionSpecificWrapper
func RegionSpecificWrapper(region string, tlsWrap RegionWrapper) Wrapper { if tlsWrap == nil { return nil } return func(conn net.Conn) (net.Conn, error) { return tlsWrap(region, conn) } }
go
func RegionSpecificWrapper(region string, tlsWrap RegionWrapper) Wrapper { if tlsWrap == nil { return nil } return func(conn net.Conn) (net.Conn, error) { return tlsWrap(region, conn) } }
[ "func", "RegionSpecificWrapper", "(", "region", "string", ",", "tlsWrap", "RegionWrapper", ")", "Wrapper", "{", "if", "tlsWrap", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "func", "(", "conn", "net", ".", "Conn", ")", "(", "net", ".", ...
// RegionSpecificWrapper is used to invoke a static Region and turns a // RegionWrapper into a Wrapper type.
[ "RegionSpecificWrapper", "is", "used", "to", "invoke", "a", "static", "Region", "and", "turns", "a", "RegionWrapper", "into", "a", "Wrapper", "type", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L91-L98
132,081
hashicorp/nomad
helper/tlsutil/config.go
AppendCA
func (c *Config) AppendCA(pool *x509.CertPool) error { if c.CAFile == "" { return nil } // Read the file data, err := ioutil.ReadFile(c.CAFile) if err != nil { return fmt.Errorf("Failed to read CA file: %v", err) } // Read certificates and return an error if no valid certificates were // found. Unfortunat...
go
func (c *Config) AppendCA(pool *x509.CertPool) error { if c.CAFile == "" { return nil } // Read the file data, err := ioutil.ReadFile(c.CAFile) if err != nil { return fmt.Errorf("Failed to read CA file: %v", err) } // Read certificates and return an error if no valid certificates were // found. Unfortunat...
[ "func", "(", "c", "*", "Config", ")", "AppendCA", "(", "pool", "*", "x509", ".", "CertPool", ")", "error", "{", "if", "c", ".", "CAFile", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "// Read the file", "data", ",", "err", ":=", "iout...
// AppendCA opens and parses the CA file and adds the certificates to // the provided CertPool.
[ "AppendCA", "opens", "and", "parses", "the", "CA", "file", "and", "adds", "the", "certificates", "to", "the", "provided", "CertPool", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L185-L204
132,082
hashicorp/nomad
helper/tlsutil/config.go
LoadKeyPair
func (c *Config) LoadKeyPair() (*tls.Certificate, error) { if c.CertFile == "" || c.KeyFile == "" { return nil, nil } if c.KeyLoader == nil { return nil, fmt.Errorf("No Keyloader object to perform LoadKeyPair") } cert, err := c.KeyLoader.LoadKeyPair(c.CertFile, c.KeyFile) if err != nil { return nil, fmt.E...
go
func (c *Config) LoadKeyPair() (*tls.Certificate, error) { if c.CertFile == "" || c.KeyFile == "" { return nil, nil } if c.KeyLoader == nil { return nil, fmt.Errorf("No Keyloader object to perform LoadKeyPair") } cert, err := c.KeyLoader.LoadKeyPair(c.CertFile, c.KeyFile) if err != nil { return nil, fmt.E...
[ "func", "(", "c", "*", "Config", ")", "LoadKeyPair", "(", ")", "(", "*", "tls", ".", "Certificate", ",", "error", ")", "{", "if", "c", ".", "CertFile", "==", "\"", "\"", "||", "c", ".", "KeyFile", "==", "\"", "\"", "{", "return", "nil", ",", "n...
// LoadKeyPair is used to open and parse a certificate and key file
[ "LoadKeyPair", "is", "used", "to", "open", "and", "parse", "a", "certificate", "and", "key", "file" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L207-L221
132,083
hashicorp/nomad
helper/tlsutil/config.go
OutgoingTLSConfig
func (c *Config) OutgoingTLSConfig() (*tls.Config, error) { // If VerifyServerHostname is true, that implies VerifyOutgoing if c.VerifyServerHostname { c.VerifyOutgoing = true } if !c.VerifyOutgoing { return nil, nil } // Create the tlsConfig tlsConfig := &tls.Config{ RootCAs: x509.NewCert...
go
func (c *Config) OutgoingTLSConfig() (*tls.Config, error) { // If VerifyServerHostname is true, that implies VerifyOutgoing if c.VerifyServerHostname { c.VerifyOutgoing = true } if !c.VerifyOutgoing { return nil, nil } // Create the tlsConfig tlsConfig := &tls.Config{ RootCAs: x509.NewCert...
[ "func", "(", "c", "*", "Config", ")", "OutgoingTLSConfig", "(", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "// If VerifyServerHostname is true, that implies VerifyOutgoing", "if", "c", ".", "VerifyServerHostname", "{", "c", ".", "VerifyOutgoing",...
// OutgoingTLSConfig generates a TLS configuration for outgoing // requests. It will return a nil config if this configuration should // not use TLS for outgoing connections. Provides a callback to // fetch certificates, allowing for reloading on the fly.
[ "OutgoingTLSConfig", "generates", "a", "TLS", "configuration", "for", "outgoing", "requests", ".", "It", "will", "return", "a", "nil", "config", "if", "this", "configuration", "should", "not", "use", "TLS", "for", "outgoing", "connections", ".", "Provides", "a",...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L227-L267
132,084
hashicorp/nomad
helper/tlsutil/config.go
OutgoingTLSWrapper
func (c *Config) OutgoingTLSWrapper() (RegionWrapper, error) { // Get the TLS config tlsConfig, err := c.OutgoingTLSConfig() if err != nil { return nil, err } // Check if TLS is not enabled if tlsConfig == nil { return nil, nil } // Generate the wrapper based on hostname verification if c.VerifyServerHos...
go
func (c *Config) OutgoingTLSWrapper() (RegionWrapper, error) { // Get the TLS config tlsConfig, err := c.OutgoingTLSConfig() if err != nil { return nil, err } // Check if TLS is not enabled if tlsConfig == nil { return nil, nil } // Generate the wrapper based on hostname verification if c.VerifyServerHos...
[ "func", "(", "c", "*", "Config", ")", "OutgoingTLSWrapper", "(", ")", "(", "RegionWrapper", ",", "error", ")", "{", "// Get the TLS config", "tlsConfig", ",", "err", ":=", "c", ".", "OutgoingTLSConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// OutgoingTLSWrapper returns a a Wrapper based on the OutgoingTLS // configuration. If hostname verification is on, the wrapper // will properly generate the dynamic server name for verification.
[ "OutgoingTLSWrapper", "returns", "a", "a", "Wrapper", "based", "on", "the", "OutgoingTLS", "configuration", ".", "If", "hostname", "verification", "is", "on", "the", "wrapper", "will", "properly", "generate", "the", "dynamic", "server", "name", "for", "verificatio...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L272-L299
132,085
hashicorp/nomad
helper/tlsutil/config.go
IncomingTLSConfig
func (c *Config) IncomingTLSConfig() (*tls.Config, error) { // Create the tlsConfig tlsConfig := &tls.Config{ ClientCAs: x509.NewCertPool(), ClientAuth: tls.NoClientCert, CipherSuites: c.CipherSuites, MinVersion: c.MinVersion, PreferServerCipherSuites: ...
go
func (c *Config) IncomingTLSConfig() (*tls.Config, error) { // Create the tlsConfig tlsConfig := &tls.Config{ ClientCAs: x509.NewCertPool(), ClientAuth: tls.NoClientCert, CipherSuites: c.CipherSuites, MinVersion: c.MinVersion, PreferServerCipherSuites: ...
[ "func", "(", "c", "*", "Config", ")", "IncomingTLSConfig", "(", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "// Create the tlsConfig", "tlsConfig", ":=", "&", "tls", ".", "Config", "{", "ClientCAs", ":", "x509", ".", "NewCertPool", "(", ...
// IncomingTLSConfig generates a TLS configuration for incoming requests
[ "IncomingTLSConfig", "generates", "a", "TLS", "configuration", "for", "incoming", "requests" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L355-L391
132,086
hashicorp/nomad
helper/tlsutil/config.go
ParseCiphers
func ParseCiphers(tlsConfig *config.TLSConfig) ([]uint16, error) { suites := []uint16{} cipherStr := strings.TrimSpace(tlsConfig.TLSCipherSuites) var parsedCiphers []string if cipherStr == "" { parsedCiphers = defaultTLSCiphers } else { parsedCiphers = strings.Split(tlsConfig.TLSCipherSuites, ",") } for _...
go
func ParseCiphers(tlsConfig *config.TLSConfig) ([]uint16, error) { suites := []uint16{} cipherStr := strings.TrimSpace(tlsConfig.TLSCipherSuites) var parsedCiphers []string if cipherStr == "" { parsedCiphers = defaultTLSCiphers } else { parsedCiphers = strings.Split(tlsConfig.TLSCipherSuites, ",") } for _...
[ "func", "ParseCiphers", "(", "tlsConfig", "*", "config", ".", "TLSConfig", ")", "(", "[", "]", "uint16", ",", "error", ")", "{", "suites", ":=", "[", "]", "uint16", "{", "}", "\n\n", "cipherStr", ":=", "strings", ".", "TrimSpace", "(", "tlsConfig", "."...
// ParseCiphers parses ciphersuites from the comma-separated string into // recognized slice
[ "ParseCiphers", "parses", "ciphersuites", "from", "the", "comma", "-", "separated", "string", "into", "recognized", "slice" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L395-L447
132,087
hashicorp/nomad
helper/tlsutil/config.go
getSignatureAlgorithm
func getSignatureAlgorithm(tlsCert *tls.Certificate) (signatureAlgorithm, error) { privKey := tlsCert.PrivateKey switch privKey.(type) { case *rsa.PrivateKey: return rsaStringRepr, nil case *ecdsa.PrivateKey: return ecdsaStringRepr, nil default: return "", fmt.Errorf("Unsupported signature algorithm %T; RSA ...
go
func getSignatureAlgorithm(tlsCert *tls.Certificate) (signatureAlgorithm, error) { privKey := tlsCert.PrivateKey switch privKey.(type) { case *rsa.PrivateKey: return rsaStringRepr, nil case *ecdsa.PrivateKey: return ecdsaStringRepr, nil default: return "", fmt.Errorf("Unsupported signature algorithm %T; RSA ...
[ "func", "getSignatureAlgorithm", "(", "tlsCert", "*", "tls", ".", "Certificate", ")", "(", "signatureAlgorithm", ",", "error", ")", "{", "privKey", ":=", "tlsCert", ".", "PrivateKey", "\n", "switch", "privKey", ".", "(", "type", ")", "{", "case", "*", "rsa...
// getSignatureAlgorithm returns the signature algorithm for a TLS certificate // This is determined by examining the type of the certificate's public key, // as Golang doesn't expose a more straightforward API which returns this // type
[ "getSignatureAlgorithm", "returns", "the", "signature", "algorithm", "for", "a", "TLS", "certificate", "This", "is", "determined", "by", "examining", "the", "type", "of", "the", "certificate", "s", "public", "key", "as", "Golang", "doesn", "t", "expose", "a", ...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L453-L463
132,088
hashicorp/nomad
helper/tlsutil/config.go
ParseMinVersion
func ParseMinVersion(version string) (uint16, error) { if version == "" { return supportedTLSVersions["tls12"], nil } vers, ok := supportedTLSVersions[version] if !ok { return 0, fmt.Errorf("unsupported TLS version %q", version) } return vers, nil }
go
func ParseMinVersion(version string) (uint16, error) { if version == "" { return supportedTLSVersions["tls12"], nil } vers, ok := supportedTLSVersions[version] if !ok { return 0, fmt.Errorf("unsupported TLS version %q", version) } return vers, nil }
[ "func", "ParseMinVersion", "(", "version", "string", ")", "(", "uint16", ",", "error", ")", "{", "if", "version", "==", "\"", "\"", "{", "return", "supportedTLSVersions", "[", "\"", "\"", "]", ",", "nil", "\n", "}", "\n\n", "vers", ",", "ok", ":=", "...
// ParseMinVersion parses the specified minimum TLS version for the Nomad agent
[ "ParseMinVersion", "parses", "the", "specified", "minimum", "TLS", "version", "for", "the", "Nomad", "agent" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L466-L477
132,089
hashicorp/nomad
helper/tlsutil/config.go
ShouldReloadRPCConnections
func ShouldReloadRPCConnections(old, new *config.TLSConfig) (bool, error) { var certificateInfoEqual bool var rpcInfoEqual bool // If already configured with TLS, compare with the new TLS configuration if new != nil { var err error certificateInfoEqual, err = new.CertificateInfoIsEqual(old) if err != nil { ...
go
func ShouldReloadRPCConnections(old, new *config.TLSConfig) (bool, error) { var certificateInfoEqual bool var rpcInfoEqual bool // If already configured with TLS, compare with the new TLS configuration if new != nil { var err error certificateInfoEqual, err = new.CertificateInfoIsEqual(old) if err != nil { ...
[ "func", "ShouldReloadRPCConnections", "(", "old", ",", "new", "*", "config", ".", "TLSConfig", ")", "(", "bool", ",", "error", ")", "{", "var", "certificateInfoEqual", "bool", "\n", "var", "rpcInfoEqual", "bool", "\n\n", "// If already configured with TLS, compare w...
// ShouldReloadRPCConnections compares two TLS Configurations and determines // whether they differ such that RPC connections should be reloaded
[ "ShouldReloadRPCConnections", "compares", "two", "TLS", "Configurations", "and", "determines", "whether", "they", "differ", "such", "that", "RPC", "connections", "should", "be", "reloaded" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/helper/tlsutil/config.go#L481-L501
132,090
hashicorp/nomad
nomad/eval_endpoint.go
GetEval
func (e *Eval) GetEval(args *structs.EvalSpecificRequest, reply *structs.SingleEvalResponse) error { if done, err := e.srv.forward("Eval.GetEval", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "get_eval"}, time.Now()) // Check for read-job permissions if aclObj, e...
go
func (e *Eval) GetEval(args *structs.EvalSpecificRequest, reply *structs.SingleEvalResponse) error { if done, err := e.srv.forward("Eval.GetEval", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "get_eval"}, time.Now()) // Check for read-job permissions if aclObj, e...
[ "func", "(", "e", "*", "Eval", ")", "GetEval", "(", "args", "*", "structs", ".", "EvalSpecificRequest", ",", "reply", "*", "structs", ".", "SingleEvalResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", ...
// GetEval is used to request information about a specific evaluation
[ "GetEval", "is", "used", "to", "request", "information", "about", "a", "specific", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L30-L73
132,091
hashicorp/nomad
nomad/eval_endpoint.go
Dequeue
func (e *Eval) Dequeue(args *structs.EvalDequeueRequest, reply *structs.EvalDequeueResponse) error { if done, err := e.srv.forward("Eval.Dequeue", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "dequeue"}, time.Now()) // Ensure there is at least one scheduler if le...
go
func (e *Eval) Dequeue(args *structs.EvalDequeueRequest, reply *structs.EvalDequeueResponse) error { if done, err := e.srv.forward("Eval.Dequeue", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "dequeue"}, time.Now()) // Ensure there is at least one scheduler if le...
[ "func", "(", "e", "*", "Eval", ")", "Dequeue", "(", "args", "*", "structs", ".", "EvalDequeueRequest", ",", "reply", "*", "structs", ".", "EvalDequeueResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", ...
// Dequeue is used to dequeue a pending evaluation
[ "Dequeue", "is", "used", "to", "dequeue", "a", "pending", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L76-L130
132,092
hashicorp/nomad
nomad/eval_endpoint.go
getWaitIndex
func (e *Eval) getWaitIndex(namespace, job string, evalModifyIndex uint64) (uint64, error) { snap, err := e.srv.State().Snapshot() if err != nil { return 0, err } evals, err := snap.EvalsByJob(nil, namespace, job) if err != nil { return 0, err } // Since dequeueing evals is concurrent with applying Raft me...
go
func (e *Eval) getWaitIndex(namespace, job string, evalModifyIndex uint64) (uint64, error) { snap, err := e.srv.State().Snapshot() if err != nil { return 0, err } evals, err := snap.EvalsByJob(nil, namespace, job) if err != nil { return 0, err } // Since dequeueing evals is concurrent with applying Raft me...
[ "func", "(", "e", "*", "Eval", ")", "getWaitIndex", "(", "namespace", ",", "job", "string", ",", "evalModifyIndex", "uint64", ")", "(", "uint64", ",", "error", ")", "{", "snap", ",", "err", ":=", "e", ".", "srv", ".", "State", "(", ")", ".", "Snaps...
// getWaitIndex returns the wait index that should be used by the worker before // invoking the scheduler. The index should be the highest modify index of any // evaluation for the job. This prevents scheduling races for the same job when // there are blocked evaluations.
[ "getWaitIndex", "returns", "the", "wait", "index", "that", "should", "be", "used", "by", "the", "worker", "before", "invoking", "the", "scheduler", ".", "The", "index", "should", "be", "the", "highest", "modify", "index", "of", "any", "evaluation", "for", "t...
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L136-L158
132,093
hashicorp/nomad
nomad/eval_endpoint.go
Ack
func (e *Eval) Ack(args *structs.EvalAckRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Ack", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "ack"}, time.Now()) // Ack the EvalID if err := e.srv.evalBroker.Ack(args.EvalID, args....
go
func (e *Eval) Ack(args *structs.EvalAckRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Ack", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "ack"}, time.Now()) // Ack the EvalID if err := e.srv.evalBroker.Ack(args.EvalID, args....
[ "func", "(", "e", "*", "Eval", ")", "Ack", "(", "args", "*", "structs", ".", "EvalAckRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", "\"", "\""...
// Ack is used to acknowledge completion of a dequeued evaluation
[ "Ack", "is", "used", "to", "acknowledge", "completion", "of", "a", "dequeued", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L161-L173
132,094
hashicorp/nomad
nomad/eval_endpoint.go
Update
func (e *Eval) Update(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Update", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "update"}, time.Now()) // Ensure there is only a single update with token if l...
go
func (e *Eval) Update(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Update", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "update"}, time.Now()) // Ensure there is only a single update with token if l...
[ "func", "(", "e", "*", "Eval", ")", "Update", "(", "args", "*", "structs", ".", "EvalUpdateRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", "\"", ...
// Update is used to perform an update of an Eval if it is outstanding.
[ "Update", "is", "used", "to", "perform", "an", "update", "of", "an", "Eval", "if", "it", "is", "outstanding", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L191-L218
132,095
hashicorp/nomad
nomad/eval_endpoint.go
Create
func (e *Eval) Create(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Create", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "create"}, time.Now()) // Ensure there is only a single update with token if l...
go
func (e *Eval) Create(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Create", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "create"}, time.Now()) // Ensure there is only a single update with token if l...
[ "func", "(", "e", "*", "Eval", ")", "Create", "(", "args", "*", "structs", ".", "EvalUpdateRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", "\"", ...
// Create is used to make a new evaluation
[ "Create", "is", "used", "to", "make", "a", "new", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L221-L263
132,096
hashicorp/nomad
nomad/eval_endpoint.go
Reblock
func (e *Eval) Reblock(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Reblock", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "reblock"}, time.Now()) // Ensure there is only a single update with token if...
go
func (e *Eval) Reblock(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Reblock", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "reblock"}, time.Now()) // Ensure there is only a single update with token if...
[ "func", "(", "e", "*", "Eval", ")", "Reblock", "(", "args", "*", "structs", ".", "EvalUpdateRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", "\"",...
// Reblock is used to reinsert an existing blocked evaluation into the blocked // evaluation tracker.
[ "Reblock", "is", "used", "to", "reinsert", "an", "existing", "blocked", "evaluation", "into", "the", "blocked", "evaluation", "tracker", "." ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L267-L305
132,097
hashicorp/nomad
nomad/eval_endpoint.go
Reap
func (e *Eval) Reap(args *structs.EvalDeleteRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Reap", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "reap"}, time.Now()) // Update via Raft _, index, err := e.srv.raftApply(structs.E...
go
func (e *Eval) Reap(args *structs.EvalDeleteRequest, reply *structs.GenericResponse) error { if done, err := e.srv.forward("Eval.Reap", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "reap"}, time.Now()) // Update via Raft _, index, err := e.srv.raftApply(structs.E...
[ "func", "(", "e", "*", "Eval", ")", "Reap", "(", "args", "*", "structs", ".", "EvalDeleteRequest", ",", "reply", "*", "structs", ".", "GenericResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", "\"", ...
// Reap is used to cleanup dead evaluations and allocations
[ "Reap", "is", "used", "to", "cleanup", "dead", "evaluations", "and", "allocations" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L308-L324
132,098
hashicorp/nomad
nomad/eval_endpoint.go
List
func (e *Eval) List(args *structs.EvalListRequest, reply *structs.EvalListResponse) error { if done, err := e.srv.forward("Eval.List", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "list"}, time.Now()) // Check for read-job permissions if aclObj, err := e.srv.Reso...
go
func (e *Eval) List(args *structs.EvalListRequest, reply *structs.EvalListResponse) error { if done, err := e.srv.forward("Eval.List", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "list"}, time.Now()) // Check for read-job permissions if aclObj, err := e.srv.Reso...
[ "func", "(", "e", "*", "Eval", ")", "List", "(", "args", "*", "structs", ".", "EvalListRequest", ",", "reply", "*", "structs", ".", "EvalListResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", "(", "\"", "...
// List is used to get a list of the evaluations in the system
[ "List", "is", "used", "to", "get", "a", "list", "of", "the", "evaluations", "in", "the", "system" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L327-L381
132,099
hashicorp/nomad
nomad/eval_endpoint.go
Allocations
func (e *Eval) Allocations(args *structs.EvalSpecificRequest, reply *structs.EvalAllocationsResponse) error { if done, err := e.srv.forward("Eval.Allocations", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "allocations"}, time.Now()) // Check for read-job permissio...
go
func (e *Eval) Allocations(args *structs.EvalSpecificRequest, reply *structs.EvalAllocationsResponse) error { if done, err := e.srv.forward("Eval.Allocations", args, args, reply); done { return err } defer metrics.MeasureSince([]string{"nomad", "eval", "allocations"}, time.Now()) // Check for read-job permissio...
[ "func", "(", "e", "*", "Eval", ")", "Allocations", "(", "args", "*", "structs", ".", "EvalSpecificRequest", ",", "reply", "*", "structs", ".", "EvalAllocationsResponse", ")", "error", "{", "if", "done", ",", "err", ":=", "e", ".", "srv", ".", "forward", ...
// Allocations is used to list the allocations for an evaluation
[ "Allocations", "is", "used", "to", "list", "the", "allocations", "for", "an", "evaluation" ]
01c267b92b476a61fbdef49ba3c6b62a84509043
https://github.com/hashicorp/nomad/blob/01c267b92b476a61fbdef49ba3c6b62a84509043/nomad/eval_endpoint.go#L384-L429