1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*******************************************************************************
*
* Copyright (c) 2025 - 2026 Haixing Hu.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0.
*
******************************************************************************/
//! Built-in CAS preset constants.
use Duration;
use DEFAULT_RETRY_MAX_ATTEMPTS;
/// Default maximum attempts inherited from `qubit-retry`.
pub const DEFAULT_CAS_MAX_ATTEMPTS: u32 = DEFAULT_RETRY_MAX_ATTEMPTS;
/// Maximum attempts for the contention-adaptive strategy.
pub const CONTENTION_ADAPTIVE_MAX_ATTEMPTS: u32 = 1000;
/// Initial retry delay for the contention-adaptive strategy.
pub const CONTENTION_ADAPTIVE_INITIAL_DELAY: Duration = from_millis;
/// Maximum retry delay for the contention-adaptive strategy.
pub const CONTENTION_ADAPTIVE_MAX_DELAY: Duration = from_secs;
/// Cumulative user operation elapsed-time budget for the contention-adaptive strategy.
pub const CONTENTION_ADAPTIVE_MAX_ELAPSED: Duration = from_secs;
/// Monotonic total retry-flow elapsed-time ceiling for the contention-adaptive strategy.
///
/// Includes user operation time, retry sleeps, and control-path listener work. The
/// value is above [`CONTENTION_ADAPTIVE_MAX_ELAPSED`]
/// so exponential backoff can use part of the wall-time budget.
pub const CONTENTION_ADAPTIVE_MAX_TOTAL_ELAPSED: Duration = from_secs;
/// Jitter factor for the contention-adaptive strategy.
pub const CONTENTION_ADAPTIVE_JITTER_FACTOR: f64 = 0.25;
/// Maximum attempts for the latency-first strategy.
pub const LATENCY_FIRST_MAX_ATTEMPTS: u32 = 100;
/// Cumulative user operation elapsed-time budget for the latency-first strategy.
pub const LATENCY_FIRST_MAX_ELAPSED: Duration = from_secs;
/// Maximum attempts for the reliability-first strategy.
pub const RELIABILITY_FIRST_MAX_ATTEMPTS: u32 = 5000;
/// Initial retry delay for the reliability-first strategy.
pub const RELIABILITY_FIRST_INITIAL_DELAY: Duration = from_secs;
/// Maximum retry delay for the reliability-first strategy.
pub const RELIABILITY_FIRST_MAX_DELAY: Duration = from_secs;
/// Cumulative user operation elapsed-time budget for the reliability-first strategy.
pub const RELIABILITY_FIRST_MAX_ELAPSED: Duration = from_secs;
/// Monotonic total retry-flow elapsed-time ceiling for the reliability-first strategy.
///
/// Set above [`RELIABILITY_FIRST_MAX_ELAPSED`] so long
/// exponential backoff windows can still fit under a hard end-to-end cap.
pub const RELIABILITY_FIRST_MAX_TOTAL_ELAPSED: Duration = from_secs;
/// Jitter factor for the reliability-first strategy.
pub const RELIABILITY_FIRST_JITTER_FACTOR: f64 = 0.1;