@bjornpagen/bumbledb-log 0.20.0 → 0.20.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.
Files changed (76) hide show
  1. package/dist/braids.d.ts +28 -0
  2. package/dist/braids.d.ts.map +1 -0
  3. package/{src/braids.ts → dist/braids.js} +22 -29
  4. package/dist/braids.js.map +1 -0
  5. package/dist/bytes.d.ts +26 -0
  6. package/dist/bytes.d.ts.map +1 -0
  7. package/dist/bytes.js +86 -0
  8. package/dist/bytes.js.map +1 -0
  9. package/dist/chain.d.ts +56 -0
  10. package/dist/chain.d.ts.map +1 -0
  11. package/dist/chain.js +137 -0
  12. package/dist/chain.js.map +1 -0
  13. package/dist/codec.d.ts +71 -0
  14. package/dist/codec.d.ts.map +1 -0
  15. package/dist/codec.js +179 -0
  16. package/dist/codec.js.map +1 -0
  17. package/dist/descriptor.d.ts +61 -0
  18. package/dist/descriptor.d.ts.map +1 -0
  19. package/dist/descriptor.js +160 -0
  20. package/dist/descriptor.js.map +1 -0
  21. package/dist/errors.d.ts +202 -0
  22. package/dist/errors.d.ts.map +1 -0
  23. package/dist/errors.js +122 -0
  24. package/dist/errors.js.map +1 -0
  25. package/dist/index.d.ts +34 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +24 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/keys.d.ts +52 -0
  30. package/dist/keys.d.ts.map +1 -0
  31. package/dist/keys.js +166 -0
  32. package/dist/keys.js.map +1 -0
  33. package/dist/manifest.d.ts +42 -0
  34. package/dist/manifest.d.ts.map +1 -0
  35. package/dist/manifest.js +116 -0
  36. package/dist/manifest.js.map +1 -0
  37. package/dist/replica.d.ts +154 -0
  38. package/dist/replica.d.ts.map +1 -0
  39. package/dist/replica.js +820 -0
  40. package/dist/replica.js.map +1 -0
  41. package/dist/store-s3.d.ts +31 -0
  42. package/dist/store-s3.d.ts.map +1 -0
  43. package/dist/store-s3.js +299 -0
  44. package/dist/store-s3.js.map +1 -0
  45. package/dist/store.d.ts +129 -0
  46. package/dist/store.d.ts.map +1 -0
  47. package/dist/store.js +577 -0
  48. package/dist/store.js.map +1 -0
  49. package/dist/tenants.d.ts +56 -0
  50. package/dist/tenants.d.ts.map +1 -0
  51. package/dist/tenants.js +333 -0
  52. package/dist/tenants.js.map +1 -0
  53. package/dist/tilde-family.json +21 -0
  54. package/dist/vector.d.ts +31 -0
  55. package/dist/vector.d.ts.map +1 -0
  56. package/dist/vector.js +87 -0
  57. package/dist/vector.js.map +1 -0
  58. package/dist/writer.d.ts +106 -0
  59. package/dist/writer.d.ts.map +1 -0
  60. package/dist/writer.js +677 -0
  61. package/dist/writer.js.map +1 -0
  62. package/package.json +12 -7
  63. package/src/bytes.ts +0 -115
  64. package/src/chain.ts +0 -181
  65. package/src/codec.ts +0 -252
  66. package/src/descriptor.ts +0 -240
  67. package/src/errors.ts +0 -309
  68. package/src/index.ts +0 -57
  69. package/src/keys.ts +0 -218
  70. package/src/manifest.ts +0 -161
  71. package/src/replica.ts +0 -1061
  72. package/src/store-s3.ts +0 -377
  73. package/src/store.ts +0 -727
  74. package/src/tenants.ts +0 -414
  75. package/src/vector.ts +0 -103
  76. package/src/writer.ts +0 -977
