@ai-ecoverse/slicc-kernel 1.51.0 → 1.51.1

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
@@ -4858,6 +4858,7 @@ var MountTable = class {
4858
4858
  mounts = /* @__PURE__ */ new Map();
4859
4859
  sessions = /* @__PURE__ */ new Map();
4860
4860
  committing = /* @__PURE__ */ new Map();
4861
+ epoch = 0;
4861
4862
  devices = 0;
4862
4863
  pending = /* @__PURE__ */ new Set();
4863
4864
  notes = /* @__PURE__ */ new Map();
@@ -5017,6 +5018,7 @@ var MountTable = class {
5017
5018
  const session = this.sessions.get(real);
5018
5019
  if (!session) return this.committing.get(real)?.done;
5019
5020
  this.sessions.delete(real);
5021
+ this.epoch++;
5020
5022
  const done4 = (async () => {
5021
5023
  try {
5022
5024
  await session.mount.conn.call({ op: "release", fh: await session.fh });
@@ -5069,19 +5071,29 @@ var MountTable = class {
5069
5071
  this.deps.changed?.(...full);
5070
5072
  }
5071
5073
  forget(mount, path) {
5074
+ this.epoch++;
5072
5075
  for (const key of [...mount.attrs.keys()]) if (within3(key, path)) mount.attrs.delete(key);
5073
5076
  mount.lists.delete(path);
5074
5077
  mount.lists.delete(parentOf5(path));
5075
5078
  for (const key of [...mount.lists.keys()]) if (within3(key, path)) mount.lists.delete(key);
5076
5079
  }
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;
5080
+ async getattr(mount, path, rel2, settled = false) {
5081
+ for (; ; ) {
5082
+ if (mount.conn.failure) throw mount.conn.failure;
5083
+ if (settled) await this.committing.get(path)?.done.catch(() => void 0);
5084
+ const cached = mount.attrs.get(path);
5085
+ if (cached && cached.expires > Date.now()) return cached.value;
5086
+ const seen = this.epoch;
5087
+ const session = this.sessions.get(path);
5088
+ const attr = await mount.conn.call({ op: "getattr", path: rel2 });
5089
+ if (this.epoch !== seen) {
5090
+ if (settled && (this.sessions.get(path) !== session || this.committing.has(path))) continue;
5091
+ return attr;
5092
+ }
5093
+ const ttl = mount.caps.attrTtl ?? 1e3;
5094
+ if (ttl > 0) mount.attrs.set(path, { value: attr, expires: Date.now() + ttl });
5095
+ return attr;
5096
+ }
5085
5097
  }
5086
5098
  async readdir(mount, path, rel2) {
5087
5099
  if (mount.conn.failure) throw mount.conn.failure;
@@ -5362,7 +5374,7 @@ var MountFs = class {
5362
5374
  const real = normalizePath(path);
5363
5375
  if (this.table.writing(real)?.truncated) await this.table.commit(real);
5364
5376
  return this.statWriting(
5365
- await this.table.getattr(found.mount, real, found.rel),
5377
+ await this.table.getattr(found.mount, real, found.rel, true),
5366
5378
  real,
5367
5379
  found.mount
5368
5380
  );