@minnowdb/core 0.3.0 → 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 +4 -2
- 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 +0 -1
- package/dist/engine/artifact-cache.js +0 -1
- package/dist/engine/batch.d.ts +5 -2
- package/dist/engine/batch.js +0 -1
- 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 +5 -6
- package/dist/engine/catalog.js +5 -5
- package/dist/engine/client.d.ts +27 -7
- package/dist/engine/client.js +197 -31
- package/dist/engine/database.d.ts +161 -38
- package/dist/engine/database.js +4320 -1523
- package/dist/engine/defaults.d.ts +0 -1
- package/dist/engine/defaults.js +2 -4
- 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 +39 -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 -11
- package/dist/engine/index.js +12 -10
- 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 +499 -129
- 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 +4 -4
- package/dist/engine/query-api.d.ts +3 -0
- package/dist/engine/query-api.js +3 -0
- package/dist/engine/query-cache.d.ts +0 -1
- package/dist/engine/query-cache.js +4 -4
- package/dist/engine/query.d.ts +4 -7
- package/dist/engine/query.js +348 -155
- package/dist/engine/result-wire.d.ts +0 -1
- package/dist/engine/result-wire.js +2 -2
- package/dist/engine/schema-wire.d.ts +1 -2
- package/dist/engine/schema-wire.js +0 -1
- package/dist/engine/schema.d.ts +3 -8
- package/dist/engine/schema.js +41 -24
- package/dist/engine/sort-keys.d.ts +0 -1
- package/dist/engine/sort-keys.js +2 -2
- package/dist/engine/sql-domains.d.ts +6 -1
- package/dist/engine/sql-domains.js +209 -45
- package/dist/engine/sql-driver.d.ts +2 -2
- package/dist/engine/sql-driver.js +0 -1
- package/dist/engine/sql-json.d.ts +0 -1
- package/dist/engine/sql-json.js +53 -7
- package/dist/engine/sql-semantics.d.ts +8 -5
- package/dist/engine/sql-semantics.js +427 -65
- package/dist/engine/typed-live.d.ts +67 -0
- package/dist/engine/typed-live.js +349 -0
- package/dist/engine/vector.d.ts +7 -1
- package/dist/engine/vector.js +202 -58
- package/dist/engine/worker-host.d.ts +8 -2
- package/dist/engine/worker-host.js +616 -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 +0 -1
- package/dist/plan/index.js +0 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/indexeddb.d.ts +74 -65
- package/dist/storage/indexeddb.js +12301 -2076
- package/dist/storage/memory.d.ts +56 -66
- package/dist/storage/memory.js +1004 -139
- 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 +403 -91
- package/dist/storage/opfs/leader.js +4306 -602
- package/dist/storage/opfs/rpc.d.ts +15 -3
- package/dist/storage/opfs/rpc.js +223 -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 +26 -121
- package/dist/storage/opfs/store.js +436 -388
- 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 -99
- package/dist/storage/snapshot.js +33 -309
- package/dist/storage/toolkit/extents.d.ts +41 -7
- package/dist/storage/toolkit/extents.js +402 -39
- package/dist/storage/toolkit/index.d.ts +3 -4
- package/dist/storage/toolkit/index.js +27 -3
- package/dist/storage/toolkit/record-core.d.ts +174 -61
- package/dist/storage/toolkit/record-core.js +5401 -849
- 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 +4 -6
- package/dist/storage/toolkit/wire.js +80 -25
- package/dist/storage/types.d.ts +1271 -218
- package/dist/storage/types.js +1471 -138
- package/dist/testing/block-store-conformance.d.ts +0 -1
- package/dist/testing/block-store-conformance.js +877 -138
- package/dist/testing/index.d.ts +42 -31
- package/dist/testing/index.js +100 -68
- package/dist/testing/opfs-shim.d.ts +13 -3
- package/dist/testing/opfs-shim.js +40 -6
- package/dist/testing/simulator.d.ts +0 -1
- package/dist/testing/simulator.js +43 -12
- package/dist/testing/sqllogictest.d.ts +0 -1
- package/dist/testing/sqllogictest.js +0 -1
- package/dist/transactions/index.d.ts +81 -20
- package/dist/transactions/index.js +1050 -268
- package/dist/worker-protocol/index.d.ts +3 -2
- package/dist/worker-protocol/index.js +2 -5
- package/package.json +49 -1
- 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-domains.d.ts.map +0 -1
- package/dist/engine/sql-domains.js.map +0 -1
- package/dist/engine/sql-driver.d.ts.map +0 -1
- package/dist/engine/sql-driver.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/testing/simulator.d.ts.map +0 -1
- package/dist/testing/simulator.js.map +0 -1
- package/dist/testing/sqllogictest.d.ts.map +0 -1
- package/dist/testing/sqllogictest.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,13 +1,26 @@
|
|
|
1
1
|
import { type BatchRow, type BatchValue, type InsertBatchInput } from "./batch.js";
|
|
2
2
|
import { BufferedTableWriter, type BufferedWriterOptions } from "./buffered-writer.js";
|
|
3
|
-
export { attachLifecycleFlush, BufferedTableWriter, type BufferedFlushResult, type BufferedWriterOptions, type LifecycleDocumentTarget, type LifecycleFlushOptions, type LifecycleFlushRequester, type LifecyclePageTarget, } from "./buffered-writer.js";
|
|
4
|
-
import { CompactionJobCancelledError, CompactionMemoryBudgetError, CompactionWriteAmplificationError, MissingKeyError, SqlCompileError, UniqueConstraintError } from "./errors.js";
|
|
3
|
+
export { attachLifecycleFlush, BufferedTableWriter, MAX_BUFFERED_WRITER_PENDING_ADDS, type BufferedFlushResult, type BufferedWriterOptions, type LifecycleDocumentTarget, type LifecycleFlushOptions, type LifecycleFlushRequester, type LifecyclePageTarget, } from "./buffered-writer.js";
|
|
4
|
+
import { CompactionJobCancelledError, CompactionMemoryBudgetError, CompactionWriteAmplificationError, MaintenanceBacklogError, MissingKeyError, SqlCompileError, UniqueConstraintError, VisibleSegmentCursorStaleError } from "./errors.js";
|
|
5
5
|
import { type Compression } from "../block-format/index.js";
|
|
6
|
-
import { type BlockStore, type ColumnDefault, type CompactionJobRecord, type CompactionJobState, type GarbageCollectionJobRecord, type GarbageCollectionJobState, type SimpleDataType, type SqlDomain, type
|
|
6
|
+
import { type BlockStore, type ColumnDefault, CompactionBacklogError, type CompactionJobRecord, type CompactionJobState, type GarbageCollectionJobRecord, type GarbageCollectionJobState, type SimpleDataType, type SqlDomain, type StorageIntegrityMode, type StorageIntegrityReport, type StorageStats, type InterruptedSnapshotImport, type InterruptedSnapshotImportAbortResult, TableInUseError } from "../storage/types.js";
|
|
7
|
+
import type { SnapshotExportProgress, SnapshotLoadProgress } from "../storage/snapshot.js";
|
|
7
8
|
import { type CompiledQuery, type CompiledStatement, type ForeignKeyDefinition, type QueryResult, type QueryRow, type QueryValue, type UniqueConstraintDefinition } from "./query.js";
|
|
8
9
|
import { LiveQuerySet, type LiveQuerySetOptions } from "./live.js";
|
|
9
10
|
import { type Catalog } from "./catalog.js";
|
|
10
11
|
import { type AnyTable, type MigrationStep, type SchemaDefinition } from "./schema.js";
|
|
12
|
+
/** Nested SQL savepoints and their total cloned transaction state are both hard bounded. */
|
|
13
|
+
export declare const MAX_TRANSACTION_SAVEPOINTS = 64;
|
|
14
|
+
export declare const MAX_TRANSACTION_SAVEPOINT_BYTES: number;
|
|
15
|
+
/** Outstanding simple writes retained by one database instance before callers must await. */
|
|
16
|
+
export declare const MAX_DATABASE_PENDING_WRITES = 64;
|
|
17
|
+
/** Concurrent direct reads retained by one database instance. Reads still execute in parallel. */
|
|
18
|
+
export declare const MAX_DATABASE_ACTIVE_READS = 256;
|
|
19
|
+
export declare class DatabaseReadBacklogError extends Error {
|
|
20
|
+
readonly limit: number;
|
|
21
|
+
readonly name = "DatabaseReadBacklogError";
|
|
22
|
+
constructor(limit?: number);
|
|
23
|
+
}
|
|
11
24
|
export interface ColumnDefinition {
|
|
12
25
|
name: string;
|
|
13
26
|
type: SimpleDataType;
|
|
@@ -37,6 +50,14 @@ export interface MigrateOptions {
|
|
|
37
50
|
*/
|
|
38
51
|
readonly schemaOwnsDatabase?: boolean;
|
|
39
52
|
}
|
|
53
|
+
export interface MigrateResult {
|
|
54
|
+
createdTables: string[];
|
|
55
|
+
alteredTables: string[];
|
|
56
|
+
droppedTables: string[];
|
|
57
|
+
replacedViews: string[];
|
|
58
|
+
droppedViews: string[];
|
|
59
|
+
steps: MigrationStep[];
|
|
60
|
+
}
|
|
40
61
|
export interface CreateTableInput {
|
|
41
62
|
name: string;
|
|
42
63
|
columns: readonly ColumnDefinition[];
|
|
@@ -75,7 +96,9 @@ export interface UpsertBatchResult extends InsertBatchResult {
|
|
|
75
96
|
updatedRowCount: number;
|
|
76
97
|
}
|
|
77
98
|
export interface UpdateBatchInput {
|
|
99
|
+
/** Stable ordinary arrays; do not mutate or expose changing accessors until the write settles. */
|
|
78
100
|
keys: readonly BatchValue[];
|
|
101
|
+
/** Stable ordinary arrays; do not mutate or expose changing accessors until the write settles. */
|
|
79
102
|
changes: Readonly<Record<string, readonly BatchValue[]>>;
|
|
80
103
|
}
|
|
81
104
|
export interface UpdateBatchResult {
|
|
@@ -153,9 +176,7 @@ export interface WriteSession {
|
|
|
153
176
|
* Read-your-writes: the query observes the pre-scope snapshot PLUS everything this scope
|
|
154
177
|
* has staged so far, ordered after all committed data — without publishing anything.
|
|
155
178
|
*/
|
|
156
|
-
query(sql: string, options?:
|
|
157
|
-
params?: QueryOptions["params"];
|
|
158
|
-
}): Promise<QueryResult>;
|
|
179
|
+
query(sql: string, options?: QueryOptions): Promise<QueryResult>;
|
|
159
180
|
/** Runs a SELECT, INSERT, UPDATE, or DELETE inside this write scope. */
|
|
160
181
|
execute(sql: string, params?: readonly QueryValue[]): Promise<ExecuteResult>;
|
|
161
182
|
insertBatch(tableName: string, input: InsertBatchInput): Promise<StagedWriteResult>;
|
|
@@ -173,6 +194,27 @@ export interface QueryExecutionStats {
|
|
|
173
194
|
*/
|
|
174
195
|
readonly peakMemoryBytes: number;
|
|
175
196
|
}
|
|
197
|
+
export interface MaintenanceStatus {
|
|
198
|
+
readonly autoCollectionEnabled: boolean;
|
|
199
|
+
readonly collectionRunning: boolean;
|
|
200
|
+
readonly collectionRequested: boolean;
|
|
201
|
+
/** Commits since collection last proved there was no immediately reclaimable work. */
|
|
202
|
+
readonly pendingCommitDebt: number;
|
|
203
|
+
readonly consecutiveFailures: number;
|
|
204
|
+
/** In-memory posting-tail retry markers; bounded and cleared with their catalog owner. */
|
|
205
|
+
readonly postingDeltaTailMarkers: number;
|
|
206
|
+
/** SQL text caches retain only inputs below the fixed cacheability ceiling. */
|
|
207
|
+
readonly retainedPlanEntries: number;
|
|
208
|
+
readonly retainedStatementEntries: number;
|
|
209
|
+
readonly lastStartedAt: Date | null;
|
|
210
|
+
readonly lastCompletedAt: Date | null;
|
|
211
|
+
readonly nextRetryAt: Date | null;
|
|
212
|
+
readonly lastError: {
|
|
213
|
+
readonly name: string;
|
|
214
|
+
readonly message: string;
|
|
215
|
+
readonly at: Date;
|
|
216
|
+
} | null;
|
|
217
|
+
}
|
|
176
218
|
export interface QueryOptions {
|
|
177
219
|
/**
|
|
178
220
|
* Called once with what this execution cost, before the result is returned. Additive and
|
|
@@ -209,7 +251,14 @@ export interface QueryOptions {
|
|
|
209
251
|
/** Maximum rows encoded in each merged spill page. */
|
|
210
252
|
readonly spillPageRows?: number;
|
|
211
253
|
}
|
|
254
|
+
export interface QueryCursorOptions extends QueryOptions {
|
|
255
|
+
/** Maximum rows in one yielded result batch. Defaults to the vector scan batch size. */
|
|
256
|
+
readonly batchRows?: number;
|
|
257
|
+
/** Cancels the scan and releases its snapshot lease. */
|
|
258
|
+
readonly signal?: AbortSignal;
|
|
259
|
+
}
|
|
212
260
|
export interface DeleteBatchInput {
|
|
261
|
+
/** Stable ordinary array; do not mutate or expose changing accessors until the write settles. */
|
|
213
262
|
keys: readonly BatchValue[];
|
|
214
263
|
}
|
|
215
264
|
export interface DeleteBatchResult {
|
|
@@ -223,8 +272,6 @@ export interface DeleteBatchResult {
|
|
|
223
272
|
metrics: WriteMetrics;
|
|
224
273
|
}
|
|
225
274
|
export interface CompactTableOptions {
|
|
226
|
-
/** @deprecated Use minimumLevel0Segments. */
|
|
227
|
-
minimumSegments?: number;
|
|
228
275
|
/** Minimum L0 segments promoted; one also permits a direct L0 -> L2 promotion. */
|
|
229
276
|
minimumLevel0Segments?: number;
|
|
230
277
|
/** Target maximum L0 segments promoted by one job. Equal-order groups remain indivisible. */
|
|
@@ -335,6 +382,7 @@ export interface CollectGarbageStepOptions {
|
|
|
335
382
|
/** See `CollectGarbageOptions.retainRecentVersions`; applies when this step plans a job. */
|
|
336
383
|
retainRecentVersions?: number;
|
|
337
384
|
}
|
|
385
|
+
export declare const MAX_GARBAGE_COLLECTION_RETAIN_RECENT_VERSIONS = 1024;
|
|
338
386
|
export interface GarbageCollectionResult {
|
|
339
387
|
jobId: string;
|
|
340
388
|
prunedManifestCount: number;
|
|
@@ -367,7 +415,7 @@ export interface TableDefinition {
|
|
|
367
415
|
uniqueKey?: string;
|
|
368
416
|
}
|
|
369
417
|
export type DatabaseRow = Record<string, Exclude<BatchValue, null> | null>;
|
|
370
|
-
export { CompactionJobCancelledError, CompactionMemoryBudgetError, CompactionWriteAmplificationError, MissingKeyError, SqlCompileError, UniqueConstraintError, };
|
|
418
|
+
export { CompactionBacklogError, CompactionJobCancelledError, CompactionMemoryBudgetError, CompactionWriteAmplificationError, MaintenanceBacklogError, MissingKeyError, SqlCompileError, TableInUseError, UniqueConstraintError, VisibleSegmentCursorStaleError, };
|
|
371
419
|
export interface MinnowDatabaseOptions {
|
|
372
420
|
/**
|
|
373
421
|
* Block codec for newly written blocks; defaults to "gzip", which is also what compaction
|
|
@@ -381,12 +429,20 @@ export interface MinnowDatabaseOptions {
|
|
|
381
429
|
* storage quota; the browser usually makes the opposite trade worth it.
|
|
382
430
|
*/
|
|
383
431
|
compression?: Compression;
|
|
432
|
+
/**
|
|
433
|
+
* Target maximum uncompressed bytes in a newly written column block. `rowsPerBlock` remains a
|
|
434
|
+
* second ceiling. A single value may exceed this target when it still fits the format's 64 MiB
|
|
435
|
+
* hard limit. Defaults to 2 MiB, matching compaction output.
|
|
436
|
+
*/
|
|
437
|
+
targetBlockBytes?: number;
|
|
384
438
|
rowsPerBlock?: number;
|
|
385
439
|
maxCommitRetries?: number;
|
|
386
440
|
now?: () => Date;
|
|
387
441
|
createId?: () => string;
|
|
388
442
|
/** Durable spill-owner lease lifetime; renewed while a spilling query runs. */
|
|
389
443
|
spillOwnerLeaseMs?: number;
|
|
444
|
+
/** Durable active-writer deadline; renewed every third while the writer is live. */
|
|
445
|
+
transactionOwnerLeaseMs?: number;
|
|
390
446
|
/**
|
|
391
447
|
* How long a statement-level transaction (`BEGIN` … `COMMIT`) may sit untouched before it
|
|
392
448
|
* rolls itself back; 30 seconds by default. A scope nobody ever closes would otherwise hold
|
|
@@ -402,6 +458,12 @@ export interface MinnowDatabaseOptions {
|
|
|
402
458
|
* LRU. 0 disables the pool. Defaults to 64 MiB.
|
|
403
459
|
*/
|
|
404
460
|
bufferPoolBytes?: number;
|
|
461
|
+
/**
|
|
462
|
+
* Default modeled execution-memory budget for every query, including mutation selection,
|
|
463
|
+
* triggers, subqueries, and read-your-writes scopes. Eligible sorts and groups spill
|
|
464
|
+
* automatically. Defaults to 64 MiB; `null` explicitly restores unbounded mode.
|
|
465
|
+
*/
|
|
466
|
+
executionMemoryBudgetBytes?: number | null;
|
|
405
467
|
/**
|
|
406
468
|
* Visible-row threshold at which a full-text MATCH on an unindexed append-only column
|
|
407
469
|
* schedules a background index build (fire-and-forget; correctness never waits on it).
|
|
@@ -420,10 +482,15 @@ export interface MinnowDatabaseOptions {
|
|
|
420
482
|
* Background collection: a garbage-collection pass after every background fold, and one
|
|
421
483
|
* every 64 commits, each keeping the 64 most recent versions readable. Without it the
|
|
422
484
|
* blocks a fold supersedes and the manifest every commit writes stay on disk until the
|
|
423
|
-
* caller runs `collectGarbage`. Defaults to
|
|
424
|
-
* caller.
|
|
485
|
+
* caller runs `collectGarbage`. Defaults to true independently of compaction; false leaves
|
|
486
|
+
* collection to the caller.
|
|
425
487
|
*/
|
|
426
488
|
autoCollect?: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Successful commits tolerated while automatic collection is failing before a foreground
|
|
491
|
+
* write assists and, if maintenance still fails, is refused. Defaults to 4096.
|
|
492
|
+
*/
|
|
493
|
+
autoCollectDebtLimitCommits?: number;
|
|
427
494
|
/**
|
|
428
495
|
* Defaults for every compaction this database plans, background folds included. A call's
|
|
429
496
|
* own `CompactTableOptions` override them.
|
|
@@ -549,13 +616,54 @@ export interface VisibleSegment {
|
|
|
549
616
|
rowCount: number;
|
|
550
617
|
columnBlockIds: Readonly<Record<string, readonly string[]>>;
|
|
551
618
|
}
|
|
619
|
+
export interface VisibleSegmentPageRecord extends VisibleSegment {
|
|
620
|
+
/** Stable logical scan order, exposed so bounded-page consumers can order a completed fold. */
|
|
621
|
+
readonly logicalOrder: number;
|
|
622
|
+
/** The commit that made the segment eligible at the captured manifest version. */
|
|
623
|
+
readonly committedVersion: number;
|
|
624
|
+
/** Stable order among segments from the same commit. */
|
|
625
|
+
readonly commitOrdinal: number;
|
|
626
|
+
}
|
|
627
|
+
/** One public segment-inspection page; kept small for direct and worker callers alike. */
|
|
628
|
+
export declare const MAX_VISIBLE_SEGMENT_PAGE_ITEMS = 64;
|
|
629
|
+
/**
|
|
630
|
+
* Opaque continuation state for a visible-segment scan. The manifest version and table identity
|
|
631
|
+
* are captured on the first page, so later commits cannot move an in-progress scan onto different
|
|
632
|
+
* data. Dropping or replacing the table makes this cursor stale and fails the next page.
|
|
633
|
+
*/
|
|
634
|
+
export interface VisibleSegmentPageCursor {
|
|
635
|
+
readonly tableName: string;
|
|
636
|
+
readonly tableId: string;
|
|
637
|
+
readonly version: number | null;
|
|
638
|
+
readonly afterId: string;
|
|
639
|
+
}
|
|
640
|
+
export interface VisibleSegmentPageOptions {
|
|
641
|
+
/** First page only. Omit for the current committed version; null names the empty version. */
|
|
642
|
+
readonly version?: number | null;
|
|
643
|
+
/** Use the exact cursor returned by the previous page; do not combine with `version`. */
|
|
644
|
+
readonly cursor?: VisibleSegmentPageCursor;
|
|
645
|
+
/** Defaults to and may not exceed MAX_VISIBLE_SEGMENT_PAGE_ITEMS. */
|
|
646
|
+
readonly limit?: number;
|
|
647
|
+
}
|
|
648
|
+
export interface VisibleSegmentPage {
|
|
649
|
+
/** Visible records from this bounded physical segment-ID window, in lexical ID order. */
|
|
650
|
+
readonly records: VisibleSegmentPageRecord[];
|
|
651
|
+
/** The exact manifest version captured for every page in this scan. */
|
|
652
|
+
readonly version: number | null;
|
|
653
|
+
/** May be non-null when `records` is empty because historical records were filtered out. */
|
|
654
|
+
readonly nextCursor: VisibleSegmentPageCursor | null;
|
|
655
|
+
}
|
|
552
656
|
export interface SnapshotExportOptions {
|
|
553
657
|
/** Called as the export moves through its phases; see SnapshotExportProgress. */
|
|
554
658
|
onProgress?: (progress: SnapshotExportProgress) => void;
|
|
659
|
+
/** Cancels transfer and releases the durable export pin. */
|
|
660
|
+
signal?: AbortSignal;
|
|
555
661
|
}
|
|
556
662
|
export interface SnapshotImportOptions {
|
|
557
663
|
/** Called as blocks land, for a progress bar over a multi-megabyte file. */
|
|
558
664
|
onProgress?: (progress: SnapshotLoadProgress) => void;
|
|
665
|
+
/** Cancels transfer and atomically removes this caller's staged import. */
|
|
666
|
+
signal?: AbortSignal;
|
|
559
667
|
}
|
|
560
668
|
export declare class MinnowDatabase {
|
|
561
669
|
#private;
|
|
@@ -567,6 +675,8 @@ export declare class MinnowDatabase {
|
|
|
567
675
|
* The injected block store remains caller-owned and must be closed separately.
|
|
568
676
|
*/
|
|
569
677
|
close(): Promise<void>;
|
|
678
|
+
/** Current background-collection health, returned as a defensive snapshot. */
|
|
679
|
+
maintenanceStatus(): MaintenanceStatus;
|
|
570
680
|
createTable(input: CreateTableInput): Promise<void>;
|
|
571
681
|
/**
|
|
572
682
|
* The published catalog: stable column IDs, key identity, constraints, triggers, and view
|
|
@@ -590,9 +700,9 @@ export declare class MinnowDatabase {
|
|
|
590
700
|
ifExists?: boolean;
|
|
591
701
|
}): Promise<boolean>;
|
|
592
702
|
/**
|
|
593
|
-
* Drops one non-key column
|
|
594
|
-
*
|
|
595
|
-
*
|
|
703
|
+
* Drops one non-key column in one storage transaction: catalog metadata and segment references
|
|
704
|
+
* change with the successor manifest that retires the column's exclusively owned live blocks.
|
|
705
|
+
* Payload bytes remain readable to historical leases until ordinary collection reclaims them.
|
|
596
706
|
*/
|
|
597
707
|
dropColumn(tableName: string, columnName: string, options?: {
|
|
598
708
|
ifExists?: boolean;
|
|
@@ -632,6 +742,12 @@ export declare class MinnowDatabase {
|
|
|
632
742
|
snapshot<T>(action: (session: SnapshotSession) => Promise<T>): Promise<T>;
|
|
633
743
|
/** Executes a read-only SELECT statement through the public query API. */
|
|
634
744
|
query(sql: string, options?: QueryOptions): Promise<QueryResult>;
|
|
745
|
+
/**
|
|
746
|
+
* Pull-driven query batches. Cursor-safe scans emit directly from vector batches; blocking
|
|
747
|
+
* plans (sorts, groups, joins, derived sources) use the ordinary correct execution and page
|
|
748
|
+
* its result. In both cases the iterator applies backpressure and owns one snapshot at a time.
|
|
749
|
+
*/
|
|
750
|
+
queryCursor(sql: string, options?: QueryCursorOptions): AsyncIterableIterator<QueryResult, undefined>;
|
|
635
751
|
/**
|
|
636
752
|
* Reclaims temp spill pages whose owner lease is expired or missing at a cutoff fixed when the
|
|
637
753
|
* pass starts. Owners with an unexpired lease are retained; each owner is removed atomically
|
|
@@ -642,7 +758,8 @@ export declare class MinnowDatabase {
|
|
|
642
758
|
* Creates a live-query set over this database. Local commits hint it directly, an optional
|
|
643
759
|
* channel carries cross-tab hints, and an optional poll interval bounds staleness without any
|
|
644
760
|
* hint; every hint path converges on the durable manifest version, so missed messages delay a
|
|
645
|
-
* refresh but never produce a stale result.
|
|
761
|
+
* refresh but never produce a stale result. Equal subscriptions retain one private exact
|
|
762
|
+
* result snapshot plus a digest that rejects most inequality before exact comparison.
|
|
646
763
|
*/
|
|
647
764
|
liveQueries(options?: LiveQuerySetOptions): LiveQuerySet;
|
|
648
765
|
/**
|
|
@@ -671,14 +788,7 @@ export declare class MinnowDatabase {
|
|
|
671
788
|
* steps — and every catalog alteration is one atomic compare-and-swap, so a concurrent
|
|
672
789
|
* migrator fails explicitly with a conflict instead of interleaving.
|
|
673
790
|
*/
|
|
674
|
-
migrate(definition: SchemaDefinition<readonly AnyTable[]>, options?: MigrateOptions): Promise<
|
|
675
|
-
createdTables: string[];
|
|
676
|
-
alteredTables: string[];
|
|
677
|
-
droppedTables: string[];
|
|
678
|
-
replacedViews: string[];
|
|
679
|
-
droppedViews: string[];
|
|
680
|
-
steps: MigrationStep[];
|
|
681
|
-
}>;
|
|
791
|
+
migrate(definition: SchemaDefinition<readonly AnyTable[]>, options?: MigrateOptions): Promise<MigrateResult>;
|
|
682
792
|
/**
|
|
683
793
|
* Renders the optimized logical plan for a SELECT statement plus the physical strategy notes
|
|
684
794
|
* the prepared execution would choose, without executing it.
|
|
@@ -700,27 +810,41 @@ export declare class MinnowDatabase {
|
|
|
700
810
|
* (the snapshot row with assignments applied — the exact values the mutation wrote).
|
|
701
811
|
*/
|
|
702
812
|
runStatement(statement: CompiledStatement, options?: RunStatementOptions): Promise<ExecuteResult>;
|
|
703
|
-
listVisibleSegments(tableName: string, version?: number): Promise<VisibleSegment[]>;
|
|
704
813
|
/**
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
*
|
|
715
|
-
* snapshots guide.
|
|
814
|
+
* Inspects exactly one bounded physical segment-ID window at a stable manifest version.
|
|
815
|
+
* Historical records that are not visible are filtered rather than replaced from later
|
|
816
|
+
* windows, so callers must follow `nextCursor` even when a page returns no records.
|
|
817
|
+
*/
|
|
818
|
+
listVisibleSegmentPage(tableName: string, options?: VisibleSegmentPageOptions): Promise<VisibleSegmentPage>;
|
|
819
|
+
/**
|
|
820
|
+
* Collects the pull-driven framed snapshot stream into one portable byte array. This helper is
|
|
821
|
+
* convenient for small and medium databases, but it necessarily retains the complete file and
|
|
822
|
+
* has the Uint8Array 4-GiB ceiling. Use `exportSnapshotStream()` for larger databases or direct
|
|
823
|
+
* file/network transfer. See the snapshots guide for framing and durability guarantees.
|
|
716
824
|
*/
|
|
717
825
|
exportSnapshot(options?: SnapshotExportOptions): Promise<Uint8Array>;
|
|
826
|
+
/**
|
|
827
|
+
* Streams one pinned committed snapshot with at most one payload block resident. Stopping the
|
|
828
|
+
* iterator releases its durable backup lease in `finally`.
|
|
829
|
+
*/
|
|
830
|
+
exportSnapshotStream(options?: SnapshotExportOptions): AsyncGenerator<Uint8Array, void, void>;
|
|
718
831
|
/**
|
|
719
832
|
* Loads a snapshot file into this database's store, which must be empty. Every block is
|
|
720
|
-
*
|
|
721
|
-
* that already holds a database throws rather than merging two histories.
|
|
833
|
+
* integrity-checked while decoding, so a corrupt file fails here rather than mid-query, and a
|
|
834
|
+
* store that already holds a database throws rather than merging two histories.
|
|
722
835
|
*/
|
|
723
836
|
importSnapshot(bytes: Uint8Array, options?: SnapshotImportOptions): Promise<void>;
|
|
837
|
+
/** Incrementally validates and stages a snapshot; only the final adapter CAS makes it visible. */
|
|
838
|
+
importSnapshotStream(source: AsyncIterable<Uint8Array>, options?: SnapshotImportOptions): Promise<void>;
|
|
839
|
+
/** Verifies adapter metadata, or metadata plus every live payload, without changing storage. */
|
|
840
|
+
checkIntegrity(options?: {
|
|
841
|
+
mode?: StorageIntegrityMode;
|
|
842
|
+
maxIssues?: number;
|
|
843
|
+
}): Promise<StorageIntegrityReport>;
|
|
844
|
+
/** Explicit, potentially storage-scanning accounting for live, obsolete, temp, and WAL bytes. */
|
|
845
|
+
storageStats(): Promise<StorageStats>;
|
|
846
|
+
inspectInterruptedImport(): Promise<InterruptedSnapshotImport | null>;
|
|
847
|
+
abortInterruptedImport(identity: string): Promise<InterruptedSnapshotImportAbortResult>;
|
|
724
848
|
compactTable(tableName: string, options?: CompactTableOptions): Promise<CompactTableResult>;
|
|
725
849
|
/** Plans or advances one restart-safe physical compaction job. */
|
|
726
850
|
compactTableStep(tableName: string, options?: CompactTableStepOptions): Promise<CompactionJobProgress>;
|
|
@@ -769,4 +893,3 @@ export declare class MinnowDatabase {
|
|
|
769
893
|
*/
|
|
770
894
|
buildFtsIndex(tableName: string, columnName: string): Promise<void>;
|
|
771
895
|
}
|
|
772
|
-
//# sourceMappingURL=database.d.ts.map
|