diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 6ef04837..38e5dd6b 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -320,9 +320,11 @@ impl Store { /// Currently, this is the naive implementatoin which does not transfer contents of the /// backends. /// - pub fn reset_backend(&mut self, backend: Box) -> Result<()> { - self.backend = backend; - Ok(()) + pub fn reset_backend(&mut self, mut backend: Box) -> Result<()> { + self.backend + .drain() + .and_then(|drain| backend.fill(drain)) + .map(|_| self.backend = backend) } /// Get the store configuration