use std::time::Duration;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct CasStrategyProfile {
max_attempts: u32,
max_elapsed: Duration,
target_conflict_ratio: f64,
uses_backoff: bool,
}
impl CasStrategyProfile {
#[inline]
pub(crate) const fn new(
max_attempts: u32,
max_elapsed: Duration,
target_conflict_ratio: f64,
uses_backoff: bool,
) -> Self {
Self {
max_attempts,
max_elapsed,
target_conflict_ratio,
uses_backoff,
}
}
#[inline]
pub fn max_attempts(&self) -> u32 {
self.max_attempts
}
#[inline]
pub fn max_elapsed(&self) -> Duration {
self.max_elapsed
}
#[inline]
pub fn target_conflict_ratio(&self) -> f64 {
self.target_conflict_ratio
}
#[inline]
pub fn uses_backoff(&self) -> bool {
self.uses_backoff
}
}