//! Minimal resilience primitives for rs-zero.

pub mod breaker;
mod breaker_state;
pub mod concurrency;
pub mod cpu;
#[cfg(feature = "cache-redis")]
pub mod period_limiter;
pub mod registry;
pub mod shedder;
mod shedder_state;
pub mod timeout;
#[cfg(feature = "cache-redis")]
pub mod token_limiter;
pub mod window;

pub use breaker::{
    BreakerCallError, BreakerConfig, BreakerError, BreakerGuard, BreakerPolicyConfig,
    BreakerSnapshot, BreakerState, CircuitBreaker, SharedCircuitBreaker,
};
pub use concurrency::ConcurrencyLimit;
pub use cpu::{
    CpuSamplerConfig, CpuUsageProvider, LinuxCpuUsageProvider, NoopCpuUsageProvider,
    SharedCpuUsageProvider, real_cpu_provider,
};
#[cfg(feature = "cache-redis")]
pub use period_limiter::{PeriodAlignment, RedisPeriodLimiter, RedisPeriodLimiterConfig};
pub use registry::{BreakerRegistry, ShedderRegistry};
pub use shedder::{
    AdaptiveShedder, AdaptiveShedderConfig, ShedderError, ShedderGuard, ShedderSnapshot,
};
pub use timeout::{TimeoutError, run_with_timeout};
#[cfg(feature = "cache-redis")]
pub use token_limiter::{RedisTokenLimiter, RedisTokenLimiterConfig, TokenLimiterRescueConfig};
pub use window::{RollingWindow, WindowConfig, WindowOutcome, WindowSnapshot};

#[cfg(test)]
mod breaker_tests;
