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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
//! ONE NODE'S SHELF in a deployment's options — the carrier the emitted spine's every field holds.
//!
//! # PRESENCE IS ENABLEMENT, and it is the ONLY enablement axis
//!
//! An application DECLARES a catalog; a deployment LAUNCHES a subset. So the absence of a node's
//! section is the statement that the node is not started — which is why the emitted spine holds
//! `Option<NodeSection<…>>` per node and not a bare section, and why a node added in code runs
//! nowhere until a deployment names it. The sleeping catalog costs no boilerplate.
//!
//! There is NO soft switch beside that hard one, and the doctrine is why: a configuration file is an
//! IMMUTABLE ARTIFACT. Behaviour changes by pointing at a different file — both of them under
//! version control, the file name carrying the intent — never by toggling a live one. Everything a
//! `enabled = false` bought is bought more cleanly per deployment: git keeps the tuning, the
//! enabling variant validates when it is used, and no reader has to ask which of two axes turned a
//! node off. A stray `enabled` key in a document is now an ordinary unknown field, refused by name
//! where the reader is looking at the file.
//!
//! # A SHELF, so what stands beside `options` can grow
//!
//! `options` is one entry of a rack rather than the whole of it. The framework's own per-node
//! blocks — `channels` today, an explicit policy selection later — mount BESIDE it under their own
//! names, each typed and each refusing its own unknown keys. That is what keeps a deployment's file
//! one schema: nothing is stringly keyed, and nothing needs a second document to say what a node's
//! edges do.
//!
//! Each block is ONE TYPE PARAMETER, defaulted — `NodeSection<O, C = Unchanneled, P = Unpoliced>`,
//! which is the rack with both of its framework rows on it. That is what makes it general rather
//! than a place a second block had to be retrofitted into: the policy row was added by adding a
//! defaulted parameter and changing no site that names one spelling, which is exactly what the
//! channels round claimed it would cost.
//!
//! # `stream` is the one row that is a VALUE and not a parameter, and the reason is the emission
//!
//! [`StreamOptions`] holds two framework-open trait objects, so it can be neither deserialized nor
//! projected off a declaration — and the row that would have carried it as a fourth parameter has
//! nowhere to read its TYPE from. A declaration states [`Declared::Pair`](super::Declared::Pair) and
//! the graph root's emission cannot see it, so the spine's field type is written once for every
//! mount; a parameter whose value differed per node would have to be projected through
//! [`Mount`](super::Mount), and a root's OPTIONS type would then refuse to exist for a node whose
//! body was not written yet — the obligation the launch discharges at its own call site, moved back
//! onto the declaration.
//!
//! So the seats ride as a concrete `Option<StreamOptions>`, `serde(skip)`ped because a trait object
//! has no document form, and a deployment states them in CODE. What that costs is the value-like
//! derives: a rack holding a trait object is no more `Copy`, `Eq` or `Hash` than
//! [`Policies`](super::Policies) is, for exactly that type's reason.
use crateStreamOptions;
/// A node's own section of a deployment's options: writing one is what launches the node, and what
/// is under it is what the node is built with.
///
/// # `options` is OPTIONAL inside a present section
///
/// A section with no `options` key is the node at whatever its own options say by default —
/// `[decode]` alone, the common case, and the only shape a zero-knob node (`type Options = ()`) can
/// be written in at all. What fills a `None` is the CONSTRUCTION's own door: it is
/// [`AsyncConstructor::new`](super::AsyncConstructor::new)'s condition — the options' [`Default`] — restated
/// as data, so the two agree by construction rather than by convention.
///
/// # `channels` and `policies` are the FRAMEWORK's blocks, and they are optional the same way
///
/// A section with no `channels` key is a node whose every edge stands at whatever its declaration
/// and the framework say — which is nearly every node. What a written one holds is the emitted
/// per-node shelf, one field per declared source, and the parameter's default
/// ([`Unchanneled`](super::Unchanneled)) is the shelf of a node that declared none.
///
/// `policies` is the second row of the same rack and reads the same way — see
/// [`PolicyShelf`](super::PolicyShelf) for what it can hold today, which is nothing, and why that
/// is the honest content rather than an unfinished one.
///
/// # Examples
///
/// ```
/// use ingraph::NodeSection;
///
/// /// A node's own options, as its author writes them.
/// #[derive(Debug, PartialEq)]
/// struct DecodeOptions {
/// threads: usize,
/// }
///
/// // A section states what it is tuned to, and its presence is what runs the node.
/// let tuned = NodeSection::new(DecodeOptions { threads: 8 });
/// assert_eq!(tuned.options(), Some(&DecodeOptions { threads: 8 }));
///
/// // A section with no options at all — the node at its own defaults.
/// let plain = NodeSection::<DecodeOptions>::default();
/// assert_eq!(plain.options(), None);
/// assert_eq!(plain.channels(), None);
/// assert_eq!(plain.policies(), None);
/// assert!(plain.stream().is_none());
/// ```
///
/// # `stream` is the rack's third framework row, and it is stated in CODE
///
/// A section with no `stream` seats is a streaming node's lane at [`StreamOptions::new`]'s three
/// shipped answers, and a buffered node reads the row not at all — see the module note for why this
/// one is a value where the other two are parameters.
// The bound is WRITTEN rather than inferred, and that is the whole of what keeps a mandatory knob
// mandatory. serde reads `#[serde(default)]` on a field mentioning `O` as `O: Default`, which would
// make a section deserializable only for options that can be built out of nothing — so an options
// type with a required field would have no section at all rather than one that refuses by name. The
// default the attribute actually spends is `Option::<O>::default()`, which every `O` already has —
// and the same sentence is why the shelf is held optionally rather than defaulted into existence.