@ai-ecoverse/slicc-kernel 1.51.0 → 1.52.0

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/node.js CHANGED
@@ -4646,6 +4646,7 @@ var DriverConnection = class _DriverConnection {
4646
4646
  // src/mount/mount-fs.ts
4647
4647
  var MAX_LINKS4 = 40;
4648
4648
  var STALE_RETRIES = 3;
4649
+ var SETTLE_ROUNDS = 4;
4649
4650
  var DEFAULT_IO = 8 * 1024 * 1024;
4650
4651
  var UNITS = { "": 1, k: 1024, m: 1024 ** 2, g: 1024 ** 3, t: 1024 ** 4 };
4651
4652
  function parseSize(text) {
@@ -4963,6 +4964,7 @@ var MountTable = class {
4963
4964
  maxFile: maxFile ?? caps.maxFile ?? 0,
4964
4965
  attrs: /* @__PURE__ */ new Map(),
4965
4966
  lists: /* @__PURE__ */ new Map(),
4967
+ epoch: 0,
4966
4968
  dispose: () => opened2.dispose(),
4967
4969
  ...opened2.present ? { present: opened2.present } : {}
4968
4970
  };
@@ -5017,6 +5019,7 @@ var MountTable = class {
5017
5019
  const session = this.sessions.get(real);
5018
5020
  if (!session) return this.committing.get(real)?.done;
5019
5021
  this.sessions.delete(real);
5022
+ session.mount.epoch++;
5020
5023
  const done4 = (async () => {
5021
5024
  try {
5022
5025
  await session.mount.conn.call({ op: "release", fh: await session.fh });
@@ -5069,19 +5072,30 @@ var MountTable = class {
5069
5072
  this.deps.changed?.(...full);
5070
5073
  }
5071
5074
  forget(mount, path) {
5075
+ mount.epoch++;
5072
5076
  for (const key of [...mount.attrs.keys()]) if (within3(key, path)) mount.attrs.delete(key);
5073
5077
  mount.lists.delete(path);
5074
5078
  mount.lists.delete(parentOf5(path));
5075
5079
  for (const key of [...mount.lists.keys()]) if (within3(key, path)) mount.lists.delete(key);
5076
5080
  }
5077
- async getattr(mount, path, rel2) {
5078
- if (mount.conn.failure) throw mount.conn.failure;
5079
- const cached = mount.attrs.get(path);
5080
- if (cached && cached.expires > Date.now()) return cached.value;
5081
- const attr = await mount.conn.call({ op: "getattr", path: rel2 });
5082
- const ttl = mount.caps.attrTtl ?? 1e3;
5083
- if (ttl > 0) mount.attrs.set(path, { value: attr, expires: Date.now() + ttl });
5084
- return attr;
5081
+ async getattr(mount, path, rel2, settled = false) {
5082
+ for (let round = 1; ; round++) {
5083
+ if (mount.conn.failure) throw mount.conn.failure;
5084
+ if (settled) await this.committing.get(path)?.done.catch(() => void 0);
5085
+ const cached = mount.attrs.get(path);
5086
+ if (cached && cached.expires > Date.now()) return cached.value;
5087
+ const seen = mount.epoch;
5088
+ const session = this.sessions.get(path);
5089
+ const attr = await mount.conn.call({ op: "getattr", path: rel2 });
5090
+ if (mount.epoch !== seen) {
5091
+ const moved2 = this.sessions.get(path) !== session || this.committing.has(path);
5092
+ if (settled && moved2 && round < SETTLE_ROUNDS) continue;
5093
+ return attr;
5094
+ }
5095
+ const ttl = mount.caps.attrTtl ?? 1e3;
5096
+ if (ttl > 0) mount.attrs.set(path, { value: attr, expires: Date.now() + ttl });
5097
+ return attr;
5098
+ }
5085
5099
  }
5086
5100
  async readdir(mount, path, rel2) {
5087
5101
  if (mount.conn.failure) throw mount.conn.failure;
@@ -5362,7 +5376,7 @@ var MountFs = class {
5362
5376
  const real = normalizePath(path);
5363
5377
  if (this.table.writing(real)?.truncated) await this.table.commit(real);
5364
5378
  return this.statWriting(
5365
- await this.table.getattr(found.mount, real, found.rel),
5379
+ await this.table.getattr(found.mount, real, found.rel, true),
5366
5380
  real,
5367
5381
  found.mount
5368
5382
  );
@@ -10501,6 +10515,7 @@ function replayingHops(inner, heldMs = HELD_MS) {
10501
10515
  clearTimeout(waiting.timer);
10502
10516
  return replay(waiting);
10503
10517
  }
10518
+ if (waiting) drop(key);
10504
10519
  const response = await inner.fetch(request);
10505
10520
  if (!response.redirects?.length) return response;
10506
10521
  return replay({