@sqd-pipes/delta-db 0.0.1-alpha.3 → 0.0.1-alpha.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sqd-pipes/delta-db",
3
- "version": "0.0.1-alpha.3",
3
+ "version": "0.0.1-alpha.5",
4
4
  "description": "Embedded rollback-aware computation engine for blockchain data",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
package/src/delta-db.node CHANGED
Binary file
package/src/index.d.ts CHANGED
@@ -31,7 +31,8 @@ export interface DeltaBatch {
31
31
  sequence: number
32
32
  finalizedHead: DeltaDbCursor | null
33
33
  latestHead: DeltaDbCursor | null
34
- records: DeltaRecord[]
34
+ /** Records grouped by table name. */
35
+ tables: Record<string, DeltaRecord[]>
35
36
  }
36
37
 
37
38
  /** Input for the atomic `ingest()` method. */
package/src/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // @ts-ignore
2
2
  const { DeltaDb: NativeDeltaDb } = require('./delta-db.node')
3
- const { encode, decode } = require('@msgpack/msgpack')
3
+ const { Encoder, decode } = require('@msgpack/msgpack')
4
+
5
+ const encoder = new Encoder({ useBigInt64: true })
4
6
 
5
7
  class DeltaDb {
6
8
  /** @type {InstanceType<typeof NativeDeltaDb>} */
@@ -21,7 +23,7 @@ class DeltaDb {
21
23
  * Returns true if backpressure should be applied.
22
24
  */
23
25
  processBatch(table, block, rows) {
24
- return this.#native.processBatch(table, block, Buffer.from(encode(rows)))
26
+ return this.#native.processBatch(table, block, Buffer.from(encoder.encode(rows)))
25
27
  }
26
28
 
27
29
  /** Roll back all state after fork_point. */
@@ -40,7 +42,7 @@ class DeltaDb {
40
42
  */
41
43
  ingest(input) {
42
44
  const buf = this.#native.ingest({
43
- data: Buffer.from(encode(input.data)),
45
+ data: Buffer.from(encoder.encode(input.data)),
44
46
  rollbackChain: input.rollbackChain,
45
47
  finalizedHead: input.finalizedHead,
46
48
  })