pub struct RepNode {
pub name: String,
pub node_type: NodeType,
pub host: String,
pub port: u16,
pub node_id: u32,
pub read_capacity_pct: u32,
pub write_capacity_pct: u32,
pub latency_hint_ms: u64,
}Expand description
Information about a node in a replication group.
Each node has a unique name within its group, a type that determines its role, and a network address (host and port) for replication communication.
Fields§
§name: StringThe unique name of this node within the replication group.
node_type: NodeTypeThe type of this node (electable, monitor, secondary, arbiter).
host: StringThe hostname or IP address for replication communication.
port: u16The port number for replication communication.
node_id: u32The unique numeric identifier assigned to this node by the group.
read_capacity_pct: u32Relative read throughput capacity × 100 (default 100 = 1.0).
Used by quoracle strategy when computing load-optimal quorums.
write_capacity_pct: u32Relative write throughput capacity × 100 (default 100 = 1.0).
latency_hint_ms: u64Expected one-way latency hint in milliseconds (default 1).
Implementations§
Source§impl RepNode
impl RepNode
Sourcepub fn new(
name: String,
node_type: NodeType,
host: String,
port: u16,
node_id: u32,
) -> Self
pub fn new( name: String, node_type: NodeType, host: String, port: u16, node_id: u32, ) -> Self
Creates a new RepNode with the given parameters.
Capacity fields default to 1.0 (100 pct) and latency to 1 ms.
Sourcepub fn with_read_capacity(self, cap: f64) -> Self
pub fn with_read_capacity(self, cap: f64) -> Self
Set relative read capacity (e.g. 0.5 for half-speed node).
The value is stored as (cap * 100) as u32.
Sourcepub fn with_write_capacity(self, cap: f64) -> Self
pub fn with_write_capacity(self, cap: f64) -> Self
Set relative write capacity.
Sourcepub fn with_latency_hint(self, d: Duration) -> Self
pub fn with_latency_hint(self, d: Duration) -> Self
Set expected one-way latency hint.
Sourcepub fn to_quoracle_node(&self) -> Node<String>
pub fn to_quoracle_node(&self) -> Node<String>
Build a quoracle::Node<String> from this RepNode, embedding
the capacity and latency hints so that quoracle’s LP strategy
can factor them into load-optimal quorum selection.
Sourcepub fn socket_address(&self) -> String
pub fn socket_address(&self) -> String
Returns the socket address string in “host:port” format.
Sourcepub fn is_electable(&self) -> bool
pub fn is_electable(&self) -> bool
Returns true if this node can participate in elections.
Sourcepub fn is_data_node(&self) -> bool
pub fn is_data_node(&self) -> bool
Returns true if this node stores data.
Sourcepub fn can_be_master(&self) -> bool
pub fn can_be_master(&self) -> bool
Returns true if this node can become master.
Trait Implementations§
impl Eq for RepNode
impl StructuralPartialEq for RepNode
Auto Trait Implementations§
impl Freeze for RepNode
impl RefUnwindSafe for RepNode
impl Send for RepNode
impl Sync for RepNode
impl Unpin for RepNode
impl UnsafeUnpin for RepNode
impl UnwindSafe for RepNode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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