pub struct CacheDir {
pub root: PathBuf,
pub cmn_ttl_ms: u64,
pub spore_max_download_bytes: u64,
pub spore_max_extract_bytes: u64,
pub spore_max_extract_files: u64,
pub spore_max_extract_file_bytes: u64,
pub spore_reject_path_components: Vec<String>,
}Expand description
Cache directory structure
Fields§
§root: PathBuf§cmn_ttl_ms: u64§spore_max_download_bytes: u64§spore_max_extract_bytes: u64§spore_max_extract_files: u64§spore_max_extract_file_bytes: u64§spore_reject_path_components: Vec<String>Implementations§
Source§impl CacheDir
impl CacheDir
Sourcepub fn new() -> Result<Self, HyphaError>
pub fn new() -> Result<Self, HyphaError>
Create a new CacheDir under $CMN_HOME/hypha/cache/ (or [cache] path from config.toml)
Sourcepub fn domain(&self, domain: &str) -> DomainCache
pub fn domain(&self, domain: &str) -> DomainCache
Get the domain cache helper
Sourcepub fn spore_path(&self, domain: &str, hash: &str) -> PathBuf
pub fn spore_path(&self, domain: &str, hash: &str) -> PathBuf
Get the cache path for a specific spore (legacy compatibility)
Sourcepub fn list_all(&self) -> Vec<CachedSpore>
pub fn list_all(&self) -> Vec<CachedSpore>
List all cached spores
Sourcepub fn clean_all(&self) -> Result<usize, HyphaError>
pub fn clean_all(&self) -> Result<usize, HyphaError>
Remove all cached items.
Only purges a directory hypha recognizes as its own — either the default
cache location or one bearing the [CACHE_SENTINEL] marker — and removes
only the managed subtrees, leaving the cache root (and marker) in place.
Auto Trait Implementations§
impl Freeze for CacheDir
impl RefUnwindSafe for CacheDir
impl Send for CacheDir
impl Sync for CacheDir
impl Unpin for CacheDir
impl UnsafeUnpin for CacheDir
impl UnwindSafe for CacheDir
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