pub struct RepoLock { /* private fields */ }Expand description
A held advisory repository lock (issue #99): while alive, no other wt (or
embedder going through this library) can mutate worktrees or wt.*
metadata in the repository. Released on drop.
Workspace::create and Workspace::remove take the lock internally
around their mutation regions (hooks run outside it, so a hook that
re-enters wt cannot deadlock) — do not hold a RepoLock while calling
them. Take one directly to make your own read-check-write sequence over
wt.* metadata atomic against concurrent writers.
Acquiring the lock also validates the repository’s metadata schema, so
every acquisition fails with Error::SchemaTooNew rather than hand back
a lock over a repository this build cannot interpret (issue #106).
Auto Trait Implementations§
impl Freeze for RepoLock
impl RefUnwindSafe for RepoLock
impl Send for RepoLock
impl Sync for RepoLock
impl Unpin for RepoLock
impl UnsafeUnpin for RepoLock
impl UnwindSafe for RepoLock
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