build_cache_to_path

Function build_cache_to_path 

Source
pub fn build_cache_to_path(
    source: &[u8],
    output: &Path,
    options: CacheOptions,
) -> Result<CacheStats, CacheError>
Expand description

Build the same cache straight to output: byte-identical to build_cache for the same input and options, without holding the mesh set. The pipeline runs with retain_meshes off; each chunk is serialized when it closes and appended to a spool file beside output, so only the open chunks and the 44-byte directory entries stay in memory.

output appears complete or not at all: the cache is written to a temporary file in the same directory, synced, then renamed over it. On any error before the rename, the temporary file and the spool are removed and an existing output is left untouched. An error from syncing the parent directory after the rename (Unix) means output already holds the complete new cache, but the rename may not survive a crash.