pub enum LockKey {
Filesystem,
Flush {
object_id: u64,
},
ObjectAttribute {
store_object_id: u64,
object_id: u64,
attribute_id: u64,
},
Object {
store_object_id: u64,
object_id: u64,
},
ProjectId {
store_object_id: u64,
project_id: u64,
},
Truncate {
store_object_id: u64,
object_id: u64,
},
}
Expand description
When creating a transaction, locks typically need to be held to prevent two or more writers trying to make conflicting mutations at the same time. LockKeys are used for this. NOTE: Ordering is important here! The lock manager sorts the list of locks in a transaction to acquire them in a consistent order, but there are special cases for the Filesystem lock and the Flush lock. The Filesystem lock is taken by every transaction and is done so first, as part of the TxnGuard. The Flush lock is taken when we flush an LSM tree (e.g. an object store), and is held for several transactions. As such, it must come first in the lock acquisition ordering, so that other transactions using the Flush lock have the same ordering as in flushing.
Variants§
Filesystem
Locks the entire filesystem.
Flush
Used to lock flushing an object.
ObjectAttribute
Used to lock changes to a particular object attribute (e.g. writes).
Object
Used to lock changes to a particular object (e.g. adding a child to a directory).
ProjectId
Truncate
Used to lock any truncate operations for a file.
Implementations§
Trait Implementations§
Source§impl Ord for LockKey
impl Ord for LockKey
Source§impl PartialOrd for LockKey
impl PartialOrd for LockKey
impl Copy for LockKey
impl Eq for LockKey
impl StructuralPartialEq for LockKey
Auto Trait Implementations§
impl Freeze for LockKey
impl RefUnwindSafe for LockKey
impl Send for LockKey
impl Sync for LockKey
impl Unpin for LockKey
impl UnwindSafe for LockKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
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>
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>
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 more