@sovereignbase/sequencer 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INTERNALS.md +12 -0
- package/README.md +44 -39
- package/dist/index.cjs +18 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/INTERNALS.md
CHANGED
|
@@ -744,10 +744,18 @@ The reported point is a **frontier**.
|
|
|
744
744
|
|
|
745
745
|
A single frontier summarizes a received prefix of a Session rather than acknowledging every reducing Insertion separately.
|
|
746
746
|
|
|
747
|
+
Every active Actor, including an offline Actor, must be registered before removals. An Actor-only acknowledgement such as `[3]` establishes that membership. Constructing another Projection does not register its Actor in the other replicas.
|
|
748
|
+
|
|
749
|
+
The application must exchange pending history before treating an acknowledgement as a complete Session frontier. The library reports receipt of reducing Insertions; it does not prove that missing earlier operations have arrived.
|
|
750
|
+
|
|
747
751
|
## Compaction
|
|
748
752
|
|
|
749
753
|
When all active Actors agree on the same frontier for a reducing Session, the acknowledged part can be removed from future retained Sequences.
|
|
750
754
|
|
|
755
|
+
This is whole-Session eligibility: every active Actor must report the same complete Session frontier. A missing claim or a different endpoint blocks that Session. Taking the minimum of unequal frontiers is not this compaction rule.
|
|
756
|
+
|
|
757
|
+
Eligible masks must disappear from the exported Sequence. Wholly removed positive Insertions and deleted Footage disappear as well. Claims for compacted Sessions are dropped; Actor membership is retained.
|
|
758
|
+
|
|
751
759
|
Suppose history contains:
|
|
752
760
|
|
|
753
761
|
```text
|
|
@@ -784,6 +792,10 @@ Anchors and remaining removals that referred to the old coordinates are adjusted
|
|
|
784
792
|
|
|
785
793
|
The running Projection does not need to be rewritten when this happens. Compaction produces another retained description of the same history.
|
|
786
794
|
|
|
795
|
+
The exported Sequence is a retained checkpoint. Its shorter Insertions and translated anchors can use different coordinates from the live graph before export. Continued editors must use compatible retained state; a compacted checkpoint does not preserve a permanent mapping to discarded history.
|
|
796
|
+
|
|
797
|
+
An offline Actor's unacknowledged history blocks compaction only if that Actor was registered. A test that omits its membership, allows compaction, then demands that its discarded anchors still work is outside this contract. Tests must not retain masks to satisfy that demand.
|
|
798
|
+
|
|
787
799
|
## Collapsed historical points
|
|
788
800
|
|
|
789
801
|
Compaction can make two old logical points collapse onto the same retained point.
|
package/README.md
CHANGED
|
@@ -30,9 +30,14 @@ projection.destroy()
|
|
|
30
30
|
### See documentation
|
|
31
31
|
|
|
32
32
|
- [How sequencer works?](INTERNALS.md)
|
|
33
|
-
- [Typescript](https://sovereignbase.dev/sequencer/)
|
|
33
|
+
- [Typescript](https://sovereignbase.dev/sequencer/classes/Projection.html)
|
|
34
34
|
- [C++](https://sovereignbase.dev/sequencer/c++)
|
|
35
35
|
|
|
36
|
+
Register active Actors, including offline Actors, before removals. When every
|
|
37
|
+
active Actor acknowledges the same complete removal Session frontier,
|
|
38
|
+
`sequence()` omits its masks and deleted Footage. Actor membership remains.
|
|
39
|
+
See the [compaction contract](INTERNALS.md#compaction).
|
|
40
|
+
|
|
36
41
|
### Errors
|
|
37
42
|
|
|
38
43
|
Library-reported failures throw `SequencerError`, with a stable `SequencerErrorCode`
|
|
@@ -53,8 +58,8 @@ Platform errors retain their original types.
|
|
|
53
58
|
|
|
54
59
|
| Format | Raw (KiB) | Minified (KiB) | Minified + gzip (KiB) |
|
|
55
60
|
| -------- | --------: | -------------: | --------------------: |
|
|
56
|
-
| ESM |
|
|
57
|
-
| CommonJS |
|
|
61
|
+
| ESM | 135.00 | 109.15 | 39.03 |
|
|
62
|
+
| CommonJS | 135.14 | 109.84 | 39.11 |
|
|
58
63
|
|
|
59
64
|
Both bundles include WASM. Terser uses three compression passes; gzip uses level 9.
|
|
60
65
|
|
|
@@ -67,37 +72,37 @@ Strips contain 1–100 Frames (visible entries). Headers show Strip counts and m
|
|
|
67
72
|
|
|
68
73
|
| Method / case | 1,000 Strips<br>50,871 Frames | 5,000 Strips<br>252,214 Frames | 10,000 Strips<br>504,871 Frames | 15,000 Strips<br>758,280 Frames | 20,000 Strips<br>1,010,749 Frames | 25,000 Strips<br>1,264,003 Frames |
|
|
69
74
|
| -------------- | ----------------------------: | -----------------------------: | ------------------------------: | ------------------------------: | --------------------------------: | --------------------------------: |
|
|
70
|
-
| apply.random |
|
|
71
|
-
| insert.head | 1,
|
|
72
|
-
| insert.random |
|
|
73
|
-
| insert.tail | 1,
|
|
75
|
+
| apply.random | 152,481 | 82,407 | 54,972 | 41,327 | 33,404 | 28,087 |
|
|
76
|
+
| insert.head | 1,125,803 | 917,202 | 989,477 | 1,002,460 | 1,008,049 | 1,005,481 |
|
|
77
|
+
| insert.random | 459,801 | 233,221 | 141,139 | 106,743 | 85,552 | 71,705 |
|
|
78
|
+
| insert.tail | 1,235,888 | 1,046,362 | 1,129,451 | 1,163,582 | 1,164,652 | 963,762 |
|
|
74
79
|
| remove.head | — | — | — | — | — | — |
|
|
75
|
-
| remove.random |
|
|
80
|
+
| remove.random | 318,832 | 161,201 | 103,195 | 76,208 | 61,027 | 50,419 |
|
|
76
81
|
| remove.tail | — | — | — | — | — | — |
|
|
77
|
-
| replace.head |
|
|
78
|
-
| replace.random |
|
|
79
|
-
| replace.tail |
|
|
80
|
-
| value.head | 2,
|
|
81
|
-
| value.random |
|
|
82
|
-
| value.tail |
|
|
82
|
+
| replace.head | 371,269 | 378,358 | 390,442 | 381,650 | 374,659 | 380,819 |
|
|
83
|
+
| replace.random | 257,863 | 147,949 | 96,725 | 71,868 | 58,024 | 48,412 |
|
|
84
|
+
| replace.tail | 316,736 | 369,208 | 364,734 | 383,559 | 366,881 | 350,473 |
|
|
85
|
+
| value.head | 2,529,757 | 3,200,174 | 3,231,484 | 3,365,642 | 3,481,984 | 3,549,918 |
|
|
86
|
+
| value.random | 644,467 | 230,616 | 126,832 | 88,155 | 68,446 | 55,752 |
|
|
87
|
+
| value.tail | 5,503,982 | 5,458,159 | 5,069,620 | 4,982,739 | 4,949,590 | 4,829,221 |
|
|
83
88
|
|
|
84
89
|
**↓ Scale down (25,000 → 0 Strips)**
|
|
85
90
|
|
|
86
91
|
| Method / case | 20,000 Strips<br>1,012,742 Frames | 15,000 Strips<br>755,860 Frames | 10,000 Strips<br>504,103 Frames | 5,000 Strips<br>251,203 Frames | 1,000 Strips<br>51,057 Frames | 0 Strips<br>0 Frames |
|
|
87
92
|
| -------------- | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
88
|
-
| apply.random |
|
|
93
|
+
| apply.random | 17,289 | 17,067 | 17,078 | 17,347 | 17,927 | 18,214 |
|
|
89
94
|
| insert.head | — | — | — | — | — | — |
|
|
90
|
-
| insert.random |
|
|
95
|
+
| insert.random | 42,405 | 41,938 | 42,228 | 42,440 | 44,086 | 44,230 |
|
|
91
96
|
| insert.tail | — | — | — | — | — | — |
|
|
92
|
-
| remove.head |
|
|
93
|
-
| remove.random |
|
|
94
|
-
| remove.tail |
|
|
95
|
-
| replace.head |
|
|
96
|
-
| replace.random |
|
|
97
|
-
| replace.tail |
|
|
98
|
-
| value.head |
|
|
99
|
-
| value.random |
|
|
100
|
-
| value.tail | 1,
|
|
97
|
+
| remove.head | 449,484 | 439,424 | 439,835 | 443,041 | 448,352 | 451,829 |
|
|
98
|
+
| remove.random | 31,440 | 31,670 | 32,353 | 33,471 | 35,064 | 35,635 |
|
|
99
|
+
| remove.tail | 447,064 | 423,868 | 431,746 | 378,400 | 389,534 | 351,739 |
|
|
100
|
+
| replace.head | 342,862 | 287,099 | 291,717 | 258,805 | 263,535 | 236,146 |
|
|
101
|
+
| replace.random | 30,799 | 30,980 | 31,637 | 32,586 | 34,069 | 34,091 |
|
|
102
|
+
| replace.tail | 188,491 | 164,510 | 155,028 | 137,842 | 134,383 | 126,497 |
|
|
103
|
+
| value.head | 1,613,774 | 1,552,830 | 1,534,695 | 1,545,267 | 1,574,964 | 1,598,674 |
|
|
104
|
+
| value.random | 34,644 | 34,727 | 35,474 | 36,721 | 38,524 | 39,415 |
|
|
105
|
+
| value.tail | 1,908,571 | 1,799,032 | 1,759,746 | 1,768,794 | 1,828,720 | 1,863,802 |
|
|
101
106
|
|
|
102
107
|
### API throughput at checkpoint
|
|
103
108
|
|
|
@@ -107,17 +112,17 @@ Checkpoint calls, in ops/s, averaged across runs.
|
|
|
107
112
|
|
|
108
113
|
| Method | 1,000 Strips<br>50,871 Frames | 5,000 Strips<br>252,214 Frames | 10,000 Strips<br>504,871 Frames | 15,000 Strips<br>758,280 Frames | 20,000 Strips<br>1,010,749 Frames | 25,000 Strips<br>1,264,003 Frames |
|
|
109
114
|
| --------------------------------- | ----------------------------: | -----------------------------: | ------------------------------: | ------------------------------: | --------------------------------: | --------------------------------: |
|
|
110
|
-
| new Projection(actorID, sequence) |
|
|
111
|
-
| sequence() |
|
|
112
|
-
| values() | 480 |
|
|
115
|
+
| new Projection(actorID, sequence) | 3,734 | 1,016 | 594 | 409 | 287 | 237 |
|
|
116
|
+
| sequence() | 479 | 85 | 42 | 26 | 17 | 12 |
|
|
117
|
+
| values() | 480 | 205 | 63 | 55 | 34 | 37 |
|
|
113
118
|
|
|
114
119
|
**↓ Scale down (25,000 → 0 Strips)**
|
|
115
120
|
|
|
116
121
|
| Method | 20,000 Strips<br>1,012,742 Frames | 15,000 Strips<br>755,860 Frames | 10,000 Strips<br>504,103 Frames | 5,000 Strips<br>251,203 Frames | 1,000 Strips<br>51,057 Frames | 0 Strips<br>0 Frames |
|
|
117
122
|
| --------------------------------- | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
118
|
-
| new Projection(actorID, sequence) |
|
|
119
|
-
| sequence() |
|
|
120
|
-
| values() |
|
|
123
|
+
| new Projection(actorID, sequence) | 284 | 410 | 505 | 1,271 | 5,357 | 22,172 |
|
|
124
|
+
| sequence() | 12 | 11 | 8 | 9 | 9 | 7 |
|
|
125
|
+
| values() | 52 | 52 | 53 | 81 | 209 | 140,305 |
|
|
121
126
|
|
|
122
127
|
### Sequence disk size at checkpoint
|
|
123
128
|
|
|
@@ -127,8 +132,8 @@ Complete exported Sequences, including Footage and acknowledgements. Sizes are i
|
|
|
127
132
|
|
|
128
133
|
| Encoding | 1,000 Strips<br>50,871 Frames | 5,000 Strips<br>252,214 Frames | 10,000 Strips<br>504,871 Frames | 15,000 Strips<br>758,280 Frames | 20,000 Strips<br>1,010,749 Frames | 25,000 Strips<br>1,264,003 Frames |
|
|
129
134
|
| ------------------ | ----------------------------: | -----------------------------: | ------------------------------: | ------------------------------: | --------------------------------: | --------------------------------: |
|
|
130
|
-
| JSON | 277.
|
|
131
|
-
| JSON + gzip | 14.59 | 73.
|
|
135
|
+
| JSON | 277.41 | 1,622.78 | 3,264.00 | 4,904.44 | 7,045.81 | 9,168.42 |
|
|
136
|
+
| JSON + gzip | 14.59 | 73.83 | 150.35 | 226.86 | 311.12 | 391.57 |
|
|
132
137
|
| MessagePack | 164.81 | 818.88 | 1,639.69 | 3,529.41 | 5,081.04 | 6,483.22 |
|
|
133
138
|
| MessagePack + gzip | 12.38 | 61.62 | 124.91 | 198.59 | 263.54 | 332.77 |
|
|
134
139
|
|
|
@@ -136,8 +141,8 @@ Complete exported Sequences, including Footage and acknowledgements. Sizes are i
|
|
|
136
141
|
|
|
137
142
|
| Encoding | 20,000 Strips<br>1,012,742 Frames | 15,000 Strips<br>755,860 Frames | 10,000 Strips<br>504,103 Frames | 5,000 Strips<br>251,203 Frames | 1,000 Strips<br>51,057 Frames | 0 Strips<br>0 Frames |
|
|
138
143
|
| ------------------ | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
139
|
-
| JSON | 7,
|
|
140
|
-
| JSON + gzip | 323.
|
|
144
|
+
| JSON | 7,451.86 | 5,621.57 | 3,772.57 | 1,886.91 | 383.51 | 0.02 |
|
|
145
|
+
| JSON + gzip | 323.11 | 244.34 | 163.82 | 80.59 | 16.33 | 0.03 |
|
|
141
146
|
| MessagePack | 5,237.17 | 3,930.33 | 2,628.38 | 1,312.43 | 266.67 | 0.01 |
|
|
142
147
|
| MessagePack + gzip | 274.96 | 207.78 | 137.38 | 67.41 | 13.67 | 0.03 |
|
|
143
148
|
|
|
@@ -157,8 +162,8 @@ One instance: WASM memory plus retained JS array slots, in KiB (1,024 bytes).
|
|
|
157
162
|
| ---------------------- | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
158
163
|
| Estimated memory (KiB) | 163,746.93 | 174,034.00 | 202,660.72 | 293,941.85 | 302,158.29 | 304,203.30 |
|
|
159
164
|
|
|
160
|
-
Measured on Node 24.
|
|
161
|
-
|
|
165
|
+
Measured on Node 24.22.0, V8 13.6.233.17-node.57,
|
|
166
|
+
linux x64, AMD EPYC 7763 64-Core Processor.
|
|
162
167
|
Peer synchronization, encoding and JS process garbage collection are outside API timings.
|
|
163
168
|
[Full lifecycle results](benchmark/.results/lifecycle.md) · [Throughput results](benchmark/.results/throughput.md).
|
|
164
169
|
|
|
@@ -166,7 +171,7 @@ Peer synchronization, encoding and JS process garbage collection are outside API
|
|
|
166
171
|
|
|
167
172
|
### Behaviour guaranteed by excessive tests
|
|
168
173
|
|
|
169
|
-
The latest verification passed
|
|
174
|
+
The latest verification passed 212 Vitest tests and 108 compatibility checks.
|
|
170
175
|
The configured 100% coverage threshold is met (100% statements, 100% branches, 100% functions, 100% lines).
|
|
171
176
|
See the [test suites](test/README.md) and
|
|
172
177
|
[automated test report](https://sovereignbase.dev/sequencer/tests/).
|
|
@@ -182,7 +187,7 @@ Runtimes covered by the latest compatibility verification:
|
|
|
182
187
|
- Edge Runtime: passed
|
|
183
188
|
- Cloudflare Workers through workerd: passed
|
|
184
189
|
- Chromium browser windows: passed
|
|
185
|
-
- Firefox browser windows:
|
|
190
|
+
- Firefox browser windows: passed
|
|
186
191
|
- WebKit browser windows: passed
|
|
187
192
|
|
|
188
193
|
### Tested realtime and offline text editing behaviour examples
|