pub trait PackProgress: Sync {
// Required method
fn indexed(&self, done: u64, total: u64);
}Expand description
Where a store says how much of a pack it has taken in, while it is still taking it in.
The one seam GitOps::put_pack_observed adds, and it is deliberately one
method taking two plain integers. It is not FnMut, it is not a channel,
and it carries no state of its own:
&self, not&mut self— a store is shared across threads (GitOps: Send + Sync) and an implementer is free to publish from whichever one is doing the splitting. A sink that needs to mutate owns its ownMutex/atomic, which is the sink’s business and not the store’s.Sync— same reason, and it is what lets a&dyn PackProgresscross into a store that is being shared.- two
u64s and no receipt — publishing must not be able to fail the ingest. A store that gave up on a push because a progress bar was not listening would be trading correctness for cosmetics.
§The contract on the numbers
done is monotone non-decreasing across one call to
GitOps::put_pack_observed, total is constant, and the last publish of
a successful call is done == total. A sink may therefore render
done/total verbatim and never see it go backwards or overshoot.
Per batch is allowed; per pack is not. An implementer whose loop is
genuinely batched may publish once per batch — a count that moves in steps
of a thousand is a count that moves. What is forbidden is a single step from
0 to total, which is what a store that publishes nothing already looks
like and is exactly the thing being fixed.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".