pub struct ActiveWorktreeRegistrationGuard<'transaction> { /* private fields */ }Expand description
Transaction-owned capability for one exact active worktree registration.
Construction is restricted to AtlasStore::with_active_worktree_registration
so lifecycle-sensitive callers can validate external state and publish one
bind or retirement under the same control-catalog writer exclusion.
Implementations§
Source§impl ActiveWorktreeRegistrationGuard<'_>
impl ActiveWorktreeRegistrationGuard<'_>
Sourcepub const fn registration(&self) -> &WorktreeRegistration
pub const fn registration(&self) -> &WorktreeRegistration
Borrow the exact active row reloaded by the transaction.
Sourcepub fn bind_project(
&mut self,
root: &Path,
project_instance_id: ProjectInstanceId,
) -> DbResult<WorktreeRegistration>
pub fn bind_project( &mut self, root: &Path, project_instance_id: ProjectInstanceId, ) -> DbResult<WorktreeRegistration>
Bind the exact initialized project inside this transaction.
§Errors
Returns an error for invalid paths, conflicting project identity,
malformed persisted state, or any SQLite failure.
Sourcepub fn bind_project_with_usage_snapshot(
&mut self,
root: &Path,
project_instance_id: ProjectInstanceId,
snapshot: &WorktreeUsageSnapshot,
) -> DbResult<(WorktreeRegistration, WorktreeUsageSyncState)>
pub fn bind_project_with_usage_snapshot( &mut self, root: &Path, project_instance_id: ProjectInstanceId, snapshot: &WorktreeUsageSnapshot, ) -> DbResult<(WorktreeRegistration, WorktreeUsageSyncState)>
Bind this project and accept its initial usage snapshot atomically.
§Errors
Returns an error for invalid paths, conflicting project or telemetry
identity, malformed or excessive snapshot state, or any SQLite failure.
Sourcepub fn synchronize_usage_snapshot(
&mut self,
snapshot: &WorktreeUsageSnapshot,
) -> DbResult<WorktreeUsageSyncState>
pub fn synchronize_usage_snapshot( &mut self, snapshot: &WorktreeUsageSnapshot, ) -> DbResult<WorktreeUsageSyncState>
Accept one usage snapshot for this already-bound active registration.
§Errors
Returns an error for a missing or mismatched project identity, malformed
or excessive snapshot state, or any SQLite failure.
Sourcepub fn retire(
&mut self,
retired_at_epoch: u64,
) -> DbResult<WorktreeRegistration>
pub fn retire( &mut self, retired_at_epoch: u64, ) -> DbResult<WorktreeRegistration>
Retire this active registration without importing another local snapshot.
§Errors
Returns an error for an invalid time, malformed persisted state, or any
SQLite failure.
Sourcepub fn retire_with_usage_snapshot(
&mut self,
root: &Path,
project_instance_id: ProjectInstanceId,
snapshot: &WorktreeUsageSnapshot,
retired_at_epoch: u64,
) -> DbResult<(WorktreeRegistration, WorktreeUsageSyncState)>
pub fn retire_with_usage_snapshot( &mut self, root: &Path, project_instance_id: ProjectInstanceId, snapshot: &WorktreeUsageSnapshot, retired_at_epoch: u64, ) -> DbResult<(WorktreeRegistration, WorktreeUsageSyncState)>
Bind, synchronize one writer-excluded local snapshot, and retire atomically.
§Errors
Returns an error for invalid paths or times, a mismatched project or
telemetry identity, malformed persisted state, or any SQLite failure.