mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 10:21:53 +00:00
feature log
This commit is contained in:
committed by
Aiden McClelland
parent
932a5741e6
commit
91cce8fb13
@@ -20,6 +20,7 @@ indexmap = { version = "1.6.2", features = ["serde"] }
|
||||
json-patch = { path = "../json-patch" }
|
||||
json-ptr = { path = "../json-ptr" }
|
||||
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" }
|
||||
@@ -27,9 +28,22 @@ serde = { version = "1.0.118", features = ["rc"] }
|
||||
serde_cbor = { path = "../cbor" }
|
||||
serde_json = "1.0.61"
|
||||
thiserror = "1.0.23"
|
||||
tokio = { version = "1.0.1", features = ["sync", "fs", "rt", "io-util", "macros"] }
|
||||
tokio = { version = "1.0.1", features = [
|
||||
"sync",
|
||||
"fs",
|
||||
"rt",
|
||||
"io-util",
|
||||
"macros",
|
||||
] }
|
||||
|
||||
[dev-dependencies]
|
||||
proptest = "1.0.0"
|
||||
serde = { version = "1.0.118", features = ["rc", "derive"] }
|
||||
tokio = { version = "1.0.1", features = ["sync", "fs", "rt", "rt-multi-thread", "io-util", "macros"] }
|
||||
tokio = { version = "1.0.1", features = [
|
||||
"sync",
|
||||
"fs",
|
||||
"rt",
|
||||
"rt-multi-thread",
|
||||
"io-util",
|
||||
"macros",
|
||||
] }
|
||||
|
||||
@@ -82,6 +82,8 @@ impl Locker {
|
||||
ptr: &JsonPointer<S, V>,
|
||||
deep: bool,
|
||||
) -> ReadGuard<HashMap<String, Locker>> {
|
||||
#[cfg(feature = "log")]
|
||||
log::debug!("Locking {} for READ: {{ deep: {} }}", ptr, deep);
|
||||
let mut lock = Some(self.0.clone().read().await.unwrap());
|
||||
for seg in ptr.iter() {
|
||||
let new_lock = if let Some(locker) = lock.as_ref().unwrap().get(seg) {
|
||||
@@ -98,6 +100,8 @@ impl Locker {
|
||||
if deep {
|
||||
Self::lock_root_read(&res);
|
||||
}
|
||||
#[cfg(feature = "log")]
|
||||
log::debug!("Locked {} for READ: {{ deep: {} }}", ptr, deep);
|
||||
res
|
||||
}
|
||||
pub(crate) async fn add_read_lock<S: AsRef<str> + Clone, V: SegList + Clone>(
|
||||
@@ -135,6 +139,8 @@ impl Locker {
|
||||
ptr: &JsonPointer<S, V>,
|
||||
deep: bool,
|
||||
) -> WriteGuard<HashMap<String, Locker>> {
|
||||
#[cfg(feature = "log")]
|
||||
log::debug!("Locking {} for WRITE: {{ deep: {} }}", ptr, deep);
|
||||
let mut lock = self.0.clone().write().await.unwrap();
|
||||
for seg in ptr.iter() {
|
||||
let new_lock = if let Some(locker) = lock.get(seg) {
|
||||
@@ -149,6 +155,8 @@ impl Locker {
|
||||
if deep {
|
||||
Self::lock_root_write(&res);
|
||||
}
|
||||
#[cfg(feature = "log")]
|
||||
log::debug!("Locked {} for WRITE: {{ deep: {} }}", ptr, deep);
|
||||
res
|
||||
}
|
||||
pub(crate) async fn add_write_lock<S: AsRef<str> + Clone, V: SegList + Clone>(
|
||||
|
||||
Reference in New Issue
Block a user