CleanupStrategy

Trait CleanupStrategy 

Source
pub trait CleanupStrategy: Send + Sync {
    // Required methods
    fn should_cleanup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn mark_as_cleaned<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Strategy for determining when to perform automatic nonce cleanup.

Cleanup strategies are used by NonceServer to automatically trigger expired nonce cleanup based on various criteria such as request count, elapsed time, or custom logic.

Required Methods§

Source

fn should_cleanup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Determines whether cleanup should be triggered.

This method is called after each successful nonce verification to check if it’s time to perform cleanup.

Source

fn mark_as_cleaned<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Marks that cleanup has been performed and resets internal state.

This method is called after cleanup has been triggered to reset counters, timestamps, or other internal state tracking.

Implementors§

Source§

impl CleanupStrategy for HybridCleanupStrategy

Source§

impl<F, Fut> CleanupStrategy for CustomCleanupStrategy<F, Fut>
where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future<Output = bool> + Send + 'static,