pub struct PushProgress { /* private fields */ }Expand description
A handle on the live counters of pushes.
A caller sets a clone of the handle in
SessionOptions::progress. Then it
reads snapshot from another task or thread
while the push runs. A session adds to the counters of the handle and
never sets them to zero.
If several sessions share a handle, the handle shows the sum of their counters and the phase of the session that set it last.
The PushStats of a session come from counters of its own, and the
handle does not change them. Each count is one relaxed atomic add to those
counters, and one more to the handle if the session has one.
§Hook calls
A handle made with with_hook calls its hook
with a snapshot at these changes:
- each time the phase changes to another phase
- after each object of the object stream, when
objects_sentgrows - each time
content_bytesreaches the next multiple of 102,400 bytes (100 KiB)
Implementations§
Source§impl PushProgress
impl PushProgress
Sourcepub fn new() -> PushProgress
pub fn new() -> PushProgress
Creates a handle whose counters are all zero.
Sourcepub fn with_hook(hook: PushProgressFn) -> PushProgress
pub fn with_hook(hook: PushProgressFn) -> PushProgress
Creates a handle whose counters are all zero and that calls hook.
Hook calls lists the calls.
PushProgressFn gives the rules of the hook.
Sourcepub fn snapshot(&self) -> PushProgressSnapshot
pub fn snapshot(&self) -> PushProgressSnapshot
Returns the counters as they stand now.
The method reads each counter on its own, so two counters of one snapshot can differ by the work of one step.