pub struct ChainLock { /* private fields */ }Expand description
Exclusive advisory lock on chain.lock beside the chain in use.
Held for the kernel’s lifetime (the OS drops it on any exit, including a crash). A second kernel on the same chain is refused with the holder’s PID instead of appending to the chain concurrently.
Implementations§
Source§impl ChainLock
impl ChainLock
Sourcepub fn lock_path(checkpoint: &Path) -> PathBuf
pub fn lock_path(checkpoint: &Path) -> PathBuf
Lock file path for a chain checkpoint (chain.json -> chain.lock).
Sourcepub fn acquire(checkpoint: &Path) -> Result<Self, String>
pub fn acquire(checkpoint: &Path) -> Result<Self, String>
Take the lock for the chain at checkpoint.
§Errors
The message names the holder PID and the ways out (--new-chain,
kernel.chain.checkpoint_path).
Sourcepub fn try_acquire(checkpoint: &Path) -> Result<Self, ChainLockError>
pub fn try_acquire(checkpoint: &Path) -> Result<Self, ChainLockError>
acquire, telling “another kernel holds it” (a
refusal no retry fixes) apart from I/O failures.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ChainLock
impl RefUnwindSafe for ChainLock
impl Send for ChainLock
impl Sync for ChainLock
impl Unpin for ChainLock
impl UnsafeUnpin for ChainLock
impl UnwindSafe for ChainLock
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