From bee97c8758320e4bc28b9fc204029b884bbb60c2 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 25 Apr 2017 14:36:41 +0200 Subject: [PATCH] Add Store::entries() --- libimagstore/src/store.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index b3d10cfc..ad8c88e8 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -749,6 +749,18 @@ impl Store { Ok(()) } + /// Get _all_ entries in the store (by id as iterator) + pub fn entries(&self) -> Result { + let iter = Walk::new(self.path().clone(), "") + .filter_map(|id| match id { + StoreObject::Id(sid) => Some(sid), + _ => None + }); + + Ok(StoreIdIterator::new(Box::new(iter))) + + } + /// Gets the path where this store is on the disk pub fn path(&self) -> &PathBuf { &self.location