Skip to main content

mark_viewed

Function mark_viewed 

Source
pub fn mark_viewed(
    cache_dir: &Path,
    files: &[String],
    current_hash: &str,
) -> Result<()>
Expand description

Record each path in files as viewed against current_hash, atomically.

Loads the existing ledger, upserts the marks, sets the stored hash to the current guide hash, then writes via a temp file + rename so a crash mid-write can never truncate the JSON. Returns the file count actually persisted. Swallows IO errors (logged at most by the caller); the viewed-state is a convenience, never load-bearing for the tour or the exit code.