use std::path::Path;
mod cache_size_index;
mod history;
mod lint_runs;
mod paths;
mod read_write;
mod runtime;
mod status;
mod trigger;
mod types;
pub(crate) fn reclaim_project_cache(project_root: &Path) {
reclaim_project_cache_under(paths::cache_root().as_path(), project_root);
}
pub(super) fn reclaim_project_cache_under(cache_root: &Path, project_root: &Path) {
let project_dir = paths::project_dir_under(cache_root, project_root);
let bytes = history::project_dir_bytes(&project_dir);
if std::fs::remove_dir_all(&project_dir).is_ok() && bytes > 0 {
cache_size_index::adjust(cache_root, -i64::try_from(bytes).unwrap_or(i64::MAX));
}
}
#[cfg(test)]
#[allow(
clippy::expect_used,
clippy::unreachable,
reason = "tests should panic on unexpected values"
)]
mod tests;
pub use history::CacheUsage;
pub use history::read_history;
pub use history::retained_cache_usage;
pub use lint_runs::LintRuns;
#[cfg(test)]
pub use paths::cache_root;
#[cfg(test)]
pub use paths::latest_path_under;
pub use paths::project_dir;
pub use runtime::RegisterProjectRequest;
pub use runtime::RuntimeHandle;
pub use runtime::project_is_eligible;
pub use runtime::spawn;
pub(crate) use status::parse_timestamp;
pub(crate) use trigger::CargoMetadataTriggerKind;
pub(crate) use trigger::classify_cargo_metadata_basename;
pub(crate) use trigger::classify_cargo_metadata_event_path;
pub(crate) use trigger::classify_event_path;
pub use types::CachedLintStatus;
#[cfg(test)]
pub use types::LintCommand;
#[cfg(test)]
pub use types::LintCommandStatus;
pub use types::LintRun;
pub use types::LintRunOrigin;
pub use types::LintRunStatus;
pub use types::LintStatus;
pub use types::LintStatusKind;