@cloudbitmaps/core 0.20.0 → 0.21.0
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/README.md +85 -0
- package/dist/{chunk-YSC7NJWV.js → chunk-IGLIZBR7.js} +740 -137
- package/dist/chunk-IGLIZBR7.js.map +7 -0
- package/dist/core/absent-operands.d.ts +8 -0
- package/dist/core/audit.d.ts +12 -2
- package/dist/core/bit-route.d.ts +2 -1
- package/dist/core/blob.d.ts +12 -1
- package/dist/core/bulk-load.d.ts +148 -0
- package/dist/core/cas-retry.d.ts +27 -0
- package/dist/core/check.d.ts +22 -0
- package/dist/core/chunk-checks.d.ts +6 -1
- package/dist/core/chunk-window.d.ts +11 -4
- package/dist/core/combine-expr.d.ts +1 -3
- package/dist/core/combine-feed.d.ts +2 -16
- package/dist/core/combine-many.d.ts +12 -9
- package/dist/core/concurrency.d.ts +8 -0
- package/dist/core/consistency.d.ts +69 -17
- package/dist/core/crbm/fingerprint.d.ts +5 -0
- package/dist/core/crbm/format.d.ts +0 -1
- package/dist/core/crbm/plan-reads.d.ts +9 -3
- package/dist/core/crbm/reader.d.ts +52 -6
- package/dist/core/crbm/varint.d.ts +2 -1
- package/dist/core/crbm/writer.d.ts +5 -1
- package/dist/core/crbm-open.d.ts +154 -0
- package/dist/core/crbm-storage-source.d.ts +65 -452
- package/dist/core/crbm-write.d.ts +75 -0
- package/dist/core/crypto.d.ts +6 -1
- package/dist/core/engine.d.ts +222 -33
- package/dist/core/erase-id.d.ts +42 -7
- package/dist/core/erasure.d.ts +4 -3
- package/dist/core/errors.d.ts +8 -2
- package/dist/core/generation-gc.d.ts +129 -15
- package/dist/core/generation-list.d.ts +11 -0
- package/dist/core/id-window.d.ts +46 -0
- package/dist/core/invalidation-scope.d.ts +77 -0
- package/dist/core/known-generations-shape.d.ts +13 -0
- package/dist/core/known-generations.d.ts +147 -0
- package/dist/core/leases.d.ts +4 -3
- package/dist/core/ledger-seed.d.ts +17 -0
- package/dist/core/load.d.ts +17 -38
- package/dist/core/lru.d.ts +2 -15
- package/dist/core/metrics.d.ts +4 -2
- package/dist/core/order.d.ts +2 -0
- package/dist/core/pinned-storage-source.d.ts +4 -4
- package/dist/core/ports.d.ts +89 -16
- package/dist/core/publish.d.ts +207 -0
- package/dist/core/registry-scan.d.ts +0 -2
- package/dist/core/retention-sweep.d.ts +69 -65
- package/dist/core/retention.d.ts +1 -1
- package/dist/core/retry.d.ts +12 -19
- package/dist/core/rollback.d.ts +60 -31
- package/dist/core/summary.d.ts +50 -18
- package/dist/core/token.d.ts +2 -2
- package/dist/core/validate.d.ts +2 -0
- package/dist/driver-kit.d.ts +4 -0
- package/dist/driver-kit.js +80 -7
- package/dist/driver-kit.js.map +3 -3
- package/dist/drivers/_shared/bytes.d.ts +6 -0
- package/dist/drivers/_shared/faults.d.ts +15 -0
- package/dist/drivers/_shared/object-keys.d.ts +18 -0
- package/dist/drivers/_shared/object-registry-keys.d.ts +0 -2
- package/dist/drivers/_shared/object-registry.d.ts +2 -0
- package/dist/drivers/_shared/options.d.ts +19 -0
- package/dist/drivers/_shared/registry.d.ts +13 -10
- package/dist/drivers/localfs/exact-case.d.ts +0 -3
- package/dist/drivers/localfs/fs-util.d.ts +22 -0
- package/dist/drivers/localfs/registry.d.ts +10 -4
- package/dist/drivers/localfs/storage.d.ts +9 -2
- package/dist/drivers/memory.d.ts +7 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3647 -2410
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/chunk-YSC7NJWV.js.map +0 -7
- package/dist/core/kept-generations.d.ts +0 -40
package/README.md
CHANGED
|
@@ -28,6 +28,91 @@ Its main entry is the flavor-author kit: the read engine, the standalone forms o
|
|
|
28
28
|
`dropSegment`, `retireExpired` and the rest), and the retry and budget internals. `@cloudbitmaps/roaring` re-exports,
|
|
29
29
|
by name, what an application uses.
|
|
30
30
|
|
|
31
|
+
## How the storage path is laid out
|
|
32
|
+
|
|
33
|
+
The `.crbm` storage path lives in `src/core/`, one module per concern. Arrows read "imports":
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
bulk-load.ts write path: ids in, a generation written and published
|
|
37
|
+
/ | \
|
|
38
|
+
v v v
|
|
39
|
+
publish.ts crbm-write.ts crbm-open.ts <---- crbm-storage-source.ts read path
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`publish.ts`, `crbm-write.ts` and `crbm-open.ts` import none of the others. Outside this group, `load.ts` imports
|
|
43
|
+
`bulk-load.ts`, `publish.ts` and `crbm-open.ts`; `erase-id.ts` imports `publish.ts`, `crbm-write.ts` and
|
|
44
|
+
`crbm-open.ts`; `rollback.ts` and `consistency.ts` import `crbm-open.ts`. `combine-many.ts`, `pinned-storage-source.ts`
|
|
45
|
+
(types only) and the package entry import `crbm-storage-source.ts`.
|
|
46
|
+
|
|
47
|
+
| File | Holds |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `crbm-write.ts` | writing one immutable generation from in-memory bitmaps, from a stream or from already-encoded chunks |
|
|
50
|
+
| `publish.ts` | the forward-only pointer advance every write ends with, the lease patch, the refusal to point a keyed row at a cleartext generation, and the settling of a registry write that got no answer |
|
|
51
|
+
| `bulk-load.ts` | the loader `load()` is built on, with its read-ahead: ids, a decoded bitmap or a combine's chunks in, made into chunks (ids bucketed, a bitmap split by its codec where the codec can, a combine's chunks checked), one generation written, and published when a registry is wired and the caller does not defer it; `load()` defers it and publishes through `publish.ts` after its guard |
|
|
52
|
+
| `known-generations.ts` | the row's ledger, `knownGens`: what a usable one is, the window a load collects by name, the cap, and the ledger a publish and a rollback write |
|
|
53
|
+
| `ledger-seed.ts` | the first window of a ledger over a row that has none, read from the bucket |
|
|
54
|
+
| `crbm-open.ts` | opening a stored generation without the cache: the blob reader over a driver object, the checked and noting opens, the identity checks that tie an open to the object it read, generation verification, and the rollback target open |
|
|
55
|
+
| `crbm-storage-source.ts` | the read path: `CrbmStorageChunkSource`, its resolution cache and the pin machinery |
|
|
56
|
+
|
|
57
|
+
No write-path module imports `crbm-storage-source.ts`, and it imports only `crbm-open.ts` of the other four.
|
|
58
|
+
|
|
59
|
+
## The row's ledger of generations
|
|
60
|
+
|
|
61
|
+
A registry row carries `knownGens`: the generations the segment knows and has not decided to delete, each with the
|
|
62
|
+
CRC32C its object's footer stores, the current one last. They are the ones it made current, in that order, and, when a
|
|
63
|
+
publish over a row with no usable ledger seeds one, the ones a count by `keep` keeps in the bucket, which can include an
|
|
64
|
+
object no load published (an orphan or a stray): an entry says the library knows the generation and its checksum, not
|
|
65
|
+
that a load published it. Its entries below the
|
|
66
|
+
pointer are the window a load keeps and the generations a live lease holds, so a load deletes what its publish pushed out
|
|
67
|
+
of the window by name and lists the bucket only when it cannot rely on the row.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
row (schema 5) bucket
|
|
71
|
+
currentGen: 7 segment.3.crbm segment.5.crbm segment.6.crbm segment.7.crbm
|
|
72
|
+
knownGens: [ {5,crcA}, {6,crcB}, {7,crcC} ] | | | |
|
|
73
|
+
\_____ window ____/ \ current deleted by in the window in the window current
|
|
74
|
+
name when a
|
|
75
|
+
load pushed it out
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- **A publish writes it** in the compare-and-swap that moves the pointer. Over a row whose ledger is usable, the window
|
|
79
|
+
is drawn from the order the generations were made current: the `keep` most recently current of the entries numbered
|
|
80
|
+
below the new generation (at most 127), beside them every entry a live lease holds, whatever `keep` says, then the
|
|
81
|
+
entries a rollback left numbered above the new generation (carried while the ledger holds fewer than 128, never
|
|
82
|
+
collected, and taking no place in `keep`), then the new generation. The generation the publish superseded is the
|
|
83
|
+
ledger's last entry, so it comes first, and after a rollback the restored generation ranks ahead of the ones the
|
|
84
|
+
rollback moved away from, from every load on. Over a row with no usable ledger (a hand repair, a restore, a pointer
|
|
85
|
+
moved down by hand) the load lists the bucket and writes the window a count by `keep` keeps there: the generation the
|
|
86
|
+
row named as current first, then the newest by number, each with a footer read (read eight at a time under the store's
|
|
87
|
+
read retry, the superseded generation's too; a clear summary that describes it with another checksum leaves it out),
|
|
88
|
+
and beside them the listed generations a live lease holds wherever they are numbered (the leases read from the row
|
|
89
|
+
once more just before the write, one more row read), oldest first by number with the leased ones before the window and
|
|
90
|
+
the superseded one last, then the new generation. A generation gone from the bucket, or whose footer fails its checks,
|
|
91
|
+
is left out. The publish then collects by that count.
|
|
92
|
+
- **An incarnation's first publish writes the new generation alone** (no row, or a row with no pointer): nothing below
|
|
93
|
+
it was made current by it, so a seed could only name objects no load of it published.
|
|
94
|
+
- **A usable ledger is never started again**: over one a run of publishes with a larger `keep` carried past 64 names
|
|
95
|
+
that no lease holds, the next load with a `keep` of 64 or less writes the window it draws from the ledger's order, the
|
|
96
|
+
leased entries and those above its number, and collects by listing.
|
|
97
|
+
- **A collection reads it.** A load with a `keep` of at most 64 deletes by name the entries its publish left out. A pass
|
|
98
|
+
that keeps by a count (a `keep` above 64, a ledger naming more than 64 below the pointer that no lease holds, or the
|
|
99
|
+
first load over a row with no usable ledger) keeps the ledger's own most recently current names first, then the newest
|
|
100
|
+
others by number, `keep` in all, and spares every name the row knows when it reads the row again before a delete.
|
|
101
|
+
- **A rollback carries it**, moving its target to the end with the checksum of the footer it read, keeping every
|
|
102
|
+
generation the row's leases name when it trims a full ledger, and writes none over a row that had none: a rollback
|
|
103
|
+
never starts a ledger.
|
|
104
|
+
- **An erasure's rewrite leaves itself alone in it**, since it deletes every older generation; a shred removes it. An
|
|
105
|
+
erasure that does not rewrite takes each generation it will delete out of the ledger first, in one write made after
|
|
106
|
+
its search and before its first delete, only when the ledger names one (`erase-id.ts`'s fence); its collections then
|
|
107
|
+
spare every generation the row names when they read the row before a delete.
|
|
108
|
+
- **Caps**: a writer writes at most 192 entries and keeps an entry nothing protects only while the ledger holds fewer
|
|
109
|
+
than 128; the registry accepts 192 written and 384 read, so no publish or rollback is refused for the ledger's size.
|
|
110
|
+
- **Errors**: a malformed ledger is `ValidationError` on a write and `IntegrityError` on a read; a ledger that disagrees
|
|
111
|
+
with its row is read and not used; a row stamped 4 or lower is `UnsupportedError`.
|
|
112
|
+
- **A rollback reads it**: it moves only onto a generation the ledger names, whose object's footer checksum is the one
|
|
113
|
+
recorded, unless the caller passes `allowUnknown`; where the pointer alone decides (a row with no usable ledger, a
|
|
114
|
+
number below a full ledger's bound) a target below the pointer needs no flag. `rollback.ts` holds the rule.
|
|
115
|
+
|
|
31
116
|
## Documentation
|
|
32
117
|
|
|
33
118
|
- [API reference](https://github.com/cloudbitmaps/cloudbitmaps/blob/main/docs/guide/api-reference.md), including the
|