@rljson/fs-agent 0.0.53 → 0.0.55
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/fs-agent.d.ts +0 -18
- package/dist/fs-agent.js +5 -42
- package/package.json +1 -1
package/dist/fs-agent.d.ts
CHANGED
|
@@ -276,24 +276,6 @@ export declare class FsAgent {
|
|
|
276
276
|
/** Files written vs left alone by the current {@link restore}. */
|
|
277
277
|
private _restoreWritten;
|
|
278
278
|
private _restoreSkipped;
|
|
279
|
-
/**
|
|
280
|
-
* The file set of the newest tree any peer has told this node about.
|
|
281
|
-
*
|
|
282
|
-
* Kept so the send path can answer the one question a receiver never can:
|
|
283
|
-
* am I about to announce my progress through someone else's state?
|
|
284
|
-
*/
|
|
285
|
-
private _lastKnownRemoteFiles?;
|
|
286
|
-
/**
|
|
287
|
-
* Whether a LOCAL deletion has been seen since the last apply.
|
|
288
|
-
*
|
|
289
|
-
* The discriminator 0.0.49 lacked. A folder smaller than the newest tree
|
|
290
|
-
* this node knows about is either a node still catching up or a node someone
|
|
291
|
-
* deleted files from, and those need opposite treatment — the first must stay
|
|
292
|
-
* quiet, the second must be heard. The shapes are identical; the CAUSE is
|
|
293
|
-
* not, and only this node can see it: a deletion arrives as a watcher event,
|
|
294
|
-
* catching up does not.
|
|
295
|
-
*/
|
|
296
|
-
private _localDeleteSinceApply;
|
|
297
279
|
/**
|
|
298
280
|
* Files this restore DELETED.
|
|
299
281
|
*
|
package/dist/fs-agent.js
CHANGED
|
@@ -1152,24 +1152,6 @@ class FsAgent {
|
|
|
1152
1152
|
/** Files written vs left alone by the current {@link restore}. */
|
|
1153
1153
|
_restoreWritten = 0;
|
|
1154
1154
|
_restoreSkipped = 0;
|
|
1155
|
-
/**
|
|
1156
|
-
* The file set of the newest tree any peer has told this node about.
|
|
1157
|
-
*
|
|
1158
|
-
* Kept so the send path can answer the one question a receiver never can:
|
|
1159
|
-
* am I about to announce my progress through someone else's state?
|
|
1160
|
-
*/
|
|
1161
|
-
_lastKnownRemoteFiles;
|
|
1162
|
-
/**
|
|
1163
|
-
* Whether a LOCAL deletion has been seen since the last apply.
|
|
1164
|
-
*
|
|
1165
|
-
* The discriminator 0.0.49 lacked. A folder smaller than the newest tree
|
|
1166
|
-
* this node knows about is either a node still catching up or a node someone
|
|
1167
|
-
* deleted files from, and those need opposite treatment — the first must stay
|
|
1168
|
-
* quiet, the second must be heard. The shapes are identical; the CAUSE is
|
|
1169
|
-
* not, and only this node can see it: a deletion arrives as a watcher event,
|
|
1170
|
-
* catching up does not.
|
|
1171
|
-
*/
|
|
1172
|
-
_localDeleteSinceApply = false;
|
|
1173
1155
|
/**
|
|
1174
1156
|
* Files this restore DELETED.
|
|
1175
1157
|
*
|
|
@@ -2025,7 +2007,6 @@ ${err.stack}` : String(err);
|
|
|
2025
2007
|
debouncedSync({ type: "safety-rescan" });
|
|
2026
2008
|
};
|
|
2027
2009
|
const debouncedSync = (change) => {
|
|
2028
|
-
if (change?.type === "deleted") this._localDeleteSinceApply = true;
|
|
2029
2010
|
if (change?.type === "safety-rescan" && this._remoteApplyInFlight) {
|
|
2030
2011
|
this._rescanDeferred = true;
|
|
2031
2012
|
return;
|
|
@@ -2040,25 +2021,6 @@ ${err.stack}` : String(err);
|
|
|
2040
2021
|
if (contentKey === this._lastSentContentKey) {
|
|
2041
2022
|
return;
|
|
2042
2023
|
}
|
|
2043
|
-
const known = this._lastKnownRemoteFiles;
|
|
2044
|
-
if (known && !this._localDeleteSinceApply && tree.trees.size > 0) {
|
|
2045
|
-
const mine = this._getFileContentMap(tree);
|
|
2046
|
-
if (mine.size < known.size) {
|
|
2047
|
-
let hasOwn = false;
|
|
2048
|
-
for (const path of mine.keys()) {
|
|
2049
|
-
if (!known.has(path)) {
|
|
2050
|
-
hasOwn = true;
|
|
2051
|
-
break;
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
if (!hasOwn) {
|
|
2055
|
-
console.log(
|
|
2056
|
-
`[FsAgent] not announcing ${mine.size} of ${known.size} files — nothing here was deleted locally, so this is a gap rather than news.`
|
|
2057
|
-
);
|
|
2058
|
-
return;
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
2024
|
const dbAdapter = new FsDbAdapter(db, treeKey);
|
|
2063
2025
|
const parentRef = this._currentRef;
|
|
2064
2026
|
const previous = await this._ancestryPrevious(
|
|
@@ -2505,12 +2467,15 @@ ${err.stack}` : String(err);
|
|
|
2505
2467
|
const ancestryExpected = this._resolveConflicts;
|
|
2506
2468
|
const declaresAncestry = (predecessorRefs?.length ?? 0) > 0;
|
|
2507
2469
|
const ancestryIsCarried = connector.syncConfig?.causalOrdering === true;
|
|
2508
|
-
const
|
|
2470
|
+
const statesIAmIn = [this._currentRef, this._lastAppliedRef].filter(
|
|
2471
|
+
(r) => r !== void 0
|
|
2472
|
+
);
|
|
2473
|
+
const senderSawMyState = !ancestryIsCarried || !declaresAncestry || statesIAmIn.some((r) => predecessorRefs.includes(r));
|
|
2509
2474
|
const withholdPrune = restoreOptions?.cleanTarget && (ancestryExpected && !declaresAncestry || !senderSawMyState);
|
|
2510
2475
|
const applyOptions = withholdPrune ? { ...restoreOptions, cleanTarget: false } : restoreOptions;
|
|
2511
2476
|
if (applyOptions !== restoreOptions) {
|
|
2512
2477
|
console.warn(
|
|
2513
|
-
`[FsAgent] ref=${treeRef.slice(0, 8)}… ` + (declaresAncestry ? `descends from ${predecessorRefs?.map((r) => r.slice(0, 8)).join(", ")}, not from
|
|
2478
|
+
`[FsAgent] ref=${treeRef.slice(0, 8)}… ` + (declaresAncestry ? `descends from ${predecessorRefs?.map((r) => r.slice(0, 8)).join(", ")}, not from a state this node is in (${statesIAmIn.map((r) => r.slice(0, 8)).join(", ") || "none"})` : "declares no ancestry") + ` — applying additively, not pruning.`
|
|
2514
2479
|
);
|
|
2515
2480
|
}
|
|
2516
2481
|
if (restoreOptions?.cleanTarget) {
|
|
@@ -2539,8 +2504,6 @@ ${err.stack}` : String(err);
|
|
|
2539
2504
|
this._persistCurrentRef(postRestoreRef);
|
|
2540
2505
|
const postRestoreFiles = this._getFileContentMap(postRestoreTree);
|
|
2541
2506
|
const incomingFiles = this._getFileContentMap(incomingTree);
|
|
2542
|
-
this._lastKnownRemoteFiles = incomingFiles;
|
|
2543
|
-
this._localDeleteSinceApply = false;
|
|
2544
2507
|
let hasNewsOfOurOwn = false;
|
|
2545
2508
|
for (const path of postRestoreFiles.keys()) {
|
|
2546
2509
|
if (!incomingFiles.has(path)) {
|