pub struct RunKey { /* private fields */ }Expand description
Everything about a run that every file’s key shares.
Computed once and reused, because hashing the ruleset and config per file would repeat identical work thousands of times per run.
Implementations§
Source§impl RunKey
impl RunKey
Sourcepub fn new(
engine_version: &str,
host_api_version: u32,
ruleset_hash: &[u8],
config_hash: &[u8],
grammars: &[GrammarKey],
) -> Self
pub fn new( engine_version: &str, host_api_version: u32, ruleset_hash: &[u8], config_hash: &[u8], grammars: &[GrammarKey], ) -> Self
Fold in everything that is constant for a run.
engine_version should be major.minor only: a patch release by definition changes no
behavior a rule can observe, and invalidating every cache on it would make patch
upgrades expensive for no benefit.
Sourcepub fn for_dated_file(
&self,
path: &str,
content: &ContentHash,
today: &str,
) -> CacheKey
pub fn for_dated_file( &self, path: &str, content: &ContentHash, today: &str, ) -> CacheKey
The key for a file whose result depends on the date.
Only for a file carrying an expiring suppression. Folding the date into every key would invalidate the whole cache daily for the sake of the handful of files that have one — and leaving it out entirely would serve an expired suppression as though it were still in force, which is the one thing an expiry exists to prevent.
Sourcepub fn for_file(&self, path: &str, content: &ContentHash) -> CacheKey
pub fn for_file(&self, path: &str, content: &ContentHash) -> CacheKey
The key for one file.
The path is an input as well as the content, because path gates make results path-sensitive — a moved file with identical bytes is not a hit.