pub struct Cache { /* private fields */ }
Expand description
Cache for registry entities.
Implementations§
Source§impl Cache
impl Cache
Sourcepub async fn new(root: Option<PathBuf>) -> Result<Self>
pub async fn new(root: Option<PathBuf>) -> Result<Self>
Create a new cache given an optional root directory.
Sourcepub fn manifests_dir(&self) -> PathBuf
pub fn manifests_dir(&self) -> PathBuf
The manifests directory for the current cache.
Sourcepub fn wasm_file(&self, digest: impl AsRef<str>) -> Result<PathBuf>
pub fn wasm_file(&self, digest: impl AsRef<str>) -> Result<PathBuf>
Return the path to a wasm file given its digest.
Sourcepub fn data_file(&self, digest: impl AsRef<str>) -> Result<PathBuf>
pub fn data_file(&self, digest: impl AsRef<str>) -> Result<PathBuf>
Return the path to a data file given its digest.
Sourcepub async fn write_wasm(
&self,
bytes: impl AsRef<[u8]>,
digest: impl AsRef<str>,
) -> Result<()>
pub async fn write_wasm( &self, bytes: impl AsRef<[u8]>, digest: impl AsRef<str>, ) -> Result<()>
Write the contents in the cache’s wasm directory.
Sourcepub async fn write_data(
&self,
bytes: impl AsRef<[u8]>,
digest: impl AsRef<str>,
) -> Result<()>
pub async fn write_data( &self, bytes: impl AsRef<[u8]>, digest: impl AsRef<str>, ) -> Result<()>
Write the contents in the cache’s data directory.
Sourcepub fn wasm_path(&self, digest: impl AsRef<str>) -> PathBuf
pub fn wasm_path(&self, digest: impl AsRef<str>) -> PathBuf
The path of contents in the cache’s wasm directory, which may or may not exist.
Sourcepub fn data_path(&self, digest: impl AsRef<str>) -> PathBuf
pub fn data_path(&self, digest: impl AsRef<str>) -> PathBuf
The path of contents in the cache’s wasm directory, which may or may not exist.
Sourcepub async fn ensure_dirs(&self) -> Result<()>
pub async fn ensure_dirs(&self) -> Result<()>
Ensure the expected configuration directories are found in the root.
└── <configuration-root>
└── registry
└──manifests
└──wasm
└──data
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self
file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more