pub enum Cmd {
Set {
key: Vec<u8>,
value: Vec<u8>,
},
Delete {
key: Vec<u8>,
},
Cas {
key: Vec<u8>,
expect: Option<Vec<u8>>,
value: Vec<u8>,
},
AcquireLock {
key: String,
holder: String,
now_ms: u64,
ttl_ms: u64,
},
RenewLock {
key: String,
holder: String,
now_ms: u64,
ttl_ms: u64,
},
ReleaseLock {
key: String,
holder: String,
},
}Expand description
A replicated state machine command.
Variants§
Set
Write a key/value pair.
Delete
Delete a key.
Cas
Compare-and-swap: write value only if the current value equals expect. Returns whether
the swap succeeded.
AcquireLock
Acquire a lock: granted if it is free, expired, or already held by the same holder; returns a monotonically increasing fencing token.
RenewLock
Lease renewal: extend the deadline if the caller still holds the lock and it has not expired.
ReleaseLock
Release a lock (only the holder may release it).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Cmd
impl<'de> Deserialize<'de> for Cmd
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Cmd
impl StructuralPartialEq for Cmd
Auto Trait Implementations§
impl Freeze for Cmd
impl RefUnwindSafe for Cmd
impl Send for Cmd
impl Sync for Cmd
impl Unpin for Cmd
impl UnsafeUnpin for Cmd
impl UnwindSafe for Cmd
Blanket Implementations§
impl<T> AppData for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
impl<T> AppDataResponse for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
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