@minnowdb/core 0.2.1 → 0.4.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 +23 -32
- package/dist/block-format/block.d.ts +32 -13
- package/dist/block-format/block.js +179 -55
- package/dist/block-format/checksum.d.ts +2 -1
- package/dist/block-format/checksum.js +5 -2
- package/dist/block-format/codecs.d.ts +7 -2
- package/dist/block-format/codecs.js +53 -12
- package/dist/block-format/column.d.ts +3 -2
- package/dist/block-format/column.js +96 -30
- package/dist/block-format/index.d.ts +2 -2
- package/dist/block-format/index.js +2 -2
- package/dist/block-format/physical.d.ts +8 -2
- package/dist/block-format/physical.js +14 -6
- package/dist/block-format/types.d.ts +7 -3
- package/dist/block-format/types.js +0 -1
- package/dist/block-format/unicode.d.ts +11 -0
- package/dist/block-format/unicode.js +46 -0
- package/dist/date-value.d.ts +15 -0
- package/dist/date-value.js +64 -0
- package/dist/engine/artifact-cache.d.ts +2 -1
- package/dist/engine/artifact-cache.js +5 -1
- package/dist/engine/batch.d.ts +11 -3
- package/dist/engine/batch.js +17 -7
- package/dist/engine/buffered-writer.d.ts +2 -1
- package/dist/engine/buffered-writer.js +34 -9
- package/dist/engine/cache-limits.d.ts +25 -0
- package/dist/engine/cache-limits.js +25 -0
- package/dist/engine/catalog.d.ts +24 -5
- package/dist/engine/catalog.js +34 -7
- package/dist/engine/client.d.ts +29 -7
- package/dist/engine/client.js +216 -40
- package/dist/engine/database.d.ts +224 -39
- package/dist/engine/database.js +7475 -1539
- package/dist/engine/defaults.d.ts +4 -8
- package/dist/engine/defaults.js +46 -22
- package/dist/engine/errors.d.ts +19 -1
- package/dist/engine/errors.js +32 -2
- package/dist/engine/fts.d.ts +0 -6
- package/dist/engine/fts.js +41 -14
- package/dist/engine/group-index.d.ts +0 -1
- package/dist/engine/group-index.js +6 -11
- package/dist/engine/index.d.ts +16 -10
- package/dist/engine/index.js +12 -9
- package/dist/engine/join-index.d.ts +0 -1
- package/dist/engine/join-index.js +2 -2
- package/dist/engine/keyed-live.d.ts +57 -0
- package/dist/engine/keyed-live.js +226 -0
- package/dist/engine/live-api.d.ts +4 -0
- package/dist/engine/live-api.js +4 -0
- package/dist/engine/live.d.ts +43 -26
- package/dist/engine/live.js +504 -126
- package/dist/engine/memory.d.ts +2 -1
- package/dist/engine/memory.js +3 -2
- package/dist/engine/optimizer.d.ts +0 -1
- package/dist/engine/optimizer.js +262 -27
- package/dist/engine/query-api.d.ts +3 -0
- package/dist/engine/query-api.js +3 -0
- package/dist/engine/query-cache.d.ts +1 -2
- package/dist/engine/query-cache.js +7 -5
- package/dist/engine/query.d.ts +134 -29
- package/dist/engine/query.js +1668 -372
- package/dist/engine/result-wire.d.ts +0 -1
- package/dist/engine/result-wire.js +2 -2
- package/dist/engine/schema-wire.d.ts +6 -3
- package/dist/engine/schema-wire.js +40 -34
- package/dist/engine/schema.d.ts +156 -80
- package/dist/engine/schema.js +570 -108
- package/dist/engine/sort-keys.d.ts +4 -4
- package/dist/engine/sort-keys.js +44 -29
- package/dist/engine/sql-domains.d.ts +31 -0
- package/dist/engine/sql-domains.js +585 -0
- package/dist/engine/sql-driver.d.ts +19 -0
- package/dist/engine/sql-driver.js +1 -0
- package/dist/engine/sql-json.d.ts +7 -9
- package/dist/engine/sql-json.js +75 -15
- package/dist/engine/sql-semantics.d.ts +8 -3
- package/dist/engine/sql-semantics.js +458 -30
- package/dist/engine/typed-live.d.ts +67 -0
- package/dist/engine/typed-live.js +349 -0
- package/dist/engine/vector.d.ts +12 -2
- package/dist/engine/vector.js +635 -119
- package/dist/engine/worker-host.d.ts +9 -2
- package/dist/engine/worker-host.js +620 -152
- package/dist/engine/worker.d.ts +0 -1
- package/dist/engine/worker.js +3 -3
- package/dist/engine/write-block-planner.d.ts +18 -0
- package/dist/engine/write-block-planner.js +112 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/plan/index.d.ts +3 -4
- package/dist/plan/index.js +3 -4
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/indexeddb.d.ts +99 -51
- package/dist/storage/indexeddb.js +13448 -2660
- package/dist/storage/memory.d.ts +64 -57
- package/dist/storage/memory.js +1042 -128
- package/dist/storage/opfs/files.d.ts +18 -7
- package/dist/storage/opfs/files.js +115 -28
- package/dist/storage/opfs/index.d.ts +1 -1
- package/dist/storage/opfs/index.js +1 -1
- package/dist/storage/opfs/leader.d.ts +409 -75
- package/dist/storage/opfs/leader.js +4621 -650
- package/dist/storage/opfs/rpc.d.ts +15 -3
- package/dist/storage/opfs/rpc.js +224 -2
- package/dist/storage/opfs/snapshot-ledger.d.ts +40 -0
- package/dist/storage/opfs/snapshot-ledger.js +281 -0
- package/dist/storage/opfs/store.d.ts +33 -99
- package/dist/storage/opfs/store.js +453 -364
- package/dist/storage/persistence.d.ts +37 -0
- package/dist/storage/persistence.js +78 -0
- package/dist/storage/snapshot-stream.d.ts +24 -0
- package/dist/storage/snapshot-stream.js +897 -0
- package/dist/storage/snapshot.d.ts +9 -85
- package/dist/storage/snapshot.js +33 -265
- package/dist/storage/toolkit/extents.d.ts +41 -7
- package/dist/storage/toolkit/extents.js +402 -39
- package/dist/storage/toolkit/index.d.ts +4 -5
- package/dist/storage/toolkit/index.js +28 -4
- package/dist/storage/toolkit/record-core.d.ts +182 -55
- package/dist/storage/toolkit/record-core.js +6158 -1331
- package/dist/storage/toolkit/sync-file.d.ts +10 -1
- package/dist/storage/toolkit/sync-file.js +50 -2
- package/dist/storage/toolkit/wal.d.ts +23 -5
- package/dist/storage/toolkit/wal.js +89 -27
- package/dist/storage/toolkit/wire.d.ts +15 -2
- package/dist/storage/toolkit/wire.js +199 -10
- package/dist/storage/types.d.ts +1439 -204
- package/dist/storage/types.js +1745 -141
- package/dist/testing/block-store-conformance.d.ts +0 -1
- package/dist/testing/block-store-conformance.js +1009 -119
- package/dist/testing/index.d.ts +46 -26
- package/dist/testing/index.js +112 -57
- package/dist/testing/opfs-shim.d.ts +13 -3
- package/dist/testing/opfs-shim.js +40 -6
- package/dist/testing/simulator.d.ts +97 -0
- package/dist/testing/simulator.js +591 -0
- package/dist/testing/sqllogictest.d.ts +89 -0
- package/dist/testing/sqllogictest.js +434 -0
- package/dist/transactions/index.d.ts +92 -16
- package/dist/transactions/index.js +1074 -236
- package/dist/worker-protocol/index.d.ts +3 -2
- package/dist/worker-protocol/index.js +2 -5
- package/package.json +53 -3
- package/postgres-feature-profile.json +223 -0
- package/sql-feature-matrix.json +172 -252
- package/dist/block-format/block.d.ts.map +0 -1
- package/dist/block-format/block.js.map +0 -1
- package/dist/block-format/checksum.d.ts.map +0 -1
- package/dist/block-format/checksum.js.map +0 -1
- package/dist/block-format/codecs.d.ts.map +0 -1
- package/dist/block-format/codecs.js.map +0 -1
- package/dist/block-format/column.d.ts.map +0 -1
- package/dist/block-format/column.js.map +0 -1
- package/dist/block-format/index.d.ts.map +0 -1
- package/dist/block-format/index.js.map +0 -1
- package/dist/block-format/physical.d.ts.map +0 -1
- package/dist/block-format/physical.js.map +0 -1
- package/dist/block-format/types.d.ts.map +0 -1
- package/dist/block-format/types.js.map +0 -1
- package/dist/engine/artifact-cache.d.ts.map +0 -1
- package/dist/engine/artifact-cache.js.map +0 -1
- package/dist/engine/batch.d.ts.map +0 -1
- package/dist/engine/batch.js.map +0 -1
- package/dist/engine/buffered-writer.d.ts.map +0 -1
- package/dist/engine/buffered-writer.js.map +0 -1
- package/dist/engine/catalog.d.ts.map +0 -1
- package/dist/engine/catalog.js.map +0 -1
- package/dist/engine/client.d.ts.map +0 -1
- package/dist/engine/client.js.map +0 -1
- package/dist/engine/coordinator.d.ts +0 -17
- package/dist/engine/coordinator.d.ts.map +0 -1
- package/dist/engine/coordinator.js +0 -60
- package/dist/engine/coordinator.js.map +0 -1
- package/dist/engine/database.d.ts.map +0 -1
- package/dist/engine/database.js.map +0 -1
- package/dist/engine/defaults.d.ts.map +0 -1
- package/dist/engine/defaults.js.map +0 -1
- package/dist/engine/errors.d.ts.map +0 -1
- package/dist/engine/errors.js.map +0 -1
- package/dist/engine/fts.d.ts.map +0 -1
- package/dist/engine/fts.js.map +0 -1
- package/dist/engine/group-index.d.ts.map +0 -1
- package/dist/engine/group-index.js.map +0 -1
- package/dist/engine/index.d.ts.map +0 -1
- package/dist/engine/index.js.map +0 -1
- package/dist/engine/join-index.d.ts.map +0 -1
- package/dist/engine/join-index.js.map +0 -1
- package/dist/engine/live.d.ts.map +0 -1
- package/dist/engine/live.js.map +0 -1
- package/dist/engine/memory.d.ts.map +0 -1
- package/dist/engine/memory.js.map +0 -1
- package/dist/engine/optimizer.d.ts.map +0 -1
- package/dist/engine/optimizer.js.map +0 -1
- package/dist/engine/query-cache.d.ts.map +0 -1
- package/dist/engine/query-cache.js.map +0 -1
- package/dist/engine/query.d.ts.map +0 -1
- package/dist/engine/query.js.map +0 -1
- package/dist/engine/result-wire.d.ts.map +0 -1
- package/dist/engine/result-wire.js.map +0 -1
- package/dist/engine/schema-wire.d.ts.map +0 -1
- package/dist/engine/schema-wire.js.map +0 -1
- package/dist/engine/schema.d.ts.map +0 -1
- package/dist/engine/schema.js.map +0 -1
- package/dist/engine/sort-keys.d.ts.map +0 -1
- package/dist/engine/sort-keys.js.map +0 -1
- package/dist/engine/sql-json.d.ts.map +0 -1
- package/dist/engine/sql-json.js.map +0 -1
- package/dist/engine/sql-semantics.d.ts.map +0 -1
- package/dist/engine/sql-semantics.js.map +0 -1
- package/dist/engine/vector.d.ts.map +0 -1
- package/dist/engine/vector.js.map +0 -1
- package/dist/engine/worker-host.d.ts.map +0 -1
- package/dist/engine/worker-host.js.map +0 -1
- package/dist/engine/worker.d.ts.map +0 -1
- package/dist/engine/worker.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plan/index.d.ts.map +0 -1
- package/dist/plan/index.js.map +0 -1
- package/dist/storage/fixture-shape.d.ts +0 -42
- package/dist/storage/fixture-shape.d.ts.map +0 -1
- package/dist/storage/fixture-shape.js +0 -146
- package/dist/storage/fixture-shape.js.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/indexeddb.d.ts.map +0 -1
- package/dist/storage/indexeddb.js.map +0 -1
- package/dist/storage/memory.d.ts.map +0 -1
- package/dist/storage/memory.js.map +0 -1
- package/dist/storage/opfs/files.d.ts.map +0 -1
- package/dist/storage/opfs/files.js.map +0 -1
- package/dist/storage/opfs/index.d.ts.map +0 -1
- package/dist/storage/opfs/index.js.map +0 -1
- package/dist/storage/opfs/leader.d.ts.map +0 -1
- package/dist/storage/opfs/leader.js.map +0 -1
- package/dist/storage/opfs/rpc.d.ts.map +0 -1
- package/dist/storage/opfs/rpc.js.map +0 -1
- package/dist/storage/opfs/store.d.ts.map +0 -1
- package/dist/storage/opfs/store.js.map +0 -1
- package/dist/storage/snapshot.d.ts.map +0 -1
- package/dist/storage/snapshot.js.map +0 -1
- package/dist/storage/toolkit/extents.d.ts.map +0 -1
- package/dist/storage/toolkit/extents.js.map +0 -1
- package/dist/storage/toolkit/index.d.ts.map +0 -1
- package/dist/storage/toolkit/index.js.map +0 -1
- package/dist/storage/toolkit/record-core.d.ts.map +0 -1
- package/dist/storage/toolkit/record-core.js.map +0 -1
- package/dist/storage/toolkit/sync-file.d.ts.map +0 -1
- package/dist/storage/toolkit/sync-file.js.map +0 -1
- package/dist/storage/toolkit/wal.d.ts.map +0 -1
- package/dist/storage/toolkit/wal.js.map +0 -1
- package/dist/storage/toolkit/wire.d.ts.map +0 -1
- package/dist/storage/toolkit/wire.js.map +0 -1
- package/dist/storage/types.d.ts.map +0 -1
- package/dist/storage/types.js.map +0 -1
- package/dist/testing/block-store-conformance.d.ts.map +0 -1
- package/dist/testing/block-store-conformance.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/opfs-shim.d.ts.map +0 -1
- package/dist/testing/opfs-shim.js.map +0 -1
- package/dist/testing/seeds.d.ts +0 -11
- package/dist/testing/seeds.d.ts.map +0 -1
- package/dist/testing/seeds.js +0 -50
- package/dist/testing/seeds.js.map +0 -1
- package/dist/transactions/index.d.ts.map +0 -1
- package/dist/transactions/index.js.map +0 -1
- package/dist/worker-protocol/index.d.ts.map +0 -1
- package/dist/worker-protocol/index.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type BeginTransactionInput, type BeginTransactionResult, type CommitTransactionInput, type CompactionJobRecord, type CompactionJobRecordUpdate, type CreateGarbageCollectionJobInput, type
|
|
2
|
-
import { type DatabaseSnapshot } from "../snapshot.js";
|
|
1
|
+
import { type BeginTransactionInput, type BeginTransactionResult, type AbortTransactionIfExpiredInput, type AdoptAbortedSegmentInput, type RenewTransactionInput, type CommitTransactionInput, type CompactionJobRecord, type CompactionJobRecordUpdate, type CreateGarbageCollectionJobInput, type UpdateGarbageCollectionPlanningInput, type DropTableColumnInput, type DropTableInput, type CatalogProbe, type FtsCandidates, type FtsPostingQuery, type FtsPosting, type GarbageCollectionJobRecord, type GarbageCollectionStepResult, type LeaseRecord, type MoveLeaseInput, type RenewLeaseInput, type RenewTempOwnerInput, type Manifest, type ManifestBlockRecord, type ListManifestBlockPageInput, type ListRetiredManifestBlockPageInput, type ManifestBlockPage, type ManifestSummary, type RowIdRange, type RunGarbageCollectionStepInput, type SegmentRecord, type RollbackTransactionArtifactsInput, type StageTransactionArtifactsInput, type StoragePage, type CatalogMutationOptions, type TableRecord, type TableRecordUpdate, type TempOwnerRecord, type TempRunPage, type TransactionRecord, type TransactionRecordUpdate, type UniqueKeyBuildRecord, type BeginUniqueKeyBuildInput, type RenewUniqueKeyBuildInput, type AppendUniqueKeyBuildChunkInput, type FinishUniqueKeyBuildInput, type AbortUniqueKeyBuildInput, type WriteTransactionInput, type SnapshotCatalogItem, type SnapshotMetadataItem, type SnapshotFrameStreamHeader, type SnapshotPostingItem, type SnapshotSegmentItem, type SnapshotTransactionItem, type SnapshotUniqueItem } from "../types.js";
|
|
3
2
|
/**
|
|
4
3
|
* How the record core sees block bytes it does not hold. The core owns every small record —
|
|
5
4
|
* catalog, manifests, transactions, leases, jobs, counters, keys — but block payloads live
|
|
@@ -10,12 +9,68 @@ export interface PhysicalBlocks {
|
|
|
10
9
|
hasBlock(id: string): boolean;
|
|
11
10
|
/** `undefined` means the block does not exist. */
|
|
12
11
|
blockByteLength(id: string): number | undefined;
|
|
12
|
+
/** Exact stored-payload CRC when the adapter persists manifest provenance. */
|
|
13
|
+
blockChecksum?(id: string): number | undefined;
|
|
14
|
+
}
|
|
15
|
+
type OrderedKey = string | number;
|
|
16
|
+
/**
|
|
17
|
+
* A small chunked ordered index. Random UUID insertion only shifts one bounded chunk, while a
|
|
18
|
+
* cursor seek binary-searches chunks and keys before walking the requested page sequentially.
|
|
19
|
+
*/
|
|
20
|
+
/** @internal Exported only so the storage hardening suite can assert operation counts. */
|
|
21
|
+
export declare class OrderedKeyIndex<Key> {
|
|
22
|
+
#private;
|
|
23
|
+
static readonly CHUNK_SIZE = 128;
|
|
24
|
+
constructor(compare: (left: Key, right: Key) => number);
|
|
25
|
+
clear(): void;
|
|
26
|
+
get empty(): boolean;
|
|
27
|
+
add(key: Key): void;
|
|
28
|
+
delete(key: Key): void;
|
|
29
|
+
after(after: Key | null): IterableIterator<Key>;
|
|
30
|
+
}
|
|
31
|
+
/** Membership lookup plus stable lexical streaming without sorting on every bulk write. */
|
|
32
|
+
/** @internal Exported only so storage hardening tests can exercise lazy-index transitions. */
|
|
33
|
+
export declare class OrderedStringSet extends Set<string> {
|
|
34
|
+
#private;
|
|
35
|
+
constructor(values?: Iterable<string>);
|
|
36
|
+
add(value: string): this;
|
|
37
|
+
/**
|
|
38
|
+
* Adds a commit delta without maintaining snapshot order token-by-token. Membership remains
|
|
39
|
+
* eager and exact; the snapshot-only index is rebuilt once, deterministically, if ordered
|
|
40
|
+
* iteration is later requested. Clearing a stale index also releases its duplicate references.
|
|
41
|
+
*/
|
|
42
|
+
addMany(values: Iterable<string>): this;
|
|
43
|
+
delete(value: string): boolean;
|
|
44
|
+
clear(): void;
|
|
45
|
+
orderedValues(): IterableIterator<string>;
|
|
46
|
+
}
|
|
47
|
+
declare class OrderedRecordMap<Key extends OrderedKey, Value> extends Map<Key, Value> {
|
|
48
|
+
#private;
|
|
49
|
+
constructor(onChange?: (previous: Value | undefined, next: Value | undefined) => void);
|
|
50
|
+
set(key: Key, value: Value): this;
|
|
51
|
+
delete(key: Key): boolean;
|
|
52
|
+
clear(): void;
|
|
53
|
+
orderedValues(after: Key | null): IterableIterator<Value>;
|
|
54
|
+
}
|
|
55
|
+
/** @internal Exported only so the storage hardening suite can exercise table-local traversal. */
|
|
56
|
+
export declare class SegmentRecordMap extends OrderedRecordMap<string, SegmentRecord> {
|
|
57
|
+
#private;
|
|
58
|
+
set(id: string, record: SegmentRecord): this;
|
|
59
|
+
delete(id: string): boolean;
|
|
60
|
+
clear(): void;
|
|
61
|
+
tableValues(tableId: string): IterableIterator<SegmentRecord>;
|
|
62
|
+
blockReferenceCount(blockId: string): number;
|
|
63
|
+
tableBlockReferenceCount(tableId: string, blockId: string): number;
|
|
64
|
+
segmentIdsForBlock(blockId: string): ReadonlySet<string>;
|
|
65
|
+
ownerReferenceCount(transactionId: string): number;
|
|
13
66
|
}
|
|
14
67
|
/** `RecordCore.dump()`'s shape; see there. Arrays rather than Maps so the value serializes. */
|
|
15
68
|
export interface RecordCoreState {
|
|
16
69
|
currentVersion: number | null;
|
|
17
70
|
catalogEpoch: number;
|
|
71
|
+
schemaEpoch: number;
|
|
18
72
|
manifests: Manifest[];
|
|
73
|
+
manifestBlocks: ManifestBlockRecord[];
|
|
19
74
|
transactions: TransactionRecord[];
|
|
20
75
|
tables: TableRecord[];
|
|
21
76
|
segments: SegmentRecord[];
|
|
@@ -34,6 +89,7 @@ export interface RecordCoreState {
|
|
|
34
89
|
totalTokens: number;
|
|
35
90
|
}]>]>;
|
|
36
91
|
uniqueKeys: Array<readonly [string, string[]]>;
|
|
92
|
+
uniqueKeyBuilds: Array<readonly [UniqueKeyBuildRecord, string[][], FinishUniqueKeyBuildInput | null]>;
|
|
37
93
|
tempOwners: TempOwnerRecord[];
|
|
38
94
|
}
|
|
39
95
|
/**
|
|
@@ -58,9 +114,12 @@ export interface RecordCoreState {
|
|
|
58
114
|
export declare class RecordCore {
|
|
59
115
|
#private;
|
|
60
116
|
constructor(physical: PhysicalBlocks);
|
|
117
|
+
/** Reconstructs and validates time-sensitive pinned-retired quotas after durable recovery. */
|
|
118
|
+
validatePinnedRetiredLimits(expiresAtCutoff: string): void;
|
|
61
119
|
createTempOwner(record: TempOwnerRecord): void;
|
|
62
120
|
getTempOwner(ownerId: string): TempOwnerRecord | undefined;
|
|
63
|
-
renewTempOwner(
|
|
121
|
+
renewTempOwner(input: RenewTempOwnerInput): TempOwnerRecord;
|
|
122
|
+
listExpiredTempOwnerPage(expiresAtCutoff: string, afterCursor: string | null, limit: number): StoragePage<string, string>;
|
|
64
123
|
/**
|
|
65
124
|
* Removes the owner record when it is absent or expired, and reports whether the caller
|
|
66
125
|
* should also remove the owner's physical pages. Page bytes are the enclosing store's.
|
|
@@ -73,26 +132,23 @@ export declare class RecordCore {
|
|
|
73
132
|
* expiry sweep can reclaim them.
|
|
74
133
|
*/
|
|
75
134
|
listTempOwnerIdsPage(afterOwnerId: string | null, limit: number, extraOwnerIds: Iterable<string>): StoragePage<string, string>;
|
|
76
|
-
addTable(record: TableRecord): void;
|
|
135
|
+
addTable(record: TableRecord, options?: CatalogMutationOptions): void;
|
|
77
136
|
getTable(id: string): TableRecord | undefined;
|
|
78
|
-
updateTable(id: string, expectedRevision: number, update:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}): TableRecord;
|
|
83
|
-
removeTable(id: string, expectedRevision: number): void;
|
|
137
|
+
updateTable(id: string, expectedRevision: number, update: TableRecordUpdate): TableRecord;
|
|
138
|
+
removeTable(id: string, expectedRevision: number, options?: CatalogMutationOptions): void;
|
|
139
|
+
dropTable(input: DropTableInput): ManifestSummary;
|
|
140
|
+
dropTableColumn(input: DropTableColumnInput): ManifestSummary;
|
|
84
141
|
writeFtsBase(tableId: string, columnId: string, input: {
|
|
85
142
|
coversVersion: number;
|
|
86
143
|
chunks: FtsPosting[][];
|
|
87
144
|
totalTokens: number;
|
|
88
145
|
}): void;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
prefix: boolean;
|
|
92
|
-
}>, upToVersion: number): FtsCandidates & {
|
|
146
|
+
removeFtsColumn(tableId: string, columnId: string): void;
|
|
147
|
+
readFtsCandidates(tableId: string, columnId: string, terms: readonly FtsPostingQuery[], upToVersion: number, maxRowIds?: number): FtsCandidates & {
|
|
93
148
|
deltaChunkCount: number;
|
|
94
149
|
totalTokens: number;
|
|
95
150
|
coversVersion: number;
|
|
151
|
+
hasBase: boolean;
|
|
96
152
|
};
|
|
97
153
|
/**
|
|
98
154
|
* The delta half of a full-text read, for stores that keep base chunks outside the core
|
|
@@ -104,6 +160,13 @@ export declare class RecordCore {
|
|
|
104
160
|
deltaChunkCount: number;
|
|
105
161
|
deltaTokens: number;
|
|
106
162
|
};
|
|
163
|
+
readFtsPostings(tableId: string, columnId: string, upToVersion: number, maxRowIds?: number, maxRetainedBytes?: number): {
|
|
164
|
+
postings: FtsPosting[];
|
|
165
|
+
overflow: boolean;
|
|
166
|
+
deltaChunkCount: number;
|
|
167
|
+
coversVersion: number;
|
|
168
|
+
hasBase: boolean;
|
|
169
|
+
};
|
|
107
170
|
/** The delta-pruning half of `writeFtsBase`, for stores that keep the base itself outside. */
|
|
108
171
|
pruneFtsDeltas(tableId: string, columnId: string, coversVersion: number): void;
|
|
109
172
|
/**
|
|
@@ -117,42 +180,51 @@ export declare class RecordCore {
|
|
|
117
180
|
job: GarbageCollectionJobRecord;
|
|
118
181
|
prunedManifestVersions: readonly number[];
|
|
119
182
|
reclaimedSegmentIds: readonly string[];
|
|
120
|
-
|
|
183
|
+
reclaimedBlockIds: readonly string[];
|
|
184
|
+
reclaimedTransactionIds: readonly string[];
|
|
121
185
|
updatedAt: string;
|
|
122
186
|
}): void;
|
|
123
187
|
getTableByName(name: string): TableRecord | undefined;
|
|
124
188
|
/** For stores that compose lookups over their own overridable methods. */
|
|
125
189
|
getTableIdByName(name: string): string | undefined;
|
|
126
190
|
listTables(): TableRecord[];
|
|
127
|
-
addSegment(record: SegmentRecord): void;
|
|
128
191
|
getSegment(id: string): SegmentRecord | undefined;
|
|
129
|
-
|
|
130
|
-
|
|
192
|
+
listSegmentPage(afterId: string | null, limit: number): StoragePage<SegmentRecord, string>;
|
|
193
|
+
listTableSegmentPage(tableId: string, afterId: string | null, limit: number): StoragePage<SegmentRecord, string>;
|
|
194
|
+
removeAbortedSegment(id: string, expectedTransactionId: string): boolean;
|
|
195
|
+
adoptAbortedSegment(input: AdoptAbortedSegmentInput): TransactionRecord;
|
|
131
196
|
reserveRowIds(tableId: string, count: number): RowIdRange;
|
|
132
197
|
reserveAutoIncrement(tableId: string, columnId: string, count: number, atLeast?: bigint): RowIdRange;
|
|
133
198
|
getExistingUniqueKeys(tableId: string, keyTokens: readonly string[]): string[];
|
|
199
|
+
/** O(1) staged UNIQUE usage for enclosing adapters' cross-accelerator admission. */
|
|
200
|
+
uniqueKeyBuildStagedUsage(): {
|
|
201
|
+
bytes: number;
|
|
202
|
+
entries: number;
|
|
203
|
+
};
|
|
204
|
+
beginUniqueKeyBuild(input: BeginUniqueKeyBuildInput): UniqueKeyBuildRecord;
|
|
205
|
+
getUniqueKeyBuild(buildId: string): UniqueKeyBuildRecord | undefined;
|
|
206
|
+
renewUniqueKeyBuild(input: RenewUniqueKeyBuildInput): UniqueKeyBuildRecord;
|
|
207
|
+
appendUniqueKeyBuildChunk(input: AppendUniqueKeyBuildChunkInput): UniqueKeyBuildRecord;
|
|
208
|
+
finishUniqueKeyBuild(input: FinishUniqueKeyBuildInput): TableRecord;
|
|
209
|
+
abortUniqueKeyBuild(input: AbortUniqueKeyBuildInput): boolean;
|
|
134
210
|
getCurrentManifestVersion(): number | null;
|
|
135
211
|
getCatalogProbe(): CatalogProbe;
|
|
136
|
-
|
|
212
|
+
hasManifestBlocks(version: number | null, ids: readonly string[]): boolean[];
|
|
213
|
+
listManifestBlockPage(input: ListManifestBlockPageInput): ManifestBlockPage;
|
|
214
|
+
listRetiredManifestBlockPage(input: ListRetiredManifestBlockPageInput): ManifestBlockPage;
|
|
137
215
|
getCurrentManifest(): Manifest | undefined;
|
|
138
216
|
getManifest(version: number): Manifest | undefined;
|
|
139
|
-
listManifests(): Manifest[];
|
|
140
217
|
listManifestPage(afterVersion: number | null, limit: number): StoragePage<Manifest, number>;
|
|
141
|
-
/**
|
|
142
|
-
|
|
143
|
-
* longer needed for delta resolution, but its narrowed block list remains the collector's
|
|
144
|
-
* durable discovery record until every named payload has actually gone. Deleting it sooner
|
|
145
|
-
* loses garbage left behind by a bounded planning pass.
|
|
146
|
-
*/
|
|
147
|
-
removePrunedManifestRecords(): number[];
|
|
148
|
-
publishManifest(input: PublishManifestInput): Manifest;
|
|
218
|
+
/** Removes only bounded summary tombstones; block discovery lives in provenance intervals. */
|
|
219
|
+
removePrunedManifestRecords(maxItems: number): number;
|
|
149
220
|
beginTransaction(input: BeginTransactionInput): BeginTransactionResult;
|
|
150
221
|
createTransaction(record: TransactionRecord): void;
|
|
151
222
|
getTransaction(id: string): TransactionRecord | undefined;
|
|
152
223
|
getTransactions(ids: readonly string[]): Array<TransactionRecord | undefined>;
|
|
153
|
-
listTransactions(): TransactionRecord[];
|
|
154
224
|
listTransactionPage(afterId: string | null, limit: number): StoragePage<TransactionRecord, string>;
|
|
155
225
|
updateTransaction(id: string, expectedRevision: number, update: TransactionRecordUpdate): TransactionRecord;
|
|
226
|
+
renewTransaction(input: RenewTransactionInput): boolean;
|
|
227
|
+
abortTransactionIfExpired(input: AbortTransactionIfExpiredInput): TransactionRecord | undefined;
|
|
156
228
|
/**
|
|
157
229
|
* Validates and applies the record half of staging: the journal update and the segment
|
|
158
230
|
* records. Block bytes are the enclosing store's to write — after this returns, in the same
|
|
@@ -165,7 +237,16 @@ export declare class RecordCore {
|
|
|
165
237
|
* the check would misread them as duplicates.
|
|
166
238
|
*/
|
|
167
239
|
blocksPrevalidated?: boolean;
|
|
240
|
+
/** Exact persisted byte lengths when prevalidated adapter bodies omit payload bytes. */
|
|
241
|
+
blockByteLengths?: ReadonlyMap<string, number>;
|
|
168
242
|
}): TransactionRecord;
|
|
243
|
+
/**
|
|
244
|
+
* Runs the complete staging preflight without changing record state. Persistent adapters use
|
|
245
|
+
* this before allocating payload storage; the real apply repeats it under the same writer lock.
|
|
246
|
+
*/
|
|
247
|
+
preflightTransactionArtifactStage(input: StageTransactionArtifactsInput): void;
|
|
248
|
+
/** Validates and applies the record/segment half of an atomic savepoint rewind. */
|
|
249
|
+
rollbackTransactionArtifacts(input: RollbackTransactionArtifactsInput): TransactionRecord;
|
|
169
250
|
commitTransaction(input: CommitTransactionInput): ManifestSummary;
|
|
170
251
|
/**
|
|
171
252
|
* The single-shot write: begin or continue a transaction, journal the artifacts, and commit
|
|
@@ -176,24 +257,37 @@ export declare class RecordCore {
|
|
|
176
257
|
writeTransaction(input: WriteTransactionInput, options?: {
|
|
177
258
|
/** As on `stageTransactionArtifacts`: the enclosing store already checked the block ids. */
|
|
178
259
|
blocksPrevalidated?: boolean;
|
|
260
|
+
/** Exact persisted lengths when an adapter replays placement-only block bodies. */
|
|
261
|
+
blockByteLengths?: ReadonlyMap<string, number>;
|
|
262
|
+
/** Exact persisted checksums when an adapter replays placement-only block bodies. */
|
|
263
|
+
blockChecksums?: ReadonlyMap<string, number>;
|
|
179
264
|
}): ManifestSummary;
|
|
265
|
+
/** Complete, non-mutating preflight used before a persistent adapter allocates block bytes. */
|
|
266
|
+
preflightWriteTransaction(input: WriteTransactionInput): void;
|
|
180
267
|
createLease(record: LeaseRecord): void;
|
|
181
268
|
getLease(id: string): LeaseRecord | undefined;
|
|
182
269
|
listLeases(): LeaseRecord[];
|
|
183
|
-
|
|
184
|
-
|
|
270
|
+
listExpiredLeasePage(expiresAtCutoff: string, afterCursor: string | null, limit: number): StoragePage<LeaseRecord, string>;
|
|
271
|
+
renewLease(input: RenewLeaseInput): LeaseRecord;
|
|
272
|
+
moveLease(input: MoveLeaseInput): LeaseRecord;
|
|
185
273
|
removeLeaseIfExpired(id: string, expectedRevision: number, expiresAtCutoff: string): boolean;
|
|
186
|
-
removeLease(
|
|
274
|
+
removeLease(input: {
|
|
275
|
+
id: string;
|
|
276
|
+
ownerId: string;
|
|
277
|
+
}): boolean;
|
|
187
278
|
createCompactionJob(record: CompactionJobRecord): void;
|
|
188
279
|
getCompactionJob(id: string): CompactionJobRecord | undefined;
|
|
189
280
|
listCompactionJobs(tableId?: string): CompactionJobRecord[];
|
|
190
281
|
listCompactionJobPage(afterId: string | null, limit: number): StoragePage<CompactionJobRecord, string>;
|
|
191
282
|
updateCompactionJob(id: string, expectedRevision: number, update: CompactionJobRecordUpdate): CompactionJobRecord;
|
|
192
283
|
cancelCompactionJob(id: string, expectedRevision: number, cancelledAt: string): CompactionJobRecord;
|
|
193
|
-
removeCompactionJob(id: string):
|
|
284
|
+
removeCompactionJob(id: string): boolean;
|
|
285
|
+
canRemoveCompactionJob(id: string): boolean;
|
|
194
286
|
createGarbageCollectionJob(input: CreateGarbageCollectionJobInput): GarbageCollectionJobRecord;
|
|
287
|
+
updateGarbageCollectionPlanning(input: UpdateGarbageCollectionPlanningInput): GarbageCollectionJobRecord;
|
|
195
288
|
getGarbageCollectionJob(id: string): GarbageCollectionJobRecord | undefined;
|
|
196
289
|
listGarbageCollectionJobs(): GarbageCollectionJobRecord[];
|
|
290
|
+
listGarbageCollectionJobPage(afterId: string | null, limit: number): StoragePage<GarbageCollectionJobRecord, string>;
|
|
197
291
|
/**
|
|
198
292
|
* Advances the job and mutates every record it reclaims. Physical block bytes are the
|
|
199
293
|
* caller's to delete afterwards, from the result's `reclaimedBlockIds` — in the same atomic
|
|
@@ -202,32 +296,55 @@ export declare class RecordCore {
|
|
|
202
296
|
runGarbageCollectionStep(input: RunGarbageCollectionStepInput): GarbageCollectionStepResult;
|
|
203
297
|
removeGarbageCollectionJob(id: string): void;
|
|
204
298
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
299
|
+
* Streams the canonical metadata half of a framed snapshot while the enclosing adapter holds
|
|
300
|
+
* its writer queue. The iterator never builds a database-sized array: ordered indexes yield
|
|
301
|
+
* one record at a time and UNIQUE membership is split into bounded immutable generations.
|
|
302
|
+
* Posting generations are substrate-specific (OPFS keeps bases outside this core) and are
|
|
303
|
+
* therefore emitted by the adapter after these five record families.
|
|
207
304
|
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* version are carried; any other indexed column is exported as `invalid` so the loaded
|
|
211
|
-
* database rebuilds it. That costs a rebuild, never a wrong answer — the index is a pruning
|
|
212
|
-
* accelerator and the scan re-verifies every candidate.
|
|
305
|
+
* @internal The returned records alias immutable-at-the-call-boundary core state. Exhaust the
|
|
306
|
+
* iterator before releasing the enclosing writer lock.
|
|
213
307
|
*/
|
|
214
|
-
|
|
308
|
+
snapshotFrameMetadataItems(): IterableIterator<SnapshotCatalogItem | SnapshotSegmentItem | SnapshotTransactionItem | SnapshotUniqueItem>;
|
|
215
309
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
310
|
+
* Streams complete current posting generations in canonical storage-column/term order.
|
|
311
|
+
* The merge retains only one term's row map and one bounded output chunk; it never builds a
|
|
312
|
+
* second database-sized postings array. A cheap first pass derives exact descriptor totals,
|
|
313
|
+
* then a second pass yields the immutable chunks.
|
|
314
|
+
*
|
|
315
|
+
* @internal Memory-backed framed snapshot export. OPFS streams its extent-backed bases.
|
|
219
316
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
317
|
+
snapshotFramePostingItems(): IterableIterator<SnapshotPostingItem>;
|
|
318
|
+
/** Exact bounded snapshot block summary; payload IDs remain in the provenance page index. */
|
|
319
|
+
snapshotFrameManifest(): ManifestSummary;
|
|
320
|
+
/** O(1) counters for diagnostics; callers never need to clone the full durable state. */
|
|
321
|
+
storageRecordStats(): {
|
|
322
|
+
manifestCount: number;
|
|
323
|
+
transactionCount: number;
|
|
324
|
+
segmentCount: number;
|
|
325
|
+
tableCount: number;
|
|
326
|
+
leaseCount: number;
|
|
327
|
+
compactionJobCount: number;
|
|
328
|
+
garbageCollectionJobCount: number;
|
|
329
|
+
rowCounterCount: number;
|
|
330
|
+
autoIncrementCounterCount: number;
|
|
331
|
+
ftsBaseCount: number;
|
|
332
|
+
ftsDeltaCount: number;
|
|
333
|
+
uniqueNamespaceCount: number;
|
|
334
|
+
uniqueKeyBuildCount: number;
|
|
335
|
+
tempOwnerCount: number;
|
|
336
|
+
liveBlockCount: number;
|
|
337
|
+
liveBlockBytes: number;
|
|
223
338
|
};
|
|
224
|
-
/**
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Atomically promotes one already-decoded framed snapshot generation. The caller supplies a
|
|
341
|
+
* streaming iterable over metadata pages and the final physical block identities; this method
|
|
342
|
+
* builds a disposable core, validates every cross-reference, then swaps state only after the
|
|
343
|
+
* complete generation proves self-consistent.
|
|
344
|
+
*
|
|
345
|
+
* @internal Framed adapters call this only at the durable finish boundary.
|
|
346
|
+
*/
|
|
347
|
+
loadSnapshotFrameItems(header: SnapshotFrameStreamHeader, items: Iterable<SnapshotMetadataItem>, blocks: Iterable<Pick<ManifestBlockRecord, "blockId" | "byteLength" | "checksum">>): void;
|
|
231
348
|
/**
|
|
232
349
|
* The complete record state as one value — the checkpoint payload of a log-structured store.
|
|
233
350
|
* Everything `load` needs to reproduce this core exactly, including operational state the
|
|
@@ -244,9 +361,19 @@ export declare class RecordCore {
|
|
|
244
361
|
load(state: RecordCoreState): void;
|
|
245
362
|
}
|
|
246
363
|
export declare function validateId(id: string): void;
|
|
364
|
+
/** Validates payload ownership at the public storage boundary without copying the hot path. */
|
|
365
|
+
export declare function validateBlockWriteBytes(bytes: unknown): asserts bytes is Uint8Array;
|
|
366
|
+
export declare function validateFtsBaseInput(input: {
|
|
367
|
+
coversVersion: number;
|
|
368
|
+
chunks: FtsPosting[][];
|
|
369
|
+
totalTokens: number;
|
|
370
|
+
}, label: string): void;
|
|
371
|
+
/** Validates each canonical term-sorted postings chunk without copying it. */
|
|
372
|
+
export declare function validateFtsPostingChunks(chunks: unknown, label: string): number;
|
|
373
|
+
export declare function validateSegmentRuntimeRecord(value: unknown, label: string): SegmentRecord;
|
|
247
374
|
export declare function validateAutoIncrementReservation(count: number, atLeast: bigint | undefined): void;
|
|
248
375
|
export declare function validateBeginTransactionInput(input: BeginTransactionInput): void;
|
|
249
376
|
export declare function validateLeaseExpiration(expiresAt: string): void;
|
|
250
377
|
export declare function validateTempRunPage(page: TempRunPage): void;
|
|
251
378
|
export declare function validateTempRunPageIdentity(ownerId: string, runId: string, pageIndex: number): void;
|
|
252
|
-
|
|
379
|
+
export {};
|