Repository navigation
Commit 94bd2f6
committed
feat: add the op log, undo and watch
Every node now keeps an op log under .origin/oplog/: size-capped segments
of checked frames, one entry per record batch written (with what the index
keeps of its records), landing left waiting, and working-copy move, each
tagged with its workspace and command. The sequence number of an entry is
the cursor of the event stream, and never changes.
Every write syncs its op log entries with its own files, in place of the
index log, which now catches up from the op log on open and stays
rebuildable from the store: record batches with their records, waiting
landings with their file, working-copy moves with the `workspace` pointer,
and a target's move with its head, as a `target.advanced` entry. Each write
holds a lock file of its own, `oplog/writers/<n>`, which its entries name:
readers stop before the first entry whose writer still holds its lock, so
no cursor is handed out that a power loss could take back, and a crashed
writer stalls nothing (readers sync its entries, then remove its file).
Damage in the middle of a segment is read past from both ends, reported
with the number of entries lost, rebuilds the index, and starts a new
segment for appends; a length running past the end of the segment is
damage too, unless no complete frame ends it, so a settled entry is never
cut off as a partial append. A move that checks files out first publishes
a `moving` marker durably, naming the files it starts from, those it goes
to and their revision, makes the files durable, writes the revision if
it's new, then the pointer, and removes the marker durably. The next
command finishes a move a crash cut short, or takes it back if its
revision wasn't written, touching only the files still on one side of it:
edits made since, and new files, stay for its snapshot to record. An
unreadable marker leaves every file as it is.
`origin op log` lists operations, `origin undo` moves only this
workspace's working copy back one operation (records and targets stay),
and `origin watch [--kind] [--subject] [--since]` prints events derived
from the op log, the records it names and the waiting landings:
statement.issued, revision.created, target.advanced and check.requested.
`Events::after` and `Events::wait` are the reader API for the server's
long poll and the CI worker.1 parent 0e07c28 commit 94bd2f6
19 files changed
Lines changed: 3689 additions & 404 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
139 | 142 | | |
140 | 143 | | |
141 | 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 | + | |
142 | 176 | | |
143 | 177 | | |
144 | 178 | | |
| |||
314 | 348 | | |
315 | 349 | | |
316 | 350 | | |
| 351 | + | |
| 352 | + | |
317 | 353 | | |
318 | 354 | | |
319 | | - | |
| 355 | + | |
320 | 356 | | |
321 | | - | |
| 357 | + | |
322 | 358 | | |
323 | 359 | | |
324 | 360 | | |
325 | 361 | | |
326 | 362 | | |
327 | 363 | | |
328 | | - | |
| 364 | + | |
329 | 365 | | |
330 | | - | |
| 366 | + | |
331 | 367 | | |
332 | 368 | | |
333 | 369 | | |
| |||
369 | 405 | | |
370 | 406 | | |
371 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
372 | 421 | | |
373 | 422 | | |
374 | 423 | | |
| |||
0 commit comments