pub struct MultiDatacenterCoordinator { /* private fields */ }Expand description
Multi-datacenter coordinator
Implementations§
Source§impl MultiDatacenterCoordinator
impl MultiDatacenterCoordinator
Sourcepub fn add_datacenter(&mut self, dc: Datacenter)
pub fn add_datacenter(&mut self, dc: Datacenter)
Add a datacenter
Sourcepub fn register_node(
&mut self,
node_id: NodeId,
dc_id: DatacenterId,
) -> Result<(), String>
pub fn register_node( &mut self, node_id: NodeId, dc_id: DatacenterId, ) -> Result<(), String>
Register a node in a datacenter
Sourcepub fn unregister_node(&mut self, node_id: &NodeId)
pub fn unregister_node(&mut self, node_id: &NodeId)
Unregister a node
Sourcepub fn get_node_datacenter(&self, node_id: &NodeId) -> Option<&Datacenter>
pub fn get_node_datacenter(&self, node_id: &NodeId) -> Option<&Datacenter>
Get the datacenter for a node
Sourcepub fn record_latency(
&mut self,
from: DatacenterId,
to: DatacenterId,
latency_ms: u64,
)
pub fn record_latency( &mut self, from: DatacenterId, to: DatacenterId, latency_ms: u64, )
Record latency between two datacenters
Sourcepub fn get_latency(&self, from: &DatacenterId, to: &DatacenterId) -> Option<u64>
pub fn get_latency(&self, from: &DatacenterId, to: &DatacenterId) -> Option<u64>
Get latency between two datacenters
Sourcepub fn datacenters(&self) -> &HashMap<DatacenterId, Datacenter>
pub fn datacenters(&self) -> &HashMap<DatacenterId, Datacenter>
Get all datacenters
Sourcepub fn total_nodes(&self) -> usize
pub fn total_nodes(&self) -> usize
Get total number of nodes across all datacenters
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiDatacenterCoordinator
impl RefUnwindSafe for MultiDatacenterCoordinator
impl Send for MultiDatacenterCoordinator
impl Sync for MultiDatacenterCoordinator
impl Unpin for MultiDatacenterCoordinator
impl UnwindSafe for MultiDatacenterCoordinator
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> 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