dataply 0.0.20-alpha.5 → 0.0.20

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/dist/cjs/index.js CHANGED
@@ -8097,6 +8097,9 @@ var PageFileSystem = class {
8097
8097
  }
8098
8098
  };
8099
8099
 
8100
+ // src/core/RowTableEngine.ts
8101
+ var import_node_os = __toESM(require("node:os"));
8102
+
8100
8103
  // src/utils/TextCodec.ts
8101
8104
  var TextCodec = class _TextCodec {
8102
8105
  static TextEncoder = new TextEncoder();
@@ -8343,11 +8346,14 @@ var RowTableEngine = class {
8343
8346
  this.maxBodySize = this.pfs.pageSize - DataPageManager.CONSTANT.SIZE_PAGE_HEADER;
8344
8347
  this.order = this.getOptimalOrder(pfs.pageSize, IndexPageManager.CONSTANT.SIZE_KEY, IndexPageManager.CONSTANT.SIZE_VALUE);
8345
8348
  this.strategy = new RowIdentifierStrategy(this.order, pfs, txContext);
8349
+ const budget = import_node_os.default.freemem() * 0.1;
8350
+ const nodeMemory = this.order * 24 + 256;
8351
+ const capacity = Math.max(1e3, Math.min(1e6, Math.floor(budget / nodeMemory)));
8346
8352
  this.bptree = new BPTreeAsync(
8347
8353
  this.strategy,
8348
8354
  new NumericComparator(),
8349
8355
  {
8350
- capacity: this.options.pageCacheCapacity
8356
+ capacity
8351
8357
  }
8352
8358
  );
8353
8359
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataply",
3
- "version": "0.0.20-alpha.5",
3
+ "version": "0.0.20",
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>",