@rljson/fs-agent 0.2.1 → 0.2.3
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.api.md +12 -4
- package/README.architecture.md +56 -1
- package/README.md +2 -2
- package/README.public.md +34 -6
- package/README.tests.md +30 -8
- package/dist/README.api.md +12 -4
- package/dist/README.architecture.md +56 -1
- package/dist/README.md +2 -2
- package/dist/README.public.md +34 -6
- package/dist/README.tests.md +30 -8
- package/dist/fs-agent.d.ts +111 -5
- package/dist/fs-agent.js +632 -179
- package/dist/fs-carry.d.ts +40 -0
- package/dist/fs-ignore.d.ts +9 -0
- package/dist/fs-scanner.d.ts +12 -1
- package/dist/fs-send.d.ts +14 -1
- package/dist/fs_agent_version.d.ts +1 -1
- package/package.json +7 -7
package/dist/fs-agent.d.ts
CHANGED
|
@@ -577,6 +577,8 @@ export declare class FsAgent {
|
|
|
577
577
|
* @param conflicted - Paths edited here while away and changed elsewhere.
|
|
578
578
|
* @param copies - Where each moved file went, `path → name`; a path the
|
|
579
579
|
* join could not move has no entry.
|
|
580
|
+
* @param why - `away`: the machine joined the network; `ignore`: it sees
|
|
581
|
+
* paths again that its ignore list had left out.
|
|
580
582
|
*/
|
|
581
583
|
private _signalJoinOutcome;
|
|
582
584
|
/**
|
|
@@ -786,7 +788,10 @@ export declare class FsAgent {
|
|
|
786
788
|
* followed to decide what to remove.
|
|
787
789
|
* @param path - Where the node is to be written.
|
|
788
790
|
* @param want - What the tree says should be there.
|
|
789
|
-
* @
|
|
791
|
+
* @param relativePath - The path in the folder, when restoring into this
|
|
792
|
+
* node's own: an entry there this node ignores is never removed.
|
|
793
|
+
* @returns Whether the place is free for the node now; `false` when an
|
|
794
|
+
* entry this node ignores holds it.
|
|
790
795
|
*/
|
|
791
796
|
/**
|
|
792
797
|
* Whether a path the prune is about to delete is actually the expected file
|
|
@@ -801,6 +806,16 @@ export declare class FsAgent {
|
|
|
801
806
|
* @returns Whether the entry must be kept.
|
|
802
807
|
*/
|
|
803
808
|
private _isSameFileAsExpected;
|
|
809
|
+
/**
|
|
810
|
+
* Whether a restore leaves a node out: what this node does not see, it does
|
|
811
|
+
* not write into its folder — a directory with everything below it. Another
|
|
812
|
+
* node's version of such a path is carried in its edits, never put on its
|
|
813
|
+
* disk. Anywhere else a tree is just a tree.
|
|
814
|
+
* @param meta - The node's meta.
|
|
815
|
+
* @param isOwnRoot - Whether the restore writes into this node's folder.
|
|
816
|
+
* @returns True when the node is not to be written.
|
|
817
|
+
*/
|
|
818
|
+
private _leavesOut;
|
|
804
819
|
private _makeRoomFor;
|
|
805
820
|
static _isInsideRoot(target: string, relativePath: string): boolean;
|
|
806
821
|
private static _isImpossiblePath;
|
|
@@ -950,6 +965,32 @@ export declare class FsAgent {
|
|
|
950
965
|
private _ownContent;
|
|
951
966
|
/** Paths the watcher saw deleted since the own head was authored. */
|
|
952
967
|
private readonly _watched;
|
|
968
|
+
/**
|
|
969
|
+
* What the last refusal held back and is still gone. A refusal holds its
|
|
970
|
+
* files until they are back — see `planAuthoring`. In memory only: after a
|
|
971
|
+
* restart the floors judge what is gone afresh, as before.
|
|
972
|
+
*/
|
|
973
|
+
private _heldBack;
|
|
974
|
+
/**
|
|
975
|
+
* The own head's nodes at the paths this node does not see — see
|
|
976
|
+
* `fs-carry.ts`. Carried into every edit it authors; an apply neither writes
|
|
977
|
+
* nor deletes them. Empty while the head names nothing this node ignores.
|
|
978
|
+
*/
|
|
979
|
+
private _carried;
|
|
980
|
+
/**
|
|
981
|
+
* Paths this node sees again since a pattern left its ignore list, whose
|
|
982
|
+
* version the own head holds is not in the folder yet. Carried until it is —
|
|
983
|
+
* see {@link FsAgent._uncover}.
|
|
984
|
+
*/
|
|
985
|
+
private readonly _uncovered;
|
|
986
|
+
/** A restart found its ignore list changed, and `_uncover` has not run. */
|
|
987
|
+
private _uncoverDue;
|
|
988
|
+
/**
|
|
989
|
+
* The ignore list the state file records: the one the folder is in step
|
|
990
|
+
* with. It becomes the scanner's list once nothing a change of the list
|
|
991
|
+
* uncovered is still missing.
|
|
992
|
+
*/
|
|
993
|
+
private _ignoreOnRecord;
|
|
953
994
|
/** Every chain entry's stamp, as this node learned it. */
|
|
954
995
|
private _stamps?;
|
|
955
996
|
/** The route this agent syncs, once a sync started. */
|
|
@@ -1090,13 +1131,35 @@ export declare class FsAgent {
|
|
|
1090
1131
|
* @returns The head, or `undefined`.
|
|
1091
1132
|
*/
|
|
1092
1133
|
private _persistedHead;
|
|
1134
|
+
/**
|
|
1135
|
+
* The ignore list `.fsagent-state.json` records, if it records one — the
|
|
1136
|
+
* list the folder was in step with when this node last ran.
|
|
1137
|
+
* @returns The list, or `undefined`.
|
|
1138
|
+
*/
|
|
1139
|
+
private _persistedIgnore;
|
|
1140
|
+
/**
|
|
1141
|
+
* `.fsagent-state.json`, read.
|
|
1142
|
+
* @returns What it holds, or `undefined` when it cannot be read.
|
|
1143
|
+
*/
|
|
1144
|
+
private _persistedState;
|
|
1093
1145
|
/**
|
|
1094
1146
|
* Makes `head` this node's head, and remembers it across a restart.
|
|
1095
1147
|
* @param head - The chain entry.
|
|
1096
1148
|
* @param content - The tree it names, `path → blob`.
|
|
1149
|
+
* @param carried - Its nodes at the paths this node does not see.
|
|
1097
1150
|
*/
|
|
1098
1151
|
private _setOwn;
|
|
1099
|
-
/**
|
|
1152
|
+
/**
|
|
1153
|
+
* What a head's tree holds at the paths this node does not see: those its
|
|
1154
|
+
* ignore list leaves out, and those it sees again and does not hold yet.
|
|
1155
|
+
* @param tree - The tree.
|
|
1156
|
+
* @returns The nodes, by path.
|
|
1157
|
+
*/
|
|
1158
|
+
private _carriedOf;
|
|
1159
|
+
/**
|
|
1160
|
+
* Writes {@link AGENT_STATE_FILE}: the own head, the stamp epochs, and the
|
|
1161
|
+
* ignore list the folder is in step with.
|
|
1162
|
+
*/
|
|
1100
1163
|
private _writeState;
|
|
1101
1164
|
/** The stamp epochs the state file holds, as written. */
|
|
1102
1165
|
private _writtenEpochs;
|
|
@@ -1119,9 +1182,10 @@ export declare class FsAgent {
|
|
|
1119
1182
|
*/
|
|
1120
1183
|
private _askForStamp;
|
|
1121
1184
|
/**
|
|
1122
|
-
* Authors an edit for the folder as `
|
|
1123
|
-
* the own head and the edit is honest — see `planAuthoring`.
|
|
1124
|
-
*
|
|
1185
|
+
* Authors an edit for the folder as `scanned` describes it, if it moved past
|
|
1186
|
+
* the own head and the edit is honest — see `planAuthoring`. The paths this
|
|
1187
|
+
* node does not see are carried as the own head holds them.
|
|
1188
|
+
* @param scanned - The folder, as just scanned.
|
|
1125
1189
|
*/
|
|
1126
1190
|
private _author;
|
|
1127
1191
|
/**
|
|
@@ -1160,6 +1224,34 @@ export declare class FsAgent {
|
|
|
1160
1224
|
* @param head - The network's head, or `undefined`.
|
|
1161
1225
|
*/
|
|
1162
1226
|
private _join;
|
|
1227
|
+
/**
|
|
1228
|
+
* Joins the paths this node sees again: a pattern left its ignore list
|
|
1229
|
+
* since it last ran.
|
|
1230
|
+
*
|
|
1231
|
+
* While a path was ignored, this node neither wrote it nor deleted it, so
|
|
1232
|
+
* the folder can lack what the head holds there, or hold a version of its
|
|
1233
|
+
* own that never went anywhere. Authored as they stand, the first would
|
|
1234
|
+
* delete the network's files and the second overwrite them. So these paths
|
|
1235
|
+
* are joined as a joining folder is (`planJoin`): a version of this node's
|
|
1236
|
+
* own is set aside as a copy, one the history removed goes to
|
|
1237
|
+
* {@link RECOVERED_DIR}, one the history never named is new work — and the
|
|
1238
|
+
* head's version is written, and carried until it is there.
|
|
1239
|
+
* @param head - The own head.
|
|
1240
|
+
* @param headTree - Its tree.
|
|
1241
|
+
* @param folderTree - The folder, as just scanned.
|
|
1242
|
+
* @returns Whether anything in the folder was moved aside.
|
|
1243
|
+
*/
|
|
1244
|
+
private _uncover;
|
|
1245
|
+
/**
|
|
1246
|
+
* Writes the head's version of every path `_uncover` is waiting for that is
|
|
1247
|
+
* not in the folder — and stops carrying each one that is, whichever
|
|
1248
|
+
* version: a file somebody saved there meanwhile is their work, and the
|
|
1249
|
+
* next edit says so.
|
|
1250
|
+
*
|
|
1251
|
+
* Asked again with every head this node hears, so a version that could not
|
|
1252
|
+
* be fetched — this node started offline — arrives once it can be.
|
|
1253
|
+
*/
|
|
1254
|
+
private _takeUncovered;
|
|
1163
1255
|
/**
|
|
1164
1256
|
* Hears a head — from an announcement, a bootstrap or a state beacon.
|
|
1165
1257
|
* @param head - The head.
|
|
@@ -1234,8 +1326,11 @@ export declare class FsAgent {
|
|
|
1234
1326
|
* — content `target` holds nowhere else — is not made. Everything else is,
|
|
1235
1327
|
* and the files kept become this node's work, so the folder never holds a
|
|
1236
1328
|
* state the chain does not describe.
|
|
1329
|
+
* The paths this node does not see are neither written nor deleted, and
|
|
1330
|
+
* the guard counts only what the folder holds.
|
|
1237
1331
|
* @param target - Where the folder should end up, `path → blob`.
|
|
1238
1332
|
* @param write - Writes the given paths' `target` versions.
|
|
1333
|
+
* @param carried - `target`'s nodes at the paths this node does not see.
|
|
1239
1334
|
* @returns `applied`; `kept` when the guard kept files `target` lacks;
|
|
1240
1335
|
* `moved` when the folder had moved past the own head.
|
|
1241
1336
|
*/
|
|
@@ -1274,6 +1369,17 @@ export declare class FsAgent {
|
|
|
1274
1369
|
* yet; `refused` when the merge could not be applied.
|
|
1275
1370
|
*/
|
|
1276
1371
|
private _merge;
|
|
1372
|
+
/**
|
|
1373
|
+
* What a merge's result holds at the paths this node does not see: the node
|
|
1374
|
+
* of whichever side's version it kept there — and, for a copy a conflict
|
|
1375
|
+
* made at such a path, a node for the version the copy keeps, which the
|
|
1376
|
+
* merge wrote like any other copy.
|
|
1377
|
+
* @param merged - The merge's result, `path → blob`.
|
|
1378
|
+
* @param theirs - The forked head's content.
|
|
1379
|
+
* @param theirCarried - Its nodes at the paths this node does not see.
|
|
1380
|
+
* @returns The nodes to carry, by path.
|
|
1381
|
+
*/
|
|
1382
|
+
private _mergeCarried;
|
|
1277
1383
|
/**
|
|
1278
1384
|
* Hears the network: announcements, the stamps of this node's own, and the
|
|
1279
1385
|
* hub's state beacon.
|