pub struct MetricHandle { /* private fields */ }Expand description
Cloneable capability for one live metric owned by a progress operation.
All mutation methods are serialized by one CAS gate critical section. A handle remains readable after its progress operation closes, but rejects all later mutations.
Implementations§
Source§impl MetricHandle
impl MetricHandle
Sourcepub fn start(&self, count: u64) -> Result<(), MetricError>
pub fn start(&self, count: u64) -> Result<(), MetricError>
Moves work from the not-started state to the active state.
§Errors
Returns a metric error when the transition violates aggregate state invariants or when the owning operation is closed.
Sourcepub fn complete(&self, count: u64) -> Result<(), MetricError>
pub fn complete(&self, count: u64) -> Result<(), MetricError>
Moves work from the active state to unclassified completion.
§Errors
Returns a metric error when the transition violates aggregate state invariants or when the owning operation is closed.
Sourcepub fn succeed(&self, count: u64) -> Result<(), MetricError>
pub fn succeed(&self, count: u64) -> Result<(), MetricError>
Moves work from the active state to the succeeded state.
§Errors
Returns a metric error when the transition violates aggregate state invariants or when the owning operation is closed.
Sourcepub fn fail(&self, count: u64) -> Result<(), MetricError>
pub fn fail(&self, count: u64) -> Result<(), MetricError>
Moves work from the active state to the failed state.
§Errors
Returns a metric error when the transition violates aggregate state invariants or when the owning operation is closed.
Sourcepub fn cancel(&self, count: u64) -> Result<(), MetricError>
pub fn cancel(&self, count: u64) -> Result<(), MetricError>
Moves work from the active state to the cancelled state.
§Errors
Returns a metric error when the transition violates aggregate state invariants or when the owning operation is closed.
Sourcepub fn apply_delta(&self, delta: MetricDelta) -> Result<(), MetricError>
pub fn apply_delta(&self, delta: MetricDelta) -> Result<(), MetricError>
Applies one atomic additive batch of lifecycle changes.
§Errors
Returns a metric error when the delta exceeds active work, violates a configured total, overflows, or the owning operation is closed. The metric is unchanged whenever an error is returned.
Sourcepub fn snapshot(&self) -> MetricSnapshot
pub fn snapshot(&self) -> MetricSnapshot
Returns one internally consistent immutable metric snapshot.
This read remains available after the owning operation closes.
Trait Implementations§
Source§impl Clone for MetricHandle
impl Clone for MetricHandle
Source§fn clone(&self) -> MetricHandle
fn clone(&self) -> MetricHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more