Skip to main content

smudge_with_fetch

Function smudge_with_fetch 

Source
pub fn smudge_with_fetch<R, W, F>(
    store: &Store,
    input: &mut R,
    output: &mut W,
    path: &str,
    extensions: &[SmudgeExtension],
    fetch: F,
) -> Result<SmudgeOutcome, SmudgeError>
where R: Read, W: Write, F: FnMut(&Pointer) -> Result<(), FetchError>,
Expand description

Like smudge, but on a missing-object miss invokes fetch to populate the store, then streams the freshly-fetched bytes to output.

fetch receives the Pointer of the missing object; the caller is expected to download exactly that OID into the local store. After a successful return, this function re-checks the store and streams the content; if the store still doesn’t have the object, an SmudgeError::ObjectMissing is surfaced (i.e. the fetch lied).