mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-06-27 16:35:59 +00:00
asyncify KeyValueDatabaseEngine
This commit is contained in:
parent
4b9520b5ad
commit
a7e34eb0b3
9 changed files with 121 additions and 111 deletions
|
@ -1,6 +1,7 @@
|
|||
use super::Config;
|
||||
use crate::Result;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
|
||||
#[cfg(feature = "sled")]
|
||||
|
@ -26,16 +27,17 @@ pub mod persy;
|
|||
))]
|
||||
pub mod watchers;
|
||||
|
||||
#[async_trait]
|
||||
pub trait KeyValueDatabaseEngine: Send + Sync {
|
||||
fn open(config: &Config) -> Result<Self>
|
||||
async fn open(config: &Config) -> Result<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>>;
|
||||
fn flush(&self) -> Result<()>;
|
||||
fn cleanup(&self) -> Result<()> {
|
||||
async fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>>;
|
||||
async fn flush(&self) -> Result<()>;
|
||||
async fn cleanup(&self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
fn memory_usage(&self) -> Result<String> {
|
||||
async fn memory_usage(&self) -> Result<String> {
|
||||
Ok("Current database engine does not support memory usage reporting.".to_owned())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue