appcore_sync/sync/retry.rs
1// =============================================================================
2// #######
3// ### ### F: retry.rs
4// ## ## ## ## P: AppCore-Runtime
5// ## ##
6// C: 2026/06/02 13:08:16 by dnettoRaw
7// ## ## ## ## U: 2026/07/23 23:50:45 by dnettoRaw
8// ########### S: 1.0.1-rc.8
9// =============================================================================
10
11//! Retry, queue, and metrics contracts for follower pushes.
12
13/// Retry and queue limits for follower push.
14#[derive(Debug, Clone, Copy, PartialEq, Eq)]
15pub struct SyncRetryPolicy {
16 /// Maximum delivery attempts per flush, with zero treated as one.
17 pub max_attempts: u32,
18 /// Fixed delay between attempts in milliseconds.
19 pub backoff_ms: u64,
20 /// Maximum number of batches retained by the outbox.
21 pub max_queue_len: usize,
22}
23
24impl Default for SyncRetryPolicy {
25 fn default() -> Self {
26 Self {
27 max_attempts: 3,
28 backoff_ms: 50,
29 max_queue_len: 64,
30 }
31 }
32}
33
34/// Basic sync push metrics for local observability.
35#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
36pub struct SyncPushMetrics {
37 /// Total transport attempts.
38 pub push_attempt: u64,
39 /// Total batches acknowledged and removed from the outbox.
40 pub push_success: u64,
41 /// Total flushes that exhausted their retry policy.
42 pub push_failed: u64,
43 /// Total batches rejected because the outbox was full.
44 pub push_dropped: u64,
45}