sync every txn

This commit is contained in:
Luke Parker
2024-03-09 03:18:52 -05:00
parent 89b237af7e
commit 68dc872b88
2 changed files with 6 additions and 3 deletions

View File

@@ -1,7 +1,8 @@
use std::sync::Arc;
use rocksdb::{
DBCompressionType, ThreadMode, SingleThreaded, LogLevel, Options, Transaction, TransactionDB,
DBCompressionType, ThreadMode, SingleThreaded, LogLevel, WriteOptions, Transaction, Options,
TransactionDB,
};
use crate::*;
@@ -31,7 +32,9 @@ impl<T: ThreadMode> Get for Arc<TransactionDB<T>> {
impl<T: ThreadMode + 'static> Db for Arc<TransactionDB<T>> {
type Transaction<'a> = Transaction<'a, TransactionDB<T>>;
fn txn(&mut self) -> Self::Transaction<'_> {
self.transaction()
let mut opts = WriteOptions::default();
opts.set_sync(true);
self.transaction_opt(&opts, &Default::default())
}
}