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
extern crate alloc;
use BTreeMap;
use ;
pub use DotFunIter;
/// The payload store: per dot, the value that write carried.
///
/// The one value-carrying [`DotStore`] minerva ships in-tree, the multi-value
/// register shape from the delta-CRDT literature (dots to values). Where
/// [`DotSet`] carries bare presence and [`DotMap`](crate::metis::DotMap)
/// carries caller keys, `DotFun<V>` carries the caller's payload under each
/// dot: a dot names one write, and the value is what that write inscribed. A
/// register is a `Dotted<DotFun<V>>` (concurrent writes are sibling dots, both
/// readable via [`values`](Self::values)); a keyed register map is a
/// `Dotted<DotMap<K, DotFun<V>>>`.
///
/// # The value discipline: keep-self, equal by basis
///
/// The trait's content-follows-the-dot law (law 3) says a surviving dot keeps
/// the content the store attached to it, and the merge never invents, splits,
/// or reassigns content. On the *honest basis* a dot names exactly one write,
/// so a dot carried by two stores was minted by one write and carries one
/// value: the two copies are equal, and [`causal_merge`](DotStore::causal_merge)
/// keeps self's. That is the whole discipline, and it needs no `V: Eq` bound.
///
/// A same-dot disagreement (two stores carrying one dot with *different*
/// values) is a basis violation of exactly the class the clock already trusts
/// away: a reused station id. A station that mints two different writes under
/// one `(station, dot)` has broken the uniqueness the dot rests on, the same
/// way a station that reuses its id breaks the version vector's per-station
/// count. This store does not police that break, and deliberately so. An
/// enforcement path would need either a `V: Eq` bound and a total fallback
/// (silently pick one, which hides the corruption) or a panic path (which
/// turns a peer's Byzantine act into a local crash, a worse failure mode than
/// the honest keep-self). Neither is better than stating the basis plainly:
/// two honest stores carrying one dot carry equal values, so keep-self is
/// exact; a disagreement is out of scope, upstream of this type.
// The construction, write, and read surface carries no bound: only the
// causal fold and the `DotStore` obligations need `V: Clone`, so a payload
// that cannot clone still composes, reads, and counts.