package/src/descriptor.ts DELETED
@@ -1,240 +0,0 @@
1
- /**
2
- * The parsed protocol descriptor: one thin parse of the engine's sealed
3
- * truth — relation ids, sealed field order, resolved closed rows,
4
- * materialized statements, and the real fingerprint — plus the braid
5
- * map and serial-at roster read off the log core's braids seat
6
- * (`internalLogBraidsOf`): one derivation of the braid partition,
7
- * projected here into the driver's branded shapes. Cached per theory
8
- * value.
9
- */
10
-
11
- import type {
12
- AnySchema,
13
- FactValue,
14
- LogCodecHandle,
15
- SchemaSpec,
16
- SealedDescriptor,
17
- SealedStatement,
18
- ValueTypeSpec
19
- } from "@bjornpagen/bumbledb"
20
- import { internalDescriptor, internalLogBraidsOf, internalLogCodec, lower } from "@bjornpagen/bumbledb"
21
- import * as errors from "@superbuilders/errors"
22
- import { regex } from "arkregex"
23
- import { fromHex } from "#bytes.ts"
24
-
25
- interface FieldInfo {
26
- readonly name: string
27
- readonly type: ValueTypeSpec
28
- readonly fresh: boolean
29
- /** Set when the field's newtype names a closed relation's id class. */
30
- readonly closedRef: string | undefined
31
- }
32
-
33
- interface RelationInfo {
34
- readonly id: number
35
- readonly name: string
36
- readonly closed: boolean
37
- readonly handles: readonly string[]
38
- /** Sealed order: a closed relation's synthetic u64 `id` at ordinal 0. */
39
- readonly fields: readonly FieldInfo[]
40
- /** Closed ground axioms in sealed order (id first), resolved values. */
41
- readonly rows: ReadonlyArray<readonly FactValue[]>
42
- }
43
-
44
- declare const braidBrand: unique symbol
45
- type Braid = string & { readonly [braidBrand]: typeof braidBrand }
46
-
47
- const BRAID_ID = regex("^c[0-9a-f]{8}$")
48
-
49
- function braid(raw: string): Braid {
50
- if (!BRAID_ID.test(raw)) {
51
- throw errors.new(`not a braid id: ${raw}`)
52
- }
53
- return raw as Braid
54
- }
55
-
56
- function refuseShape(why: string): never {
57
- throw errors.new(`theory: ${why}`)
58
- }
59
-
60
- interface SerialStatement {
61
- readonly statement: number
62
- readonly braid: Braid
63
- }
64
-
65
- /** The braids seat names serial-at statements by id; the braid tag is a
66
- * projection join through the statement's own relation. */
67
- function serialAtFrom(
68
- ids: readonly number[],
69
- statements: readonly SealedStatement[],
70
- braidOfRelation: ReadonlyMap<number, Braid>
71
- ): SerialStatement[] {
72
- const statementById = new Map<number, SealedStatement>()
73
- for (const statement of statements) {
74
- statementById.set(statement.id, statement)
75
- }
76
- return ids.map(function joinBraid(id) {
77
- const statement = statementById.get(id)
78
- if (statement === undefined) {
79
- refuseShape(`serial-at statement ${id} is not in the sealed statements`)
80
- }
81
- if (statement.kind === "containment") {
82
- refuseShape(`serial-at statement ${id} is a containment`)
83
- }
84
- const relation = statement.kind === "functionality" ? statement.relation : statement.target.relation
85
- const braid = braidOfRelation.get(relation)
86
- if (braid === undefined) {
87
- refuseShape(`serial-at statement ${id} relation ${relation} is in no braid`)
88
- }
89
- return { statement: id, braid }
90
- })
91
- }
92
-
93
- interface Descriptor {
94
- readonly relations: readonly RelationInfo[]
95
- readonly relationByName: ReadonlyMap<string, RelationInfo>
96
- readonly statements: readonly SealedStatement[]
97
- /** Ordinary relation id → braid id (`c{smallest:08x}`). */
98
- readonly braidOfRelation: ReadonlyMap<number, Braid>
99
- /** Braid id → member relation ids, ascending. */
100
- readonly braidMembers: ReadonlyMap<Braid, readonly number[]>
101
- readonly serialAtStatements: readonly SerialStatement[]
102
- /** The sealed per-theory codec handle — the grammar's one reader,
103
- * minted once and cached with the parse. */
104
- readonly codec: LogCodecHandle
105
- readonly fingerprint: string
106
- readonly fingerprintBytes: Uint8Array
107
- }
108
-
109
- /** The pure trio's input: the theory value, its lowered spec, or an already-parsed descriptor. */
110
- type Theory = AnySchema | SchemaSpec | Descriptor
111
-
112
- function isDescriptor(theory: Theory): theory is Descriptor {
113
- return "braidMembers" in theory
114
- }
115
-
116
- function isSpec(theory: Theory): theory is SchemaSpec {
117
- return Array.isArray((theory as SchemaSpec).relations)
118
- }
119
-
120
- const cache = new WeakMap<object, Descriptor>()
121
-
122
- function descriptorOf(theory: Theory): Descriptor {
123
- if (isDescriptor(theory)) {
124
- return theory
125
- }
126
- const hit = cache.get(theory)
127
- if (hit !== undefined) {
128
- return hit
129
- }
130
- const spec = isSpec(theory) ? theory : lower(theory)
131
- const parsed = spec === theory ? fromSealed(spec) : (cache.get(spec) ?? fromSealed(spec))
132
- cache.set(theory, parsed)
133
- cache.set(spec, parsed)
134
- return parsed
135
- }
136
-
137
- function braidHex(relationId: number): Braid {
138
- return braid(`c${relationId.toString(16).padStart(8, "0")}`)
139
- }
140
-
141
- function fromSealed(spec: SchemaSpec): Descriptor {
142
- const sealed: SealedDescriptor = internalDescriptor(spec)
143
-
144
- /** Handle newtype (`{name}.id`, off each closed relation's sealed id slot) → roster name. */
145
- const ownerOfIdClass = new Map<string, string>()
146
- for (const relation of sealed.relations) {
147
- if (relation.extension === undefined) {
148
- continue
149
- }
150
- const idSlot = relation.fields.find(function idOf(field) {
151
- return field.name === "id"
152
- })
153
- const handleClass = idSlot?.newtype
154
- if (handleClass === undefined) {
155
- refuseShape(`closed relation ${relation.name} has no handle class on its sealed id slot`)
156
- }
157
- ownerOfIdClass.set(handleClass, relation.name)
158
- }
159
-
160
- const relations: RelationInfo[] = sealed.relations.map(function relationOf(relation) {
161
- const fields: FieldInfo[] = relation.fields.map(function fieldOf(field) {
162
- return {
163
- name: field.name,
164
- type: field.valueType,
165
- fresh: field.fresh,
166
- closedRef: field.newtype === undefined ? undefined : ownerOfIdClass.get(field.newtype)
167
- }
168
- })
169
- const extension = relation.extension ?? []
170
- const named = new Map(
171
- relation.fields.map(function indexOf(field) {
172
- return [field.name, field]
173
- })
174
- )
175
- const rows = extension.map(function rowOf(row) {
176
- const cells = new Map(
177
- row.values.map(function cellOf(cell) {
178
- return [cell.name, cell.value]
179
- })
180
- )
181
- return relation.fields.map(function cellValue(field) {
182
- const hit = cells.get(field.name)
183
- if (hit !== undefined) {
184
- return hit
185
- }
186
- if (field.name === "id" && named.has("id")) {
187
- return row.id
188
- }
189
- return refuseShape(`closed relation ${relation.name}: sealed row ${row.handle} missing field ${field.name}`)
190
- })
191
- })
192
- return {
193
- id: relation.id,
194
- name: relation.name,
195
- closed: relation.extension !== undefined,
196
- handles: extension.map(function handleOf(row) {
197
- return row.handle
198
- }),
199
- fields,
200
- rows
201
- }
202
- })
203
-
204
- const byName = new Map<string, RelationInfo>()
205
- for (const relation of relations) {
206
- if (byName.has(relation.name)) {
207
- refuseShape(`duplicate relation ${relation.name}`)
208
- }
209
- byName.set(relation.name, relation)
210
- }
211
-
212
- const statements = sealed.statements
213
- const braids = internalLogBraidsOf(sealed)
214
- const braidOfRelation = new Map<number, Braid>()
215
- const braidMembers = new Map<Braid, readonly number[]>()
216
- for (const component of braids.components) {
217
- const id = braidHex(component.braid)
218
- braidMembers.set(id, component.relations)
219
- for (const member of component.relations) {
220
- braidOfRelation.set(member, id)
221
- }
222
- }
223
- const serialAtStatements = serialAtFrom(braids.serialAt, statements, braidOfRelation)
224
-
225
- const fingerprint = sealed.fingerprint
226
- return {
227
- relations,
228
- relationByName: byName,
229
- statements,
230
- braidOfRelation,
231
- braidMembers,
232
- serialAtStatements,
233
- codec: internalLogCodec(sealed),
234
- fingerprint,
235
- fingerprintBytes: fromHex(fingerprint)
236
- }
237
- }
238
-
239
- export type { Braid, Descriptor, FieldInfo, RelationInfo, SerialStatement, Theory }
240
- export { braid, braidHex, descriptorOf, serialAtFrom }
package/src/errors.ts DELETED
@@ -1,309 +0,0 @@
1
- /**
2
- * The driver's error identities, on the SDK's `@superbuilders/errors`
3
- * idiom: exported sentinel values checked with `errors.is`, structured
4
- * causes carried as data properties read back with the `*Of` accessors —
5
- * never by message-string matching. There is deliberately no
6
- * `ErrAlreadyApplied`: the state it would name is absorbed by idempotent
7
- * replay (L10) and never surfaces. ManifestMissing, OverWidth,
8
- * RefillNeeded, Exhausted, and SlotRetired are named sums of their own: a
9
- * replica without a manifest, a draw past the lease width, a cached id
10
- * block too short for the draw, the u64 ceiling, and a below-floor
11
- * create. Exhaustion means the id space is spent — a refill is never an
12
- * exhaustion. An unproved conditional write is the store verbs' own
13
- * `ambiguous` outcome arm, never an error identity.
14
- */
15
-
16
- import * as errors from "@superbuilders/errors"
17
- import type { Braid } from "#descriptor.ts"
18
- import type { Generation, StoreKey } from "#keys.ts"
19
-
20
- /**
21
- * Typed refusal of a protocol object before any apply: batch shape,
22
- * version, fingerprint, manifest shape, checkpoint braid-set drift —
23
- * one identity, cause data per site.
24
- */
25
- const ErrRefused = errors.new("bumbledb-log refused")
26
-
27
- /** `commit` recorded ops in more than one braid; `commitSplit` is the verb. */
28
- const ErrSpanningCommit = errors.new(
29
- "bumbledb-log spanningCommit: the recorded ops span braids — commitSplit is the explicit verb"
30
- )
31
-
32
- /** A rejected replay on a store that passed the wholeness check. */
33
- const ErrReplayDiverged = errors.new(
34
- "bumbledb-log replayDiverged: a published batch rejected during steady-state replay"
35
- )
36
-
37
- /** The chain discipline, one identity with three proved causes. */
38
- const ErrChainMismatch = errors.new("bumbledb-log chainMismatch: the batch violates the braid's chain discipline")
39
-
40
- /** Bounded live-tip losses exhausted — an operational signal, not an outcome arm. */
41
- const ErrContention = errors.new("bumbledb-log contention: consecutive live-tip losses exhausted the bound")
42
-
43
- /** A replica (or any read-role handle) found no manifest; only the writer births a store. */
44
- export const ErrManifestMissing = errors.new("bumbledb-log manifestMissing: the store has no manifest")
45
-
46
- /** A single id draw larger than one lease width; the width is the one block size. */
47
- const ErrOverWidth = errors.new("bumbledb-log overWidth: the draw exceeds the lease width")
48
-
49
- /**
50
- * The cached id block is too short for the draw — the writer's signal
51
- * to lease a fresh block. A refill is not an exhaustion: the id space
52
- * still has room; only the cache is short.
53
- */
54
- const ErrRefillNeeded = errors.new("bumbledb-log refillNeeded: the cached id block cannot cover the draw")
55
-
56
- /** The next lease would leave u64 — the id space is spent. */
57
- const ErrExhausted = errors.new("bumbledb-log exhausted: the id space is spent")
58
-
59
- /** A put_create at a slot below the published checkpoint vector. */
60
- const ErrSlotRetired = errors.new("bumbledb-log slotRetired: the slot is retired")
61
-
62
- /** The vendor channel: I/O and store infrastructure failures. */
63
- const ErrStore = errors.new("bumbledb-log store failure")
64
-
65
- /**
66
- * The typed causes behind `ErrRefused`, one arm per identity. Every
67
- * `kind` is either a row of the generated identity table
68
- * (`crates/bumbledb-log/conformance/v3/identities.json`, spelled by the
69
- * core's one speller per family) or one of the three host-side kinds at
70
- * the tail, which cross no bridge. The boundary carries
71
- * `{ kind, message }` only, so a bridge-minted cause is the bare kind —
72
- * the detail rides the message — and a payload field exists only where
73
- * the minting seat owns the datum: a held document's version byte
74
- * (`version`, byte 0 of every v:3 document) and length (`at`), the
75
- * codec seat's own arity coordinates, the manifest audit's
76
- * fingerprints, the counter object's key. The raw id of an
77
- * `UnknownBraid` rides the message.
78
- */
79
- type RefusalCause =
80
- // The batch grammar's rows (`batchDecode` | `batchEncode`), bridge
81
- // order. `Version` carries the version byte where a document seat
82
- // holds the bytes; `FingerprintMismatch` carries both digests where
83
- // the replica's manifest audit owns them; `Arity` carries its
84
- // coordinates where the codec seat's pre-bridge cell gate owns them.
85
- | { readonly kind: "Truncated" }
86
- | { readonly kind: "BadMagic" }
87
- | { readonly kind: "Version"; readonly version?: number }
88
- | { readonly kind: "Flags" }
89
- | { readonly kind: "FingerprintMismatch"; readonly carried?: string; readonly expected?: string }
90
- | { readonly kind: "UnknownBraid" }
91
- | { readonly kind: "UnknownOpKind" }
92
- | { readonly kind: "UnknownRelation" }
93
- | { readonly kind: "ClosedRelation" }
94
- | { readonly kind: "OpRelationOutsideBraid" }
95
- | { readonly kind: "TagMismatch" }
96
- | { readonly kind: "BoolByte" }
97
- | { readonly kind: "InvalidUtf8" }
98
- | { readonly kind: "EmptyInterval" }
99
- | { readonly kind: "IntervalOverflow" }
100
- | { readonly kind: "TrailingBytes" }
101
- | { readonly kind: "Arity"; readonly op?: number; readonly relation?: string; readonly row?: number }
102
- | { readonly kind: "Value" }
103
- | { readonly kind: "TooManyOps" }
104
- | { readonly kind: "TooManyRows" }
105
- // The document grammars' own rows (`manifest` | `checkpoint` |
106
- // `sidecar`): the seat holds the refused bytes, so `Malformed`
107
- // carries the document's length.
108
- | { readonly kind: "Malformed"; readonly at: number }
109
- | { readonly kind: "Overflow" }
110
- | { readonly kind: "BraidSet" }
111
- // The id-lease counter's row (`counter`): the writer's parse gate
112
- // owns the counter object's key. `Exhausted` and `OverWidth` are
113
- // `LeaseRefusal` arms with sentinels of their own.
114
- | { readonly kind: "Counter"; readonly key: StoreKey }
115
- // Host-side kinds with no table row: `DigestWidth` refuses a short
116
- // digest at the seat before a value crosses corrupted (the corpus
117
- // pins the name); `CheckpointDigest` and `NoOpSlot` are the replica
118
- // machine's own refusals — the machines keep two executors and no
119
- // bridge family.
120
- | { readonly kind: "DigestWidth" }
121
- | { readonly kind: "CheckpointDigest"; readonly expected: string; readonly computed: string }
122
- | { readonly kind: "NoOpSlot"; readonly braid: Braid; readonly slot: Generation; readonly writer: bigint }
123
-
124
- type ChainCause = "prev" | "slot" | "timestamp"
125
-
126
- interface ChainMismatchData {
127
- readonly cause: ChainCause
128
- readonly braid: Braid
129
- readonly slot: Generation
130
- readonly writer: bigint
131
- }
132
-
133
- type ContentionCause =
134
- | {
135
- readonly kind: "hot-key"
136
- readonly statement: string
137
- readonly determinants: ReadonlyArray<Readonly<Record<string, unknown>>>
138
- }
139
- | { readonly kind: "slot-race"; readonly tip: Generation }
140
-
141
- interface ContentionData {
142
- readonly braid: Braid
143
- readonly cause: ContentionCause
144
- }
145
-
146
- interface OverWidthData {
147
- readonly requested: bigint
148
- }
149
-
150
- interface RefillNeededData {
151
- readonly relation: number
152
- readonly field: number
153
- readonly requested: bigint
154
- }
155
-
156
- interface ExhaustedData {
157
- readonly relation: number
158
- readonly field: number
159
- }
160
-
161
- interface SlotRetiredData {
162
- readonly braid: Braid
163
- readonly slot: Generation
164
- }
165
-
166
- /** The id-lease algebra's refusal sum — the identity table's `counter`
167
- * family, arm for arm: Counter | Exhausted | OverWidth. `Counter`
168
- * carries the counter object's key, the datum this driver's parse gate
169
- * owns (the core's twin carries relation and field). A cache refill is
170
- * no arm: the shared algebra has none. */
171
- type LeaseRefusal =
172
- | { readonly kind: "Counter"; readonly key: StoreKey }
173
- | { readonly kind: "Exhausted"; readonly relation: number; readonly field: number }
174
- | { readonly kind: "OverWidth"; readonly requested: bigint }
175
-
176
- const refusalData = new WeakMap<Error, RefusalCause>()
177
- const chainData = new WeakMap<Error, ChainMismatchData>()
178
- const contentionData = new WeakMap<Error, ContentionData>()
179
- const overWidthData = new WeakMap<Error, OverWidthData>()
180
- const refillNeededData = new WeakMap<Error, RefillNeededData>()
181
- const exhaustedData = new WeakMap<Error, ExhaustedData>()
182
- const slotRetiredData = new WeakMap<Error, SlotRetiredData>()
183
-
184
- function refuse(cause: RefusalCause, detail: string): never {
185
- const error = errors.wrap(ErrRefused, detail)
186
- refusalData.set(error, cause)
187
- throw error
188
- }
189
-
190
- function refuseChain(data: ChainMismatchData, detail: string): never {
191
- const error = errors.wrap(ErrChainMismatch, detail)
192
- chainData.set(error, data)
193
- throw error
194
- }
195
-
196
- function throwContention(data: ContentionData, detail: string): never {
197
- const error = errors.wrap(ErrContention, detail)
198
- contentionData.set(error, data)
199
- throw error
200
- }
201
-
202
- function refuseManifestMissing(detail: string): never {
203
- throw errors.wrap(ErrManifestMissing, detail)
204
- }
205
-
206
- function isManifestMissing(error: unknown): boolean {
207
- return error instanceof Error && errors.is(error, ErrManifestMissing)
208
- }
209
-
210
- function refuseOverWidth(data: OverWidthData, detail: string): never {
211
- const error = errors.wrap(ErrOverWidth, detail)
212
- overWidthData.set(error, data)
213
- throw error
214
- }
215
-
216
- function throwRefillNeeded(data: RefillNeededData, detail: string): never {
217
- const error = errors.wrap(ErrRefillNeeded, detail)
218
- refillNeededData.set(error, data)
219
- throw error
220
- }
221
-
222
- function refuseExhausted(data: ExhaustedData, detail: string): never {
223
- const error = errors.wrap(ErrExhausted, detail)
224
- exhaustedData.set(error, data)
225
- throw error
226
- }
227
-
228
- function refuseSlotRetired(data: SlotRetiredData, detail: string): never {
229
- const error = errors.wrap(ErrSlotRetired, detail)
230
- slotRetiredData.set(error, data)
231
- throw error
232
- }
233
-
234
- function refusalOf(error: Error): RefusalCause | undefined {
235
- return refusalData.get(error)
236
- }
237
-
238
- function chainMismatchOf(error: Error): ChainMismatchData | undefined {
239
- return chainData.get(error)
240
- }
241
-
242
- function contentionOf(error: Error): ContentionData | undefined {
243
- return contentionData.get(error)
244
- }
245
-
246
- function overWidthOf(error: Error): OverWidthData | undefined {
247
- return overWidthData.get(error)
248
- }
249
-
250
- function refillNeededOf(error: Error): RefillNeededData | undefined {
251
- return refillNeededData.get(error)
252
- }
253
-
254
- function exhaustedOf(error: Error): ExhaustedData | undefined {
255
- return exhaustedData.get(error)
256
- }
257
-
258
- function slotRetiredOf(error: Error): SlotRetiredData | undefined {
259
- return slotRetiredData.get(error)
260
- }
261
-
262
- /** Every store failure wraps the exported sentinel itself, so
263
- * `errors.is(e, ErrStore)` matches by identity; the vendor error's
264
- * message rides the detail verbatim. */
265
- function wrapStore(inner: Error, detail: string): Error {
266
- return errors.wrap(ErrStore, `${detail}: ${inner.message}`)
267
- }
268
-
269
- export type {
270
- ChainCause,
271
- ChainMismatchData,
272
- ContentionCause,
273
- ContentionData,
274
- ExhaustedData,
275
- LeaseRefusal,
276
- OverWidthData,
277
- RefillNeededData,
278
- RefusalCause,
279
- SlotRetiredData
280
- }
281
- export {
282
- chainMismatchOf,
283
- contentionOf,
284
- ErrChainMismatch,
285
- ErrContention,
286
- ErrExhausted,
287
- ErrOverWidth,
288
- ErrRefillNeeded,
289
- ErrRefused,
290
- ErrReplayDiverged,
291
- ErrSlotRetired,
292
- ErrSpanningCommit,
293
- ErrStore,
294
- exhaustedOf,
295
- isManifestMissing,
296
- overWidthOf,
297
- refillNeededOf,
298
- refusalOf,
299
- refuse,
300
- refuseChain,
301
- refuseExhausted,
302
- refuseManifestMissing,
303
- refuseOverWidth,
304
- refuseSlotRetired,
305
- slotRetiredOf,
306
- throwContention,
307
- throwRefillNeeded,
308
- wrapStore
309
- }
package/src/index.ts DELETED
@@ -1,57 +0,0 @@
1
- /**
2
- * @bjornpagen/bumbledb-log — braided object-store replication for
3
- * bumbledb, a thin peer of the engine SDK. The protocol grammar has one
4
- * implementation, `crates/bumbledb-log`, reached through the engine
5
- * bridge; this package is typed payload construction, the replica and
6
- * writer machines, the five-verb object store with its tier-1 `fsStore`,
7
- * in-process `memStore`, and the `s3Store` AWS S3 client, and
8
- * `openReplica`/`openWriter`/`openTenants` composed from the engine
9
- * SDK's own verbs — the replica hands out the SDK's `Db`, and no engine
10
- * surface is duplicated. Engine types (`FactValue`, `IntervalValue`, …)
11
- * are the peer `@bjornpagen/bumbledb`'s own exports, never re-exported
12
- * here.
13
- */
14
-
15
- export type { Braid } from "#braids.ts"
16
- export { braid, braidsOf, serialAtStatementsOf } from "#braids.ts"
17
- export type { BatchHeader, ChainEntry, DecodedBatch, EncodeHeader, Op } from "#codec.ts"
18
- export { decodeBatch, encodeBatch, verifyChain } from "#codec.ts"
19
- export type { Descriptor, SerialStatement, Theory } from "#descriptor.ts"
20
- export { descriptorOf } from "#descriptor.ts"
21
- export type { ChainCause, ChainMismatchData, ContentionCause, ContentionData, RefusalCause } from "#errors.ts"
22
- export {
23
- chainMismatchOf,
24
- contentionOf,
25
- ErrChainMismatch,
26
- ErrContention,
27
- ErrManifestMissing,
28
- ErrRefused,
29
- ErrReplayDiverged,
30
- ErrSpanningCommit,
31
- ErrStore,
32
- isManifestMissing,
33
- refusalOf
34
- } from "#errors.ts"
35
- export type { Generation, StoreKey } from "#keys.ts"
36
- export { generation, storeKey } from "#keys.ts"
37
- export type { OpenReplicaOptions, Replica, Waited } from "#replica.ts"
38
- export { openReplica } from "#replica.ts"
39
- export type { Create, Etag, Fetched, ObjectStore, Poll, S3Config, S3Credentials, Swap } from "#store.ts"
40
- export { etag, fsStore, memStore, s3Store } from "#store.ts"
41
- export type { OpenTenantsOptions, Tenants } from "#tenants.ts"
42
- export { openTenants } from "#tenants.ts"
43
- export type { CheckpointOrder } from "#vector.ts"
44
- export { Overflow, Vector } from "#vector.ts"
45
- export type {
46
- Batch,
47
- BraidOutcome,
48
- Commit,
49
- CommitReceipt,
50
- CommitSplit,
51
- Deposition,
52
- Durability,
53
- EmptyCommit,
54
- Landing,
55
- Writer
56
- } from "#writer.ts"
57
- export { openWriter } from "#writer.ts"