pub fn serve_with_selected_pack<R: Repository + ?Sized, W: Write>(
repository: &ValidatedRepository<'_, '_, R>,
request: Request<'_>,
storage: &mut SelectionStorage<'_>,
output: &mut W,
write_selected: impl FnOnce(&[usize], &mut [u8], &mut PackOutput<'_, W>) -> Result<()>,
) -> Result<Response>Expand description
Serve selected requests using a trusted host’s raw-pack writer. Routing,
authorization and bounded selection are identical to serve_with_selection.
The writer runs once only when a pack is needed, including an empty selected
set, and must emit exactly indices from this same stable repository.
ACK-only rounds and shallow probes never invoke it. Its sink applies the
current request’s sideband framing; cache only the raw PACK bytes.
Use cache::selected::write with Selection::Indices(indices) to integrate
verified caller-owned caches. Authorization and selection precede every hit.
Control packets may already be written when the writer fails: discard the
entire output on any error. Buffer the response before sending HTTP success,
or close the transport on a late failure. The writer retains no references
after this synchronous call, and a failure emits no successful terminator.