diff --git a/src/storage/backend.rs b/src/storage/backend.rs index 0b7dbe72..7c413b24 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -8,6 +8,7 @@ use std::vec::Vec; use std::fs::File as FSFile; use std::io::Read; use std::io::Write; +use std::vec::IntoIter; use glob::glob; use glob::Paths; @@ -61,6 +62,17 @@ impl StorageBackend { } } + pub fn iter_ids(&self, m: &Module) -> Option> + { + glob(&self.prefix_of_files_for_module(m)[..]).and_then(|globlist| { + let v = globlist.filter_map(Result::ok) + .map(|pbuf| from_pathbuf(&pbuf)) + .collect::>() + .into_iter(); + Ok(v) + }).ok() + } + /* * Write a file to disk. *