Skip to content

Commit

Permalink
fix(rocksdb): use TransactionDB instead of OptimisticTransactionDB (#194
Browse files Browse the repository at this point in the history
)
  • Loading branch information
greenhat616 authored Dec 25, 2023
1 parent 1dbd52e commit 8373913
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/tauri/src/core/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MultiThreaded>,
instance: rocksdb::TransactionDB<MultiThreaded>,
path: String,
}

Expand All @@ -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::<MultiThreaded>::open_default(&path).unwrap();
let instance = rocksdb::TransactionDB::<MultiThreaded>::open_default(&path).unwrap();
Arc::new(Storage { instance, path })
})
}

pub fn get_instance(&self) -> &rocksdb::OptimisticTransactionDB<MultiThreaded> {
pub fn get_instance(&self) -> &rocksdb::TransactionDB<MultiThreaded> {
&self.instance
}

Expand Down

0 comments on commit 8373913

Please sign in to comment.