Skip to main content

ClaimTracker

Trait ClaimTracker 

Source
pub trait ClaimTracker: Send + Sync {
    // Required methods
    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 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 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_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 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 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 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;
}
Expand description

Async trait for symbol-level claim tracking across sessions.

Implementations:

  • LocalClaimTracker — in-memory DashMap (single-pod / tests)
  • ValkeyClaimTracker — Valkey/Redis-backed (multi-pod, behind valkey feature)

Required Methods§

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,

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,

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,

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,

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,

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,

Return all conflicts for a session across all file paths.

This method is only meaningful for the non-blocking record_claim path where multiple sessions can record overlapping claims without rejection. Backends that use exclusive locking (e.g. ValkeyClaimTracker) may return an empty list since cross-session conflicts are prevented at write time by acquire_lock.

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,

Remove all claims belonging to a session across ALL repos.

Implementors§