From c4584bf1ca1fa4b8bf296995eade307e3df6eb26 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 16:59:23 +0200 Subject: [PATCH 01/12] Add debug output in Store::create() --- libimagstore/src/store.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 4d7e811d..be0ad79e 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -333,6 +333,8 @@ impl Store { pub fn create<'a, S: IntoStoreId>(&'a self, id: S) -> Result> { let id = try!(id.into_storeid()).with_base(self.path().clone()); + debug!("Creating id: '{}'", id); + { let mut hsmap = match self.entries.write() { Err(_) => return Err(SEK::LockPoisoned.into_error()).map_err_into(SEK::CreateCallError), @@ -340,15 +342,19 @@ impl Store { }; if hsmap.contains_key(&id) { + debug!("Cannot create, internal cache already contains: '{}'", id); return Err(SEK::EntryAlreadyExists.into_error()).map_err_into(SEK::CreateCallError); } hsmap.insert(id.clone(), { + debug!("Creating: '{}'", id); let mut se = try!(StoreEntry::new(id.clone())); se.status = StoreEntryStatus::Borrowed; se }); } + debug!("Constructing FileLockEntry: '{}'", id); + Ok(FileLockEntry::new(self, Entry::new(id))) } From 6cb5300cd995da49d0f8abd3bc31323e61884441 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:04:42 +0200 Subject: [PATCH 02/12] Add debug output to Store::retrieve --- libimagstore/src/store.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index be0ad79e..5a2b2262 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -374,6 +374,7 @@ impl Store { /// pub fn retrieve<'a, S: IntoStoreId>(&'a self, id: S) -> Result> { let id = try!(id.into_storeid()).with_base(self.path().clone()); + debug!("Retrieving id: '{}'", id); let entry = try!({ self.entries .write() @@ -388,6 +389,7 @@ impl Store { .map_err_into(SEK::RetrieveCallError) }); + debug!("Constructing FileLockEntry: '{}'", id); Ok(FileLockEntry::new(self, entry)) } From 13e80445ae47c69004c7b900cf62df1ae184a084 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:05:35 +0200 Subject: [PATCH 03/12] Add debug output to Store::get --- libimagstore/src/store.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 5a2b2262..a842cd0b 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -406,6 +406,8 @@ impl Store { pub fn get<'a, S: IntoStoreId + Clone>(&'a self, id: S) -> Result>> { let id = try!(id.into_storeid()).with_base(self.path().clone()); + debug!("Getting id: '{}'", id); + let exists = try!(id.exists()) || try!(self.entries .read() .map(|map| map.contains_key(&id)) From a3466ae5480dc98b1a6e833fb3613178c2dc3a81 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:06:22 +0200 Subject: [PATCH 04/12] Add debug output to Store::retrieve_for_module --- libimagstore/src/store.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index a842cd0b..10f56cf2 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -438,6 +438,8 @@ impl Store { let mut path = self.path().clone(); path.push(mod_name); + debug!("Retrieving for module: '{}'", mod_name); + path.to_str() .ok_or(SE::new(SEK::EncodingError, None)) .and_then(|path| { From bc80a3b7d5bc208dc9996a287d10db39301b5d45 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:06:54 +0200 Subject: [PATCH 05/12] Add debug output to Store::walk --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 10f56cf2..e86ba894 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -457,6 +457,7 @@ impl Store { /// The difference between a `Walk` and a `StoreIdIterator` is that with a `Walk`, one can find /// "collections" (folders). pub fn walk<'a>(&'a self, mod_name: &str) -> Walk { + debug!("Creating Walk object for {}", mod_name); Walk::new(self.path().clone(), mod_name) } From ef0a76a02f9e024d9224dfa0e6529b84c9416406 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:08:47 +0200 Subject: [PATCH 06/12] Add debug output to Store::update --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index e86ba894..e11aa29f 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -466,6 +466,7 @@ impl Store { /// See `Store::_update()`. /// pub fn update<'a>(&'a self, entry: &mut FileLockEntry<'a>) -> Result<()> { + debug!("Updating FileLockEntry at '{}'", entry.get_location()); self._update(entry, false).map_err_into(SEK::UpdateCallError) } From 79623e1db27e27500566c41cf1b8461543d45502 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:11:18 +0200 Subject: [PATCH 07/12] Add debug output to Store::retrieve_copy --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index e11aa29f..588a8b78 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -523,6 +523,7 @@ impl Store { /// pub fn retrieve_copy(&self, id: S) -> Result { let id = try!(id.into_storeid()).with_base(self.path().clone()); + debug!("Retrieving copy of '{}'", id); let entries = match self.entries.write() { Err(_) => { return Err(SE::new(SEK::LockPoisoned, None)) From fc854f3647ea8b22b0d35804c8b24241c9333490 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:12:03 +0200 Subject: [PATCH 08/12] Add debug output to Store::delete --- libimagstore/src/store.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 588a8b78..2f2867a3 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -554,6 +554,8 @@ impl Store { pub fn delete(&self, id: S) -> Result<()> { let id = try!(id.into_storeid()).with_base(self.path().clone()); + debug!("Deleting id: '{}'", id); + { let mut entries = match self.entries.write() { Err(_) => return Err(SE::new(SEK::LockPoisoned, None)) @@ -580,6 +582,7 @@ impl Store { } } + debug!("Deleted"); Ok(()) } From e157a906bd31486db4b0eae24cc27f3dd485819b Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:13:06 +0200 Subject: [PATCH 09/12] Add debug output to Store::save_to --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 2f2867a3..604cfcc3 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -588,6 +588,7 @@ impl Store { /// Save a copy of the Entry in another place pub fn save_to(&self, entry: &FileLockEntry, new_id: StoreId) -> Result<()> { + debug!("Saving '{}' to '{}'", entry.get_location(), new_id); self.save_to_other_location(entry, new_id, false) } From c06d8c319f53e441e45c9347114715bd88bf134c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:13:24 +0200 Subject: [PATCH 10/12] Add debug output to Store::save_as --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 604cfcc3..4fa556d8 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -595,6 +595,7 @@ impl Store { /// Save an Entry in another place /// Removes the original entry pub fn save_as(&self, entry: FileLockEntry, new_id: StoreId) -> Result<()> { + debug!("Saving '{}' as '{}'", entry.get_location(), new_id); self.save_to_other_location(&entry, new_id, true) } From 1c18db56e6d8aa44c43ed39c814c3999e4d7a5c1 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:14:41 +0200 Subject: [PATCH 11/12] Add debug output to Store::save_to_other_location --- libimagstore/src/store.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 4fa556d8..8696d107 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -621,6 +621,7 @@ impl Store { FileAbstraction::copy(&old_id_as_path, &new_id_as_path) .and_then(|_| { if remove_old { + debug!("Removing old '{:?}'", old_id_as_path); FileAbstraction::remove_file(&old_id_as_path) } else { Ok(()) From fa0e8130b6df5fef6cb4035ad8a99f182703b7bf Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 4 Jun 2017 19:15:42 +0200 Subject: [PATCH 12/12] Add debug output to Store::move_by_id --- libimagstore/src/store.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 8696d107..7d12a270 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -668,6 +668,8 @@ impl Store { let new_id = new_id.with_base(self.path().clone()); let old_id = old_id.with_base(self.path().clone()); + debug!("Moving '{}' to '{}'", old_id, new_id); + { let mut hsmap = match self.entries.write() { Err(_) => return Err(SE::new(SEK::LockPoisoned, None)), @@ -706,6 +708,7 @@ impl Store { } + debug!("Moved"); Ok(()) }