remove qutex

This commit is contained in:
Aiden McClelland
2021-09-23 19:23:26 -06:00
committed by Aiden McClelland
parent 843e7febcb
commit a861f8173f
5 changed files with 6 additions and 13 deletions

3
.gitmodules vendored
View File

@@ -7,6 +7,3 @@
[submodule "json-ptr"] [submodule "json-ptr"]
path = json-ptr path = json-ptr
url = git@github.com:dr-bonez/json-ptr.git url = git@github.com:dr-bonez/json-ptr.git
[submodule "qutex"]
path = qutex
url = git@github.com:dr-bonez/qutex.git

View File

@@ -6,5 +6,4 @@ members = [
"cbor", "cbor",
"json-patch", "json-patch",
"json-ptr", "json-ptr",
"qutex",
] ]

View File

@@ -23,7 +23,6 @@ lazy_static = "1.4.0"
log = { version = "*", optional = true } log = { version = "*", optional = true }
nix = "0.20.0" nix = "0.20.0"
patch-db-macro = { path = "../patch-db-macro" } patch-db-macro = { path = "../patch-db-macro" }
qutex = { path = "../qutex", package = "qutex-2" }
serde = { version = "1.0.118", features = ["rc"] } serde = { version = "1.0.118", features = ["rc"] }
serde_cbor = { path = "../cbor" } serde_cbor = { path = "../cbor" }
serde_json = "1.0.61" serde_json = "1.0.61"

View File

@@ -9,24 +9,23 @@ use fd_lock_rs::FdLock;
use indexmap::IndexSet; use indexmap::IndexSet;
use json_ptr::{JsonPointer, SegList}; use json_ptr::{JsonPointer, SegList};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use qutex::{Guard, Qutex};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
use tokio::fs::File; use tokio::fs::File;
use tokio::sync::broadcast::{Receiver, Sender}; 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::patch::{diff, DiffPatch, Dump, Revision};
use crate::Error; use crate::Error;
use crate::{locker::Locker, PatchDbHandle}; use crate::{locker::Locker, PatchDbHandle};
lazy_static! { lazy_static! {
static ref OPEN_STORES: Mutex<HashMap<PathBuf, Qutex<()>>> = Mutex::new(HashMap::new()); static ref OPEN_STORES: Mutex<HashMap<PathBuf, Arc<Mutex<()>>>> = Mutex::new(HashMap::new());
} }
pub struct Store { pub struct Store {
file: FdLock<File>, file: FdLock<File>,
_lock: Guard<()>, _lock: OwnedMutexGuard<()>,
cache_corrupted: Option<Arc<IOError>>, cache_corrupted: Option<Arc<IOError>>,
data: Value, data: Value,
revision: u64, revision: u64,
@@ -41,11 +40,11 @@ impl Store {
let mut lock = OPEN_STORES.lock().await; let mut lock = OPEN_STORES.lock().await;
( (
if let Some(open) = lock.get(&path) { if let Some(open) = lock.get(&path) {
open.clone().lock().await.unwrap() open.clone().lock_owned().await
} else { } else {
let tex = Qutex::new(()); let tex = Arc::new(Mutex::new(()));
lock.insert(path.clone(), tex.clone()); lock.insert(path.clone(), tex.clone());
tex.lock().await.unwrap() tex.lock_owned().await
}, },
path, path,
) )

1
qutex

Submodule qutex deleted from 9b4e2fe1dc