mirror of
https://github.com/ShadowJonathan/conduit_toolbox.git
synced 2025-06-07 18:07:08 +03:00
add additional flushes
This commit is contained in:
parent
632ef87337
commit
0e0a025c37
5 changed files with 21 additions and 1 deletions
|
@ -13,6 +13,8 @@ pub trait Database {
|
||||||
fn names<'a>(&'a self) -> Vec<Vec<u8>>;
|
fn names<'a>(&'a self) -> Vec<Vec<u8>>;
|
||||||
|
|
||||||
fn segment<'a>(&'a mut self, name: Vec<u8>) -> Option<Box<dyn Segment + 'a>>; // change return type to Result
|
fn segment<'a>(&'a mut self, name: Vec<u8>) -> Option<Box<dyn Segment + 'a>>; // change return type to Result
|
||||||
|
|
||||||
|
fn flush(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Segment {
|
pub trait Segment {
|
||||||
|
@ -54,8 +56,10 @@ pub fn copy_database(
|
||||||
}
|
}
|
||||||
|
|
||||||
drop(dst_seg);
|
drop(dst_seg);
|
||||||
|
|
||||||
drop(src_seg_iter);
|
drop(src_seg_iter);
|
||||||
|
drop(src_seg);
|
||||||
|
|
||||||
|
dst.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -64,6 +64,10 @@ impl Database for HeedDB {
|
||||||
.map(|(k, _)| k)
|
.map(|(k, _)| k)
|
||||||
.collect_vec()
|
.collect_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) {
|
||||||
|
// NOOP
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pub struct HeedSegment {
|
pub struct HeedSegment {
|
||||||
env: heed::Env,
|
env: heed::Env,
|
||||||
|
|
|
@ -80,6 +80,10 @@ impl Database for RocksDB {
|
||||||
.map(|v| v.as_bytes().to_vec())
|
.map(|v| v.as_bytes().to_vec())
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) {
|
||||||
|
self.rocks.flush().unwrap()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for RocksDB {
|
impl Drop for RocksDB {
|
||||||
|
|
|
@ -33,6 +33,10 @@ impl Database for SledDB {
|
||||||
.ok()
|
.ok()
|
||||||
.map(|t| -> Box<dyn Segment> { Box::new(t) })
|
.map(|t| -> Box<dyn Segment> { Box::new(t) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) {
|
||||||
|
self.0.flush().unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Segment for Tree {
|
impl Segment for Tree {
|
||||||
|
|
|
@ -64,6 +64,10 @@ impl Database for SqliteDB {
|
||||||
name: string,
|
name: string,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn flush(&mut self) {
|
||||||
|
// NOOP
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SqliteSegment<'a> {
|
pub struct SqliteSegment<'a> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue