pub struct BufferedStorage<S: Storage> { /* private fields */ }Expand description
Storage wrapper that buffers write operations for improved performance
Implementations§
Source§impl<S: Storage> BufferedStorage<S>
impl<S: Storage> BufferedStorage<S>
Sourcepub fn with_config(inner: S, config: BufferConfig) -> Self
pub fn with_config(inner: S, config: BufferConfig) -> Self
Create a new buffered storage wrapper with custom configuration
Sourcepub async fn buffer_stats(&self) -> (usize, u64, u64)
pub async fn buffer_stats(&self) -> (usize, u64, u64)
Get statistics about the buffer
Trait Implementations§
Source§impl<S: Storage> Drop for BufferedStorage<S>
impl<S: Storage> Drop for BufferedStorage<S>
Source§impl<S: Storage> Storage for BufferedStorage<S>
impl<S: Storage> Storage for BufferedStorage<S>
Source§fn open<'life0, 'async_trait>(
path: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
fn open<'life0, 'async_trait>(
path: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
'life0: 'async_trait,
Open a storage instance at the given path
Source§fn insert<'life0, 'async_trait>(
&'life0 mut self,
doc: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn insert<'life0, 'async_trait>(
&'life0 mut self,
doc: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new document
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ValidatedDocumentId,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 ValidatedDocumentId,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a document by ID
Source§fn update<'life0, 'async_trait>(
&'life0 mut self,
doc: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update<'life0, 'async_trait>(
&'life0 mut self,
doc: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update an existing document
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: &'life1 ValidatedDocumentId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: &'life1 ValidatedDocumentId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a document by ID
Source§fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush any pending changes
Source§fn sync<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn sync<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sync changes to persistent storage
Auto Trait Implementations§
impl<S> Freeze for BufferedStorage<S>where
S: Freeze,
impl<S> !RefUnwindSafe for BufferedStorage<S>
impl<S> Send for BufferedStorage<S>
impl<S> Sync for BufferedStorage<S>
impl<S> Unpin for BufferedStorage<S>where
S: Unpin,
impl<S> !UnwindSafe for BufferedStorage<S>
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> 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