pub trait Storage: Send + Sync {
// Required methods
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 insert<'life0, 'async_trait>(
&'life0 mut self,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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;
fn update<'life0, 'async_trait>(
&'life0 mut self,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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;
fn list_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + 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;
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 close<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait;
}Expand description
Core storage contract
Required Methods§
Sourcefn 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
Sourcefn insert<'life0, 'async_trait>(
&'life0 mut self,
document: 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,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert a new document
Sourcefn 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
Sourcefn update<'life0, 'async_trait>(
&'life0 mut self,
document: 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,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update an existing document
Sourcefn 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
Sourcefn list_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all documents
Sourcefn 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