pub struct Policy {
pub router: Arc<dyn RouteStrategy>,
pub balancer: Arc<dyn Balancer>,
}Fields§
§router: Arc<dyn RouteStrategy>§balancer: Arc<dyn Balancer>Implementations§
Source§impl Policy
impl Policy
Sourcepub fn header_sticky(header: &'static str) -> Self
pub fn header_sticky(header: &'static str) -> Self
Built-in sticky policy by request header + consistent hash.
Sourcepub fn path_sticky(param: &'static str) -> Self
pub fn path_sticky(param: &'static str) -> Self
Built-in sticky policy by path parameter + consistent hash.
Sourcepub fn consistent_hash() -> Self
pub fn consistent_hash() -> Self
Built-in policy: NoRouteKey + ConsistentHash.
Sourcepub fn least_request() -> Self
pub fn least_request() -> Self
Built-in policy: NoRouteKey + LeastRequest.
Sourcepub fn least_time() -> Self
pub fn least_time() -> Self
Built-in policy: NoRouteKey + LeastTime.
Sourcepub fn round_robin() -> Self
pub fn round_robin() -> Self
Built-in policy: NoRouteKey + RoundRobin.
pub fn router<R>(self, router: R) -> Selfwhere
R: RouteStrategy,
pub fn balancer<B>(self, balancer: B) -> Selfwhere
B: Balancer,
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Policy
impl !RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnsafeUnpin for Policy
impl !UnwindSafe for Policy
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