pub struct CachingDirectory { /* private fields */ }Expand description
The caching directory is a simple cache that wraps another directory.
Implementations§
Source§impl CachingDirectory
impl CachingDirectory
Sourcepub fn bounded(
underlying: Arc<dyn Directory>,
_capacity_in_bytes: usize,
file_stats: FileStats,
) -> CachingDirectory
pub fn bounded( underlying: Arc<dyn Directory>, _capacity_in_bytes: usize, file_stats: FileStats, ) -> CachingDirectory
Creates a new CachingDirectory.
Warming: The resulting CacheDirectory will cache all information without ever removing any item from the cache.
pub fn unbounded( underlying: Arc<dyn Directory>, file_stats: FileStats, ) -> CachingDirectory
Trait Implementations§
Source§impl Clone for CachingDirectory
impl Clone for CachingDirectory
Source§fn clone(&self) -> CachingDirectory
fn clone(&self) -> CachingDirectory
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CachingDirectory
impl Debug for CachingDirectory
Source§impl Directory for CachingDirectory
impl Directory for CachingDirectory
Source§fn get_file_handle(
&self,
path: &Path,
) -> Result<Arc<dyn FileHandle>, OpenReadError>
fn get_file_handle( &self, path: &Path, ) -> Result<Arc<dyn FileHandle>, OpenReadError>
Opens a file and returns a boxed
FileHandle. Read moreSource§fn exists(&self, path: &Path) -> Result<bool, OpenReadError>
fn exists(&self, path: &Path) -> Result<bool, OpenReadError>
Returns true if and only if the file exists
Source§fn open_write(&self, path: &Path) -> Result<WritePtr, OpenWriteError>
fn open_write(&self, path: &Path) -> Result<WritePtr, OpenWriteError>
Source§fn atomic_read(&self, path: &Path) -> Result<Vec<u8>, OpenReadError>
fn atomic_read(&self, path: &Path) -> Result<Vec<u8>, OpenReadError>
Reads the full content file that has been written using
Directory::atomic_write(). Read moreSource§fn atomic_read_async<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, OpenReadError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn atomic_read_async<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, OpenReadError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads asynchronously the full content file that has been written using
Directory::atomic_write(). Read moreSource§fn atomic_write(&self, path: &Path, data: &[u8]) -> Result<()>
fn atomic_write(&self, path: &Path, data: &[u8]) -> Result<()>
Atomically replace the content of a file with data. Read more
Source§fn acquire_lock(&self, lock: &Lock) -> Result<DirectoryLock, LockError>
fn acquire_lock(&self, lock: &Lock) -> Result<DirectoryLock, LockError>
Source§fn watch(&self, callback: WatchCallback) -> Result<WatchHandle>
fn watch(&self, callback: WatchCallback) -> Result<WatchHandle>
Registers a callback that will be called whenever a change on the
meta.json
using the Directory::atomic_write() API is detected. Read morefn as_any(&self) -> &dyn Any
fn underlying_directory(&self) -> Option<&dyn Directory>
fn real_directory(&self) -> &dyn Directory
Source§fn open_read(&self, path: &Path) -> Result<FileSlice, OpenReadError>
fn open_read(&self, path: &Path) -> Result<FileSlice, OpenReadError>
Once a virtual file is open, its data may not
change. Read more
fn open_read_async<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<FileSlice, OpenReadError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_async<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 Path,
) -> Pin<Box<dyn Future<Output = Result<(), DeleteError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl Freeze for CachingDirectory
impl !RefUnwindSafe for CachingDirectory
impl Send for CachingDirectory
impl Sync for CachingDirectory
impl Unpin for CachingDirectory
impl !UnwindSafe for CachingDirectory
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DirectoryClone for T
impl<T> DirectoryClone for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§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