pub struct CachingDirectory<D> { /* private fields */ }Expand description
A Directory implementation wrapping another one and caching some data using
deadpool_redis.
Implementations§
Source§impl<D> CachingDirectory<D>
impl<D> CachingDirectory<D>
Sourcepub fn new(dir: D, redis: Pool) -> Self
pub fn new(dir: D, redis: Pool) -> Self
Creates a new CachingDirectory from the given directory and pool.
The provided Directory must return a FileHandle that implements
read_bytes_async() without panicking.
This must be called from within a tokio context.
Source§impl<D: Directory + Clone> CachingDirectory<D>
impl<D: Directory + Clone> CachingDirectory<D>
Sourcepub fn warmer(&self) -> Warmer<D>
pub fn warmer(&self) -> Warmer<D>
Creates a Warmer that allows warming this directory’s cache.
The warmer defaults to the host’s available parallelism; configure it with
Warmer::with_concurrency.
Trait Implementations§
Source§impl<D: Clone> Clone for CachingDirectory<D>
impl<D: Clone> Clone for CachingDirectory<D>
Source§fn clone(&self) -> CachingDirectory<D>
fn clone(&self) -> CachingDirectory<D>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<D: Debug> Debug for CachingDirectory<D>
impl<D: Debug> Debug for CachingDirectory<D>
Source§impl<D: Clone + Directory> Directory for CachingDirectory<D>
impl<D: Clone + Directory> Directory for CachingDirectory<D>
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_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
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_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 watch(&self, cb: WatchCallback) -> Result<WatchHandle>
fn watch(&self, cb: 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 moreSource§fn acquire_lock(&self, lock: &Lock) -> Result<DirectoryLock, LockError>
fn acquire_lock(&self, lock: &Lock) -> Result<DirectoryLock, LockError>
Auto Trait Implementations§
impl<D> !RefUnwindSafe for CachingDirectory<D>
impl<D> !UnwindSafe for CachingDirectory<D>
impl<D> Freeze for CachingDirectory<D>where
D: Freeze,
impl<D> Send for CachingDirectory<D>where
D: Send,
impl<D> Sync for CachingDirectory<D>where
D: Sync,
impl<D> Unpin for CachingDirectory<D>where
D: Unpin,
impl<D> UnsafeUnpin for CachingDirectory<D>where
D: UnsafeUnpin,
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
impl<T> Fruit 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