change flush to be on drop

This commit is contained in:
Jonathan de Jong 2021-12-21 18:04:15 +01:00
parent c096eefa32
commit 8293beba48

View file

@ -66,6 +66,13 @@ impl Database for RocksDB {
}
}
impl Drop for RocksDB {
#[allow(unused_must_use)]
fn drop(&mut self) {
self.rocks.flush();
}
}
pub struct RocksDBCF<'a> {
db: &'a mut RocksDB,
name: String,
@ -87,8 +94,6 @@ impl<'r> Segment for RocksDBCF<'r> {
self.db.rocks.put_cf(cf, key, value)?;
}
self.db.rocks.flush_cf(cf)?;
Ok(())
}