pub struct LocalClaimTracker { /* private fields */ }Expand description
Thread-safe, lock-free tracker for symbol-level claims across sessions.
Key insight: two sessions modifying DIFFERENT symbols in the same file is NOT a conflict. Only same-symbol modifications across sessions are TRUE conflicts. This is dkod’s core differentiator over line-based VCS.
The tracker is keyed by (repo_id, file_path) and stores a Vec<SymbolClaim>
for each file. DashMap provides fine-grained per-shard locking so reads are
effectively lock-free when not contending on the same shard.
Implementations§
Trait Implementations§
Source§impl ClaimTracker for LocalClaimTracker
impl ClaimTracker for LocalClaimTracker
Source§fn record_claim<'life0, 'life1, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
claim: SymbolClaim,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn record_claim<'life0, 'life1, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
claim: SymbolClaim,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Record a symbol claim (non-blocking — does not reject on conflict).
Source§fn acquire_lock<'life0, 'life1, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
claim: SymbolClaim,
) -> Pin<Box<dyn Future<Output = Result<AcquireOutcome, SymbolLocked>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn acquire_lock<'life0, 'life1, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
claim: SymbolClaim,
) -> Pin<Box<dyn Future<Output = Result<AcquireOutcome, SymbolLocked>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attempt to acquire a symbol lock. Returns
Err(SymbolLocked) if
another session already holds the symbol.Source§fn release_lock<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
session_id: Uuid,
qualified_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn release_lock<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
session_id: Uuid,
qualified_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Release a single symbol lock for a session in a specific file.
Source§fn release_locks<'life0, 'async_trait>(
&'life0 self,
repo_id: Uuid,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Vec<ReleasedLock>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release_locks<'life0, 'async_trait>(
&'life0 self,
repo_id: Uuid,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Vec<ReleasedLock>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Release all locks held by a session for a specific repo.
Source§fn check_conflicts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
session_id: Uuid,
qualified_names: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Vec<ConflictInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn check_conflicts<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
repo_id: Uuid,
file_path: &'life1 str,
session_id: Uuid,
qualified_names: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Vec<ConflictInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check whether any of the given symbols conflict with another session.
Source§fn get_all_conflicts_for_session<'life0, 'async_trait>(
&'life0 self,
repo_id: Uuid,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Vec<(String, ConflictInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_all_conflicts_for_session<'life0, 'async_trait>(
&'life0 self,
repo_id: Uuid,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Vec<(String, ConflictInfo)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return all conflicts for a session across all file paths. Read more
Source§fn clear_session<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Vec<ReleasedLock>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_session<'life0, 'async_trait>(
&'life0 self,
session_id: Uuid,
) -> Pin<Box<dyn Future<Output = Vec<ReleasedLock>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove all claims belonging to a session across ALL repos.
Auto Trait Implementations§
impl Freeze for LocalClaimTracker
impl !RefUnwindSafe for LocalClaimTracker
impl Send for LocalClaimTracker
impl Sync for LocalClaimTracker
impl Unpin for LocalClaimTracker
impl UnsafeUnpin for LocalClaimTracker
impl UnwindSafe for LocalClaimTracker
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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