use std::future::Future;
use std::time::Duration;
pub trait RateLimitStore: Send + Sync + Clone + 'static {
fn take(&self, key: &str) -> impl Future<Output = Option<Duration>> + Send;
}
pub trait SlidingWindowStore: Send + Sync + Clone + 'static {
fn take(&self, key: &str) -> impl Future<Output = Option<Duration>> + Send;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CircuitAction {
Allow,
Reject,
}
pub trait CircuitBreakerStore: Send + Sync + Clone + 'static {
fn check(&self, key: &str) -> impl Future<Output = CircuitAction> + Send;
fn record(&self, key: &str, success: bool) -> impl Future<Output = ()> + Send;
}