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
/*
* Copyright (c) 2024. Govcraft
*
* Licensed under either of
* * Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* * MIT license: http://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the applicable License for the specific language governing permissions and
* limitations under that License.
*/
//! Supervision of child actors.
//!
//! Every type in this module is re-exported from here, so the public paths
//! [`SupervisionStrategy`] and [`SupervisionDecision`] resolve exactly as they
//! did when this module was a single file.
//!
//! # Layout
//!
//! - [`strategy`] — which children to restart when one terminates
//! - [`registry`] — the value types describing a supervisor's children
//! - [`status`] — what a supervisor publishes about one child
//! - [`escalation`] — what happens once restarting stops working
//! - [`events`] — supervision notifications broadcast over the broker
//! - [`error`] — the errors the subsystem returns
//! - [`plan`] — the pure decision layer the engine carries out
//! - [`spawner`] — how a supervisor recreates a child
//! - [`engine`] — the supervising actor's side of registration
pub use SupervisionError;
pub use Escalation;
pub use ;
pub use ;
// `ChildSlot` and `SlotState` are deliberately not re-exported yet: nothing
// outside `registry` names them by that path, and an unused re-export is a
// warning rather than a placeholder. `engine` reaches `ChildSlot` and
// `PendingSlot` through `super::registry::` directly.
pub use ;
pub use ;
pub use ;
pub use ;
/// Contains the supervising actor's side of registration.
///
/// `supervise_with` and `unsupervise` on `ManagedActor` have no caller yet: they
/// need `&mut self` held across an `await`, which only the message loop can
/// provide, and the loop does not drive them until the restart engine lands.
/// `supervise_deferred` is the user-reachable path in the meantime — it hands
/// the message loop the `await` instead of needing one itself.
pub use status_channel;
/// Contains the errors returned by the supervision subsystem.
/// Contains the policy for what a supervisor does after restarts stop working.
/// Contains the supervision events broadcast over the system broker.
/// Contains the pure decision layer: what to do about a terminated child.
///
/// Kept separate from the engine that carries its decisions out, so that the
/// restart rules — which is where the subtle bugs live — are tested by calling
/// a function and comparing a value, with no runtime and no timing.
///
/// It carried a `dead_code` expectation until the engine landed, which the
/// compiler then rejected as unfulfilled. That is what an `expect` is for.
/// Contains a supervisor's record of its children.
///
/// Same deferral as [`plan`]: the registry is wired onto `ManagedActor` here but
/// nothing reads or writes it until registration and the engine land.
/// Contains the recipe a supervisor uses to recreate a child.
/// Contains a supervisor's published view of one supervised child.
/// Contains the supervision strategies and the decisions they produce.