Add StorageBackend builder
This commit is contained in:
parent
e1faad7a28
commit
da792694c5
1 changed files with 9 additions and 1 deletions
|
@ -14,6 +14,9 @@ use glob::Paths;
|
|||
use storage::file::File;
|
||||
use storage::file_id::*;
|
||||
|
||||
use module::Module;
|
||||
use runtime::Runtime;
|
||||
|
||||
pub type BackendOperationResult = Result<(), StorageBackendError>;
|
||||
|
||||
pub struct StorageBackend {
|
||||
|
@ -22,12 +25,17 @@ pub struct StorageBackend {
|
|||
|
||||
impl StorageBackend {
|
||||
|
||||
fn new(basepath: String) -> StorageBackend {
|
||||
pub fn new(basepath: String) -> StorageBackend {
|
||||
StorageBackend {
|
||||
basepath: basepath,
|
||||
}
|
||||
}
|
||||
|
||||
fn build<M: Module>(rt: &Runtime, m: &M) -> StorageBackend {
|
||||
let path = rt.get_rtp() + m.name() + "/store";
|
||||
StorageBackend::new(path)
|
||||
}
|
||||
|
||||
fn get_file_ids(&self) -> Option<Vec<FileID>> {
|
||||
let list = glob(&self.basepath[..]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue