Add Store::retrieve_for_module()
This commit is contained in:
parent
36770abac5
commit
bbd08d9526
2 changed files with 12 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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<StoreId> {
|
||||
unimplemented!()
|
||||
self.paths.next().and_then(|o| o.ok())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue