dataply 0.0.26-alpha.12 → 0.0.26-alpha.13

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 (2) hide show
  1. package/dist/cjs/index.js +10 -31
  2. package/package.json +2 -2
package/dist/cjs/index.js CHANGED
@@ -2977,27 +2977,12 @@ var BPTreeTransaction = class _BPTreeTransaction {
2977
2977
  static CheckConflicts(transactions) {
2978
2978
  return MVCCTransaction.CheckConflicts(transactions.map((tx) => tx.mvcc));
2979
2979
  }
2980
- /**
2981
- * Returns the ID of the root node.
2982
- * @returns The root node ID.
2983
- */
2984
2980
  getRootId() {
2985
2981
  return this.rootId;
2986
2982
  }
2987
- /**
2988
- * Returns the order of the B+Tree.
2989
- * @returns The order of the tree.
2990
- */
2991
2983
  getOrder() {
2992
2984
  return this.order;
2993
2985
  }
2994
- /**
2995
- * Verified if the value satisfies the condition.
2996
- *
2997
- * @param nodeValue The value to verify.
2998
- * @param condition The condition to verify against.
2999
- * @returns Returns true if the value satisfies the condition.
3000
- */
3001
2986
  verify(nodeValue, condition) {
3002
2987
  for (const key in condition) {
3003
2988
  const verify2 = this.verifierMap[key];
@@ -5265,14 +5250,10 @@ var BPTreePureAsync = class {
5265
5250
  }
5266
5251
  _createReadOps() {
5267
5252
  const strategy = this.strategy;
5268
- const readBuffer = /* @__PURE__ */ new Map();
5253
+ let headBuffer = null;
5269
5254
  return {
5270
5255
  async getNode(id) {
5271
- const buffered = readBuffer.get(id);
5272
- if (buffered) return buffered;
5273
- const node = await strategy.read(id);
5274
- readBuffer.set(id, node);
5275
- return node;
5256
+ return await strategy.read(id);
5276
5257
  },
5277
5258
  async createNode(leaf, keys, values, parent = null, next = null, prev = null) {
5278
5259
  const id = await strategy.id(leaf);
@@ -5284,15 +5265,17 @@ var BPTreePureAsync = class {
5284
5265
  async deleteNode() {
5285
5266
  },
5286
5267
  async readHead() {
5287
- return await strategy.readHead();
5268
+ if (headBuffer) return headBuffer;
5269
+ headBuffer = await strategy.readHead();
5270
+ return headBuffer;
5288
5271
  },
5289
- async writeHead() {
5272
+ async writeHead(head) {
5273
+ headBuffer = head;
5290
5274
  }
5291
5275
  };
5292
5276
  }
5293
5277
  _createBufferedOps() {
5294
5278
  const strategy = this.strategy;
5295
- const readBuffer = /* @__PURE__ */ new Map();
5296
5279
  const writeBuffer = /* @__PURE__ */ new Map();
5297
5280
  const deleteBuffer = /* @__PURE__ */ new Set();
5298
5281
  let headBuffer = null;
@@ -5300,11 +5283,7 @@ var BPTreePureAsync = class {
5300
5283
  async getNode(id) {
5301
5284
  const buffered = writeBuffer.get(id);
5302
5285
  if (buffered) return buffered;
5303
- const read = readBuffer.get(id);
5304
- if (read) return read;
5305
- const node = await strategy.read(id);
5306
- readBuffer.set(id, node);
5307
- return node;
5286
+ return await strategy.read(id);
5308
5287
  },
5309
5288
  async createNode(leaf, keys, values, parent = null, next = null, prev = null) {
5310
5289
  const id = await strategy.id(leaf);
@@ -5321,7 +5300,8 @@ var BPTreePureAsync = class {
5321
5300
  },
5322
5301
  async readHead() {
5323
5302
  if (headBuffer) return headBuffer;
5324
- return await strategy.readHead();
5303
+ headBuffer = await strategy.readHead();
5304
+ return headBuffer;
5325
5305
  },
5326
5306
  async writeHead(head) {
5327
5307
  headBuffer = head;
@@ -5337,7 +5317,6 @@ var BPTreePureAsync = class {
5337
5317
  if (headBuffer) {
5338
5318
  await strategy.writeHead(headBuffer);
5339
5319
  }
5340
- readBuffer.clear();
5341
5320
  writeBuffer.clear();
5342
5321
  deleteBuffer.clear();
5343
5322
  headBuffer = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataply",
3
- "version": "0.0.26-alpha.12",
3
+ "version": "0.0.26-alpha.13",
4
4
  "description": "A lightweight storage engine for Node.js with support for MVCC, WAL.",
5
5
  "license": "MIT",
6
6
  "author": "izure <admin@izure.org>",
@@ -49,6 +49,6 @@
49
49
  "hookall": "^2.2.0",
50
50
  "mvcc-api": "^1.3.7",
51
51
  "ryoiki": "^1.2.0",
52
- "serializable-bptree": "^9.0.4-alpha.1"
52
+ "serializable-bptree": "^9.0.4-alpha.2"
53
53
  }
54
54
  }