implement flush() and cleanup() for rocksdb

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry
2024-03-08 12:51:21 -05:00
committed by June
parent 0df17a4103
commit 7cbb0139f2
+14 -2
View File
@@ -4,7 +4,10 @@
sync::{Arc, RwLock},
};
use rocksdb::LogLevel::{Debug, Error, Fatal, Info, Warn};
use rocksdb::{
FlushOptions,
LogLevel::{Debug, Error, Fatal, Info, Warn},
};
use tracing::{debug, info};
use super::{super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree};
@@ -143,7 +146,9 @@ fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>> {
}
fn flush(&self) -> Result<()> {
// TODO?
debug!("Running flush_wal (no sync)");
rocksdb::DBCommon::flush_wal(&self.rocks, false)?;
Ok(())
}
@@ -161,6 +166,13 @@ fn memory_usage(&self) -> Result<String> {
))
}
fn cleanup(&self) -> Result<()> {
debug!("Running flush_opt");
rocksdb::DBCommon::flush_opt(&self.rocks, &FlushOptions::default())?;
Ok(())
}
// TODO: figure out if this is needed for rocksdb
#[allow(dead_code)]
fn clear_caches(&self) {}