pub struct WorktreeResourceMonitor { /* private fields */ }Expand description
Monitor for worktree resource usage
Implementations§
Source§impl WorktreeResourceMonitor
impl WorktreeResourceMonitor
Sourcepub fn new(
disk_usage_threshold_mb: u64,
max_worktrees_per_job: usize,
max_total_worktrees: usize,
) -> Self
pub fn new( disk_usage_threshold_mb: u64, max_worktrees_per_job: usize, max_total_worktrees: usize, ) -> Self
Create a new resource monitor
Sourcepub fn check_limits(&self) -> CleanupResult<()>
pub fn check_limits(&self) -> CleanupResult<()>
Check resource limits
Sourcepub fn get_metrics(&self) -> WorktreeMetrics
pub fn get_metrics(&self) -> WorktreeMetrics
Get current metrics
Sourcepub fn update_metrics(&mut self, metrics: WorktreeMetrics)
pub fn update_metrics(&mut self, metrics: WorktreeMetrics)
Update metrics after scanning worktrees
Sourcepub fn cleanup_recommendation(&self) -> CleanupRecommendation
pub fn cleanup_recommendation(&self) -> CleanupRecommendation
Get cleanup recommendation based on current state
Sourcepub async fn calculate_disk_usage(path: &Path) -> u64
pub async fn calculate_disk_usage(path: &Path) -> u64
Calculate disk usage for a path
Sourcepub async fn scan_worktree_directory(
&mut self,
base_path: &Path,
) -> CleanupResult<()>
pub async fn scan_worktree_directory( &mut self, base_path: &Path, ) -> CleanupResult<()>
Scan worktree directory and update metrics
Sourcepub fn record_cleanup(&mut self, success: bool, duration: Duration)
pub fn record_cleanup(&mut self, success: bool, duration: Duration)
Record cleanup operation
Sourcepub async fn get_cleanup_candidates(
base_path: &Path,
max_age: Duration,
) -> CleanupResult<Vec<PathBuf>>
pub async fn get_cleanup_candidates( base_path: &Path, max_age: Duration, ) -> CleanupResult<Vec<PathBuf>>
Get worktree paths that should be cleaned
Auto Trait Implementations§
impl Freeze for WorktreeResourceMonitor
impl RefUnwindSafe for WorktreeResourceMonitor
impl Send for WorktreeResourceMonitor
impl Sync for WorktreeResourceMonitor
impl Unpin for WorktreeResourceMonitor
impl UnsafeUnpin for WorktreeResourceMonitor
impl UnwindSafe for WorktreeResourceMonitor
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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