diff --git a/.gitmodules b/.gitmodules index 9399954..da5dc12 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "json-ptr"] path = json-ptr url = git@github.com:dr-bonez/json-ptr.git -[submodule "qutex"] - path = qutex - url = git@github.com:dr-bonez/qutex.git diff --git a/Cargo.toml b/Cargo.toml index 77f6638..6ed4cb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,5 +6,4 @@ members = [ "cbor", "json-patch", "json-ptr", - "qutex", ] diff --git a/patch-db/Cargo.toml b/patch-db/Cargo.toml index 6d5225a..3c3e8e3 100644 --- a/patch-db/Cargo.toml +++ b/patch-db/Cargo.toml @@ -23,7 +23,6 @@ lazy_static = "1.4.0" log = { version = "*", optional = true } nix = "0.20.0" patch-db-macro = { path = "../patch-db-macro" } -qutex = { path = "../qutex", package = "qutex-2" } serde = { version = "1.0.118", features = ["rc"] } serde_cbor = { path = "../cbor" } serde_json = "1.0.61" diff --git a/patch-db/src/store.rs b/patch-db/src/store.rs index 0d1bbf7..971bb2c 100644 --- a/patch-db/src/store.rs +++ b/patch-db/src/store.rs @@ -9,24 +9,23 @@ use fd_lock_rs::FdLock; use indexmap::IndexSet; use json_ptr::{JsonPointer, SegList}; use lazy_static::lazy_static; -use qutex::{Guard, Qutex}; use serde::{Deserialize, Serialize}; use serde_json::Value; use tokio::fs::File; use tokio::sync::broadcast::{Receiver, Sender}; -use tokio::sync::{Mutex, RwLock, RwLockWriteGuard}; +use tokio::sync::{Mutex, OwnedMutexGuard, RwLock, RwLockWriteGuard}; use crate::patch::{diff, DiffPatch, Dump, Revision}; use crate::Error; use crate::{locker::Locker, PatchDbHandle}; lazy_static! { - static ref OPEN_STORES: Mutex>> = Mutex::new(HashMap::new()); + static ref OPEN_STORES: Mutex>>> = Mutex::new(HashMap::new()); } pub struct Store { file: FdLock, - _lock: Guard<()>, + _lock: OwnedMutexGuard<()>, cache_corrupted: Option>, data: Value, revision: u64, @@ -41,11 +40,11 @@ impl Store { let mut lock = OPEN_STORES.lock().await; ( if let Some(open) = lock.get(&path) { - open.clone().lock().await.unwrap() + open.clone().lock_owned().await } else { - let tex = Qutex::new(()); + let tex = Arc::new(Mutex::new(())); lock.insert(path.clone(), tex.clone()); - tex.lock().await.unwrap() + tex.lock_owned().await }, path, ) diff --git a/qutex b/qutex deleted file mode 160000 index 9b4e2fe..0000000 --- a/qutex +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9b4e2fe1dccab70813c5f5e28c5fecacbd5d5617