@ai-ecoverse/slicc-kernel 1.196.43 → 1.196.45
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/async-process.js +1 -1
- package/dist/cloudflare-sources.js +1 -1
- package/dist/cloudflare.js +158 -63
- package/dist/cloudflare.js.map +4 -4
- package/dist/kernel-worker.js +158 -63
- package/dist/kernel-worker.js.map +4 -4
- package/dist/meta.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +158 -63
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/fs/meta.d.ts +3 -0
- package/dist/types/fs/opfs.d.ts +2 -0
- package/dist/types/fs/rename-cleanup.d.ts +1 -1
- package/dist/types/fs/rename-manifest.d.ts +16 -0
- package/package.json +2 -2
package/dist/kernel-worker.js
CHANGED
|
@@ -1883,9 +1883,9 @@ async function copiedEntry(handle, path, file) {
|
|
|
1883
1883
|
function absent(err) {
|
|
1884
1884
|
return err.name === "NotFoundError";
|
|
1885
1885
|
}
|
|
1886
|
-
async function removeOne(parent, name2, rest2,
|
|
1886
|
+
async function removeOne(parent, name2, rest2, lookup2, signal) {
|
|
1887
1887
|
signal?.throwIfAborted();
|
|
1888
|
-
const entry =
|
|
1888
|
+
const entry = await lookup2(rest2);
|
|
1889
1889
|
if (!entry) return;
|
|
1890
1890
|
try {
|
|
1891
1891
|
const handle = entry.kind === "file" ? await parent.getFileHandle(name2) : await parent.getDirectoryHandle(name2);
|
|
@@ -1895,7 +1895,7 @@ async function removeOne(parent, name2, rest2, entries, signal) {
|
|
|
1895
1895
|
if (file.lastModified !== entry.mtime || file.size !== entry.size) return;
|
|
1896
1896
|
} else {
|
|
1897
1897
|
for await (const child2 of handle.keys())
|
|
1898
|
-
await removeOne(handle, child2, rest2 + "/" + child2,
|
|
1898
|
+
await removeOne(handle, child2, rest2 + "/" + child2, lookup2, signal);
|
|
1899
1899
|
}
|
|
1900
1900
|
signal?.throwIfAborted();
|
|
1901
1901
|
await parent.removeEntry(name2);
|
|
@@ -1903,10 +1903,64 @@ async function removeOne(parent, name2, rest2, entries, signal) {
|
|
|
1903
1903
|
if (!absent(err) && err.name !== "TypeMismatchError") throw err;
|
|
1904
1904
|
}
|
|
1905
1905
|
}
|
|
1906
|
-
function removeCopied(parent, name2, manifest, signal) {
|
|
1907
|
-
|
|
1906
|
+
function removeCopied(parent, name2, manifest, signal, overflow) {
|
|
1907
|
+
const entries = new Map(manifest.map((entry) => [entry.path, entry]));
|
|
1908
|
+
return removeOne(parent, name2, "", (path) => entries.get(path) ?? overflow?.(path), signal);
|
|
1908
1909
|
}
|
|
1909
1910
|
|
|
1911
|
+
// src/fs/rename-manifest.ts
|
|
1912
|
+
var INLINE_BYTES = 256 * 1024;
|
|
1913
|
+
var BATCH = 64;
|
|
1914
|
+
function manifestRoot(intent) {
|
|
1915
|
+
return "rename-manifest:" + intent;
|
|
1916
|
+
}
|
|
1917
|
+
async function storedStamp(meta, intent, path) {
|
|
1918
|
+
const [row] = await meta.get([manifestRoot(intent) + path]);
|
|
1919
|
+
return row?.copyStamp && { path, ...row.copyStamp };
|
|
1920
|
+
}
|
|
1921
|
+
var RenameManifest = class {
|
|
1922
|
+
meta;
|
|
1923
|
+
intent;
|
|
1924
|
+
entries = [];
|
|
1925
|
+
pending = [];
|
|
1926
|
+
bytes = 2;
|
|
1927
|
+
indexed = false;
|
|
1928
|
+
constructor(meta, intent) {
|
|
1929
|
+
this.meta = meta;
|
|
1930
|
+
this.intent = intent;
|
|
1931
|
+
}
|
|
1932
|
+
async record(entry) {
|
|
1933
|
+
if (!this.indexed) {
|
|
1934
|
+
this.bytes += storedSize(JSON.stringify(entry)) + 1;
|
|
1935
|
+
if (this.bytes <= INLINE_BYTES) {
|
|
1936
|
+
this.entries.push(entry);
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
this.indexed = true;
|
|
1940
|
+
}
|
|
1941
|
+
const { path: relative2, ...copyStamp } = entry;
|
|
1942
|
+
const path = manifestRoot(this.intent) + relative2;
|
|
1943
|
+
this.pending.push({ path, change: () => ({ path, copyStamp }) });
|
|
1944
|
+
if (this.pending.length === BATCH) await this.flush();
|
|
1945
|
+
}
|
|
1946
|
+
async flush() {
|
|
1947
|
+
if (!this.pending.length) return;
|
|
1948
|
+
if (this.meta.updateMany) await this.meta.updateMany(this.pending);
|
|
1949
|
+
else for (const { path, change } of this.pending) await this.meta.update(path, change);
|
|
1950
|
+
this.pending.length = 0;
|
|
1951
|
+
}
|
|
1952
|
+
async marker(to) {
|
|
1953
|
+
await this.flush();
|
|
1954
|
+
if (!this.entries.length && !this.indexed) return void 0;
|
|
1955
|
+
return {
|
|
1956
|
+
intent: this.intent,
|
|
1957
|
+
to,
|
|
1958
|
+
entries: this.entries,
|
|
1959
|
+
...this.indexed && { indexed: true }
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
|
|
1910
1964
|
// src/fs/view.ts
|
|
1911
1965
|
function view(target, overrides) {
|
|
1912
1966
|
const keys2 = new Set(Object.keys(overrides));
|
|
@@ -1971,9 +2025,10 @@ var INTENT_POLL_MS = 5;
|
|
|
1971
2025
|
var SOURCE_RETRY_MS = 250;
|
|
1972
2026
|
var SOURCE_BACKOFF_MS = 1e3;
|
|
1973
2027
|
var Copies = class extends Map {
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2028
|
+
manifest;
|
|
2029
|
+
constructor(meta, intent) {
|
|
2030
|
+
super();
|
|
2031
|
+
if (intent) this.manifest = new RenameManifest(meta, intent);
|
|
1977
2032
|
}
|
|
1978
2033
|
};
|
|
1979
2034
|
function needsCopy(handle, swap) {
|
|
@@ -3739,12 +3794,12 @@ var OpfsFs = class {
|
|
|
3739
3794
|
return this.privateCopy(source, parent, destination, target?.handle, moving);
|
|
3740
3795
|
const place = async () => {
|
|
3741
3796
|
this.forget(destination);
|
|
3742
|
-
const
|
|
3743
|
-
const root = { ino: inodeOf(source.path), ...moving };
|
|
3797
|
+
const root = { ino: sourceStat.ino, ...moving };
|
|
3744
3798
|
const owned4 = lock ? { lock } : {};
|
|
3745
3799
|
hooks.notify?.();
|
|
3746
3800
|
const first = copying ? await this.intend({ from: source.path, to: staged2, root, ...owned4 }) : void 0;
|
|
3747
3801
|
const second = copying && swap ? await this.intend({ from: staged2, to: destination, replace: true, root, ...owned4 }) : void 0;
|
|
3802
|
+
const copies = new Copies(this.meta, first);
|
|
3748
3803
|
await hooks.started?.().catch(async (err) => {
|
|
3749
3804
|
for (const intent of [first, second]) {
|
|
3750
3805
|
if (intent) await this.meta.update(intent, () => void 0);
|
|
@@ -3760,21 +3815,21 @@ var OpfsFs = class {
|
|
|
3760
3815
|
});
|
|
3761
3816
|
if (swap) await PLAIN.rm.call(this, destination);
|
|
3762
3817
|
if (second) await this.intend({ from: staged2, to: destination, root, ...owned4 }, second);
|
|
3763
|
-
left.copyCommit = copies.marker(
|
|
3818
|
+
left.copyCommit = await copies.manifest?.marker(destination);
|
|
3764
3819
|
await this.meta.move(source.path, destination, carry, left);
|
|
3765
3820
|
this.movePending(source.path, destination);
|
|
3766
3821
|
if (!moved2 && first)
|
|
3767
|
-
await this.releaseSource(first, source.path, destination, left.ino, lock
|
|
3768
|
-
else if (first) await this.
|
|
3769
|
-
if (swap) {
|
|
3822
|
+
await this.releaseSource(first, source.path, destination, left.ino, lock);
|
|
3823
|
+
else if (first) await this.retireIntent(first);
|
|
3824
|
+
if (swap && second) {
|
|
3770
3825
|
const hidden = await dir.getDirectoryHandle(staging);
|
|
3771
|
-
copies.
|
|
3826
|
+
copies.manifest = new RenameManifest(this.meta, second);
|
|
3772
3827
|
const placed = await this.place(hidden, dir, name2, copies, copying);
|
|
3773
|
-
if (!placed
|
|
3774
|
-
const mark = vacatedAt(staged2, copies.marker(
|
|
3828
|
+
if (!placed) {
|
|
3829
|
+
const mark = vacatedAt(staged2, await copies.manifest.marker(destination));
|
|
3775
3830
|
await this.meta.update(staged2, () => mark);
|
|
3776
|
-
await this.releaseSource(second, staged2, destination, mark.ino, lock
|
|
3777
|
-
} else
|
|
3831
|
+
await this.releaseSource(second, staged2, destination, mark.ino, lock);
|
|
3832
|
+
} else await this.retireIntent(second);
|
|
3778
3833
|
}
|
|
3779
3834
|
await this.restamp(destination, copies);
|
|
3780
3835
|
this.changed(source.path, destination);
|
|
@@ -4156,7 +4211,6 @@ var OpfsFs = class {
|
|
|
4156
4211
|
const handle = source.handle;
|
|
4157
4212
|
const dir = parent.handle;
|
|
4158
4213
|
const name2 = baseOf(to);
|
|
4159
|
-
const copies = new Copies();
|
|
4160
4214
|
const [entry] = await this.meta.get([source.path]);
|
|
4161
4215
|
const root = { ino: occupied(entry).ino ?? inodeOf(source.path), ...owner };
|
|
4162
4216
|
if (target?.kind === "directory" && movable(target) && movable(handle)) {
|
|
@@ -4166,14 +4220,23 @@ var OpfsFs = class {
|
|
|
4166
4220
|
if (await this.swapNative(source, dir, name2, target, emptyBackup, intent2)) {
|
|
4167
4221
|
this.forget(source.path);
|
|
4168
4222
|
this.forget(to);
|
|
4169
|
-
await this.commitPrivateCopy(
|
|
4223
|
+
await this.commitPrivateCopy(
|
|
4224
|
+
source.path,
|
|
4225
|
+
to,
|
|
4226
|
+
root,
|
|
4227
|
+
intent2,
|
|
4228
|
+
new Copies(this.meta, intent2),
|
|
4229
|
+
emptyBackup
|
|
4230
|
+
);
|
|
4170
4231
|
return;
|
|
4171
4232
|
}
|
|
4172
4233
|
}
|
|
4173
4234
|
await this.beforePrivateCopy?.();
|
|
4174
4235
|
const intent = await this.intend({ from: source.path, to, root, privateCopy: true });
|
|
4236
|
+
const copies = new Copies(this.meta, intent);
|
|
4175
4237
|
try {
|
|
4176
4238
|
await this.duplicate(handle, dir, name2, copies, "");
|
|
4239
|
+
await copies.manifest?.flush();
|
|
4177
4240
|
} catch (err) {
|
|
4178
4241
|
if (!target)
|
|
4179
4242
|
await dir.removeEntry(name2, { recursive: true }).catch((e) => {
|
|
@@ -4184,7 +4247,7 @@ var OpfsFs = class {
|
|
|
4184
4247
|
await target.removeEntry(child2, { recursive: true });
|
|
4185
4248
|
}
|
|
4186
4249
|
this.forget(to);
|
|
4187
|
-
await this.
|
|
4250
|
+
await this.retireIntent(intent);
|
|
4188
4251
|
throw translate(err, to, "write");
|
|
4189
4252
|
}
|
|
4190
4253
|
await this.commitPrivateCopy(source.path, to, root, intent, copies);
|
|
@@ -4211,7 +4274,7 @@ var OpfsFs = class {
|
|
|
4211
4274
|
const entries = await this.meta.get([from, to]);
|
|
4212
4275
|
let mark = entries[0];
|
|
4213
4276
|
if (!mark?.vacated || entries[1]?.ino !== ino) {
|
|
4214
|
-
mark = vacatedAt(from, copies.marker(
|
|
4277
|
+
mark = vacatedAt(from, await copies.manifest?.marker(to));
|
|
4215
4278
|
await this.meta.move(
|
|
4216
4279
|
from,
|
|
4217
4280
|
to,
|
|
@@ -4219,8 +4282,7 @@ var OpfsFs = class {
|
|
|
4219
4282
|
mark
|
|
4220
4283
|
);
|
|
4221
4284
|
}
|
|
4222
|
-
if (!emptyBackup)
|
|
4223
|
-
await this.releaseSource(intent, from, to, mark.ino, void 0, copies.remaining);
|
|
4285
|
+
if (!emptyBackup) await this.releaseSource(intent, from, to, mark.ino);
|
|
4224
4286
|
this.movePending(from, to);
|
|
4225
4287
|
await this.restamp(to, copies);
|
|
4226
4288
|
this.changed(from, to);
|
|
@@ -4242,22 +4304,45 @@ var OpfsFs = class {
|
|
|
4242
4304
|
}
|
|
4243
4305
|
return cleanupId(handle);
|
|
4244
4306
|
}
|
|
4245
|
-
|
|
4307
|
+
retireIntent(intent) {
|
|
4308
|
+
return this.meta.remove([intent, manifestRoot(intent)]);
|
|
4309
|
+
}
|
|
4310
|
+
async releaseSource(intent, from, to, id2, lock, unverified = false) {
|
|
4246
4311
|
this.syncSourceReservation(intent, from);
|
|
4247
|
-
const physicalSource = copiedEntries?.find((entry) => entry.path === "")?.id;
|
|
4248
4312
|
await this.intend(
|
|
4249
4313
|
{
|
|
4250
4314
|
from,
|
|
4251
4315
|
to,
|
|
4252
4316
|
sourceCleanup: id2,
|
|
4253
|
-
...
|
|
4254
|
-
...
|
|
4255
|
-
...copiedEntries && { copiedEntries }
|
|
4317
|
+
...unverified && { unverifiedSource: true },
|
|
4318
|
+
...lock && { lock }
|
|
4256
4319
|
},
|
|
4257
4320
|
intent
|
|
4258
4321
|
);
|
|
4259
4322
|
await this.cleanSource(intent, from, id2);
|
|
4260
4323
|
}
|
|
4324
|
+
async removeReserved(intent, from, reservation, rename, signal) {
|
|
4325
|
+
if (rename.unverifiedSource) {
|
|
4326
|
+
await this.sourceId(from);
|
|
4327
|
+
throw fsError("EBUSY", from);
|
|
4328
|
+
}
|
|
4329
|
+
const commit = reservation.copyCommit?.intent === intent ? reservation.copyCommit : void 0;
|
|
4330
|
+
const entries = commit?.entries ?? rename.copiedEntries;
|
|
4331
|
+
const expected = entries?.find((entry) => entry.path === "")?.id ?? rename.physicalSource;
|
|
4332
|
+
if (expected === void 0 || await this.sourceId(from) === expected) {
|
|
4333
|
+
const [dir, name2] = await this.parent(from);
|
|
4334
|
+
await this.inDir(dir, (parent) => {
|
|
4335
|
+
signal?.throwIfAborted();
|
|
4336
|
+
return entries ? removeCopied(
|
|
4337
|
+
parent,
|
|
4338
|
+
name2,
|
|
4339
|
+
entries,
|
|
4340
|
+
signal,
|
|
4341
|
+
commit?.indexed ? (path) => storedStamp(this.meta, intent, path) : void 0
|
|
4342
|
+
) : parent.removeEntry(name2);
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4261
4346
|
async cleanSource(intent, from, id2, signal) {
|
|
4262
4347
|
const remove = async () => {
|
|
4263
4348
|
if (signal?.aborted) return;
|
|
@@ -4266,14 +4351,7 @@ var OpfsFs = class {
|
|
|
4266
4351
|
const [reservation] = await (this.meta.fresh ?? this.meta.get).call(this.meta, [from]);
|
|
4267
4352
|
if (reservation?.vacated && reservation.ino === id2) {
|
|
4268
4353
|
try {
|
|
4269
|
-
|
|
4270
|
-
if (expected === void 0 || await this.sourceId(from) === expected) {
|
|
4271
|
-
const [dir, name2] = await this.parent(from);
|
|
4272
|
-
await this.inDir(dir, (parent) => {
|
|
4273
|
-
signal?.throwIfAborted();
|
|
4274
|
-
return current.rename?.copiedEntries ? removeCopied(parent, name2, current.rename.copiedEntries, signal) : parent.removeEntry(name2);
|
|
4275
|
-
});
|
|
4276
|
-
}
|
|
4354
|
+
await this.removeReserved(intent, from, reservation, current.rename, signal);
|
|
4277
4355
|
} catch (err) {
|
|
4278
4356
|
if (!missing2(err) && err.name !== "NotFoundError") return;
|
|
4279
4357
|
}
|
|
@@ -4282,7 +4360,7 @@ var OpfsFs = class {
|
|
|
4282
4360
|
(current2) => current2?.vacated && current2.ino === reservation.ino ? vacatedAt(from) : current2
|
|
4283
4361
|
);
|
|
4284
4362
|
}
|
|
4285
|
-
await this.
|
|
4363
|
+
await this.retireIntent(intent);
|
|
4286
4364
|
}
|
|
4287
4365
|
this.syncSourceReservation(intent);
|
|
4288
4366
|
};
|
|
@@ -4294,7 +4372,7 @@ var OpfsFs = class {
|
|
|
4294
4372
|
}
|
|
4295
4373
|
async duplicate(handle, parent, name2, copies, rest2) {
|
|
4296
4374
|
if (handle.kind === "file") return this.copyBytes(handle, parent, name2, { copies }, rest2);
|
|
4297
|
-
copies.
|
|
4375
|
+
await copies.manifest?.record(await copiedEntry(handle, rest2));
|
|
4298
4376
|
const dir = await this.io(parent.getDirectoryHandle(name2, { create: true }));
|
|
4299
4377
|
this.others++;
|
|
4300
4378
|
for await (const child2 of handle.values())
|
|
@@ -4303,24 +4381,27 @@ var OpfsFs = class {
|
|
|
4303
4381
|
hiddenBackups = /* @__PURE__ */ new Set();
|
|
4304
4382
|
pendingSources = /* @__PURE__ */ new Map();
|
|
4305
4383
|
retryAfter = /* @__PURE__ */ new Map();
|
|
4306
|
-
async retrySource(intent, from) {
|
|
4384
|
+
async retrySource(intent, from, mayClean, deadline) {
|
|
4307
4385
|
const now = performance.now();
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4386
|
+
if (now >= deadline) return false;
|
|
4387
|
+
const eligible = mayClean && now >= (this.retryAfter.get(intent) ?? -Infinity);
|
|
4388
|
+
let attempted = false;
|
|
4311
4389
|
if (eligible) this.retryAfter.set(intent, Infinity);
|
|
4312
4390
|
const controller = new AbortController();
|
|
4313
4391
|
const { promise, resolve: resolve2 } = Promise.withResolvers();
|
|
4314
4392
|
const timer = setTimeout(() => {
|
|
4315
4393
|
controller.abort();
|
|
4316
4394
|
resolve2();
|
|
4317
|
-
},
|
|
4395
|
+
}, deadline - now);
|
|
4318
4396
|
const retry = async () => {
|
|
4319
4397
|
const [entry] = await this.meta.under(intent);
|
|
4320
4398
|
controller.signal.throwIfAborted();
|
|
4321
4399
|
const id2 = entry?.rename?.sourceCleanup;
|
|
4322
4400
|
if (id2 === void 0) this.syncSourceReservation(intent);
|
|
4323
|
-
else if (eligible)
|
|
4401
|
+
else if (eligible) {
|
|
4402
|
+
attempted = true;
|
|
4403
|
+
await this.cleanSource(intent, from, id2, controller.signal);
|
|
4404
|
+
}
|
|
4324
4405
|
};
|
|
4325
4406
|
const attempt = retry().catch(nothing).finally(() => {
|
|
4326
4407
|
clearTimeout(timer);
|
|
@@ -4328,6 +4409,7 @@ var OpfsFs = class {
|
|
|
4328
4409
|
this.retryAfter.set(intent, performance.now() + SOURCE_BACKOFF_MS);
|
|
4329
4410
|
});
|
|
4330
4411
|
await Promise.race([promise, attempt]);
|
|
4412
|
+
return attempted;
|
|
4331
4413
|
}
|
|
4332
4414
|
syncSourceReservation(intent, from) {
|
|
4333
4415
|
const path = from ?? this.pendingSources.get(intent);
|
|
@@ -4340,13 +4422,14 @@ var OpfsFs = class {
|
|
|
4340
4422
|
async reservedOp(name2, args) {
|
|
4341
4423
|
const touched = name2 === "symlink" ? args.slice(1, 2) : args.slice(0, PAIRED.has(name2) ? 2 : 1);
|
|
4342
4424
|
let attempted = false;
|
|
4425
|
+
let deadline;
|
|
4343
4426
|
for (const [intent, source] of this.pendingSources) {
|
|
4344
4427
|
if (!READS.includes(name2) && touched.some((p) => {
|
|
4345
4428
|
const at = normalizePath(p);
|
|
4346
4429
|
return within4(at, source) || REMOVALS.has(name2) && (at === "/" || within4(source, at));
|
|
4347
4430
|
})) {
|
|
4348
|
-
|
|
4349
|
-
attempted = true;
|
|
4431
|
+
deadline ??= performance.now() + SOURCE_RETRY_MS;
|
|
4432
|
+
if (await this.retrySource(intent, source, !attempted, deadline)) attempted = true;
|
|
4350
4433
|
if (this.pendingSources.has(intent)) throw fsError("EBUSY", source);
|
|
4351
4434
|
} else {
|
|
4352
4435
|
const [entry] = await this.meta.under(intent);
|
|
@@ -4386,7 +4469,7 @@ var OpfsFs = class {
|
|
|
4386
4469
|
}
|
|
4387
4470
|
this.forget(from);
|
|
4388
4471
|
this.forget(to);
|
|
4389
|
-
for (const intent of intents) if (intent) await this.
|
|
4472
|
+
for (const intent of intents) if (intent) await this.retireIntent(intent);
|
|
4390
4473
|
} catch {
|
|
4391
4474
|
}
|
|
4392
4475
|
}
|
|
@@ -4422,7 +4505,7 @@ var OpfsFs = class {
|
|
|
4422
4505
|
}
|
|
4423
4506
|
if (!left) {
|
|
4424
4507
|
if ((await this.swapEntry(to))?.kind !== "directory") throw fsError("EIO", to);
|
|
4425
|
-
return this.commitPrivateCopy(from, to, root, intent, new Copies(), backup);
|
|
4508
|
+
return this.commitPrivateCopy(from, to, root, intent, new Copies(this.meta, intent), backup);
|
|
4426
4509
|
}
|
|
4427
4510
|
const staged2 = await this.swapEntry(backup);
|
|
4428
4511
|
if (staged2) {
|
|
@@ -4440,16 +4523,27 @@ var OpfsFs = class {
|
|
|
4440
4523
|
const [mark, placed] = await this.meta.get([from, to]);
|
|
4441
4524
|
if (mark?.vacated && mark.ino !== void 0 && mark.copyCommit?.intent === intent) {
|
|
4442
4525
|
const commit = mark.copyCommit;
|
|
4443
|
-
return this.releaseSource(intent, from, commit.to, mark.ino, rename.lock
|
|
4526
|
+
return this.releaseSource(intent, from, commit.to, mark.ino, rename.lock);
|
|
4527
|
+
}
|
|
4528
|
+
if (mark?.vacated && mark.ino !== void 0 && mark.ino !== root?.ino) {
|
|
4529
|
+
if (!mark.copyCommit)
|
|
4530
|
+
return this.releaseSource(
|
|
4531
|
+
intent,
|
|
4532
|
+
from,
|
|
4533
|
+
to,
|
|
4534
|
+
mark.ino,
|
|
4535
|
+
rename.lock,
|
|
4536
|
+
!root || placed?.ino !== root.ino
|
|
4537
|
+
);
|
|
4538
|
+
return this.retireIntent(intent);
|
|
4444
4539
|
}
|
|
4445
4540
|
const left = await this.real(from);
|
|
4446
|
-
|
|
4447
|
-
return this.releaseSource(intent, from, to, mark.ino, rename.lock);
|
|
4541
|
+
await this.meta.remove([manifestRoot(intent)]);
|
|
4448
4542
|
if (rename.privateCopy) {
|
|
4449
4543
|
if (left) {
|
|
4450
4544
|
const src = await this.locate(from, false);
|
|
4451
4545
|
const dir = await this.locate(parentOf4(to), true);
|
|
4452
|
-
const copies = new Copies();
|
|
4546
|
+
const copies = new Copies(this.meta, intent);
|
|
4453
4547
|
await this.duplicate(
|
|
4454
4548
|
src.handle,
|
|
4455
4549
|
dir.handle,
|
|
@@ -4458,14 +4552,14 @@ var OpfsFs = class {
|
|
|
4458
4552
|
""
|
|
4459
4553
|
);
|
|
4460
4554
|
await this.commitPrivateCopy(from, to, root ?? { ino: inodeOf(from) }, intent, copies);
|
|
4461
|
-
} else await this.
|
|
4555
|
+
} else await this.retireIntent(intent);
|
|
4462
4556
|
return;
|
|
4463
4557
|
}
|
|
4464
4558
|
await this.resumeCoordinatedCopy(intent, rename, left);
|
|
4465
4559
|
}
|
|
4466
4560
|
async resumeCoordinatedCopy(intent, rename, left) {
|
|
4467
4561
|
const { from, to, replace, root } = rename;
|
|
4468
|
-
const copies = new Copies();
|
|
4562
|
+
const copies = new Copies(this.meta, intent);
|
|
4469
4563
|
if (left && replace && await this.real(to))
|
|
4470
4564
|
await PLAIN.rm.call(this, to, { recursive: true });
|
|
4471
4565
|
if (left) {
|
|
@@ -4480,7 +4574,7 @@ var OpfsFs = class {
|
|
|
4480
4574
|
this.forget(from);
|
|
4481
4575
|
this.forget(to);
|
|
4482
4576
|
}
|
|
4483
|
-
const mark = left ? vacatedAt(from, copies.marker(
|
|
4577
|
+
const mark = left ? vacatedAt(from, await copies.manifest?.marker(to)) : void 0;
|
|
4484
4578
|
if ((await this.meta.under(from)).some((entry) => !entry.vacated)) {
|
|
4485
4579
|
await this.meta.move(
|
|
4486
4580
|
from,
|
|
@@ -4494,8 +4588,8 @@ var OpfsFs = class {
|
|
|
4494
4588
|
mark
|
|
4495
4589
|
);
|
|
4496
4590
|
} else if (mark) await this.meta.update(from, () => mark);
|
|
4497
|
-
if (mark) await this.releaseSource(intent, from, to, mark.ino, rename.lock
|
|
4498
|
-
else await this.
|
|
4591
|
+
if (mark) await this.releaseSource(intent, from, to, mark.ino, rename.lock);
|
|
4592
|
+
else await this.retireIntent(intent);
|
|
4499
4593
|
this.remote?.emit({ paths: [], trees: [], moved: { from, to } });
|
|
4500
4594
|
}
|
|
4501
4595
|
async finishRename(entry) {
|
|
@@ -4651,6 +4745,7 @@ var OpfsFs = class {
|
|
|
4651
4745
|
const before = this.fileMoves;
|
|
4652
4746
|
try {
|
|
4653
4747
|
await this.copy(handle, dir, name2, { copies });
|
|
4748
|
+
await copies.manifest?.flush();
|
|
4654
4749
|
} catch (err) {
|
|
4655
4750
|
if (handle.kind === "directory" && this.fileMoves === before) {
|
|
4656
4751
|
await this.io(dir.removeEntry(name2, { recursive: true }));
|
|
@@ -4697,7 +4792,7 @@ var OpfsFs = class {
|
|
|
4697
4792
|
if (await this.moveChild(handle, dir, name2)) return;
|
|
4698
4793
|
return this.copyBytes(handle, dir, name2, options, rest2);
|
|
4699
4794
|
}
|
|
4700
|
-
|
|
4795
|
+
await options.copies?.manifest?.record(await copiedEntry(handle, rest2));
|
|
4701
4796
|
const target = await this.io(dir.getDirectoryHandle(name2, { create: true }));
|
|
4702
4797
|
this.others++;
|
|
4703
4798
|
for await (const child2 of handle.values()) {
|
|
@@ -4706,6 +4801,7 @@ var OpfsFs = class {
|
|
|
4706
4801
|
}
|
|
4707
4802
|
async copyBytes(handle, dir, name2, options, rest2) {
|
|
4708
4803
|
const file = await this.io(handle.getFile());
|
|
4804
|
+
await options.copies?.manifest?.record(await copiedEntry(handle, rest2, file));
|
|
4709
4805
|
const made2 = await this.io(dir.getFileHandle(name2, { create: true }));
|
|
4710
4806
|
const writable3 = await this.io(made2.createWritable());
|
|
4711
4807
|
try {
|
|
@@ -4715,7 +4811,6 @@ var OpfsFs = class {
|
|
|
4715
4811
|
await writable3.abort().catch(nothing);
|
|
4716
4812
|
throw err;
|
|
4717
4813
|
}
|
|
4718
|
-
if (options.copies) options.copies.remaining.push(await copiedEntry(handle, rest2, file));
|
|
4719
4814
|
options.copies?.set(rest2, {
|
|
4720
4815
|
before: options.copies.get(rest2)?.before ?? file.lastModified,
|
|
4721
4816
|
made: made2
|
|
@@ -4857,7 +4952,7 @@ var OpfsFs = class {
|
|
|
4857
4952
|
const entries = await this.meta.all();
|
|
4858
4953
|
const carried = new Set(entries.filter((e) => !e.vacated).map((e) => e.ino));
|
|
4859
4954
|
const checked = entries.filter(
|
|
4860
|
-
(e) => !e.rename && !(e.vacated && carried.has(inodeOf(e.path)))
|
|
4955
|
+
(e) => !e.rename && !e.copyStamp && !(e.vacated && carried.has(inodeOf(e.path)))
|
|
4861
4956
|
);
|
|
4862
4957
|
const real = await this.present(
|
|
4863
4958
|
checked.flatMap((e) => e.link === void 0 ? [e.path] : [e.path, parentOf4(e.path)])
|
|
@@ -10305,7 +10400,7 @@ function satisfies(version, range2) {
|
|
|
10305
10400
|
}
|
|
10306
10401
|
|
|
10307
10402
|
// src/version.ts
|
|
10308
|
-
var KERNEL_VERSION = true ? "1.196.
|
|
10403
|
+
var KERNEL_VERSION = true ? "1.196.45" : "0.0.0-dev";
|
|
10309
10404
|
var OS_RELEASE = "6.0.0-slicc";
|
|
10310
10405
|
function procVersion() {
|
|
10311
10406
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|