@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.
@@ -6451,6 +6451,7 @@ var MountTable = class {
6451
6451
  mounts = /* @__PURE__ */ new Map();
6452
6452
  sessions = /* @__PURE__ */ new Map();
6453
6453
  committing = /* @__PURE__ */ new Map();
6454
+ epoch = 0;
6454
6455
  devices = 0;
6455
6456
  pending = /* @__PURE__ */ new Set();
6456
6457
  notes = /* @__PURE__ */ new Map();
@@ -6610,6 +6611,7 @@ var MountTable = class {
6610
6611
  const session = this.sessions.get(real);
6611
6612
  if (!session) return this.committing.get(real)?.done;
6612
6613
  this.sessions.delete(real);
6614
+ this.epoch++;
6613
6615
  const done4 = (async () => {
6614
6616
  try {
6615
6617
  await session.mount.conn.call({ op: "release", fh: await session.fh });
@@ -6662,19 +6664,29 @@ var MountTable = class {
6662
6664
  this.deps.changed?.(...full);
6663
6665
  }
6664
6666
  forget(mount, path) {
6667
+ this.epoch++;
6665
6668
  for (const key of [...mount.attrs.keys()]) if (within4(key, path)) mount.attrs.delete(key);
6666
6669
  mount.lists.delete(path);
6667
6670
  mount.lists.delete(parentOf5(path));
6668
6671
  for (const key of [...mount.lists.keys()]) if (within4(key, path)) mount.lists.delete(key);
6669
6672
  }
6670
- async getattr(mount, path, rel2) {
6671
- if (mount.conn.failure) throw mount.conn.failure;
6672
- const cached = mount.attrs.get(path);
6673
- if (cached && cached.expires > Date.now()) return cached.value;
6674
- const attr = await mount.conn.call({ op: "getattr", path: rel2 });
6675
- const ttl = mount.caps.attrTtl ?? 1e3;
6676
- if (ttl > 0) mount.attrs.set(path, { value: attr, expires: Date.now() + ttl });
6677
- return attr;
6673
+ async getattr(mount, path, rel2, settled = false) {
6674
+ for (; ; ) {
6675
+ if (mount.conn.failure) throw mount.conn.failure;
6676
+ if (settled) await this.committing.get(path)?.done.catch(() => void 0);
6677
+ const cached = mount.attrs.get(path);
6678
+ if (cached && cached.expires > Date.now()) return cached.value;
6679
+ const seen = this.epoch;
6680
+ const session = this.sessions.get(path);
6681
+ const attr = await mount.conn.call({ op: "getattr", path: rel2 });
6682
+ if (this.epoch !== seen) {
6683
+ if (settled && (this.sessions.get(path) !== session || this.committing.has(path))) continue;
6684
+ return attr;
6685
+ }
6686
+ const ttl = mount.caps.attrTtl ?? 1e3;
6687
+ if (ttl > 0) mount.attrs.set(path, { value: attr, expires: Date.now() + ttl });
6688
+ return attr;
6689
+ }
6678
6690
  }
6679
6691
  async readdir(mount, path, rel2) {
6680
6692
  if (mount.conn.failure) throw mount.conn.failure;
@@ -6955,7 +6967,7 @@ var MountFs = class {
6955
6967
  const real = normalizePath(path);
6956
6968
  if (this.table.writing(real)?.truncated) await this.table.commit(real);
6957
6969
  return this.statWriting(
6958
- await this.table.getattr(found.mount, real, found.rel),
6970
+ await this.table.getattr(found.mount, real, found.rel, true),
6959
6971
  real,
6960
6972
  found.mount
6961
6973
  );