Expand description
A cache of per-chunk hashes, so a file that has not changed is never read.
Delta sync needs both ends to know the hash of every chunk. Computing those means reading the whole file, which is fine once and absurd on the tenth sync of a tree that never changed: re-sending an unchanged 3.4 GiB tree moved 0.1 MiB but still spent 27 seconds hashing.
So the hashes are remembered. An entry is trusted while the file’s size and
modification time both match what they were when it was hashed, which is the
same bargain rsync and Syncthing make. It is a bargain, not a proof: a file
edited within the timestamp’s resolution and left at the same length would
be missed. Two things bound the damage — the receiver verifies every
completed file against the sender’s hash root before committing it, so a
stale entry surfaces as a failed transfer rather than a corrupt file, and
Config::trust_mtime turns the whole thing off for callers who would rather
pay the read.
Structs§
- Chunk
Index - Chunk hashes for the files under one root.
Constants§
- INDEX_
FILE - Where the cache lives, relative to the root it describes.
Functions§
- mtime_
of - The modification time of
meta, in nanoseconds since the epoch.