pub struct HierarchicalLockManager { /* private fields */ }Expand description
Hierarchical lock manager that respects precedence
Implementations§
Source§impl HierarchicalLockManager
impl HierarchicalLockManager
Sourcepub fn is_locked(&self, key: &str) -> Option<(ConfigLevel, &LockEntry)>
pub fn is_locked(&self, key: &str) -> Option<(ConfigLevel, &LockEntry)>
Check if a key is locked at any level
Returns the most specific lock (project > user > system)
Sourcepub fn is_locked_at_level(
&self,
key: &str,
level: ConfigLevel,
) -> Option<&LockEntry>
pub fn is_locked_at_level( &self, key: &str, level: ConfigLevel, ) -> Option<&LockEntry>
Check if a specific level has a lock
Sourcepub fn get_effective_locks(&self) -> HashMap<String, (ConfigLevel, LockEntry)>
pub fn get_effective_locks(&self) -> HashMap<String, (ConfigLevel, LockEntry)>
Get all locks merged with proper precedence
Sourcepub async fn lock(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
reason: impl Into<String>,
level: ConfigLevel,
) -> Result<()>
pub async fn lock( &mut self, key: impl Into<String>, value: impl Into<String>, reason: impl Into<String>, level: ConfigLevel, ) -> Result<()>
Sourcepub async fn unlock(
&mut self,
key: &str,
level: ConfigLevel,
reason: &str,
) -> Result<LockEntry>
pub async fn unlock( &mut self, key: &str, level: ConfigLevel, reason: &str, ) -> Result<LockEntry>
Unlock a key at a specific level
§Errors
Returns an error if the key is not locked at this level or if saving fails.
Sourcepub fn status_report(&self) -> String
pub fn status_report(&self) -> String
Get lock status report
Trait Implementations§
Source§impl HierarchicalLockManagerExt for HierarchicalLockManager
impl HierarchicalLockManagerExt for HierarchicalLockManager
Source§async fn get_locks_at_level(
&self,
level: ConfigLevel,
) -> Result<HashMap<String, LockEntry>>
async fn get_locks_at_level( &self, level: ConfigLevel, ) -> Result<HashMap<String, LockEntry>>
Get all locks at a specific level
Auto Trait Implementations§
impl Freeze for HierarchicalLockManager
impl RefUnwindSafe for HierarchicalLockManager
impl Send for HierarchicalLockManager
impl Sync for HierarchicalLockManager
impl Unpin for HierarchicalLockManager
impl UnsafeUnpin for HierarchicalLockManager
impl UnwindSafe for HierarchicalLockManager
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 more