pub struct ModelOperationLock {
locks: Arc<RwLock<HashMap<i64, OperationType>>>,
}Expand description
Concurrency control for model operations.
Ensures only one operation of each type can run on a model at a time.
Fields§
§locks: Arc<RwLock<HashMap<i64, OperationType>>>Implementations§
Source§impl ModelOperationLock
impl ModelOperationLock
Sourcepub async fn try_acquire(
&self,
model_id: i64,
operation: OperationType,
) -> Result<OperationGuard, String>
pub async fn try_acquire( &self, model_id: i64, operation: OperationType, ) -> Result<OperationGuard, String>
Try to acquire a lock for the specified operation.
Returns Ok(guard) if the lock was acquired, or Err if another
operation is already in progress for this model.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelOperationLock
impl !RefUnwindSafe for ModelOperationLock
impl Send for ModelOperationLock
impl Sync for ModelOperationLock
impl Unpin for ModelOperationLock
impl !UnwindSafe for ModelOperationLock
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