pub struct LockManager { /* private fields */ }Expand description
Lock manager for stripe locking during preflight phase
Provides per-key locking with configurable number of stripes. Non-conflicting keys map to different stripes and can be locked concurrently.
Implementations§
Source§impl LockManager
impl LockManager
Sourcepub fn new(num_stripes: usize) -> Self
pub fn new(num_stripes: usize) -> Self
Create a new lock manager with the specified number of stripes
Common values: 256, 512, 1024 More stripes = less contention but more memory
Sourcepub fn read_lock(&self, key: &[u8]) -> RwLockReadGuard<'_, ()>
pub fn read_lock(&self, key: &[u8]) -> RwLockReadGuard<'_, ()>
Acquire read lock for a key (blocking)
Multiple readers can hold locks on the same stripe concurrently. Used during preflight when reading state.
This method blocks until the lock is acquired.
Sourcepub fn write_lock(&self, key: &[u8]) -> RwLockWriteGuard<'_, ()>
pub fn write_lock(&self, key: &[u8]) -> RwLockWriteGuard<'_, ()>
Acquire write lock for a key (blocking)
Only one writer can hold a lock on a stripe at a time. Used during preflight when validating writes.
This method blocks until the lock is acquired.
Sourcepub fn num_stripes(&self) -> usize
pub fn num_stripes(&self) -> usize
Get the number of stripes
Auto Trait Implementations§
impl Freeze for LockManager
impl RefUnwindSafe for LockManager
impl Send for LockManager
impl Sync for LockManager
impl Unpin for LockManager
impl UnwindSafe for LockManager
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