@vrtmrz/livesync-commonlib 0.4.0 → 0.4.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.
- package/dist/common/models/fileaccess.definition.d.ts +35 -0
- package/dist/common/models/fileaccess.definition.js +11 -0
- package/dist/common/typeUtils.d.ts +27 -4
- package/dist/interfaces/FileHandler.d.ts +1 -1
- package/dist/managers/StorageEventManager/admission.d.ts +50 -0
- package/dist/managers/StorageEventManager/admission.js +129 -0
- package/dist/managers/StorageEventManager/batching.d.ts +93 -0
- package/dist/managers/StorageEventManager/batching.js +97 -0
- package/dist/managers/StorageEventManager/operations.d.ts +142 -0
- package/dist/managers/StorageEventManager/operations.js +69 -0
- package/dist/managers/StorageEventManager/processing.d.ts +63 -0
- package/dist/managers/StorageEventManager/processing.js +94 -0
- package/dist/managers/StorageEventManager/queue.d.ts +73 -0
- package/dist/managers/StorageEventManager/queue.js +113 -0
- package/dist/managers/StorageEventManager/retry.d.ts +33 -0
- package/dist/managers/StorageEventManager/retry.js +31 -0
- package/dist/managers/StorageEventManager/snapshot.d.ts +46 -0
- package/dist/managers/StorageEventManager/snapshot.js +53 -0
- package/dist/managers/StorageEventManager/state.d.ts +155 -0
- package/dist/managers/StorageEventManager/state.js +105 -0
- package/dist/managers/StorageEventManager/watching.d.ts +93 -0
- package/dist/managers/StorageEventManager/watching.js +36 -0
- package/dist/managers/StorageEventManager.d.ts +303 -83
- package/dist/managers/StorageEventManager.js +457 -547
- package/dist/serviceModules/ServiceFileHandlerBase/chunks.d.ts +10 -0
- package/dist/serviceModules/ServiceFileHandlerBase/chunks.js +51 -0
- package/dist/serviceModules/ServiceFileHandlerBase/context.d.ts +168 -0
- package/dist/serviceModules/ServiceFileHandlerBase/context.js +15 -0
- package/dist/serviceModules/ServiceFileHandlerBase/deletion.d.ts +40 -0
- package/dist/serviceModules/ServiceFileHandlerBase/deletion.js +142 -0
- package/dist/serviceModules/ServiceFileHandlerBase/events.d.ts +20 -0
- package/dist/serviceModules/ServiceFileHandlerBase/events.js +205 -0
- package/dist/serviceModules/ServiceFileHandlerBase/locking.d.ts +23 -0
- package/dist/serviceModules/ServiceFileHandlerBase/locking.js +51 -0
- package/dist/serviceModules/ServiceFileHandlerBase/protection.d.ts +26 -0
- package/dist/serviceModules/ServiceFileHandlerBase/protection.js +67 -0
- package/dist/serviceModules/ServiceFileHandlerBase/provenance.d.ts +174 -0
- package/dist/serviceModules/ServiceFileHandlerBase/provenance.js +182 -0
- package/dist/serviceModules/ServiceFileHandlerBase/reflection.d.ts +48 -0
- package/dist/serviceModules/ServiceFileHandlerBase/reflection.js +344 -0
- package/dist/serviceModules/ServiceFileHandlerBase/renaming.d.ts +23 -0
- package/dist/serviceModules/ServiceFileHandlerBase/renaming.js +77 -0
- package/dist/serviceModules/ServiceFileHandlerBase/saving.d.ts +40 -0
- package/dist/serviceModules/ServiceFileHandlerBase/saving.js +306 -0
- package/dist/serviceModules/ServiceFileHandlerBase/scanning.d.ts +22 -0
- package/dist/serviceModules/ServiceFileHandlerBase/scanning.js +93 -0
- package/dist/serviceModules/ServiceFileHandlerBase/selection.d.ts +58 -0
- package/dist/serviceModules/ServiceFileHandlerBase/selection.js +94 -0
- package/dist/serviceModules/ServiceFileHandlerBase/storage.d.ts +55 -0
- package/dist/serviceModules/ServiceFileHandlerBase/storage.js +37 -0
- package/dist/serviceModules/ServiceFileHandlerBase.d.ts +119 -182
- package/dist/serviceModules/ServiceFileHandlerBase.js +182 -1402
- package/docs/conflict-resolution.md +3 -1
- package/docs/development.md +36 -0
- package/docs/offline-scanner.md +5 -1
- package/docs/p2p-transport-lifecycle.md +8 -1
- package/docs/storage-events-and-reflection.md +203 -19
- package/package.json +1 -1
|
@@ -1,217 +1,154 @@
|
|
|
1
1
|
import type { AnyEntry, FilePath, FilePathWithPrefix, MetaEntry, UXFileInfo, UXFileInfoStub, UXInternalFileInfoStub } from "../common/types.js";
|
|
2
|
-
import type { LiveSyncEventHub } from "../hub/hub.js";
|
|
3
2
|
import type { IFileHandler, StoreFileOptions } from "../interfaces/FileHandler.js";
|
|
4
|
-
import { ServiceModuleBase } from "./ServiceModuleBase.js";
|
|
5
|
-
import type { APIService } from "../services/base/APIService.js";
|
|
6
3
|
import type { DatabaseFileAccess } from "../interfaces/DatabaseFileAccess.js";
|
|
7
4
|
import type { StorageAccess } from "../interfaces/StorageAccess.js";
|
|
8
|
-
import
|
|
9
|
-
import type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import type { SettingService } from "../services/base/SettingService.js";
|
|
13
|
-
import type { VaultService } from "../services/base/VaultService.js";
|
|
14
|
-
import type { FileReflectionProvenance } from "../interfaces/FileReflectionProvenance.js";
|
|
15
|
-
export interface ServiceFileHandlerDependencies {
|
|
16
|
-
events: LiveSyncEventHub;
|
|
17
|
-
API: APIService;
|
|
18
|
-
databaseFileAccess: DatabaseFileAccess;
|
|
19
|
-
storageAccess: StorageAccess;
|
|
20
|
-
fileProcessing: FileProcessingService;
|
|
21
|
-
replication: ReplicationService;
|
|
22
|
-
conflict: ConflictService;
|
|
23
|
-
path: PathService;
|
|
24
|
-
setting: SettingService;
|
|
25
|
-
vault: VaultService;
|
|
26
|
-
/**
|
|
27
|
-
* Device-local record of the exact database revision reflected in storage.
|
|
28
|
-
*
|
|
29
|
-
* This is optional for compatibility hosts. Maintained hosts should provide
|
|
30
|
-
* it so edits made while a document is conflicted extend the displayed
|
|
31
|
-
* branch instead of whichever branch PouchDB currently selects as winner.
|
|
32
|
-
* The host must finish opening its backing store before it dispatches file
|
|
33
|
-
* or replication events; provenance does not hide lifecycle violations by
|
|
34
|
-
* waiting for readiness.
|
|
35
|
-
*/
|
|
36
|
-
fileReflectionProvenance?: FileReflectionProvenance;
|
|
37
|
-
}
|
|
5
|
+
import { ServiceModuleBase } from "./ServiceModuleBase.js";
|
|
6
|
+
import { type ServiceFileHandlerDependencies } from "./ServiceFileHandlerBase/context.js";
|
|
7
|
+
export type { ServiceFileHandlerDependencies } from "./ServiceFileHandlerBase/context.js";
|
|
8
|
+
/** Compatibility facade retaining public host methods while delegating file responsibilities. */
|
|
38
9
|
export declare abstract class ServiceFileHandlerBase extends ServiceModuleBase<ServiceFileHandlerDependencies> implements IFileHandler {
|
|
39
|
-
|
|
40
|
-
private databaseFileAccess;
|
|
41
|
-
|
|
42
|
-
private
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
10
|
+
/** Database service captured at construction; the public getter remains virtual. */
|
|
11
|
+
private readonly databaseFileAccess;
|
|
12
|
+
/** Storage service captured at construction; the public getter remains virtual. */
|
|
13
|
+
private readonly storageAccess;
|
|
14
|
+
/** Captured services, per-instance state, and the dynamic public host boundary. */
|
|
15
|
+
private readonly context;
|
|
16
|
+
/**
|
|
17
|
+
* Capture services and register the existing storage and replication handlers.
|
|
18
|
+
* @param services - Host-owned services, copied by value into this facade and its context.
|
|
19
|
+
* @remarks Replication registration binds the current subclass method at construction,
|
|
20
|
+
* retaining the original callback capture semantics. No database or storage I/O starts here.
|
|
21
|
+
*/
|
|
49
22
|
constructor(services: ServiceFileHandlerDependencies);
|
|
23
|
+
/**
|
|
24
|
+
* Expose the database service captured when the facade was constructed.
|
|
25
|
+
* @returns The captured database access service.
|
|
26
|
+
* @remarks Responsibility functions resolve this virtual getter at each original access site.
|
|
27
|
+
*/
|
|
50
28
|
get db(): DatabaseFileAccess;
|
|
29
|
+
/**
|
|
30
|
+
* Expose the storage service captured when the facade was constructed.
|
|
31
|
+
* @returns The captured storage access service.
|
|
32
|
+
* @remarks Responsibility functions resolve this virtual getter at each original access site.
|
|
33
|
+
*/
|
|
51
34
|
get storage(): StorageAccess;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
private getProvenBaseRevision;
|
|
59
|
-
/**
|
|
60
|
-
* Classify a storage read against its displayed database branch.
|
|
61
|
-
*
|
|
62
|
-
* A recorded revision identifies the branch and therefore takes precedence
|
|
63
|
-
* over byte matches. Without a readable base, only current live leaves are
|
|
64
|
-
* considered. Any match avoids a duplicate write, but only a unique match
|
|
65
|
-
* identifies provenance; no match is `unknown`.
|
|
66
|
-
* `preferredPath` selects the provenance key during a rename, and
|
|
67
|
-
* `currentLoaded` supplies an already decoded candidate body when available.
|
|
68
|
-
* A valid saved content hash can prove unchanged bytes after revision
|
|
69
|
-
* pruning. It cannot reconstruct ancestry for an edited file.
|
|
70
|
-
*/
|
|
71
|
-
private classifyStorageContent;
|
|
72
|
-
/** Record provenance only when storage matches one unambiguous live leaf. */
|
|
73
|
-
private rememberMatchingLeaf;
|
|
74
|
-
/**
|
|
75
|
-
* Read the raw provenance value used by an optimistic storage snapshot.
|
|
76
|
-
* Unlike `getProvenance`, this does not validate or remove the referenced
|
|
77
|
-
* database revision. Recovery callers require a readable value so a store
|
|
78
|
-
* failure cannot be mistaken for absent provenance.
|
|
79
|
-
*/
|
|
80
|
-
private readProvenanceSnapshot;
|
|
81
|
-
/**
|
|
82
|
-
* Check that storage still has the same path, bytes, timestamp, and
|
|
83
|
-
* provenance as a previously captured snapshot.
|
|
84
|
-
*/
|
|
85
|
-
private currentStorageSnapshotMatches;
|
|
86
|
-
/**
|
|
87
|
-
* Publish provenance after a durable database write if storage is unchanged.
|
|
88
|
-
* A failed revalidation leaves the database revision stored and asks the
|
|
89
|
-
* caller to reread storage before proceeding.
|
|
90
|
-
*/
|
|
91
|
-
private finaliseStoredRevision;
|
|
92
|
-
/**
|
|
93
|
-
* Reread storage after a restored startup snapshot changed and retry a save.
|
|
94
|
-
* The bounded counter prevents an unstable file from causing an endless
|
|
95
|
-
* startup loop; the next event or scan can reconcile a final refusal.
|
|
96
|
-
*/
|
|
97
|
-
private retryCurrentStorage;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve an entry through the captured host path service.
|
|
37
|
+
* @param entry - The database metadata being processed.
|
|
38
|
+
* @returns The path reported by the captured path service.
|
|
39
|
+
* @remarks Resolve through the path service captured at construction. This synchronous method acquires no document lock.
|
|
40
|
+
*/
|
|
98
41
|
getPath(entry: AnyEntry): FilePathWithPrefix;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve a storage path through the path service and remove its namespace prefix.
|
|
44
|
+
* @param entry - The database metadata being processed.
|
|
45
|
+
* @returns The path without a storage namespace prefix.
|
|
46
|
+
* @remarks Resolve through the captured path service independently of getPath overrides, then strip the namespace. No document lock is acquired.
|
|
47
|
+
*/
|
|
99
48
|
getPathWithoutPrefix(entry: AnyEntry): FilePathWithPrefix;
|
|
49
|
+
/**
|
|
50
|
+
* Reuse a supplied body or acquire the current content through storage.
|
|
51
|
+
* @param file - The supplied storage observation; its body is reused when present.
|
|
52
|
+
* @returns The supplied or acquired complete file; missing content rejects the operation.
|
|
53
|
+
* @remarks This public reader acquires no document lock. It reuses a supplied body or reads storage, and missing/read failures reject its promise.
|
|
54
|
+
*/
|
|
100
55
|
readFileFromStub(file: UXFileInfoStub | UXFileInfo): Promise<UXFileInfo>;
|
|
56
|
+
/**
|
|
57
|
+
* Offer a metadata-only scan hint without certifying bytes or changing provenance.
|
|
58
|
+
* @param info - The supplied file observation or path.
|
|
59
|
+
* @param expected - The database metadata expected by this scan.
|
|
60
|
+
* @returns Whether the scan may skip this unchanged metadata observation.
|
|
61
|
+
* @remarks Acquire the document lock while checking a metadata-only hint. No revision or file content is written; inspection failures are logged and return false.
|
|
62
|
+
*/
|
|
101
63
|
canSkipUnchangedFile(info: UXFileInfoStub, expected: MetaEntry): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Record an unchanged current revision after rechecking storage and database evidence.
|
|
66
|
+
* @param info - The supplied file observation or path.
|
|
67
|
+
* @param expectedRevision - The exact revision the scan expects to remain current.
|
|
68
|
+
* @returns Whether the exact still-current revision was recorded without writing file content.
|
|
69
|
+
* @remarks Acquire the document lock before attempting an evidence-only provenance update. Missing Chunks follow the settings-controlled retrieval policy. No Metadata revision or file content is written; inspection/store failures are logged and return false.
|
|
70
|
+
*/
|
|
102
71
|
tryRecordUntrackedFileRevision(info: UXFileInfoStub | UXFileInfo, expectedRevision: string): Promise<boolean>;
|
|
103
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Save ordinary storage content under its document lock.
|
|
74
|
+
* @param info - The supplied file observation or path.
|
|
75
|
+
* @param force - Whether the existing force policy bypasses ordinary unchanged-content checks.
|
|
76
|
+
* @param onlyChunks - Whether to repair chunks without creating a document revision.
|
|
77
|
+
* @param options - The existing recovery revalidation option for this save.
|
|
78
|
+
* @returns True when current bytes are represented or chunk repair succeeds; false for refused or unstable observations.
|
|
79
|
+
* @remarks Acquire the document lock and retain deferred post-lock conflict hooks. Ordinary revision writes reuse the captured body; legacy-evidence upgrades and recovery retain their existing validation reads. Provenance publication is best-effort.
|
|
80
|
+
*/
|
|
104
81
|
storeFileToDB(info: UXFileInfoStub | UXFileInfo | UXInternalFileInfoStub | FilePathWithPrefix, force?: boolean, onlyChunks?: boolean, options?: StoreFileOptions): Promise<boolean>;
|
|
105
|
-
storeFileToDBWithBaseRevision(info: UXFileInfoStub | UXFileInfo | FilePathWithPrefix, baseRevision: string, createIfDifferent?: boolean): Promise<boolean>;
|
|
106
82
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
83
|
+
* Save current bytes under one selected live database revision.
|
|
84
|
+
* @param info - The supplied file observation or path.
|
|
85
|
+
* @param baseRevision - The exact selected live database revision.
|
|
86
|
+
* @param createIfDifferent - Whether differing bytes may create a child of the selected revision.
|
|
87
|
+
* @returns True when matching bytes are certified or a selected-base child is stored; false when the live-base or content condition refuses it.
|
|
88
|
+
* @remarks Acquire the document lock and reject a selected base that is no longer live. Matching bytes or a new selected-base child may complete; provenance publication is best-effort.
|
|
110
89
|
*/
|
|
111
|
-
|
|
90
|
+
storeFileToDBWithBaseRevision(info: UXFileInfoStub | UXFileInfo | FilePathWithPrefix, baseRevision: string, createIfDifferent?: boolean): Promise<boolean>;
|
|
112
91
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
92
|
+
* Record a storage deletion under the corresponding document lock.
|
|
93
|
+
* @param info - The supplied file observation or path.
|
|
94
|
+
* @returns True after deletion or conservative conflict preservation; false for absent/deleted records or a refused write.
|
|
95
|
+
* @remarks Acquire the source document lock. Unknown conflict ancestry is preserved for review; database errors reject and optional provenance cleanup remains best-effort.
|
|
117
96
|
*/
|
|
118
|
-
private storeFileToDBFromRevision;
|
|
119
97
|
deleteFileFromDB(info: UXFileInfoStub | UXInternalFileInfoStub | FilePath): Promise<boolean>;
|
|
120
|
-
/** Complete a validated storage deletion when its database effect is already represented. */
|
|
121
|
-
private deleteFileFromDBIfPresent;
|
|
122
98
|
/**
|
|
123
|
-
* Record a
|
|
124
|
-
*
|
|
99
|
+
* Record a rename under both source and destination document locks.
|
|
100
|
+
* @param info - The destination file observation, optionally already containing its body.
|
|
101
|
+
* @param oldPath - The rename source path whose branch must be preserved or deleted safely.
|
|
102
|
+
* @returns True after target/source handling or conservative source preservation; false on target collision or refused work.
|
|
103
|
+
* @remarks Acquire deduplicated source and target document locks. Save the target before guarded source cleanup; unknown source ancestry is preserved for review.
|
|
125
104
|
*/
|
|
126
|
-
private deleteFileFromDBCore;
|
|
127
105
|
renameFileInDB(info: UXFileInfoStub | UXFileInfo, oldPath: FilePath | FilePathWithPrefix): Promise<boolean>;
|
|
128
106
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
107
|
+
* Delete a selected revision under its document lock.
|
|
108
|
+
* @param info - The supplied file observation or path.
|
|
109
|
+
* @param rev - The exact selected database revision.
|
|
110
|
+
* @returns The database deletion result; matching provenance is cleared only after success.
|
|
111
|
+
* @remarks Acquire the document lock and delete the selected revision. Matching provenance clearing is attempted best-effort only after successful deletion.
|
|
132
112
|
*/
|
|
133
|
-
private renameFileInDBCore;
|
|
134
113
|
deleteRevisionFromDB(info: UXFileInfoStub | FilePath | FilePathWithPrefix, rev: string): Promise<boolean | undefined>;
|
|
135
|
-
/**
|
|
136
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Run the legacy delete-and-reflect resolution under one document lock.
|
|
116
|
+
* @param info - The supplied file observation or path.
|
|
117
|
+
* @param rev - The exact selected database revision.
|
|
118
|
+
* @returns False on refusal; the existing undefined result on successful legacy completion.
|
|
119
|
+
* @remarks Acquire the document lock for the existing metadata-capture, deletion, reflection, and best-effort-provenance-clear sequence. Operation errors retain precedence over post-lock hook errors.
|
|
120
|
+
*/
|
|
137
121
|
resolveConflictedByDeletingRevision(info: UXFileInfoStub | FilePath, rev: string): Promise<boolean | undefined>;
|
|
138
122
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
123
|
+
* Reflect one selected live revision under the storage document lock.
|
|
124
|
+
* @param info - The supplied file observation or path.
|
|
125
|
+
* @param rev - The exact selected database revision.
|
|
126
|
+
* @param force - Whether the existing force policy bypasses ordinary unchanged-content checks.
|
|
127
|
+
* @returns The selected live leaf reflection result, or false if the selected revision is no longer live.
|
|
128
|
+
* @remarks Acquire the document lock and validate that the selected revision remains live before protected reflection. Refusals return false; operation errors reject.
|
|
141
129
|
*/
|
|
142
|
-
private resolveConflictedByDeletingRevisionCore;
|
|
143
130
|
dbToStorageWithSpecificRev(info: UXFileInfoStub | UXFileInfo | FilePath | FilePathWithPrefix | null, rev: string, force?: boolean): Promise<boolean>;
|
|
144
131
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
132
|
+
* Fetch and reflect the current database revision under its document lock.
|
|
133
|
+
* @param entryInfo - Current metadata or a path from which metadata is loaded.
|
|
134
|
+
* @param info - The supplied file observation or path.
|
|
135
|
+
* @param force - Whether the existing force policy bypasses ordinary unchanged-content checks.
|
|
136
|
+
* @returns True after reflection or a safe conflict/absence skip; false on unreadable or unsafe observations.
|
|
137
|
+
* @remarks Acquire the document lock before fetching current metadata and protected reflection. Safe skips may return true without writing a file; operation errors reject.
|
|
147
138
|
*/
|
|
148
|
-
private dbToStorageWithSpecificRevCore;
|
|
149
139
|
dbToStorage(entryInfo: MetaEntry | FilePathWithPrefix, info: UXFileInfoStub | UXFileInfo | FilePath | null, force?: boolean): Promise<boolean>;
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
|
|
156
|
-
* destructive operation.
|
|
157
|
-
*/
|
|
158
|
-
private applyDatabaseEntryToStorage;
|
|
159
|
-
/**
|
|
160
|
-
* Preserve storage bytes before an incoming reflection can replace them.
|
|
161
|
-
*
|
|
162
|
-
* The initial read and provenance form one candidate snapshot. Classification
|
|
163
|
-
* gives a recorded branch priority, deduplicates matching live leaves, or
|
|
164
|
-
* creates an independent root for unknown origin. Optional `incomingContent` avoids
|
|
165
|
-
* re-reading an already loaded incoming body. Storage is revalidated before
|
|
166
|
-
* and after the database write; `preserved: true` stops the incoming write,
|
|
167
|
-
* while a returned `snapshot` lets the caller continue only after revalidation.
|
|
168
|
-
*/
|
|
169
|
-
private preserveUnsyncedStorageAsConflict;
|
|
170
|
-
/**
|
|
171
|
-
* Repeat overwrite protection from a fresh storage read after a snapshot
|
|
172
|
-
* becomes stale. Existing conflicts may defer reflection and request an
|
|
173
|
-
* open-only check while leaving the current storage untouched.
|
|
174
|
-
*/
|
|
175
|
-
private recheckIncomingStorage;
|
|
176
|
-
/**
|
|
177
|
-
* Re-read database metadata immediately before reflecting an incoming entry.
|
|
178
|
-
* If the current revision advanced, recurse with fresh storage; force and
|
|
179
|
-
* explicitly allowed conflict writes retain the caller's selected entry.
|
|
180
|
-
* `incomingRetry` bounds repeated database churn.
|
|
181
|
-
*/
|
|
182
|
-
private reconcileAdvancedIncomingRevision;
|
|
183
|
-
private _anyHandlerProcessesFileEvent;
|
|
184
|
-
private canRecordStorageDeletion;
|
|
185
|
-
/**
|
|
186
|
-
* Serialise work by every document ID represented by the supplied paths.
|
|
187
|
-
* IDs are deduplicated and sorted so aliases take one lock and cross-document renames have one order.
|
|
188
|
-
* The callback runs under those locks and must use core methods; conflict
|
|
189
|
-
* hooks requested inside it are deferred until all locks have been released.
|
|
190
|
-
*/
|
|
191
|
-
private serializedByFileEventPaths;
|
|
192
|
-
/**
|
|
193
|
-
* Queue a conflict hook while its document lock is held, or run it directly
|
|
194
|
-
* when no matching lock is active. Preserve `ifOpen` across deferral.
|
|
195
|
-
*/
|
|
196
|
-
private queueConflictCheckFor;
|
|
197
|
-
/**
|
|
198
|
-
* Revalidate a persisted storage operation against the current storage state.
|
|
199
|
-
*
|
|
200
|
-
* Snapshot entries preserve operation intent and ordering only. Their file
|
|
201
|
-
* stub, timestamps, and existence assumptions can be stale after a restart.
|
|
202
|
-
* Current inclusion is therefore read from storage, while destructive work
|
|
203
|
-
* is allowed only after current absence has been observed. Store and rename
|
|
204
|
-
* actions use the fresh reread with bounded retry because no later watcher
|
|
205
|
-
* event is guaranteed after startup reconciliation.
|
|
206
|
-
*/
|
|
207
|
-
private _processRestoredFileEvent;
|
|
208
|
-
private _planRestoredFileEvent;
|
|
209
|
-
private _planRestoredRename;
|
|
210
|
-
private getExactCurrentFile;
|
|
211
|
-
private isCurrentFileSelected;
|
|
212
|
-
private isCurrentPathSelected;
|
|
213
|
-
private canApplyRestoredDeletion;
|
|
214
|
-
private logRestoredEventValidationFailure;
|
|
140
|
+
/**
|
|
141
|
+
* Select and reflect a replicated document while retaining host override dispatch.
|
|
142
|
+
* @param entry - The database metadata being processed.
|
|
143
|
+
* @returns Whether replication reflection completed; excluded or unsafe documents retain a false result.
|
|
144
|
+
* @remarks Acquire the related document lock before selection and reflection. Constructor registration captures the current subclass override with bind; internal public seams remain live at use time.
|
|
145
|
+
*/
|
|
215
146
|
_anyProcessReplicatedDoc(entry: MetaEntry): Promise<boolean>;
|
|
147
|
+
/**
|
|
148
|
+
* Repair missing chunks with at most ten acquired file operations at a time.
|
|
149
|
+
* @param showingNotice - Whether progress uses notice-level messages instead of informational messages.
|
|
150
|
+
* @returns Completion after all selected tasks settle. Per-file save errors are logged and swallowed; listing, selection, acquisition, progress, or logger failures can still reject.
|
|
151
|
+
* @remarks Each file uses the dynamic public save seam and its document lock. Up to ten permits are acquired; progress remains before the original guarded body, preserving its existing cleanup semantics.
|
|
152
|
+
*/
|
|
216
153
|
createAllChunks(showingNotice?: boolean): Promise<void>;
|
|
217
154
|
}
|