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
//! What a publisher emits and a subscriber applies.
//!
//! One frame type per table in the set `rewrite` copies, so the frame set has
//! a completeness check rather than a guess. No I/O here; [`wire`](super::wire)
//! turns these into bytes.
use BTreeMap;
use crate;
/// The hash a publisher declares over its index state, and the only thing a
/// subscriber compares.
///
/// Two `u64` rather than one because a 64-bit hash of a set of a few thousand
/// slots collides often enough to matter when a mismatch silently drops rows;
/// 128 bits does not. dendro neither computes nor interprets it — see
/// [`Frame::Index`] for why it is the publisher's.
pub type IndexState = ;
/// The state a stream starts at: no index entry has been applied.
///
/// A publisher whose caller keeps no secondary index emits this on every
/// frame, and a subscriber matches it trivially, so replicating an archive
/// with no index needs no index. It is also the one state exempt from the
/// "wait for a [`Full`](IndexKind::Full)" rule, because rows built against no
/// index are always resolvable — without that exemption such a stream would
/// wait for a `Full` that is never coming.
///
/// **A publisher that has an index must never declare this.** Doing so claims
/// its rows reference nothing, and a subscriber will apply them against
/// whatever it happens to hold.
pub const NO_INDEX_STATE: IndexState = ;
/// Whether an [`Index`](Frame::Index) frame carries the whole slot set or a
/// change to it.
/// One unit of replication.
///
/// Every variant carries `source`, the ordinal its
/// [`Handshake`](Frame::Handshake) assigned. One connection therefore carries
/// every source of an archive and both kinds of content, which is the whole
/// reason it is one connection: two streams would make ordering a
/// distributed-systems problem, and one makes it a question about a single
/// FIFO. The logical split survives as the variants below, which demultiplex
/// to `caller_rows` and `wal`.