pub struct Cluster { /* private fields */ }
Expand description
Describes a cluster, including operating mode, primaries & secondaries
Implementations§
Source§impl Cluster
impl Cluster
Sourcepub fn new() -> Self
pub fn new() -> Self
Initialize Cluster
§Arguments
- update_interval - milliseconds, Interval between discovery service call
Sourcepub async fn secondaries(&self) -> Option<Arc<HashSet<RestClusterNode>>>
pub async fn secondaries(&self) -> Option<Arc<HashSet<RestClusterNode>>>
Get the list of secondaries. Returns None
if Cluster is inactive or in
Secondary mode. List can be empty.
Sourcepub async fn primaries(&self) -> Option<HashSet<RestClusterNode>>
pub async fn primaries(&self) -> Option<HashSet<RestClusterNode>>
Get the list of primaries. Returns None
if Cluster is inactive or in
Primary mode. List can be empty.
Sourcepub async fn is_primary(&self) -> bool
pub async fn is_primary(&self) -> bool
true if Cluster mode is Primary
Sourcepub async fn is_secondary(&self) -> bool
pub async fn is_secondary(&self) -> bool
true if Cluster mode is Secondary
Sourcepub async fn accept_raft_request_vote(
&self,
requester_node_id: String,
term: usize,
)
pub async fn accept_raft_request_vote( &self, requester_node_id: String, term: usize, )
Forward almost_raft::Message::RequestVote message to Raft process
Sourcepub async fn accept_raft_request_vote_resp(&self, term: usize, vote: bool)
pub async fn accept_raft_request_vote_resp(&self, term: usize, vote: bool)
Forward almost_raft::Message::RequestVoteResponse message to Raft process
Sourcepub async fn accept_raft_heartbeat(&self, leader_node_id: String, term: usize)
pub async fn accept_raft_heartbeat(&self, leader_node_id: String, term: usize)
Forward almost_raft::Message::HeartBeat message to Raft process
Sourcepub async fn get_service_instance(&self) -> Option<ServiceInstance>
pub async fn get_service_instance(&self) -> Option<ServiceInstance>
get the service instance of this cluster node
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Cluster
impl !RefUnwindSafe for Cluster
impl Send for Cluster
impl Sync for Cluster
impl Unpin for Cluster
impl UnwindSafe for Cluster
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