Skip to content
Snippets Groups Projects
Commit 7cbb0139 authored by 🥺's avatar 🥺 :transgender_flag: Committed by 🥺
Browse files

implement flush() and cleanup() for rocksdb

parent 0df17a41
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,10 @@ ...@@ -4,7 +4,10 @@
sync::{Arc, RwLock}, 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 tracing::{debug, info};
use super::{super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree}; use super::{super::Config, watchers::Watchers, KeyValueDatabaseEngine, KvTree};
...@@ -143,7 +146,9 @@ fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>> { ...@@ -143,7 +146,9 @@ fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>> {
} }
fn flush(&self) -> Result<()> { fn flush(&self) -> Result<()> {
// TODO? debug!("Running flush_wal (no sync)");
rocksdb::DBCommon::flush_wal(&self.rocks, false)?;
Ok(()) Ok(())
} }
...@@ -161,6 +166,13 @@ fn memory_usage(&self) -> Result<String> { ...@@ -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 // TODO: figure out if this is needed for rocksdb
#[allow(dead_code)] #[allow(dead_code)]
fn clear_caches(&self) {} fn clear_caches(&self) {}
......
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