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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
//! Whether the caller that started a delivery still wants it, asked again while
//! the delivery waits.
//!
//! # Why this is the CALLER's state and not the transport's
//!
//! A liminal push blocks for the worker's correlated reply, and re-polls a
//! predicate throughout that wait so a delivery nobody is waiting for any more
//! can be abandoned instead of held open. Two of the questions that predicate
//! asks belong to the transport — the deployment is draining, the worker is
//! still registered — but the third does not: the outbox arm also asks whether
//! **the pass that started this delivery still owns the row's claim**.
//!
//! That question cannot be answered from inside the transport, and the reason is
//! one fact about [`DeliveryGate`](super::outbox_dispatcher::DeliveryGate): its
//! `holds` is plain set membership, so **a key that was never begun reads
//! identically to a key that was released**. A delivery dispatched from the
//! worker dispatcher never takes a hold, so a transport that derived the row's
//! dispatch key for itself would find `holds == false` at the delivery's very
//! first poll and abandon before the worker could possibly reply — reported as
//! `delivery wait abandoned`, which reads to an operator as a **worker** fault.
//! Dropping the term instead would silently remove the outbox arm's live claim
//! guard. Neither is acceptable, so the predicate travels as an argument.
//!
//! # Why a named trait and not a closure
//!
//! Each implementation below names **one caller** and states that caller's whole
//! abandonment condition in one place. A bare `impl Fn() -> bool` would let any
//! call site assemble a predicate inline, which is precisely how a dispatcher
//! pass could silently borrow the outbox's claim check, or how "no abandonment
//! condition" could be spelled `|| true` and never be found again. This is the
//! same law [`Undeliverable`](super::task_delivery::Undeliverable) follows: the
//! decision has a name, and one definition per caller.
use Arc;
use DeliveryGate;
use ;
/// Asked repeatedly while a delivery waits: does the caller still want it?
///
/// Returning `false` abandons the wait. A late reply that arrives afterwards is
/// discarded, so an implementation must only answer `false` when the caller
/// genuinely no longer owns the delivery — not merely because it is slow.
/// The outbox pass's intent: it wants the delivery while the deployment is not
/// draining, it still holds the row's claim, **and** the chosen worker is still
/// registered.
///
/// The claim is the half no transport can ask about — see the module docs.
///
/// # Why the registration term is here and not left to the transport
///
/// An intent answers the caller's whole question. If a transport also applied
/// terms of its own, `still_wanted()` would be a partial answer whose real
/// meaning depended on which transport asked it, and the two halves could drift
/// apart with nothing to catch it. So every term the outbox arm's original
/// closure asked lives here — including the registration re-check, which that
/// closure did ask (`liminal_transport.rs:1209-1220`) and which would otherwise
/// be silently lost in the move.
/// The registration re-check both real intents apply, with one definition so the
/// two cannot answer it differently — including on the error path, where an
/// unreadable registry must not license a continued wait.
/// The worker dispatcher's intent: it wants the delivery while the deployment is
/// not draining **and** the chosen worker is still registered.
///
/// 🔴 It deliberately does **not** consult the delivery gate's held keys. This
/// pass never took a hold, and a never-held key is indistinguishable from a
/// released one, so consulting it would abandon every dispatcher-originated
/// delivery at its first poll.
/// A caller with no abandonment condition at all.
///
/// Named, rather than spelled `|| true` at a call site, so that the decision is
/// **visible and greppable**: every place a delivery is allowed to wait
/// unconditionally says so by naming this type.
;
/// Shared handle to a caller's intent, for the delivery paths that must move it
/// onto a blocking thread.
pub type SharedDeliveryIntent = ;