From 83739131fd53e0a59798db986f441d10d6faea33 Mon Sep 17 00:00:00 2001 From: Jonson Petard <41122242+greenhat616@users.noreply.github.com> Date: Tue, 26 Dec 2023 01:14:11 +0800 Subject: [PATCH] fix(rocksdb): use TransactionDB instead of OptimisticTransactionDB (#194) --- backend/tauri/src/core/storage.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/tauri/src/core/storage.rs b/backend/tauri/src/core/storage.rs index 8a39528490..cbb571e21d 100644 --- a/backend/tauri/src/core/storage.rs +++ b/backend/tauri/src/core/storage.rs @@ -5,7 +5,7 @@ use std::sync::{Arc, OnceLock}; /// storage is a wrapper or called a facade for the rocksdb /// Maybe provide a facade for a kv storage is a good idea? pub struct Storage { - instance: rocksdb::OptimisticTransactionDB, + instance: rocksdb::TransactionDB, path: String, } @@ -15,13 +15,12 @@ impl Storage { STORAGE.get_or_init(|| { let path = dirs::storage_path().unwrap().to_str().unwrap().to_string(); - let instance = - rocksdb::OptimisticTransactionDB::::open_default(&path).unwrap(); + let instance = rocksdb::TransactionDB::::open_default(&path).unwrap(); Arc::new(Storage { instance, path }) }) } - pub fn get_instance(&self) -> &rocksdb::OptimisticTransactionDB { + pub fn get_instance(&self) -> &rocksdb::TransactionDB { &self.instance }