pub struct Lock {
pub resource: Vec<u8>,
pub val: Vec<u8>,
pub validity_time: usize,
pub lock_manager: LockManager,
}Expand description
A distributed lock that can be acquired and released across multiple Redis instances.
A Lock represents a distributed lock in Redis.
The lock is associated with a resource, identified by a unique key, and a value that identifies
the lock owner. The LockManager is responsible for managing the acquisition, release, and extension
of locks.
Fields§
§resource: Vec<u8>The resource to lock. Will be used as the key in Redis.
val: Vec<u8>The value for this lock.
validity_time: usizeTime the lock is still valid. Should only be slightly smaller than the requested TTL.
lock_manager: LockManagerUsed to limit the lifetime of a lock to its lock manager.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lock
impl !RefUnwindSafe for Lock
impl Send for Lock
impl Sync for Lock
impl Unpin for Lock
impl !UnwindSafe for Lock
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