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
use fmt;
use PhantomData;
use crateKairos;
use crate;
/// An event released by an [`Ideal`](super::Ideal) through gate `G`.
///
/// On normal return, the machine's final readiness check admitted the contained
/// pending occurrence, the machine removed it, and [`Gate::advance`] returned for
/// that same occurrence. The private constructor makes this provenance a safe-code
/// invariant. `G` names the rule that participated; its dependency representation
/// alone is insufficient because distinct gates may share one [`Gate::Dep`].
///
/// The witness is neither [`Clone`] nor [`Copy`]. Consuming APIs can therefore use
/// it at most once in safe code, while dropping it remains valid. It does not prove
/// that a caller-defined gate satisfies its semantic laws, identify the originating
/// machine instance, carry caller eligibility policy, grant authority, establish
/// durability, or imply exactly-once external effects.
///
/// The gate brand is invariant and occupies no storage. `repr(transparent)` keeps
/// the witness's layout and ABI equal to its [`Event`] field.
///
/// A raw event cannot substitute for release provenance:
///
/// ```compile_fail
/// use minerva::metis::{Causal, Event, Released, VersionVector};
/// use minerva::kairos::Kairos;
///
/// fn needs_release(_: Released<u8, Causal>) {}
///
/// let event = Event {
/// stamp: Kairos::new(1, 0, 1, 0u16),
/// deps: VersionVector::new(),
/// payload: 1u8,
/// };
/// needs_release(event);
/// ```
///
/// Downstream code cannot construct the witness directly:
///
/// ```compile_fail
/// use core::marker::PhantomData;
/// use minerva::kairos::Kairos;
/// use minerva::metis::{Causal, Event, Released, VersionVector};
///
/// let event = Event {
/// stamp: Kairos::new(1, 0, 1, 0u16),
/// deps: VersionVector::new(),
/// payload: 1u8,
/// };
/// let _ = Released::<_, Causal> {
/// event,
/// _gate: PhantomData,
/// };
/// ```
///
/// Gate brands cannot be exchanged even when their dependency representations agree:
///
/// ```compile_fail
/// use minerva::metis::{Gate, Released};
///
/// struct Rule<const ID: u8>;
///
/// impl<const ID: u8> Gate for Rule<ID> {
/// type Dep = u64;
/// type Progress = ();
///
/// fn deliverable(_progress: &(), _sender: u32, _dep: &u64) -> bool {
/// false
/// }
///
/// fn advance(_progress: &mut (), _sender: u32, _dep: &u64) {}
///
/// fn stale(_progress: &(), _sender: u32, _dep: &u64) -> bool {
/// false
/// }
/// }
///
/// fn needs_rule_two(_: Released<u8, Rule<2>>) {}
///
/// fn wrong_gate(released: Released<u8, Rule<1>>) {
/// needs_rule_two(released);
/// }
/// ```
///
/// The provenance witness cannot be duplicated:
///
/// ```compile_fail
/// use minerva::metis::{Causal, Released};
///
/// fn duplicate(released: Released<u8, Causal>) {
/// let _copy = released.clone();
/// }
/// ```