pub struct LoadBalancer { /* private fields */ }Expand description
负载均衡器
Implementations§
Source§impl LoadBalancer
impl LoadBalancer
Sourcepub fn with_health_check(
self,
health_check: impl HealthCheck + Send + Sync + 'static,
) -> Self
pub fn with_health_check( self, health_check: impl HealthCheck + Send + Sync + 'static, ) -> Self
设置健康检查
Sourcepub fn with_update_frequency(self, update_frequency: Duration) -> Self
pub fn with_update_frequency(self, update_frequency: Duration) -> Self
设置更新频率
Sourcepub fn with_health_check_frequency(
self,
health_check_frequency: Duration,
) -> Self
pub fn with_health_check_frequency( self, health_check_frequency: Duration, ) -> Self
设置健康检查的频率
pub fn with_health_check_parallel(self, health_check_parallel: bool) -> Self
Sourcepub async fn update(&self) -> Result<(), Error>
pub async fn update(&self) -> Result<(), Error>
运行服务发现并更新选择算法。
如果这个 LoadBalancer 实例作为后台服务运行,此函数将每隔 update_frequency 被调用一次。
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LoadBalancer
impl !RefUnwindSafe for LoadBalancer
impl !UnwindSafe for LoadBalancer
impl Send for LoadBalancer
impl Sync for LoadBalancer
impl Unpin for LoadBalancer
impl UnsafeUnpin for LoadBalancer
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