Persist the per-folder root ETag across restarts (#195) - #196
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #195.
Problem
The root ETag gate (#189, v0.2.10) skips the full
nextcloudcmdreconciliation when the remote tree is unchanged, but the per-folder ETag lived only in the engine's in-memoryetag_slot. After an app restart the slot was empty, so the firstRemoteIntervalof every folder re-scanned fully even with zero remote changes. On the large folders (Fotos ~65k files) that is a full tree re-scan on every launch.Change
Persist the ETag per folder and seed the engine from it:
src/core/etag_store.rs:read_etag(folder_id)/write_etag(folder_id, etag)stored atstate_dir()/etags/<folder_id>. Kept outside the synced folder - writing inside it would be seen by the FsWatcher and could requeue the folder (the Startup pass and queue discipline: folders re-run immediately instead of one clean pass each #181 vector). Reads/writes are best-effort; a missing/stale value degrades to "changed", which reconciles (the safe direction).SyncEngine::newseedsetag_slotfrom the persisted value.etag_store::write_etag) and fires an optionalon_etag_changecallback.RuntimeConfiggainedremote_etags: HashMap<String,String>(serde default + migration parse) for any future wiring, though the engine persists viaetag_storedirectly.Testing
4 new tests (
etag_store, hermetic with injectable base dir) + existing engine ETag tests. Gate: 705 tests, clippy clean, fmt applied.