pub struct ServerListManager { /* private fields */ }Expand description
Server list manager for load balancing
Implementations§
Source§impl ServerListManager
impl ServerListManager
Sourcepub fn new(addresses: Vec<String>) -> Result<Self>
pub fn new(addresses: Vec<String>) -> Result<Self>
Create a new server list manager from address strings
Sourcepub fn next_server(&self) -> &ServerAddress
pub fn next_server(&self) -> &ServerAddress
Get the next server using round-robin
Sourcepub fn current_server(&self) -> &ServerAddress
pub fn current_server(&self) -> &ServerAddress
Get current server
Sourcepub fn all_servers(&self) -> &[ServerAddress]
pub fn all_servers(&self) -> &[ServerAddress]
Get all servers
Sourcepub fn server_count(&self) -> usize
pub fn server_count(&self) -> usize
Get server count
Sourcepub fn fail_current(&self) -> &ServerAddress
pub fn fail_current(&self) -> &ServerAddress
Mark current server as failed and move to next
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ServerListManager
impl RefUnwindSafe for ServerListManager
impl Send for ServerListManager
impl Sync for ServerListManager
impl Unpin for ServerListManager
impl UnwindSafe for ServerListManager
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request