implement flush() and cleanup() for rocksdb
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
0df17a4103
commit
7cbb0139f2
1 changed files with 14 additions and 2 deletions
|
@ -4,7 +4,10 @@ use std::{
|
||||||
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 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue