1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Runtime task identity.
//!
//! [`TaskId`] is the opaque runtime identity of one task run.
//!
//! It is minted by Taskvisor when a task is accepted into the runtime.
//! Users can read it, compare it, log it, and pass it back to runtime APIs such as cancel/remove.
//! Users cannot construct arbitrary ids.
//!
//! ## TaskId vs Name vs Slot
//!
//! | Concept | Owned by | Meaning |
//! |------------------|------------|-------------------------------------------------------------|
//! | [`TaskId`] | runtime | unique identity of one task run |
//! | task name | task | human label used for logs, metrics, and registry uniqueness |
//! | controller slot | controller | admission key for "one at a time" scheduling |
//!
//! A task name may be reused after the previous task is removed.
//! A `TaskId` is never reused.
//!
//! With the `controller` feature, a submitted task also has a slot key (`ControllerSpec::slot_name`).
//! The slot controls admission only; it is not the same thing as the task's runtime identity.
use ;
/// Process-global monotonic source of task identities.
///
/// Starts at `1`; `0` is never minted.
static TASK_ID_SEQ: AtomicU64 = new;
/// Opaque runtime identity of one task run.
///
/// A `TaskId` is minted by the runtime and carried on lifecycle [`Event`](crate::Event)s.
///
/// Use it to:
/// - correlate events for the same run,
/// - cancel or remove a task by identity,
/// - keep stable external logs/metrics references.
///
/// Do not parse display output.
/// Use [`get`](Self::get) when a numeric value is needed for logs or external correlation.
;