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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//! Typed payloads for authoritative runtime evidence transitions.
use super::{StackId, WaitKey, kind_types::*};
use crate::diagnostics::{CarrierId, ScopeId, ShutdownPhase, SuspensionReason, TaskId};
/// One authoritative runtime state transition.
#[derive(
::core::clone::Clone,
::core::marker::Copy,
::core::fmt::Debug,
::core::cmp::PartialEq,
::core::cmp::Eq,
)]
#[non_exhaustive]
pub enum RuntimeEventKind {
/// An owned root or supervisor scope became active.
/// Borrowed local scopes do not receive separate scope identities or events.
ScopeOpened {
/// New runtime-local scope identity.
scope: ScopeId,
/// Always `None` in this release because every owned scope is top-level.
parent: Option<ScopeId>,
/// Whether this is a long-lived supervisor.
supervised: bool,
},
/// An owned root or supervisor drained and released its retained records.
ScopeClosed {
/// Drained runtime-local scope identity.
scope: ScopeId,
},
/// A task became irrevocably owned by the runtime.
TaskAccepted {
/// New monotonic task identity.
task: TaskId,
/// Owning root or supervisor.
scope: ScopeId,
/// Same-runtime spawning task, when present.
parent: Option<TaskId>,
/// Immutable owner carrier.
carrier: CarrierId,
},
/// A reusable stack mapping became owned by a task.
StackCheckedOut {
/// Task receiving the mapping.
task: TaskId,
/// Reusable mapping identity.
stack: StackId,
},
/// A task began one carrier-affine execution turn.
Mounted {
/// Mounted task.
task: TaskId,
/// Carrier performing the mount.
carrier: CarrierId,
},
/// A task voluntarily yielded its execution turn.
Yielded {
/// Yielding task.
task: TaskId,
/// Carrier retaining the task.
carrier: CarrierId,
},
/// A wait generation was registered with its carrier.
WaitPublished {
/// Waiting task.
task: TaskId,
/// Newly active generation.
wait: WaitKey,
/// Whether the park requested a timer.
has_deadline: bool,
},
/// The carrier transferred a task into its parked table.
Parked {
/// Parked task.
task: TaskId,
/// Exact active generation.
wait: WaitKey,
/// Owner carrier.
carrier: CarrierId,
/// Typed suspension boundary.
reason: SuspensionReason,
},
/// A producer attempted to select one exact wait generation.
WakeOffered {
/// Task captured by the generation registration.
task: TaskId,
/// Exact offered generation.
wait: WaitKey,
/// Offered wake cause.
cause: EvidenceWakeCause,
/// Context that offered this wake.
origin: WakeOrigin,
},
/// The offered cause became the generation's sole winner.
WakeSelected {
/// Selected task.
task: TaskId,
/// Selected generation.
wait: WaitKey,
/// Winning wake cause.
cause: EvidenceWakeCause,
/// Context that offered the winning wake.
origin: WakeOrigin,
},
/// The offered cause could not select the requested generation.
WakeRejected {
/// Task captured by the offered registration.
task: TaskId,
/// Rejected generation.
wait: WaitKey,
/// Rejected wake cause.
cause: EvidenceWakeCause,
/// Context that offered the rejected wake.
origin: WakeOrigin,
/// Exact rejection reason.
reason: WakeRejection,
},
/// Task execution returned from a modeled park operation.
Resumed {
/// Resumed task.
task: TaskId,
/// Generation being completed.
wait: WaitKey,
/// Previously selected winner.
cause: EvidenceWakeCause,
},
/// A wait generation entered a carrier's timer queue.
TimerRegistered {
/// Timed generation.
wait: WaitKey,
/// Owner carrier.
carrier: CarrierId,
},
/// A wait generation left a carrier's timer queue.
TimerRetired {
/// Retired timed generation.
wait: WaitKey,
/// Owner carrier.
carrier: CarrierId,
/// Retirement cause.
reason: TimerRetirement,
},
/// Task ownership of a stack mapping ended.
StackReleased {
/// Previous task owner.
task: TaskId,
/// Released mapping.
stack: StackId,
/// Cache or unmap disposition.
disposition: StackDisposition,
},
/// A task reached its single terminal runtime state.
TaskTerminated {
/// Terminal task.
task: TaskId,
/// Runtime-observed terminal state.
outcome: TaskOutcome,
},
/// A bounded carrier queue changed depth.
QueueDepth {
/// Queue owner carrier.
carrier: CarrierId,
/// Queue category.
queue: QueueKind,
/// Depth after the transition.
depth: usize,
/// Immutable configured limit.
capacity: usize,
},
/// Bounded runtime resource admission rejected work.
AdmissionRejected {
/// Resource that rejected admission.
resource: crate::error::CapacityResource,
/// Configured resource limit.
limit: usize,
},
/// Runtime shutdown advanced to a nondecreasing phase.
ShutdownAdvanced {
/// Newly visible shutdown phase.
phase: ShutdownPhase,
},
}
#[cfg(test)]
#[path = "kind_test.rs"]
mod kind_test;