pub struct DiskCache { /* private fields */ }Expand description
A content-addressed disk cache of DiskArtifacts. UNTRUSTED: every read is
re-verified by the caller against the URN’s root before use.
Implementations§
Source§impl DiskCache
impl DiskCache
Sourcepub fn new(dir: impl Into<PathBuf>) -> Self
pub fn new(dir: impl Into<PathBuf>) -> Self
Open (creating the directory) a disk cache rooted at dir.
Sourcepub fn get(&self, id: &str) -> Option<DiskArtifacts>
pub fn get(&self, id: &str) -> Option<DiskArtifacts>
Load the stored artifacts for id, or None on miss / unreadable /
malformed (a corrupt envelope is a miss, not a crash).
Sourcepub fn put(&self, id: &str, artifacts: &DiskArtifacts)
pub fn put(&self, id: &str, artifacts: &DiskArtifacts)
Persist the verifiable artifacts for id (best-effort; ignore I/O errors).
Auto Trait Implementations§
impl Freeze for DiskCache
impl RefUnwindSafe for DiskCache
impl Send for DiskCache
impl Sync for DiskCache
impl Unpin for DiskCache
impl UnsafeUnpin for DiskCache
impl UnwindSafe for DiskCache
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