pub struct LeaderElectionCommands;Expand description
Redis commands for leader election using SET NX EX (atomic lock).
Implementations§
Source§impl LeaderElectionCommands
impl LeaderElectionCommands
Sourcepub fn try_acquire(key: &str, node_id: &str, ttl_secs: u64) -> Vec<String>
pub fn try_acquire(key: &str, node_id: &str, ttl_secs: u64) -> Vec<String>
Attempt to acquire leadership. Uses SET key value NX EX ttl for atomic acquire.
Sourcepub fn renew_lua() -> &'static str
pub fn renew_lua() -> &'static str
Renew leadership lease (only if we still hold it). Uses a Lua script for atomic check-and-renew.
Sourcepub fn release_lua() -> &'static str
pub fn release_lua() -> &'static str
Release leadership (only if we hold it).
Sourcepub fn get_leader(key: &str) -> Vec<String>
pub fn get_leader(key: &str) -> Vec<String>
Get current leader.
Auto Trait Implementations§
impl Freeze for LeaderElectionCommands
impl RefUnwindSafe for LeaderElectionCommands
impl Send for LeaderElectionCommands
impl Sync for LeaderElectionCommands
impl Unpin for LeaderElectionCommands
impl UnsafeUnpin for LeaderElectionCommands
impl UnwindSafe for LeaderElectionCommands
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 moreCreates a shared type from an unshared type.