Expand description
The in-memory concurrent cache of file states and hashes of one build.
Recording a step and checking the cache both need the BLAKE3 hash of files that
were read, and many steps often read the same files. FileStates keeps, for
each path, the metadata of the regular file there and the hash of its content, in
a [DashMap] that every thread of the build shares, so a file that many steps
depend on is hashed once per build.
An entry is dropped when a step records a write to its path. A lookup also hashes the file again when its current metadata differs from the metadata the entry holds, so a change that no step recorded is never hidden behind a stale hash.
/proc and /sys files that a track pattern matches never go through the
cache: their metadata says nothing about their content, so they are read and
hashed again whenever they are recorded or checked.
FileStates holds the build’s WorkerPool: every hash runs inside it, so
BLAKE3’s parallel hashing of a large file splits its work on the pool, and the
cache check and the recording of observations run their parallel work there too.
Structs§
- File
States - The file states and hashes of one build, shared by every thread.