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
//! THE RECEIPT a consumer takes: the message itself, or the landed entity's KEY.
//!
//! A store's emission is its COMMIT RECEIPT MADE FLOW — only committed items, after the commit, in
//! commit order — and that law is the driver's, held by
//! [`Resident::reconcile`](super::Resident) for both modes at once: the write lane answers first,
//! and only the positions it committed are fanned out, in the order they were staged. Nothing here
//! re-states it and nothing here can weaken it.
//!
//! What this module adds is the OTHER half of the ⑥ ruling: the receipt is the SUBSCRIBER's choice,
//! per upstream entry, and the author emits `T` ONCE. So the projection `(key, T) → key` happens at
//! the SEND SITE — here — rather than in the operator, which is why one store legally feeds a
//! message-receipt consumer and a notify-receipt one at the same moment, from the same commit, in
//! the same order.
//!
//! ```text
//! ┌── message edge ── Vec<Item<T>>
//! land → commit → fan-out ┤
//! └── notify edge ── Vec<Item<T::Key>>
//! ```
//!
//! # Two ack domains, and they do not meet
//!
//! The upstream settles at the COMMIT; a downstream's ack rides its own edge and can never
//! un-commit anything. That separation is structural rather than a rule written here: the commit
//! already happened before [`Sink::deliver`](super::Sink::deliver) was called at all.
use ;
use crateTransformer;
/// A node's out-edges when SOME of its consumers took the notify receipt.
///
/// Two lists rather than one enum per edge, and the reason is the type: a message edge carries `T`
/// and a notify edge carries `T::Key`, so no single [`Outbox`](super::Outbox) names both. Each list
/// is an ordinary [`Downstream`], which is what keeps the whole of the existing edge machinery —
/// windows, nudges, backpressure — unchanged on both sides.
///
/// A node NONE of whose consumers asked for a receipt carries a bare [`Downstream<T>`] exactly as it
/// did: this type is what the wiring builds only when a `notify` word was written, so the fence and
/// the projection cost a graph without one nothing at all.
///
/// # The edge INDEX runs messages first, then receipts
///
/// [`Sink::deliver`]'s index is a position in this node's whole edge list, and the order is stated
/// rather than discovered because the wiring and the driver have to agree on it: every message edge,
/// in the order it was attached, then every notify edge in the order it was attached.
/// `T::Key: Send + 'static` for the same reason `T` is — a notify edge is an ordinary edge and its
/// batch crosses threads with the body that sends it.
///
/// `Clone` on both is the two [`Downstream`]s' own — see that type's [`Sink`] impl. It is spent here
/// twice over: every edge of this set carries every output ([`carries`](Sink::carries) is the
/// inherited every-edge answer), so a node with a message edge AND a notify edge is already a
/// fan-out of two, and the key an arm mints is taken from a value that had to survive the arm before
/// it.