pub enum NodeState {
Detached,
Unknown,
Master,
Replica,
Shutdown,
}Expand description
The possible states of a replication node.
These states determine which operations are permitted on the node. For example, only the Master node can execute write operations.
Variants§
Detached
Node is not associated with the group. Its handle has been closed. No operations can be performed on the environment when it is in this state.
Unknown
Node is not currently in contact with the master, but is actively trying to establish contact with, or decide upon, a master. While in this state the node is restricted to performing just read operations on its environment. In a functioning group, this state is transitory.
Master
Node is the unique master of the group and can both read and write to its environment. When the node transitions to this state, the application running on the node must make provisions to start processing application level write requests in addition to read requests.
Replica
Node is a replica that is being updated by the master. It is restricted to reading its environment. When the node transitions to this state, the application running on the node must arrange for all write requests to be routed to the master.
Shutdown
Node is shutting down. No operations can be performed.
Implementations§
Source§impl NodeState
impl NodeState
Sourcepub fn is_writable(&self) -> bool
pub fn is_writable(&self) -> bool
Whether this state accepts write operations.
Sourcepub fn is_readable(&self) -> bool
pub fn is_readable(&self) -> bool
Whether this state accepts read operations.
Sourcepub fn is_replica(&self) -> bool
pub fn is_replica(&self) -> bool
Whether this is the Replica state.
Sourcepub fn is_detached(&self) -> bool
pub fn is_detached(&self) -> bool
Whether this is the Detached state.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Whether this is the Unknown state.
Sourcepub fn can_transition_to(&self, new_state: NodeState) -> bool
pub fn can_transition_to(&self, new_state: NodeState) -> bool
Check if a transition to the given state is valid from this state.
Trait Implementations§
impl Copy for NodeState
impl Eq for NodeState
impl StructuralPartialEq for NodeState
Auto Trait Implementations§
impl Freeze for NodeState
impl RefUnwindSafe for NodeState
impl Send for NodeState
impl Sync for NodeState
impl Unpin for NodeState
impl UnsafeUnpin for NodeState
impl UnwindSafe for NodeState
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