Expand description
Maintains a persistent index of files that have been previously synced.
The index maps local file paths to their checksums, modification times,
and target album IDs. A sharded design (ShardedSyncIndex) distributes
entries across multiple segment files for lock-free concurrent reads
during parallel scans. On startup, unchanged files are skipped entirely
by comparing stored checksums against the current state.
Structsยง
- Shard ๐
- A single shard of the sync index, holding a subset of entries.
- Sharded
Sync Index - Thread-safe sync index that distributes entries across 16
RwLockshards keyed by path hash. This eliminates the single-lock bottleneck when parallel producers (startup scan, watcher workers) and consumers (library UI sync-state lookups) all contend on the index simultaneously. - Sync
Index ๐Data - Inner serialized structure representing the index files list.
- Sync
Index ๐Data Ref - Borrowed reference of the serialized index for zero-copy writes.
- Sync
Target - Describes the intended album target for a file during sync operations.
- Synced
File Record - Represents a record stored on disk for a synced file, including the last associated album target.
Enumsยง
- Sync
Decision - Indicates the result of comparing a file on disk with the saved sync index.
Constantsยง
- SHARD_
COUNT ๐ - Number of shards for distributing sync index entries.
Functionsยง
- fingerprint_
from_ ๐metadata - Helper to calculate the size and modification timestamp fingerprint of a file.
- load_
entries ๐ - Helper to load all stored sync records from the file.
- migrate_
from_ ๐cache_ dir - Migrate legacy cache-dir synced indices on first launch.
- shard_
for ๐ - Determine which shard index a path belongs to.