Skip to main content

refresh_file

Function refresh_file 

Source
pub fn refresh_file(
    store: &mut Store,
    repository_id: i64,
    root: &Path,
    rel: &str,
) -> Result<Refresh, Box<dyn Error>>
Expand description

Lazily revalidate one indexed file against disk: re-extract it if its content changed. This is the staleness check search runs over its top results.

It deliberately never forgets a file: a failed read isn’t proof of deletion (a wrong checkout root, a transient FS error, or a race all look the same), and a search must never destroy index data over it — that bug dropped whole indexes when a stale checkout root made every read fail. Genuine deletions are reconciled by an indexing pass ([run_index]), which sees the whole tree at once and can tell “gone” from “couldn’t read one file”.