use std::path::{Path, PathBuf};
pub mod cached_cdn_client;
pub mod cached_ribbit_client;
pub mod cached_tact_client;
pub mod cdn;
pub mod error;
pub mod generic;
pub mod hybrid_version_client;
pub mod ribbit;
pub mod stats;
pub use cdn::CdnCache;
pub use error::{Error, Result};
pub use stats::{CacheReport, CacheStats, CacheStatsSnapshot};
pub fn get_cache_dir() -> Result<PathBuf> {
dirs::cache_dir()
.ok_or(Error::CacheDirectoryNotFound)
.map(|dir| dir.join("ngdp"))
}
pub(crate) async fn ensure_dir(path: &Path) -> Result<()> {
if tokio::fs::metadata(path).await.is_err() {
tokio::fs::create_dir_all(path).await?;
}
Ok(())
}