summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-06-18 19:17:58 +0200
committerGitHub <noreply@github.com>2017-06-18 19:17:58 +0200
commitd33b4350313364bab82c7e509bb9d6da219f5bb0 (patch)
tree4d3a430563f0342c3e42e2c2069ff95f4600ebe4
parente75c37fbb2eaad7018c1ad18c227e82e67ec9629 (diff)
parentbee97c8758320e4bc28b9fc204029b884bbb60c2 (diff)
downloadimag-d33b4350313364bab82c7e509bb9d6da219f5bb0.zip
imag-d33b4350313364bab82c7e509bb9d6da219f5bb0.tar.gz
Merge pull request #922 from matthiasbeyer/libimagstore/all-entries
Add Store::entries()
-rw-r--r--libimagstore/src/store.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs
index b3d10cf..ad8c88e 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<StoreIdIterator> {
+ 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