Merge pull request #439 from matthiasbeyer/libimagstore/fle-and-entry-have-storeid

Remove duplicated StoreId member in FileLockEntry, use member from Entry
This commit is contained in:
Matthias Beyer 2016-05-29 02:15:26 +02:00
commit ea5319812d

View file

@ -338,7 +338,7 @@ impl Store {
se se
}); });
let mut fle = FileLockEntry::new(self, Entry::new(id.clone()), id); let mut fle = FileLockEntry::new(self, Entry::new(id));
self.execute_hooks_for_mut_file(self.post_create_aspects.clone(), &mut fle) self.execute_hooks_for_mut_file(self.post_create_aspects.clone(), &mut fle)
.map_err(|e| SE::new(SEK::PostHookExecuteError, Some(Box::new(e)))) .map_err(|e| SE::new(SEK::PostHookExecuteError, Some(Box::new(e))))
.map(|_| fle) .map(|_| fle)
@ -370,7 +370,7 @@ impl Store {
se.status = StoreEntryStatus::Borrowed; se.status = StoreEntryStatus::Borrowed;
entry entry
}) })
.map(|e| FileLockEntry::new(self, e, id)) .map(|e| FileLockEntry::new(self, e))
.and_then(|mut fle| { .and_then(|mut fle| {
self.execute_hooks_for_mut_file(self.post_retrieve_aspects.clone(), &mut fle) self.execute_hooks_for_mut_file(self.post_retrieve_aspects.clone(), &mut fle)
.map_err(|e| SE::new(SEK::HookExecutionError, Some(Box::new(e)))) .map_err(|e| SE::new(SEK::HookExecutionError, Some(Box::new(e))))
@ -480,7 +480,7 @@ impl Store {
Ok(e) => e, Ok(e) => e,
}; };
let mut se = try!(hsmap.get_mut(&entry.key).ok_or(SE::new(SEK::IdNotFound, None))); let mut se = try!(hsmap.get_mut(&entry.location).ok_or(SE::new(SEK::IdNotFound, None)));
assert!(se.is_borrowed(), "Tried to update a non borrowed entry."); assert!(se.is_borrowed(), "Tried to update a non borrowed entry.");
@ -683,15 +683,13 @@ impl Drop for Store {
pub struct FileLockEntry<'a> { pub struct FileLockEntry<'a> {
store: &'a Store, store: &'a Store,
entry: Entry, entry: Entry,
key: StoreId,
} }
impl<'a> FileLockEntry<'a, > { impl<'a> FileLockEntry<'a, > {
fn new(store: &'a Store, entry: Entry, key: StoreId) -> FileLockEntry<'a> { fn new(store: &'a Store, entry: Entry) -> FileLockEntry<'a> {
FileLockEntry { FileLockEntry {
store: store, store: store,
entry: entry, entry: entry,
key: key,
} }
} }
} }