dataply 0.0.25-alpha.0 → 0.0.25

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
@@ -9162,10 +9162,15 @@ var RowTableEngine = class {
9162
9162
  }
9163
9163
  const metadataPage = await this.pfs.getMetadata(tx);
9164
9164
  const manager = this.factory.getManagerFromType(MetadataPageManager.CONSTANT.PAGE_TYPE_METADATA);
9165
+ const pageSize = manager.getPageSize(metadataPage);
9166
+ const pageCount = manager.getPageCount(metadataPage);
9167
+ const rowCount = manager.getRowCount(metadataPage);
9168
+ const usage = pageCount / Math.pow(2, 32);
9165
9169
  return {
9166
- pageSize: manager.getPageSize(metadataPage),
9167
- pageCount: manager.getPageCount(metadataPage),
9168
- rowCount: manager.getRowCount(metadataPage)
9170
+ pageSize,
9171
+ pageCount,
9172
+ rowCount,
9173
+ usage
9169
9174
  };
9170
9175
  }
9171
9176
  /**
@@ -10257,9 +10262,11 @@ var DataplyAPI = class {
10257
10262
  if (!this.initialized) {
10258
10263
  throw new Error("Dataply instance is not initialized");
10259
10264
  }
10260
- return this.hook.trigger("close", void 0, async () => {
10261
- await this.pfs.close();
10262
- import_node_fs3.default.closeSync(this.fileHandle);
10265
+ return this.runWithDefaultWrite(() => {
10266
+ return this.hook.trigger("close", void 0, async () => {
10267
+ await this.pfs.close();
10268
+ import_node_fs3.default.closeSync(this.fileHandle);
10269
+ });
10263
10270
  });
10264
10271
  }
10265
10272
  };
@@ -37,6 +37,11 @@ export interface DataplyMetadata {
37
37
  * The total number of data rows in the dataply.
38
38
  */
39
39
  rowCount: number;
40
+ /**
41
+ * The usage of the dataply. It is calculated based on the remaining page capacity.
42
+ * The value is between 0 and 1.
43
+ */
44
+ usage: number;
40
45
  }
41
46
  export type DataPage = Uint8Array & {
42
47
  __pageType: 'data';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataply",
3
- "version": "0.0.25-alpha.0",
3
+ "version": "0.0.25",
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>",
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/jest": "^30.0.0",
41
- "@types/node": "^25.0.3",
42
- "esbuild": "^0.27.2",
43
- "jest": "^30.2.0",
41
+ "@types/node": "^25.4.0",
42
+ "esbuild": "^0.27.3",
43
+ "jest": "^30.3.0",
44
44
  "ts-jest": "^29.4.6",
45
45
  "typescript": "^5.9.3"
46
46
  },