serializable-bptree 5.0.2 → 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/README.md +1 -1
- package/dist/cjs/index.cjs +18 -4
- package/dist/esm/index.mjs +18 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ import {
|
|
|
102
102
|
ValueComparator,
|
|
103
103
|
NumericComparator,
|
|
104
104
|
StringComparator
|
|
105
|
-
} from 'https://cdn.jsdelivr.net/npm/serializable-bptree@5
|
|
105
|
+
} from 'https://cdn.jsdelivr.net/npm/serializable-bptree@5/+esm'
|
|
106
106
|
</script>
|
|
107
107
|
```
|
|
108
108
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -73,6 +73,13 @@ var InvertedWeakMap = class {
|
|
|
73
73
|
return this._map.clear();
|
|
74
74
|
}
|
|
75
75
|
delete(key) {
|
|
76
|
+
const ref = this._map.get(key);
|
|
77
|
+
if (ref) {
|
|
78
|
+
const raw = ref.deref();
|
|
79
|
+
if (raw !== void 0) {
|
|
80
|
+
this._registry.unregister(raw);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
76
83
|
return this._map.delete(key);
|
|
77
84
|
}
|
|
78
85
|
get(key) {
|
|
@@ -190,12 +197,21 @@ var BPTree = class {
|
|
|
190
197
|
}
|
|
191
198
|
}
|
|
192
199
|
bufferForNodeCreate(node) {
|
|
200
|
+
if (node.id === this.root.id) {
|
|
201
|
+
this._strategyDirty = true;
|
|
202
|
+
}
|
|
193
203
|
this._nodeCreateBuffer.set(node.id, node);
|
|
194
204
|
}
|
|
195
205
|
bufferForNodeUpdate(node) {
|
|
206
|
+
if (node.id === this.root.id) {
|
|
207
|
+
this._strategyDirty = true;
|
|
208
|
+
}
|
|
196
209
|
this._nodeUpdateBuffer.set(node.id, node);
|
|
197
210
|
}
|
|
198
211
|
bufferForNodeDelete(node) {
|
|
212
|
+
if (node.id === this.root.id) {
|
|
213
|
+
this._strategyDirty = true;
|
|
214
|
+
}
|
|
199
215
|
this._nodeDeleteBuffer.set(node.id, node);
|
|
200
216
|
}
|
|
201
217
|
/**
|
|
@@ -326,10 +342,10 @@ var BPTreeSync = class extends BPTree {
|
|
|
326
342
|
this.root = this.getNode(keys[0]);
|
|
327
343
|
this.root.parent = null;
|
|
328
344
|
this.strategy.head.root = this.root.id;
|
|
329
|
-
this._strategyDirty = true;
|
|
330
345
|
this.bufferForNodeUpdate(this.root);
|
|
331
346
|
return;
|
|
332
347
|
} else if (this.root === node) {
|
|
348
|
+
this.bufferForNodeUpdate(this.root);
|
|
333
349
|
return;
|
|
334
350
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
335
351
|
if (node.parent === null) {
|
|
@@ -510,7 +526,6 @@ var BPTreeSync = class extends BPTree {
|
|
|
510
526
|
const root = this._createNode(false, [node.id, pointer.id], [value]);
|
|
511
527
|
this.root = root;
|
|
512
528
|
this.strategy.head.root = root.id;
|
|
513
|
-
this._strategyDirty = true;
|
|
514
529
|
node.parent = root.id;
|
|
515
530
|
pointer.parent = root.id;
|
|
516
531
|
this.bufferForNodeCreate(root);
|
|
@@ -889,10 +904,10 @@ var BPTreeAsync = class extends BPTree {
|
|
|
889
904
|
this.root = await this.getNode(keys[0]);
|
|
890
905
|
this.root.parent = null;
|
|
891
906
|
this.strategy.head.root = this.root.id;
|
|
892
|
-
this._strategyDirty = true;
|
|
893
907
|
this.bufferForNodeUpdate(this.root);
|
|
894
908
|
return;
|
|
895
909
|
} else if (this.root === node) {
|
|
910
|
+
this.bufferForNodeUpdate(this.root);
|
|
896
911
|
return;
|
|
897
912
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
898
913
|
if (node.parent === null) {
|
|
@@ -1073,7 +1088,6 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1073
1088
|
const root = await this._createNode(false, [node.id, pointer.id], [value]);
|
|
1074
1089
|
this.root = root;
|
|
1075
1090
|
this.strategy.head.root = root.id;
|
|
1076
|
-
this._strategyDirty = true;
|
|
1077
1091
|
node.parent = root.id;
|
|
1078
1092
|
pointer.parent = root.id;
|
|
1079
1093
|
this.bufferForNodeCreate(root);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -39,6 +39,13 @@ var InvertedWeakMap = class {
|
|
|
39
39
|
return this._map.clear();
|
|
40
40
|
}
|
|
41
41
|
delete(key) {
|
|
42
|
+
const ref = this._map.get(key);
|
|
43
|
+
if (ref) {
|
|
44
|
+
const raw = ref.deref();
|
|
45
|
+
if (raw !== void 0) {
|
|
46
|
+
this._registry.unregister(raw);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
42
49
|
return this._map.delete(key);
|
|
43
50
|
}
|
|
44
51
|
get(key) {
|
|
@@ -156,12 +163,21 @@ var BPTree = class {
|
|
|
156
163
|
}
|
|
157
164
|
}
|
|
158
165
|
bufferForNodeCreate(node) {
|
|
166
|
+
if (node.id === this.root.id) {
|
|
167
|
+
this._strategyDirty = true;
|
|
168
|
+
}
|
|
159
169
|
this._nodeCreateBuffer.set(node.id, node);
|
|
160
170
|
}
|
|
161
171
|
bufferForNodeUpdate(node) {
|
|
172
|
+
if (node.id === this.root.id) {
|
|
173
|
+
this._strategyDirty = true;
|
|
174
|
+
}
|
|
162
175
|
this._nodeUpdateBuffer.set(node.id, node);
|
|
163
176
|
}
|
|
164
177
|
bufferForNodeDelete(node) {
|
|
178
|
+
if (node.id === this.root.id) {
|
|
179
|
+
this._strategyDirty = true;
|
|
180
|
+
}
|
|
165
181
|
this._nodeDeleteBuffer.set(node.id, node);
|
|
166
182
|
}
|
|
167
183
|
/**
|
|
@@ -292,10 +308,10 @@ var BPTreeSync = class extends BPTree {
|
|
|
292
308
|
this.root = this.getNode(keys[0]);
|
|
293
309
|
this.root.parent = null;
|
|
294
310
|
this.strategy.head.root = this.root.id;
|
|
295
|
-
this._strategyDirty = true;
|
|
296
311
|
this.bufferForNodeUpdate(this.root);
|
|
297
312
|
return;
|
|
298
313
|
} else if (this.root === node) {
|
|
314
|
+
this.bufferForNodeUpdate(this.root);
|
|
299
315
|
return;
|
|
300
316
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
301
317
|
if (node.parent === null) {
|
|
@@ -476,7 +492,6 @@ var BPTreeSync = class extends BPTree {
|
|
|
476
492
|
const root = this._createNode(false, [node.id, pointer.id], [value]);
|
|
477
493
|
this.root = root;
|
|
478
494
|
this.strategy.head.root = root.id;
|
|
479
|
-
this._strategyDirty = true;
|
|
480
495
|
node.parent = root.id;
|
|
481
496
|
pointer.parent = root.id;
|
|
482
497
|
this.bufferForNodeCreate(root);
|
|
@@ -855,10 +870,10 @@ var BPTreeAsync = class extends BPTree {
|
|
|
855
870
|
this.root = await this.getNode(keys[0]);
|
|
856
871
|
this.root.parent = null;
|
|
857
872
|
this.strategy.head.root = this.root.id;
|
|
858
|
-
this._strategyDirty = true;
|
|
859
873
|
this.bufferForNodeUpdate(this.root);
|
|
860
874
|
return;
|
|
861
875
|
} else if (this.root === node) {
|
|
876
|
+
this.bufferForNodeUpdate(this.root);
|
|
862
877
|
return;
|
|
863
878
|
} else if (node.keys.length < Math.ceil(this.order / 2) && !node.leaf || node.values.length < Math.ceil((this.order - 1) / 2) && node.leaf) {
|
|
864
879
|
if (node.parent === null) {
|
|
@@ -1039,7 +1054,6 @@ var BPTreeAsync = class extends BPTree {
|
|
|
1039
1054
|
const root = await this._createNode(false, [node.id, pointer.id], [value]);
|
|
1040
1055
|
this.root = root;
|
|
1041
1056
|
this.strategy.head.root = root.id;
|
|
1042
|
-
this._strategyDirty = true;
|
|
1043
1057
|
node.parent = root.id;
|
|
1044
1058
|
pointer.parent = root.id;
|
|
1045
1059
|
this.bufferForNodeCreate(root);
|