serializable-bptree 7.0.3 → 7.0.4

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.
@@ -1688,7 +1688,6 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1688
1688
  dirtyIds;
1689
1689
  createdInTx;
1690
1690
  deletedIds;
1691
- obsoleteNodes = /* @__PURE__ */ new Map();
1692
1691
  originalNodes = /* @__PURE__ */ new Map();
1693
1692
  initialRootId;
1694
1693
  transactionRootId;
@@ -1899,13 +1898,11 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1899
1898
  if (success) {
1900
1899
  const distinctObsolete = /* @__PURE__ */ new Set();
1901
1900
  for (const oldId of this.dirtyIds) {
1902
- if (!this.createdInTx.has(oldId)) {
1903
- if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
1904
- distinctObsolete.add(oldId);
1905
- if (this.originalNodes.has(oldId)) {
1906
- this.obsoleteNodes.set(oldId, this.originalNodes.get(oldId));
1907
- }
1908
- }
1901
+ if (this.createdInTx.has(oldId)) {
1902
+ continue;
1903
+ }
1904
+ if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
1905
+ distinctObsolete.add(oldId);
1909
1906
  }
1910
1907
  }
1911
1908
  if (cleanup) {
@@ -1920,6 +1917,7 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1920
1917
  }
1921
1918
  }
1922
1919
  this.realBaseTree.unregisterTransaction(this.transactionId);
1920
+ this.realBaseTree.pruneObsoleteNodes();
1923
1921
  return {
1924
1922
  success: true,
1925
1923
  createdIds: newCreatedIds,
@@ -1951,6 +1949,7 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1951
1949
  }
1952
1950
  }
1953
1951
  this.realBaseTree.unregisterTransaction(this.transactionId);
1952
+ this.realBaseTree.pruneObsoleteNodes();
1954
1953
  return createdIds;
1955
1954
  }
1956
1955
  readLock(fn) {
@@ -3149,7 +3148,6 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3149
3148
  dirtyIds;
3150
3149
  createdInTx;
3151
3150
  deletedIds;
3152
- obsoleteNodes = /* @__PURE__ */ new Map();
3153
3151
  originalNodes = /* @__PURE__ */ new Map();
3154
3152
  initialRootId;
3155
3153
  transactionRootId;
@@ -3365,13 +3363,11 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3365
3363
  if (success) {
3366
3364
  const distinctObsolete = /* @__PURE__ */ new Set();
3367
3365
  for (const oldId of this.dirtyIds) {
3368
- if (!this.createdInTx.has(oldId)) {
3369
- if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
3370
- distinctObsolete.add(oldId);
3371
- if (this.originalNodes.has(oldId)) {
3372
- this.obsoleteNodes.set(oldId, this.originalNodes.get(oldId));
3373
- }
3374
- }
3366
+ if (this.createdInTx.has(oldId)) {
3367
+ continue;
3368
+ }
3369
+ if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
3370
+ distinctObsolete.add(oldId);
3375
3371
  }
3376
3372
  }
3377
3373
  if (cleanup) {
@@ -3386,6 +3382,7 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3386
3382
  }
3387
3383
  }
3388
3384
  this.realBaseTree.unregisterTransaction(this.transactionId);
3385
+ this.realBaseTree.pruneObsoleteNodes();
3389
3386
  return {
3390
3387
  success: true,
3391
3388
  createdIds: newCreatedIds,
@@ -3417,6 +3414,7 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3417
3414
  }
3418
3415
  }
3419
3416
  this.realBaseTree.unregisterTransaction(this.transactionId);
3417
+ this.realBaseTree.pruneObsoleteNodes();
3420
3418
  return createdIds;
3421
3419
  }
3422
3420
  async readLock(fn) {
@@ -1652,7 +1652,6 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1652
1652
  dirtyIds;
1653
1653
  createdInTx;
1654
1654
  deletedIds;
1655
- obsoleteNodes = /* @__PURE__ */ new Map();
1656
1655
  originalNodes = /* @__PURE__ */ new Map();
1657
1656
  initialRootId;
1658
1657
  transactionRootId;
@@ -1863,13 +1862,11 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1863
1862
  if (success) {
1864
1863
  const distinctObsolete = /* @__PURE__ */ new Set();
1865
1864
  for (const oldId of this.dirtyIds) {
1866
- if (!this.createdInTx.has(oldId)) {
1867
- if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
1868
- distinctObsolete.add(oldId);
1869
- if (this.originalNodes.has(oldId)) {
1870
- this.obsoleteNodes.set(oldId, this.originalNodes.get(oldId));
1871
- }
1872
- }
1865
+ if (this.createdInTx.has(oldId)) {
1866
+ continue;
1867
+ }
1868
+ if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
1869
+ distinctObsolete.add(oldId);
1873
1870
  }
1874
1871
  }
1875
1872
  if (cleanup) {
@@ -1884,6 +1881,7 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1884
1881
  }
1885
1882
  }
1886
1883
  this.realBaseTree.unregisterTransaction(this.transactionId);
1884
+ this.realBaseTree.pruneObsoleteNodes();
1887
1885
  return {
1888
1886
  success: true,
1889
1887
  createdIds: newCreatedIds,
@@ -1915,6 +1913,7 @@ var BPTreeSyncTransaction = class extends BPTreeSyncBase {
1915
1913
  }
1916
1914
  }
1917
1915
  this.realBaseTree.unregisterTransaction(this.transactionId);
1916
+ this.realBaseTree.pruneObsoleteNodes();
1918
1917
  return createdIds;
1919
1918
  }
1920
1919
  readLock(fn) {
@@ -3113,7 +3112,6 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3113
3112
  dirtyIds;
3114
3113
  createdInTx;
3115
3114
  deletedIds;
3116
- obsoleteNodes = /* @__PURE__ */ new Map();
3117
3115
  originalNodes = /* @__PURE__ */ new Map();
3118
3116
  initialRootId;
3119
3117
  transactionRootId;
@@ -3329,13 +3327,11 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3329
3327
  if (success) {
3330
3328
  const distinctObsolete = /* @__PURE__ */ new Set();
3331
3329
  for (const oldId of this.dirtyIds) {
3332
- if (!this.createdInTx.has(oldId)) {
3333
- if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
3334
- distinctObsolete.add(oldId);
3335
- if (this.originalNodes.has(oldId)) {
3336
- this.obsoleteNodes.set(oldId, this.originalNodes.get(oldId));
3337
- }
3338
- }
3330
+ if (this.createdInTx.has(oldId)) {
3331
+ continue;
3332
+ }
3333
+ if (this.txNodes.has(oldId) || this.deletedIds.has(oldId)) {
3334
+ distinctObsolete.add(oldId);
3339
3335
  }
3340
3336
  }
3341
3337
  if (cleanup) {
@@ -3350,6 +3346,7 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3350
3346
  }
3351
3347
  }
3352
3348
  this.realBaseTree.unregisterTransaction(this.transactionId);
3349
+ this.realBaseTree.pruneObsoleteNodes();
3353
3350
  return {
3354
3351
  success: true,
3355
3352
  createdIds: newCreatedIds,
@@ -3381,6 +3378,7 @@ var BPTreeAsyncTransaction = class extends BPTreeAsyncBase {
3381
3378
  }
3382
3379
  }
3383
3380
  this.realBaseTree.unregisterTransaction(this.transactionId);
3381
+ this.realBaseTree.pruneObsoleteNodes();
3384
3382
  return createdIds;
3385
3383
  }
3386
3384
  async readLock(fn) {
@@ -11,7 +11,6 @@ export declare class BPTreeAsyncTransaction<K, V> extends BPTreeAsyncBase<K, V>
11
11
  protected readonly dirtyIds: Set<string>;
12
12
  protected readonly createdInTx: Set<string>;
13
13
  protected readonly deletedIds: Set<string>;
14
- readonly obsoleteNodes: Map<string, BPTreeUnknownNode<K, V>>;
15
14
  private readonly originalNodes;
16
15
  private initialRootId;
17
16
  private transactionRootId;
@@ -11,7 +11,6 @@ export declare class BPTreeSyncTransaction<K, V> extends BPTreeSyncBase<K, V> {
11
11
  protected readonly dirtyIds: Set<string>;
12
12
  protected readonly createdInTx: Set<string>;
13
13
  protected readonly deletedIds: Set<string>;
14
- readonly obsoleteNodes: Map<string, BPTreeUnknownNode<K, V>>;
15
14
  private readonly originalNodes;
16
15
  private initialRootId;
17
16
  private transactionRootId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serializable-bptree",
3
- "version": "7.0.3",
3
+ "version": "7.0.4",
4
4
  "description": "Store the B+tree flexibly, not only in-memory.",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "main": "./dist/cjs/index.cjs",