@poe-platform/safe-fs 0.1.802 → 0.1.803

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.
@@ -159,6 +159,7 @@ class FastDirectoryEntriesMap {
159
159
  }
160
160
  _rebuild(newCap) {
161
161
  this._missKey = "";
162
+ this._missSlot = -1;
162
163
  const newTableLen = newCap * 2;
163
164
  const newMask = newTableLen - 1;
164
165
  const newTable = newCap <= 16384 ? new Int16Array(newTableLen).fill(-1) : new Int32Array(newTableLen).fill(-1);
@@ -198,16 +199,17 @@ class FastDirectoryEntriesMap {
198
199
  this._next = writeIdx;
199
200
  }
200
201
  set(k, v) {
201
- if (k === this._missKey && this._next < this._keys.length) {
202
+ const missSlot = k === this._missKey ? this._missSlot : -1;
203
+ this._missKey = "";
204
+ this._missSlot = -1;
205
+ if (missSlot >= 0 && (this._table[missSlot] === -1 || this._table[missSlot] === -2) && this._next < this._keys.length) {
202
206
  const entryIdx = this._next++;
203
- this._table[this._missSlot] = entryIdx;
207
+ this._table[missSlot] = entryIdx;
204
208
  this._keys[entryIdx] = k;
205
209
  this._vals[entryIdx] = v;
206
210
  this.size++;
207
- this._missKey = "";
208
211
  return this;
209
212
  }
210
- this._missKey = "";
211
213
  if (this._next >= this._keys.length) {
212
214
  this._rebuild(this.size * 2 <= this._keys.length ? this._keys.length : this._keys.length * 2);
213
215
  }
@@ -240,6 +242,7 @@ class FastDirectoryEntriesMap {
240
242
  }
241
243
  delete(k) {
242
244
  this._missKey = "";
245
+ this._missSlot = -1;
243
246
  if (this.size === 0)
244
247
  return false;
245
248
  let slot = this._hash(k);
@@ -268,6 +271,7 @@ class FastDirectoryEntriesMap {
268
271
  }
269
272
  clear() {
270
273
  this._missKey = "";
274
+ this._missSlot = -1;
271
275
  if (this._next > 0) {
272
276
  this._table.fill(-1);
273
277
  for (let i = 0; i < this._next; i++) {
@@ -893,6 +897,7 @@ export class MemoryFileSystem {
893
897
  if (alloc.isReleased64()) {
894
898
  alloc.detachLedger(DUMMY_POOL_LEDGER);
895
899
  if (this.ledger.hasInfiniteRetained && this.ledger.hasInfiniteFileBytes && sharedAllocationPoolLen < SHARED_POOL_CAPACITY) {
900
+ alloc.data.fill(0);
896
901
  sharedAllocationPool[sharedAllocationPoolLen++] = alloc;
897
902
  }
898
903
  else if (cache.allocations.length < 128) {
@@ -902,6 +907,7 @@ export class MemoryFileSystem {
902
907
  else if (alloc.isReleased65536()) {
903
908
  alloc.detachLedger(DUMMY_POOL_LEDGER);
904
909
  if (this.ledger.hasInfiniteRetained && this.ledger.hasInfiniteFileBytes && sharedLargeAllocationPoolLen < SHARED_LARGE_POOL_CAPACITY) {
910
+ alloc.data.fill(0);
905
911
  sharedLargeAllocationPool[sharedLargeAllocationPoolLen++] = alloc;
906
912
  }
907
913
  }
@@ -921,6 +927,7 @@ export class MemoryFileSystem {
921
927
  cache.lastFastDirNode = undefined;
922
928
  }
923
929
  if (node.entries.size === 0) {
930
+ node.entries.clear();
924
931
  if (sharedDirectoryNodePoolLen < SHARED_DIR_POOL_CAPACITY) {
925
932
  sharedDirectoryNodePool[sharedDirectoryNodePoolLen++] = node;
926
933
  }
@@ -946,12 +953,14 @@ export class MemoryFileSystem {
946
953
  if (previous.isReleased64()) {
947
954
  previous.detachLedger(DUMMY_POOL_LEDGER);
948
955
  if (this.ledger.hasInfiniteRetained && this.ledger.hasInfiniteFileBytes && sharedAllocationPoolLen < SHARED_POOL_CAPACITY) {
956
+ previous.data.fill(0);
949
957
  sharedAllocationPool[sharedAllocationPoolLen++] = previous;
950
958
  }
951
959
  }
952
960
  else if (previous.isReleased65536()) {
953
961
  previous.detachLedger(DUMMY_POOL_LEDGER);
954
962
  if (this.ledger.hasInfiniteRetained && this.ledger.hasInfiniteFileBytes && sharedLargeAllocationPoolLen < SHARED_LARGE_POOL_CAPACITY) {
963
+ previous.data.fill(0);
955
964
  sharedLargeAllocationPool[sharedLargeAllocationPoolLen++] = previous;
956
965
  }
957
966
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-fs",
3
- "version": "0.1.802",
3
+ "version": "0.1.803",
4
4
  "description": "Composable filesystem with a portable core and explicit Node adapters",
5
5
  "type": "module",
6
6
  "license": "MIT",