Skip to main content

write_cache

Function write_cache 

Source
pub fn write_cache<const FULL_ROUNDS: usize, G, Srs>(
    identifier: &str,
    index: &ProverIndex<FULL_ROUNDS, G, Srs>,
    path: &Path,
) -> Result<(), CacheError>
where G: KimchiCurve<FULL_ROUNDS>, Srs: SRS<G>, G::BaseField: PrimeField,
Expand description

Writes a proving index to path in the mmap cache format.

The identifier is stored verbatim (bounded at IDENTIFIER_MAX_LEN bytes) and must be supplied again on read for validation. Callers typically pass a hash of the circuit’s identifying key.

Writes are atomic: the file is staged at a unique per-writer temp path (path.tmp.<pid>.<n>) and renamed into place, so concurrent readers of an existing path see either the old or new content but never a half-written file, and two concurrent writers cannot corrupt each other’s staging file.