Skip to content
Snippets Groups Projects
Commit cb2b5bee authored by Timo Kösters's avatar Timo Kösters
Browse files

Merge branch 'fix_persy' into 'next'

fix: update persy implementation after refactor

See merge request famedly/conduit!396
parents 2231a69b 842feabc
No related branches found
No related tags found
No related merge requests found
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 { ...@@ -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 @@ fn open(config: &Config) -> Result<Self> { ...@@ -27,7 +27,7 @@ fn open(config: &Config) -> Result<Self> {
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 @@ fn begin(&self) -> Result<Transaction> { ...@@ -61,7 +61,7 @@ fn begin(&self) -> Result<Transaction> {
} }
} }
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment