Add Store::retrieve_for_module()

This commit is contained in:
Matthias Beyer 2016-01-24 12:17:41 +01:00
parent 36770abac5
commit bbd08d9526
2 changed files with 12 additions and 7 deletions

View file

@ -15,7 +15,7 @@ use regex::Regex;
use error::{ParserErrorKind, ParserError}; use error::{ParserErrorKind, ParserError};
use error::{StoreError, StoreErrorKind}; use error::{StoreError, StoreErrorKind};
use storeid::StoreId; use storeid::{StoreId, StoreIdIterator};
use lazyfile::LazyFile; use lazyfile::LazyFile;
/// The Result Type returned by any interaction with the store that could fail /// 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))) .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 /// Return the `FileLockEntry` and write to disk
pub fn update<'a>(&'a self, entry: FileLockEntry<'a>) -> Result<()> { pub fn update<'a>(&'a self, entry: FileLockEntry<'a>) -> Result<()> {
self._update(&entry) self._update(&entry)

View file

@ -1,5 +1,5 @@
use std::path::PathBuf; use std::path::PathBuf;
use glob::GlobResult; use glob::Paths;
/// The Index into the Store /// The Index into the Store
pub type StoreId = PathBuf; pub type StoreId = PathBuf;
@ -64,15 +64,15 @@ macro_rules! module_entry_path_mod {
) )
} }
struct StoreIdIterator { pub struct StoreIdIterator {
globres: GlobResult, paths: Paths,
} }
impl StoreIdIterator { impl StoreIdIterator {
pub fn new(globres: GlobResult) -> StoreIdIterator { pub fn new(paths: Paths) -> StoreIdIterator {
StoreIdIterator { StoreIdIterator {
globres: globres, paths: paths,
} }
} }
@ -82,7 +82,7 @@ impl Iterator for StoreIdIterator {
type Item = StoreId; type Item = StoreId;
fn next(&mut self) -> Option<StoreId> { fn next(&mut self) -> Option<StoreId> {
unimplemented!() self.paths.next().and_then(|o| o.ok())
} }
} }