Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rocksdb): resource busy issue #194

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading