pub struct ServerScore { /* private fields */ }Expand description
Server’s statistic score
Implementations§
Source§impl ServerScore
impl ServerScore
Sourcepub fn new(
user_weight: f32,
max_server_rtt: Duration,
check_window: Duration,
) -> Self
pub fn new( user_weight: f32, max_server_rtt: Duration, check_window: Duration, ) -> Self
Create a ServerScore
Sourcepub async fn push_score(&self, score: Score) -> u32
pub async fn push_score(&self, score: Score) -> u32
Append a Score into statistic and recalculate score of the server
Sourcepub async fn push_score_fetch_statistic(
&self,
score: Score,
) -> (u32, ServerStatData)
pub async fn push_score_fetch_statistic( &self, score: Score, ) -> (u32, ServerStatData)
Append a Score into statistic and recalculate score of the server
Sourcepub async fn report_failure(&self) -> u32
pub async fn report_failure(&self) -> u32
Report request failure of this server, which will eventually records an Errored score
Sourcepub async fn stat_data(&self) -> ServerStatData
pub async fn stat_data(&self) -> ServerStatData
Get statistic data
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ServerScore
impl !RefUnwindSafe for ServerScore
impl Send for ServerScore
impl Sync for ServerScore
impl Unpin for ServerScore
impl !UnwindSafe for ServerScore
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