From 55c39ac94d220723df688a7a46289e3684f953e0 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 5 Jul 2016 12:42:47 +0200 Subject: [PATCH] Fix: We cannot offer a Ref::delete(self), but a Ref::delete_by_hash() We cannot offer the former because deleting self would always fail as the FileLockEntry is already borrowed from the store, so the store declines this. But deleting by hash works. --- libimagref/src/reference.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libimagref/src/reference.rs b/libimagref/src/reference.rs index 465ca105..cd3edca7 100644 --- a/libimagref/src/reference.rs +++ b/libimagref/src/reference.rs @@ -56,12 +56,12 @@ impl<'a> Ref<'a> { .map_err(|e| REK::StoreReadError.into_error_with_cause(e)) } - /// Delete this ref + /// Delete a ref by hash /// /// If the returned Result contains an error, the ref might not be deleted. - pub fn delete(self, store: &'a Store) -> Result<()> { + pub fn delete_by_hash(store: &'a Store, hash: String) -> Result<()> { store - .delete(self.0.get_location().clone()) + .delete(ModuleEntryPath::new(hash).into_storeid()) .map_err(Box::new) .map_err(|e| REK::StoreWriteError.into_error_with_cause(e)) }