MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / get

Method get

worker/queue.go:194–209  ·  view source on GitHub ↗

get retrieves metadata for a given task ID.

(id uint64)

Source from the content-addressed store, hash-verified

192
193// get retrieves metadata for a given task ID.
194func (t *tasks) get(id uint64) (TaskMeta, error) {
195 if t == nil {
196 return 0, fmt.Errorf("task queue hasn't been initialized yet")
197 }
198
199 if id == 0 || id == math.MaxUint64 {
200 return 0, fmt.Errorf("task ID is invalid: %d", id)
201 }
202 t.logMu.Lock()
203 defer t.logMu.Unlock()
204 meta := TaskMeta(t.log.Get(id))
205 if meta == 0 {
206 return 0, fmt.Errorf("task does not exist or has expired")
207 }
208 return meta, nil
209}
210
211// worker loops forever, running queued tasks one at a time. Any returned errors are logged.
212func (t *tasks) worker() {

Callers 1

TaskStatusMethod · 0.45

Calls 5

TaskMetaTypeAlias · 0.85
GetMethod · 0.65
ErrorfMethod · 0.45
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected