serializable-bptree 5.0.3 → 5.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.
- package/dist/cjs/index.cjs +11 -4
- package/dist/esm/index.mjs +11 -4
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -197,12 +197,21 @@ var BPTree = class {
|
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
bufferForNodeCreate(node) {
|
|
200
|
+
if (node.id === this.root.id) {
|
|
201
|
+
this._strategyDirty = true;
|
|
202
|
+
}
|
|
200
203
|
this._nodeCreateBuffer.set(node.id, node);
|
|
201
204
|
}
|
|
202
205
|
bufferForNodeUpdate(node) {
|
|
206
|
+
if (node.id === this.root.id) {
|
|
207
|
+
this._strategyDirty = true;
|
|
208
|
+
}
|
|
203
209
|
this._nodeUpdateBuffer.set(node.id, node);
|
|
204
210
|
}
|
|
205
211
|
bufferForNodeDelete(node) {
|
|
212
|
+
if (node.id === this.root.id) {
|
|
213
|
+
this._strategyDirty = true;
|
|
214
|
+
}
|
|
206
215
|
this._nodeDeleteBuffer.set(node.id, node);
|
|
207
216
|
}
|
|
208
217
|
/**
|
|
@@ -333,10 +342,10 @@ var BPTreeSync = class extends BPTree {
|
|
|
333
342
|
this.root = this.getNode(keys[0]);
|
|
334
343
|
this.root.parent = null;
|
|
335
344
|
this.strategy.head.root = this.root.id;
|
|
336
|
-
this._strategyDirty = true;
|
|
337
345
|
this.bufferForNodeUpdate(this.root);
|
|
338
346
|
return;
|
|
339
347
|
} else if (this.root === node) {
|
|
348
|
+
this.bufferForNodeUpdate(this.root);
|
|
340
349
|
return;
|
|
341
350
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
342
351
|
if (node.parent === null) {
|
|
@@ -517,7 +526,6 @@ var BPTreeSync = class extends BPTree {
|
|
|
517
526
|
const root = this._createNode(false, [node.id, pointer.id], [value]);
|
|
518
527
|
this.root = root;
|
|
519
528
|
this.strategy.head.root = root.id;
|
|
520
|
-
this._strategyDirty = true;
|
|
521
529
|
node.parent = root.id;
|
|
522
530
|
pointer.parent = root.id;
|
|
523
531
|
this.bufferForNodeCreate(root);
|
|
@@ -896,10 +904,10 @@ var BPTreeAsync = class extends BPTree {
|
|
|
896
904
|
this.root = await this.getNode(keys[0]);
|
|
897
905
|
this.root.parent = null;
|
|
898
906
|
this.strategy.head.root = this.root.id;
|
|
899
|
-
this._strategyDirty = true;
|
|
900
907
|
this.bufferForNodeUpdate(this.root);
|
|
901
908
|
return;
|
|
902
909
|
} else if (this.root === node) {
|
|
910
|
+
this.bufferForNodeUpdate(this.root);
|
|
903
911
|
return;
|
|
904
912
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
905
913
|
if (node.parent === null) {
|
|
@@ -1080,7 +1088,6 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1080
1088
|
const root = await this._createNode(false, [node.id, pointer.id], [value]);
|
|
1081
1089
|
this.root = root;
|
|
1082
1090
|
this.strategy.head.root = root.id;
|
|
1083
|
-
this._strategyDirty = true;
|
|
1084
1091
|
node.parent = root.id;
|
|
1085
1092
|
pointer.parent = root.id;
|
|
1086
1093
|
this.bufferForNodeCreate(root);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -163,12 +163,21 @@ var BPTree = class {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
bufferForNodeCreate(node) {
|
|
166
|
+
if (node.id === this.root.id) {
|
|
167
|
+
this._strategyDirty = true;
|
|
168
|
+
}
|
|
166
169
|
this._nodeCreateBuffer.set(node.id, node);
|
|
167
170
|
}
|
|
168
171
|
bufferForNodeUpdate(node) {
|
|
172
|
+
if (node.id === this.root.id) {
|
|
173
|
+
this._strategyDirty = true;
|
|
174
|
+
}
|
|
169
175
|
this._nodeUpdateBuffer.set(node.id, node);
|
|
170
176
|
}
|
|
171
177
|
bufferForNodeDelete(node) {
|
|
178
|
+
if (node.id === this.root.id) {
|
|
179
|
+
this._strategyDirty = true;
|
|
180
|
+
}
|
|
172
181
|
this._nodeDeleteBuffer.set(node.id, node);
|
|
173
182
|
}
|
|
174
183
|
/**
|
|
@@ -299,10 +308,10 @@ var BPTreeSync = class extends BPTree {
|
|
|
299
308
|
this.root = this.getNode(keys[0]);
|
|
300
309
|
this.root.parent = null;
|
|
301
310
|
this.strategy.head.root = this.root.id;
|
|
302
|
-
this._strategyDirty = true;
|
|
303
311
|
this.bufferForNodeUpdate(this.root);
|
|
304
312
|
return;
|
|
305
313
|
} else if (this.root === node) {
|
|
314
|
+
this.bufferForNodeUpdate(this.root);
|
|
306
315
|
return;
|
|
307
316
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
308
317
|
if (node.parent === null) {
|
|
@@ -483,7 +492,6 @@ var BPTreeSync = class extends BPTree {
|
|
|
483
492
|
const root = this._createNode(false, [node.id, pointer.id], [value]);
|
|
484
493
|
this.root = root;
|
|
485
494
|
this.strategy.head.root = root.id;
|
|
486
|
-
this._strategyDirty = true;
|
|
487
495
|
node.parent = root.id;
|
|
488
496
|
pointer.parent = root.id;
|
|
489
497
|
this.bufferForNodeCreate(root);
|
|
@@ -862,10 +870,10 @@ var BPTreeAsync = class extends BPTree {
|
|
|
862
870
|
this.root = await this.getNode(keys[0]);
|
|
863
871
|
this.root.parent = null;
|
|
864
872
|
this.strategy.head.root = this.root.id;
|
|
865
|
-
this._strategyDirty = true;
|
|
866
873
|
this.bufferForNodeUpdate(this.root);
|
|
867
874
|
return;
|
|
868
875
|
} else if (this.root === node) {
|
|
876
|
+
this.bufferForNodeUpdate(this.root);
|
|
869
877
|
return;
|
|
870
878
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
871
879
|
if (node.parent === null) {
|
|
@@ -1046,7 +1054,6 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1046
1054
|
const root = await this._createNode(false, [node.id, pointer.id], [value]);
|
|
1047
1055
|
this.root = root;
|
|
1048
1056
|
this.strategy.head.root = root.id;
|
|
1049
|
-
this._strategyDirty = true;
|
|
1050
1057
|
node.parent = root.id;
|
|
1051
1058
|
pointer.parent = root.id;
|
|
1052
1059
|
this.bufferForNodeCreate(root);
|