pub struct ReplicaSet {
pub shard_id: String,
pub replication_factor: u32,
pub primary: Option<String>,
pub replicas: HashMap<String, ReplicaInfo>,
pub target_replicas: u32,
pub version: u64,
}Expand description
Replica set for a shard/namespace
Fields§
§shard_id: StringShard or namespace identifier
replication_factor: u32Configured replication factor
primary: Option<String>Primary replica node
replicas: HashMap<String, ReplicaInfo>All replicas (including primary)
target_replicas: u32Target replication factor (may differ during rebalancing)
version: u64Version for optimistic concurrency
Implementations§
Source§impl ReplicaSet
impl ReplicaSet
pub fn new(shard_id: String, replication_factor: u32) -> Self
Sourcepub fn healthy_count(&self) -> usize
pub fn healthy_count(&self) -> usize
Get count of healthy replicas
Sourcepub fn in_sync_count(&self) -> usize
pub fn in_sync_count(&self) -> usize
Get count of in-sync replicas
Sourcepub fn has_quorum(&self) -> bool
pub fn has_quorum(&self) -> bool
Check if replica set has quorum
Sourcepub fn can_write(&self, mode: WriteAckMode) -> bool
pub fn can_write(&self, mode: WriteAckMode) -> bool
Check if replica set can accept writes
Sourcepub fn get_in_sync_replicas(&self) -> Vec<String>
pub fn get_in_sync_replicas(&self) -> Vec<String>
Get all in-sync replica node IDs
Sourcepub fn get_healthy_replicas(&self) -> Vec<String>
pub fn get_healthy_replicas(&self) -> Vec<String>
Get all healthy replica node IDs
Trait Implementations§
Source§impl Clone for ReplicaSet
impl Clone for ReplicaSet
Source§fn clone(&self) -> ReplicaSet
fn clone(&self) -> ReplicaSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReplicaSet
impl Debug for ReplicaSet
Source§impl<'de> Deserialize<'de> for ReplicaSet
impl<'de> Deserialize<'de> for ReplicaSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ReplicaSet
impl RefUnwindSafe for ReplicaSet
impl Send for ReplicaSet
impl Sync for ReplicaSet
impl Unpin for ReplicaSet
impl UnsafeUnpin for ReplicaSet
impl UnwindSafe for ReplicaSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more