pub struct ServerGroup {
pub primary: String,
pub backups: Vec<String>,
pub failover_threshold: usize,
}Expand description
Server group configuration for failover support
Fields§
§primary: StringPrimary server ID
backups: Vec<String>Backup server IDs in priority order
failover_threshold: usizeMinimum health check failures before failover
Implementations§
Source§impl ServerGroup
impl ServerGroup
Sourcepub fn new(primary: impl Into<String>, backups: Vec<String>) -> Self
pub fn new(primary: impl Into<String>, backups: Vec<String>) -> Self
Create a new server group with primary and backups
Sourcepub fn with_failover_threshold(self, threshold: usize) -> Self
pub fn with_failover_threshold(self, threshold: usize) -> Self
Set the failover threshold
Sourcepub fn all_servers(&self) -> Vec<&str>
pub fn all_servers(&self) -> Vec<&str>
Get all server IDs in priority order (primary first, then backups)
Sourcepub fn next_server(&self, current: &str) -> Option<&str>
pub fn next_server(&self, current: &str) -> Option<&str>
Get the next available server after the current one
Trait Implementations§
Source§impl Clone for ServerGroup
impl Clone for ServerGroup
Source§fn clone(&self) -> ServerGroup
fn clone(&self) -> ServerGroup
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ServerGroup
impl RefUnwindSafe for ServerGroup
impl Send for ServerGroup
impl Sync for ServerGroup
impl Unpin for ServerGroup
impl UnwindSafe for ServerGroup
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)