diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index fb222fc5..f38c4643 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -15,7 +15,7 @@ use regex::Regex; use error::{ParserErrorKind, ParserError}; use error::{StoreError, StoreErrorKind}; -use storeid::StoreId; +use storeid::{StoreId, StoreIdIterator}; use lazyfile::LazyFile; /// The Result Type returned by any interaction with the store that could fail @@ -140,6 +140,11 @@ impl Store { .and_then(|entry| Ok(FileLockEntry::new(self, entry, id))) } + /// Iterate over all StoreIds for one module name + pub fn retrieve_for_module(&self, mod_name: &str) -> StoreIdIterator { + unimplemented!(); + } + /// Return the `FileLockEntry` and write to disk pub fn update<'a>(&'a self, entry: FileLockEntry<'a>) -> Result<()> { self._update(&entry) diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index b28b13fc..a8c72b01 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -1,5 +1,5 @@ use std::path::PathBuf; -use glob::GlobResult; +use glob::Paths; /// The Index into the Store pub type StoreId = PathBuf; @@ -64,15 +64,15 @@ macro_rules! module_entry_path_mod { ) } -struct StoreIdIterator { - globres: GlobResult, +pub struct StoreIdIterator { + paths: Paths, } impl StoreIdIterator { - pub fn new(globres: GlobResult) -> StoreIdIterator { + pub fn new(paths: Paths) -> StoreIdIterator { StoreIdIterator { - globres: globres, + paths: paths, } } @@ -82,7 +82,7 @@ impl Iterator for StoreIdIterator { type Item = StoreId; fn next(&mut self) -> Option { - unimplemented!() + self.paths.next().and_then(|o| o.ok()) } }