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
//! WHICH NODES A DEPLOYMENT LAUNCHES — and why an absence is the whole of an answer.
//!
//! # Presence is enablement
//!
//! An application DECLARES a catalog and a deployment LAUNCHES a subset of it. So the statement a
//! deployment makes is what it NAMES, and a node it does not name is a node that never starts: the
//! sleeping catalog costs no boilerplate, and a node added in code runs nowhere until somebody says
//! it should. That is the design and not a hazard — a catalog of thirty nodes is a menu, and a
//! deployment orders from it.
//!
//! The carrier of the naming is a SECTION — [`NodeSection`], one per node, held `Option`ally by the
//! emitted `<Root>Options` spine — and this type is what that spine's own `enablement()` folds
//! into: one [`mounted`](Enablement::mounted) call per declared mount, carrying whatever the
//! document had there, which for most of a catalog is nothing.
//!
//! # ONE shape of "not launched", because there is one axis
//!
//! There is a single darkness — nothing named it — and a single fix: write the node a section. The
//! soft switch that once made a second one is gone, configuration files being immutable artifacts
//! that a deployment swaps rather than toggles, so a refusal about a dark upstream has one sentence
//! to say and says it.
use HashSet;
use Utf8Bytes;
use NodeSection;
/// Which nodes a deployment launches, as its options named them.
///
/// The names in it are the arrangement's own node names, which are the MOUNT names the declaration
/// wrote — one word for both, so a section's key and a node's name cannot drift apart. A name
/// naming nothing is a START-UP refusal rather than a silent no-op: options that misspell a node
/// have said something false about the deployment, and finding that out at start-up is the whole
/// value of checking it.
///
/// The typed spine cannot produce that misspelling — its keys are FIELDS, and `deny_unknown_fields`
/// refuses an unknown one at deserialization, where the reader is looking at the document. What can
/// is the door beside it: a deployment assembled in code, which names its nodes with strings
/// because nothing else can carry a name a program computes.
///
/// # Examples
///
/// ```
/// use ingraph::Enablement;
///
/// // A deployment of a three-node catalog that runs one of them.
/// let enablement = Enablement::new().launching("decode");
///
/// assert!(enablement.is_enabled("decode"));
/// // Never named at all, and therefore never launched.
/// assert!(!enablement.is_enabled("captions"));
/// assert!(!enablement.is_enabled("scenes"));
/// ```