pub struct ReplicaState {
pub node_id: String,
pub vector_clock: VectorClock,
pub state_hash: StateHash,
pub operations_applied: u64,
pub last_update_ms: u64,
}Expand description
State of a replica
Fields§
§node_id: String§vector_clock: VectorClock§state_hash: StateHash§operations_applied: u64§last_update_ms: u64Implementations§
Source§impl ReplicaState
impl ReplicaState
pub fn new(node_id: String, initial_hash: StateHash) -> Self
Sourcepub fn apply_transaction(
&mut self,
envelope: &TransactionEnvelope,
new_state_hash: StateHash,
)
pub fn apply_transaction( &mut self, envelope: &TransactionEnvelope, new_state_hash: StateHash, )
Update replica state after transaction
Sourcepub fn wait_for_clock_advance(&self, required_clock: &VectorClock) -> bool
pub fn wait_for_clock_advance(&self, required_clock: &VectorClock) -> bool
Causal read: wait for vector clock to advance
Trait Implementations§
Source§impl Clone for ReplicaState
impl Clone for ReplicaState
Auto Trait Implementations§
impl Freeze for ReplicaState
impl RefUnwindSafe for ReplicaState
impl Send for ReplicaState
impl Sync for ReplicaState
impl Unpin for ReplicaState
impl UnsafeUnpin for ReplicaState
impl UnwindSafe for ReplicaState
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