document-dataply 0.0.4-alpha.2 → 0.0.4-alpha.3
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 +9 -8
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -7382,7 +7382,7 @@ var require_cjs = __commonJS({
|
|
|
7382
7382
|
entrySize;
|
|
7383
7383
|
buffer;
|
|
7384
7384
|
view;
|
|
7385
|
-
|
|
7385
|
+
totalWrittenPages = 0;
|
|
7386
7386
|
/**
|
|
7387
7387
|
* Constructor
|
|
7388
7388
|
* @param walFilePath WAL file path
|
|
@@ -7543,18 +7543,19 @@ var require_cjs = __commonJS({
|
|
|
7543
7543
|
return restoredPages;
|
|
7544
7544
|
}
|
|
7545
7545
|
/**
|
|
7546
|
-
* Increments the
|
|
7546
|
+
* Increments the total written pages count.
|
|
7547
|
+
* @param count Number of pages written
|
|
7547
7548
|
*/
|
|
7548
|
-
|
|
7549
|
-
this.
|
|
7549
|
+
incrementWrittenPages(count) {
|
|
7550
|
+
this.totalWrittenPages += count;
|
|
7550
7551
|
}
|
|
7551
7552
|
/**
|
|
7552
7553
|
* Returns whether a checkpoint should be performed.
|
|
7553
|
-
* @param threshold Threshold
|
|
7554
|
+
* @param threshold Threshold (number of pages)
|
|
7554
7555
|
* @returns Whether a checkpoint should be performed
|
|
7555
7556
|
*/
|
|
7556
7557
|
shouldCheckpoint(threshold) {
|
|
7557
|
-
return this.
|
|
7558
|
+
return this.totalWrittenPages >= threshold;
|
|
7558
7559
|
}
|
|
7559
7560
|
/**
|
|
7560
7561
|
* Initializes (clears) the log file.
|
|
@@ -7568,7 +7569,7 @@ var require_cjs = __commonJS({
|
|
|
7568
7569
|
return new Promise((resolve, reject) => {
|
|
7569
7570
|
import_node_fs.default.truncate(this.walFilePath, 0, (err) => {
|
|
7570
7571
|
if (err) return reject(err);
|
|
7571
|
-
this.
|
|
7572
|
+
this.totalWrittenPages = 0;
|
|
7572
7573
|
resolve();
|
|
7573
7574
|
});
|
|
7574
7575
|
});
|
|
@@ -8843,7 +8844,7 @@ var require_cjs = __commonJS({
|
|
|
8843
8844
|
await this.pageStrategy.write(pageId, data);
|
|
8844
8845
|
}
|
|
8845
8846
|
if (this.pfs.wal) {
|
|
8846
|
-
this.pfs.wal.
|
|
8847
|
+
this.pfs.wal.incrementWrittenPages(this.dirtyPages.size);
|
|
8847
8848
|
if (this.pfs.wal.shouldCheckpoint(this.pfs.options.walCheckpointThreshold)) {
|
|
8848
8849
|
await this.pfs.wal.clear();
|
|
8849
8850
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-dataply",
|
|
3
|
-
"version": "0.0.4-alpha.
|
|
3
|
+
"version": "0.0.4-alpha.3",
|
|
4
4
|
"description": "Simple and powerful JSON document database supporting complex queries and flexible indexing policies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "izure <admin@izure.org>",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dataply"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"dataply": "^0.0.20-alpha.
|
|
45
|
+
"dataply": "^0.0.20-alpha.2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/jest": "^30.0.0",
|