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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
//! THE CHANNELS BLOCK: what a deployment says about a node's own edges, and how the three layers
//! that can say it are resolved into one.
//!
//! `[node.channels]` is the second entry of the rack [`NodeSection`] is — `options` is the node
//! author's type, this is the framework's own — and the two are read the same way: a block nobody
//! wrote states an absence, and an absence is what the layer under it fills.
//!
//! # The precedence is UNIFORM, kind included
//!
//! ```text
//! config > macro-declared > shipped
//! ```
//!
//! A deployment's word wins over the author's default, which wins over the framework's constant —
//! for the KIND exactly as for the depth, so a upstream an author shipped as `bounded(512)` can be
//! made unbounded by a document and an unbounded one can be bounded back. There is no frozen axis:
//! presence already lets a document decide which nodes exist, and retuning the edges between them is
//! the same hand.
//!
//! # A POSITION, not a name, is what reaches this layer
//!
//! The document's keys are the emitted shelf's FIELDS — one per declared upstream, named by the
//! upstream the declaration wrote — and the shelf hands this layer a table in DECLARATION ORDER.
//! That is the same convention a [`PollUpstream`](crate::PollUpstream) position already follows, and the
//! same one [`Wiring::source_of`](super::Wiring::source_of) reads off the graph, so a upstream's
//! channel and a upstream's tick are numbered by one rule and no map from string to edge exists to
//! fall out of step.
//!
//! # The contradiction row reads the resolution, and only the resolution
//!
//! An UNBOUNDED edge with a DROPPING [`OverflowPolicy`](crate::OverflowPolicy) is a contradiction —
//! nothing can overflow a queue nothing bounds — and its refusal is at launch validate, on the
//! RESOLVED kind rather than on what any one layer declared. What lands here is that resolution;
//! the row itself is [`Refusal::DroppingUnbounded`](super::Refusal::DroppingUnbounded), which reads
//! this table beside the deployment's own policy set.
use BTreeMap;
use Utf8Bytes;
use crate::;
use ;
/// WHAT A PER-NODE CHANNELS BLOCK CAN BE ASKED, whoever emitted it.
///
/// The emitted shelf is a struct with one field per declared upstream — typed, `deny_unknown_fields`,
/// and named by the declaration rather than by a string — so this layer cannot read its fields by
/// name and does not want to: what it needs is the table, in declaration order, which is the one
/// thing every shelf can say.
/// The shelf of a node that declares NO upstreams — the rack's default, and the only shelf a document
/// can write nothing into.
///
/// It exists so that [`NodeSection`]'s second parameter has an answer for every node whose
/// declaration named no upstream, and so that a document writing `channels` for such a node is
/// refused by name at deserialization rather than accepted and ignored.
/// What a deployment TUNED, node by node — the config layer of the channel precedence.
///
/// [`Enablement`](super::Enablement)'s sibling and deliberately its shape: the names in it are the
/// arrangement's own node names, the bridge from the emitted spine is one call per mount, and a
/// deployment assembled in code reaches the same door with strings because nothing else can carry a
/// name a program computes.
///
/// # Examples
///
/// ```
/// use ingraph::{ChannelOptions, Channels};
///
/// // A deployment that widens one node's second upstream and says nothing about the rest.
/// let channels = Channels::new().tuned("captions", [None, Some(ChannelOptions::Unbounded)]);
///
/// assert_eq!(channels.spec("captions", 1), Some(ChannelOptions::Unbounded));
/// // Said nothing about, so whatever the declaration and the framework say stands.
/// assert_eq!(channels.spec("captions", 0), None);
/// assert_eq!(channels.spec("decode", 0), None);
/// ```
/// THE PRECEDENCE, in one place: config over macro-declared over shipped.
///
/// Uniform for the kind as well as the depth, which is what makes it one function rather than two
/// rules that could disagree: a layer either speaks about this edge or it does not, and the first
/// one that does is the answer.
pub const
/// EVERY EDGE'S ANSWER, resolved once at the validate walk: one row per node, one entry per inbound
/// channel upstream, in the graph's own edge order.
///
/// The order is the convention, not a choice made here: a node's inbound channel edges are numbered
/// as [`Wiring::source_of`](super::Wiring::source_of) numbers them, which is the declaration order
/// the emitted shelf's fields are written in and the same rule a `PollUpstream` position follows. So a
/// document's `ocr = "unbounded"` and the edge it tunes meet at a POSITION, with no map from string
/// to edge in between to fall out of step.
///
/// Non-channel upstreams are skipped for the reason they are skipped everywhere else: a changes
/// listener reads its producer's store, a poll edge carries no messages, and a transient edge is a
/// door — none of the three is opened as a data channel, so none has a channel to resolve.
pub