@visorcraft/mongreldb 0.26.0 → 0.27.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.
Binary file
package/native.d.ts CHANGED
@@ -65,6 +65,28 @@ export interface CompactStats {
65
65
  /** Number of tables skipped (fewer than 2 runs, or compaction failed). */
66
66
  skipped: number
67
67
  }
68
+ /** Page-cache statistics for one table (hits / misses / lock contention). */
69
+ export interface CacheStatsJs {
70
+ hits: number
71
+ misses: number
72
+ /** Lookups skipped because the cache shard's lock was contended. */
73
+ tryLockMisses: number
74
+ /** Fraction of lookups served from cache in `[0, 1]`. */
75
+ hitRate: number
76
+ }
77
+ /** Trigger execution policy — recursion, depth caps, loop limits. */
78
+ export interface TriggerConfigJs {
79
+ recursiveTriggers: boolean
80
+ maxDepth: number
81
+ maxLoopIterations: number
82
+ }
83
+ /** Index build policy: defer to first query (fastest ingest) or build eagerly. */
84
+ export const enum IndexBuildPolicyJs {
85
+ /** Defer index building to the first query/flush — fastest ingest (default). */
86
+ Deferred = 0,
87
+ /** Build and checkpoint indexes inside the bulk load — fastest first query. */
88
+ Eager = 1
89
+ }
68
90
  export interface SchemaSpec {
69
91
  columns: Array<ColumnSpec>
70
92
  indexes: Array<IndexSpec>
@@ -283,6 +305,43 @@ export declare class Database {
283
305
  sql(sql: string): Promise<Buffer>
284
306
  /** Flush + release. Optional — the `Database` also drops on GC. */
285
307
  close(): void
308
+ /**
309
+ * Set the per-table spill threshold (bytes). When a transaction's staged
310
+ * bytes for a single table exceed this, rows are written as a uniform-epoch
311
+ * pending run instead of streamed Put records.
312
+ */
313
+ setSpillThreshold(bytes: number): void
314
+ /** Enable or disable recursive trigger execution (database-wide). */
315
+ setRecursiveTriggers(enabled: boolean): void
316
+ /** Read the current trigger execution policy. */
317
+ triggerConfig(): TriggerConfigJs
318
+ /** Set the trigger execution policy. `max_depth` must be > 0. */
319
+ setTriggerConfig(config: TriggerConfigJs): void
320
+ /** Set a table's compaction zstd level (-1 = default, 0 = none, 1..22). */
321
+ setTableCompactionZstdLevel(name: string, level: number): void
322
+ /** Set a table's result-cache max bytes. */
323
+ setTableResultCacheMaxBytes(name: string, maxBytes: number): void
324
+ /** Set a table's mutable-run spill threshold (bytes). */
325
+ setTableMutableRunSpillBytes(name: string, bytes: number): void
326
+ /** Set a table's WAL sync byte threshold (bytes between group-syncs). */
327
+ setTableSyncByteThreshold(name: string, threshold: number): void
328
+ /**
329
+ * Set a table's index build policy (`Deferred` for fast ingest, `Eager`
330
+ * for fast first query).
331
+ */
332
+ setTableIndexBuildPolicy(name: string, policy: IndexBuildPolicyJs): void
333
+ /** Page-cache statistics for a table. */
334
+ tablePageCacheStats(name: string): CacheStatsJs
335
+ /** Number of sorted runs a table currently has (compaction target: 1). */
336
+ tableRunCount(name: string): number
337
+ /** Memtable length (uncommitted staged rows) for a table. */
338
+ tableMemtableLen(name: string): number
339
+ /** Mutable-run length for a table. */
340
+ tableMutableRunLen(name: string): number
341
+ /** Page-cache entry count for a table. */
342
+ tablePageCacheLen(name: string): number
343
+ /** Decoded-page-cache entry count for a table. */
344
+ tableDecodedCacheLen(name: string): number
286
345
  /**
287
346
  * Create a fresh encrypted database (page-level AES-256-GCM; the database
288
347
  * KEK is derived from `passphrase` via Argon2id + HKDF).
package/native.js CHANGED
@@ -310,10 +310,11 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { ColumnType, IndexKindSpec, ConditionKind, Database, TableHandle, Transaction, TxnTable, WriteBuffer, RemoteDatabase } = nativeBinding
313
+ const { ColumnType, IndexKindSpec, IndexBuildPolicyJs, ConditionKind, Database, TableHandle, Transaction, TxnTable, WriteBuffer, RemoteDatabase } = nativeBinding
314
314
 
315
315
  module.exports.ColumnType = ColumnType
316
316
  module.exports.IndexKindSpec = IndexKindSpec
317
+ module.exports.IndexBuildPolicyJs = IndexBuildPolicyJs
317
318
  module.exports.ConditionKind = ConditionKind
318
319
  module.exports.Database = Database
319
320
  module.exports.TableHandle = TableHandle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visorcraft/mongreldb",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "High-performance Node.js bindings for MongrelDB with native in-process storage, sub-ms writes, and hybrid indexing.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",