@rljson/fs-agent 0.0.49 → 0.0.51
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 +13 -3
- package/dist/fs-agent.js +17 -5
- package/package.json +1 -1
package/dist/fs-agent.d.ts
CHANGED
|
@@ -279,11 +279,21 @@ export declare class FsAgent {
|
|
|
279
279
|
/**
|
|
280
280
|
* The file set of the newest tree any peer has told this node about.
|
|
281
281
|
*
|
|
282
|
-
* Kept so the
|
|
283
|
-
* am I about to announce
|
|
284
|
-
* else's? See the check in `syncToDb`.
|
|
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?
|
|
285
284
|
*/
|
|
286
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;
|
|
287
297
|
/**
|
|
288
298
|
* Files this restore DELETED.
|
|
289
299
|
*
|
package/dist/fs-agent.js
CHANGED
|
@@ -1155,11 +1155,21 @@ class FsAgent {
|
|
|
1155
1155
|
/**
|
|
1156
1156
|
* The file set of the newest tree any peer has told this node about.
|
|
1157
1157
|
*
|
|
1158
|
-
* Kept so the
|
|
1159
|
-
* am I about to announce
|
|
1160
|
-
* else's? See the check in `syncToDb`.
|
|
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?
|
|
1161
1160
|
*/
|
|
1162
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;
|
|
1163
1173
|
/**
|
|
1164
1174
|
* Files this restore DELETED.
|
|
1165
1175
|
*
|
|
@@ -2015,6 +2025,7 @@ ${err.stack}` : String(err);
|
|
|
2015
2025
|
debouncedSync({ type: "safety-rescan" });
|
|
2016
2026
|
};
|
|
2017
2027
|
const debouncedSync = (change) => {
|
|
2028
|
+
if (change?.type === "deleted") this._localDeleteSinceApply = true;
|
|
2018
2029
|
if (change?.type === "safety-rescan" && this._remoteApplyInFlight) {
|
|
2019
2030
|
this._rescanDeferred = true;
|
|
2020
2031
|
return;
|
|
@@ -2030,7 +2041,7 @@ ${err.stack}` : String(err);
|
|
|
2030
2041
|
return;
|
|
2031
2042
|
}
|
|
2032
2043
|
const known = this._lastKnownRemoteFiles;
|
|
2033
|
-
if (known && tree.trees.size > 0) {
|
|
2044
|
+
if (known && !this._localDeleteSinceApply && tree.trees.size > 0) {
|
|
2034
2045
|
const mine = this._getFileContentMap(tree);
|
|
2035
2046
|
if (mine.size < known.size) {
|
|
2036
2047
|
let hasOwn = false;
|
|
@@ -2042,7 +2053,7 @@ ${err.stack}` : String(err);
|
|
|
2042
2053
|
}
|
|
2043
2054
|
if (!hasOwn) {
|
|
2044
2055
|
console.log(
|
|
2045
|
-
`[FsAgent] not announcing ${mine.size} of ${known.size} files —
|
|
2056
|
+
`[FsAgent] not announcing ${mine.size} of ${known.size} files — nothing here was deleted locally, so this is a gap rather than news.`
|
|
2046
2057
|
);
|
|
2047
2058
|
return;
|
|
2048
2059
|
}
|
|
@@ -2526,6 +2537,7 @@ ${err.stack}` : String(err);
|
|
|
2526
2537
|
const postRestoreFiles = this._getFileContentMap(postRestoreTree);
|
|
2527
2538
|
const incomingFiles = this._getFileContentMap(incomingTree);
|
|
2528
2539
|
this._lastKnownRemoteFiles = incomingFiles;
|
|
2540
|
+
this._localDeleteSinceApply = false;
|
|
2529
2541
|
let hasNewsOfOurOwn = false;
|
|
2530
2542
|
for (const path of postRestoreFiles.keys()) {
|
|
2531
2543
|
if (!incomingFiles.has(path)) {
|