mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-08-29 00:08:18 +00:00
implement flush() and cleanup() for rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
@@ -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) {}
|
||||
|
||||
Reference in New Issue
Block a user