Skip to main content

open

Function open 

Source
pub fn open(basis: &Basis, delivery: &Delivery) -> Result<(Index, OpenReport)>
Expand description

Open a tree, using the snapshot cache when one is usable.

On the warm path the snapshot is loaded and then reconciled against the filesystem before being returned. Errors are represented as partial freshness and the previous complete snapshot is left untouched; callers must inspect OpenReport::is_complete or Index::freshness before treating totals as complete.

The index observes control state as ScanConfig::read_controls says, and the default is on: the index exposes Index::controls and Index::is_ignored, and a watch over it maintains them. A one-shot report from prepare_report observes it on the same terms, so a default open and a default report share one snapshot scope and each starts warm from the other’s snapshot. A caller wanting a single answer should use prepare_report.

A caller that reads no ignore classification may turn the field off. Its open reads no .gitignore, and its index answers Index::is_ignored and Index::controls with Error::ControlStateNotObserved rather than calling every entry unignored. Its snapshot is of another scope. When its entry identity matches a default snapshot, the loader discards that snapshot’s control tier and constructs the returned index directly in the requested controls-off scope. The projected index never replaces the stronger snapshot, including during a watch session.