pub struct CacheMetadataManager<'a, F: FileSystem> { /* private fields */ }Expand description
Manages cache metadata for optimized version checking
Implementations§
Source§impl<'a, F: FileSystem> CacheMetadataManager<'a, F>
impl<'a, F: FileSystem> CacheMetadataManager<'a, F>
pub const fn new(fs: &'a F) -> Self
Sourcepub fn load_metadata<P: AsRef<Path>>(
&self,
cache_dir: P,
) -> Result<GlobalCacheMetadata, Error>
pub fn load_metadata<P: AsRef<Path>>( &self, cache_dir: P, ) -> Result<GlobalCacheMetadata, Error>
Load global cache metadata, creating default if it doesn’t exist
§Errors
Returns an error if the metadata file exists but cannot be read or parsed
Sourcepub fn save_metadata<P: AsRef<Path>>(
&self,
cache_dir: P,
metadata: &GlobalCacheMetadata,
) -> Result<(), Error>
pub fn save_metadata<P: AsRef<Path>>( &self, cache_dir: P, metadata: &GlobalCacheMetadata, ) -> Result<(), Error>
Save global cache metadata
§Errors
Returns an error if the metadata cannot be serialized or written to disk
Sourcepub fn check_spec_version<P: AsRef<Path>>(
&self,
cache_dir: P,
spec_name: &str,
) -> Result<bool, Error>
pub fn check_spec_version<P: AsRef<Path>>( &self, cache_dir: P, spec_name: &str, ) -> Result<bool, Error>
Check if a spec’s cache is compatible with current version
§Errors
Returns an error if the metadata file cannot be loaded
Sourcepub fn update_spec_metadata<P: AsRef<Path>>(
&self,
cache_dir: P,
spec_name: &str,
file_size: u64,
) -> Result<(), Error>
pub fn update_spec_metadata<P: AsRef<Path>>( &self, cache_dir: P, spec_name: &str, file_size: u64, ) -> Result<(), Error>
Update metadata for a specific spec
§Errors
Returns an error if the metadata cannot be loaded or saved
Auto Trait Implementations§
impl<'a, F> Freeze for CacheMetadataManager<'a, F>
impl<'a, F> RefUnwindSafe for CacheMetadataManager<'a, F>where
F: RefUnwindSafe,
impl<'a, F> Send for CacheMetadataManager<'a, F>where
F: Sync,
impl<'a, F> Sync for CacheMetadataManager<'a, F>where
F: Sync,
impl<'a, F> Unpin for CacheMetadataManager<'a, F>
impl<'a, F> UnwindSafe for CacheMetadataManager<'a, F>where
F: RefUnwindSafe,
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