pub struct AutoRecoveryService { /* private fields */ }Expand description
The auto-recovery queue + background drain loop.
Implementations§
Source§impl AutoRecoveryService
impl AutoRecoveryService
Sourcepub fn new(config: RecoveryConfig, clock: Arc<dyn Clock>) -> Arc<Self> ⓘ
pub fn new(config: RecoveryConfig, clock: Arc<dyn Clock>) -> Arc<Self> ⓘ
Creates a service. Call set_executor then
spawn to start draining.
Sourcepub fn set_executor(&self, executor: Weak<dyn RecoveryExecutor>)
pub fn set_executor(&self, executor: Weak<dyn RecoveryExecutor>)
Wires the executor that replays items (the cache). Held as a Weak so the
service never keeps the cache alive.
Sourcepub fn enqueue(&self, item: RecoveryItem)
pub fn enqueue(&self, item: RecoveryItem)
Queues an operation for replay (deduplicated by key — the newest
timestamp wins). Respects max_items by dropping the soonest-expiring
item when full.
Sourcepub fn spawn(self: &Arc<Self>)
pub fn spawn(self: &Arc<Self>)
Starts the background drain loop. Idempotent-safe to call once after
set_executor. Requires a tokio runtime.
Sourcepub async fn drain_once(&self, executor: &dyn RecoveryExecutor)
pub async fn drain_once(&self, executor: &dyn RecoveryExecutor)
Replays every currently-queued item once. Public for deterministic tests.
Auto Trait Implementations§
impl !Freeze for AutoRecoveryService
impl !RefUnwindSafe for AutoRecoveryService
impl !UnwindSafe for AutoRecoveryService
impl Send for AutoRecoveryService
impl Sync for AutoRecoveryService
impl Unpin for AutoRecoveryService
impl UnsafeUnpin for AutoRecoveryService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more