mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-26 16:33:44 +00:00
add sync() to db abstraction for fsync(2).
This commit is contained in:
parent
d4cfee4e71
commit
544c38341b
|
@ -18,6 +18,7 @@ pub(crate) trait KeyValueDatabaseEngine: Send + Sync {
|
|||
Self: Sized;
|
||||
fn open_tree(&self, name: &'static str) -> Result<Arc<dyn KvTree>>;
|
||||
fn flush(&self) -> Result<()>;
|
||||
fn sync(&self) -> Result<()> { Ok(()) }
|
||||
fn cleanup(&self) -> Result<()> { Ok(()) }
|
||||
fn memory_usage(&self) -> Result<String> {
|
||||
Ok("Current database engine does not support memory usage reporting.".to_owned())
|
||||
|
|
|
@ -170,12 +170,17 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
|||
}
|
||||
|
||||
fn flush(&self) -> Result<()> {
|
||||
debug!("Running flush_wal (no sync)");
|
||||
rust_rocksdb::DBCommon::flush_wal(&self.rocks, false)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn sync(&self) -> Result<()> {
|
||||
rust_rocksdb::DBCommon::flush_wal(&self.rocks, true)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn memory_usage(&self) -> Result<String> {
|
||||
let stats = rust_rocksdb::perf::get_memory_usage_stats(Some(&[&self.rocks]), Some(&[&self.cache]))?;
|
||||
Ok(format!(
|
||||
|
|
Loading…
Reference in a new issue