fix: update persy implementation after refactor
This commit is contained in:
parent
c948324cf2
commit
842feabced
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
database::{
|
database::{
|
||||||
abstraction::{watchers::Watchers, DatabaseEngine, Tree},
|
abstraction::{watchers::Watchers, KeyValueDatabaseEngine, KvTree},
|
||||||
Config,
|
Config,
|
||||||
},
|
},
|
||||||
Result,
|
Result,
|
||||||
|
@ -15,7 +15,7 @@ pub struct Engine {
|
||||||
persy: Persy,
|
persy: Persy,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DatabaseEngine for Arc<Engine> {
|
impl KeyValueDatabaseEngine for Arc<Engine> {
|
||||||
fn open(config: &Config) -> Result<Self> {
|
fn open(config: &Config) -> Result<Self> {
|
||||||
let mut cfg = persy::Config::new();
|
let mut cfg = persy::Config::new();
|
||||||
cfg.change_cache_size((config.db_cache_capacity_mb * 1024.0 * 1024.0) as u64);
|
cfg.change_cache_size((config.db_cache_capacity_mb * 1024.0 * 1024.0) as u64);
|
||||||
|
@ -27,7 +27,7 @@ impl DatabaseEngine for Arc<Engine> {
|
||||||
Ok(Arc::new(Engine { persy }))
|
Ok(Arc::new(Engine { persy }))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_tree(&self, name: &'static str) -> Result<Arc<dyn Tree>> {
|
fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>> {
|
||||||
// Create if it doesn't exist
|
// Create if it doesn't exist
|
||||||
if !self.persy.exists_index(name)? {
|
if !self.persy.exists_index(name)? {
|
||||||
let mut tx = self.persy.begin()?;
|
let mut tx = self.persy.begin()?;
|
||||||
|
@ -61,7 +61,7 @@ impl PersyTree {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tree for PersyTree {
|
impl KvTree for PersyTree {
|
||||||
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
|
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>> {
|
||||||
let result = self
|
let result = self
|
||||||
.persy
|
.persy
|
||||||
|
|
Loading…
Reference in a new issue