1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! # Load Balancer Library
//!
//! This library provides a set of generic load balancer implementations for distributing
//! workloads across multiple targets, such as clients, network endpoints, or resources.
//!
//! ## Traits
//!
//! ### `LoadBalancer<T>`
//!
//! A generic trait for asynchronous or synchronous load balancing. Implementors provide
//! methods to allocate a resource from the pool.
//!
//! ```rust
//! use std::future::Future;
//!
//! pub trait LoadBalancer<T>: Send + Sync + Clone + 'static {
//! /// Asynchronously allocate a resource.
//! fn alloc(&self) -> impl Future<Output = T> + Send;
//!
//! /// Attempt to allocate a resource synchronously without awaiting.
//! fn try_alloc(&self) -> Option<T>;
//! }
//! ```
/// Cooldown-based load balancer with per-entry reuse intervals.
/// Fault-tolerant load balancer with error tracking and auto-disabling.
/// Proxy pool with health checking and latency-based sorting.
/// Random selection load balancer.
/// Token-bucket rate limiter.
/// Round-robin sequential load balancer.
/// Sliding-window load balancer with per-entry rate limits.
pub use anyhow;
pub use dashmap;
pub use reqwest;
/// A generic load balancer trait for allocating resources from a pool.
///
/// Implementors manage a collection of items and distribute them according to
/// their specific strategy (round-robin, random, cooldown, etc.).