Add implementation for Store::retrieve_for_module()
This commit is contained in:
parent
98df49b6eb
commit
fe0849f8eb
2 changed files with 15 additions and 2 deletions
|
@ -33,6 +33,7 @@ pub enum StoreErrorKind {
|
||||||
PreHookExecuteError,
|
PreHookExecuteError,
|
||||||
PostHookExecuteError,
|
PostHookExecuteError,
|
||||||
StorePathLacksVersion,
|
StorePathLacksVersion,
|
||||||
|
GlobError,
|
||||||
// maybe more
|
// maybe more
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ fn store_error_type_as_str(e: &StoreErrorKind) -> &'static str {
|
||||||
&StoreErrorKind::PreHookExecuteError => "Pre-Hook execution error",
|
&StoreErrorKind::PreHookExecuteError => "Pre-Hook execution error",
|
||||||
&StoreErrorKind::PostHookExecuteError => "Post-Hook execution error",
|
&StoreErrorKind::PostHookExecuteError => "Post-Hook execution error",
|
||||||
&StoreErrorKind::StorePathLacksVersion => "The supplied store path has no version part",
|
&StoreErrorKind::StorePathLacksVersion => "The supplied store path has no version part",
|
||||||
|
&StoreErrorKind::GlobError => "glob() error",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ use toml::{Table, Value};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use crossbeam;
|
use crossbeam;
|
||||||
use crossbeam::ScopedJoinHandle;
|
use crossbeam::ScopedJoinHandle;
|
||||||
|
use glob::glob;
|
||||||
|
|
||||||
use error::{ParserErrorKind, ParserError};
|
use error::{ParserErrorKind, ParserError};
|
||||||
use error::{StoreError, StoreErrorKind};
|
use error::{StoreError, StoreErrorKind};
|
||||||
|
@ -307,8 +308,18 @@ impl Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over all StoreIds for one module name
|
/// Iterate over all StoreIds for one module name
|
||||||
pub fn retrieve_for_module(&self, mod_name: &str) -> StoreIdIterator {
|
pub fn retrieve_for_module(&self, mod_name: &str) -> Result<StoreIdIterator> {
|
||||||
unimplemented!();
|
let mut path = self.path().clone();
|
||||||
|
path.push(mod_name);
|
||||||
|
|
||||||
|
if let Some(path) = path.to_str() {
|
||||||
|
let path = [ path, "/*" ].join("");
|
||||||
|
debug!("glob()ing with '{}'", path);
|
||||||
|
glob(&path[..]).map(StoreIdIterator::new)
|
||||||
|
.map_err(|e| StoreError::new(StoreErrorKind::GlobError, Some(Box::new(e))))
|
||||||
|
} else {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the `FileLockEntry` and write to disk
|
/// Return the `FileLockEntry` and write to disk
|
||||||
|
|
Loading…
Reference in a new issue