Struct cargo::core::global_cache_tracker::GlobalCacheTracker
source · pub struct GlobalCacheTracker { /* private fields */ }
Expand description
Tracking for the global shared cache (registry files, etc.).
This is the interface to the global cache database, used for tracking and
cleaning. See the crate::core::global_cache_tracker
module docs for
details.
Implementations§
source§impl GlobalCacheTracker
impl GlobalCacheTracker
sourcepub fn new(config: &Config) -> CargoResult<GlobalCacheTracker>
pub fn new(config: &Config) -> CargoResult<GlobalCacheTracker>
Creates a new GlobalCacheTracker
.
The caller is responsible for locking the package cache with
CacheLockMode::DownloadExclusive
before calling this.
sourcepub fn db_path(config: &Config) -> Filesystem
pub fn db_path(config: &Config) -> Filesystem
The path to the database.
sourcepub fn registry_index_all(&self) -> CargoResult<Vec<(RegistryIndex, u64)>>
pub fn registry_index_all(&self) -> CargoResult<Vec<(RegistryIndex, u64)>>
Returns all index cache timestamps.
sourcepub fn registry_crate_all(&self) -> CargoResult<Vec<(RegistryCrate, u64)>>
pub fn registry_crate_all(&self) -> CargoResult<Vec<(RegistryCrate, u64)>>
Returns all registry crate cache timestamps.
sourcepub fn registry_src_all(&self) -> CargoResult<Vec<(RegistrySrc, u64)>>
pub fn registry_src_all(&self) -> CargoResult<Vec<(RegistrySrc, u64)>>
Returns all registry source cache timestamps.
sourcepub fn git_db_all(&self) -> CargoResult<Vec<(GitDb, u64)>>
pub fn git_db_all(&self) -> CargoResult<Vec<(GitDb, u64)>>
Returns all git db timestamps.
sourcepub fn git_checkout_all(&self) -> CargoResult<Vec<(GitCheckout, u64)>>
pub fn git_checkout_all(&self) -> CargoResult<Vec<(GitCheckout, u64)>>
Returns all git checkout timestamps.
sourcepub fn should_run_auto_gc(&mut self, frequency: Duration) -> CargoResult<bool>
pub fn should_run_auto_gc(&mut self, frequency: Duration) -> CargoResult<bool>
Returns whether or not an auto GC should be performed, compared to the last time it was recorded in the database.
sourcepub fn set_last_auto_gc(&self) -> CargoResult<()>
pub fn set_last_auto_gc(&self) -> CargoResult<()>
Writes to the database to indicate that an automatic GC has just been completed.
sourcepub fn clean(
&mut self,
clean_ctx: &mut CleanContext<'_>,
gc_opts: &GcOpts
) -> CargoResult<()>
pub fn clean( &mut self, clean_ctx: &mut CleanContext<'_>, gc_opts: &GcOpts ) -> CargoResult<()>
Deletes files from the global cache based on the given options.