Add debug output in Store::create()

This commit is contained in:
Matthias Beyer 2017-06-04 16:59:23 +02:00
parent e88c5011ab
commit c4584bf1ca

View file

@ -333,6 +333,8 @@ impl Store {
pub fn create<'a, S: IntoStoreId>(&'a self, id: S) -> Result<FileLockEntry<'a>> {
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)))
}