document-dataply 0.0.9-alpha.10 → 0.0.9-alpha.11

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 +22 -4
  2. package/package.json +2 -2
package/dist/cjs/index.js CHANGED
@@ -1681,7 +1681,7 @@ var require_cjs = __commonJS({
1681
1681
  },
1682
1682
  primaryGt: {
1683
1683
  asc: {
1684
- start: (tx, v) => tx.insertableNodeByPrimary(v[0]),
1684
+ start: (tx, v) => tx.insertableRightestEndNodeByPrimary(v[0]),
1685
1685
  end: () => null,
1686
1686
  direction: 1,
1687
1687
  earlyTerminate: false
@@ -2220,7 +2220,7 @@ var require_cjs = __commonJS({
2220
2220
  return this.getNode(node.next);
2221
2221
  }
2222
2222
  insertableEndNode(value, direction) {
2223
- const insertableNode = this.insertableNode(value);
2223
+ const insertableNode = direction === -1 ? this.insertableNodeByPrimary(value) : this.insertableRightestNodeByPrimary(value);
2224
2224
  let key;
2225
2225
  switch (direction) {
2226
2226
  case -1:
@@ -3348,7 +3348,7 @@ var require_cjs = __commonJS({
3348
3348
  return await this.getNode(node.next);
3349
3349
  }
3350
3350
  async insertableEndNode(value, direction) {
3351
- const insertableNode = await this.insertableNode(value);
3351
+ const insertableNode = direction === -1 ? await this.insertableNodeByPrimary(value) : await this.insertableRightestNodeByPrimary(value);
3352
3352
  let key;
3353
3353
  switch (direction) {
3354
3354
  case -1:
@@ -8206,6 +8206,22 @@ var require_cjs = __commonJS({
8206
8206
  this.dirtyPages.delete(pageId);
8207
8207
  }
8208
8208
  }
8209
+ /**
8210
+ * 지정된 페이지들만 디스크에 기록합니다.
8211
+ * WAL 없이 트랜잭션 커밋 시, 해당 트랜잭션의 dirty pages만 선택적으로 flush합니다.
8212
+ * @param pages 기록할 페이지 맵 (PageID -> PageData)
8213
+ */
8214
+ async flushPages(pages) {
8215
+ if (pages.size === 0) {
8216
+ return;
8217
+ }
8218
+ const sortedPageIds = Array.from(pages.keys()).sort((a, b) => a - b);
8219
+ for (const pageId of sortedPageIds) {
8220
+ const data = pages.get(pageId);
8221
+ const position = pageId * this.pageSize;
8222
+ await this._writeToDisk(data, position);
8223
+ }
8224
+ }
8209
8225
  /**
8210
8226
  * 메인 DB 파일의 물리적 동기화를 수행합니다 (fsync).
8211
8227
  */
@@ -9563,7 +9579,9 @@ var require_cjs = __commonJS({
9563
9579
  for (const [pageId, data] of this.dirtyPages) {
9564
9580
  await this.pageStrategy.write(pageId, data);
9565
9581
  }
9566
- if (this.pfs.wal) {
9582
+ if (!this.pfs.wal) {
9583
+ await this.pfs.strategy.flushPages(this.dirtyPages);
9584
+ } else {
9567
9585
  this.pfs.wal.incrementWrittenPages(this.dirtyPages.size);
9568
9586
  if (this.pfs.wal.shouldCheckpoint(this.pfs.options.walCheckpointThreshold)) {
9569
9587
  shouldTriggerCheckpoint = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-dataply",
3
- "version": "0.0.9-alpha.10",
3
+ "version": "0.0.9-alpha.11",
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.24-alpha.8"
45
+ "dataply": "^0.0.24-alpha.10"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/jest": "^30.0.0",