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
//! `printobserver-core`.
//!
//! Owns: the supervision logic — the loop that turns printer state and vision
//! observations into supervisory decisions, and the policy that decides which
//! decisions are allowed to reach the printer — together with the event kinds
//! and source names that logic writes ([`kinds`]), the one aggregate a
//! caller and the agent both read, the print's context ([`context`]), and the
//! persistence interfaces it needs, one per aggregate ([`store`]).
//!
//! May depend on: `printobserver-types` and the three port crates
//! (`printobserver-printer-api`, `printobserver-vision-api`,
//! `printobserver-supervisor-api`), and NO implementation crate. This is the
//! rule the whole design rests on and `just check-repo` enforces it. The
//! persistence interfaces this crate needs are its own ([`store`]), one trait
//! per aggregate it persists, and the store implementation depends on this
//! crate to implement them.
//!
//! # The policy, which is the reason this layer exists
//!
//! A failure detector can already see a failure and a printer can already
//! drive the machine. What does not exist without this crate is the thing in between that
//! decides what an agent is allowed to do about it, and its whole value is in
//! being thin, bounded, and the **single** place that decision is made — so
//! that an operator's own commands are bounded by exactly the same rules an
//! agent's are.
//!
//! * **Effective bounds** are the configured [safety
//! envelope](crate::records::SafetyEnvelope) intersected with the active
//! print's manifest. A manifest may only narrow; a range wider than the
//! envelope's is narrowed to the envelope's and the narrowing is recorded on
//! the print. See [`bounds`].
//! * **Every action from every actor passes one decision**, taken by
//! [`decision::decide`] and issued by the one function named in
//! [`supervisor`]. There is no path by which an action reaches the printer
//! without it, and that is structural: no other item of this crate names an
//! action method of the printer port, and no item outside that one module can
//! obtain the handle to call one on.
//! * **A request outside the bounds is rejected, not clamped**, and the
//! rejection is persisted with the value asked for and the range allowed, so
//! the caller can ask again inside the range.
//! * **A bounded intervention expires on its own.** Core reads the current time
//! through an injected [`Clock`] rather than the system's, so expiry is
//! driven by time passing and by nothing else. See [`expiry`].
//! * **Nothing in this crate, and nothing reachable from it, sends a command
//! string to a printer.** The printer port declares no method that admits
//! one: no method admits a byte sequence at all, and the only string anywhere
//! in the closure its parameters reach is the one
//! [`FileName`](printobserver_types::FileName) wraps.
pub use ;
pub use block_on;
pub use ;
pub use ;
pub use ;
pub use PrintContext;
pub use ;
pub use CoreError;
pub use TERMINAL_STATES;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;