Add implementation for Storage::createEmpty()
This commit is contained in:
parent
7c96a10488
commit
48fd3e66f5
2 changed files with 13 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
#[macro_use] extern crate serde;
|
#[macro_use] extern crate serde;
|
||||||
#[macro_use] extern crate serde_json;
|
#[macro_use] extern crate serde_json;
|
||||||
#[macro_use] extern crate glob;
|
#[macro_use] extern crate glob;
|
||||||
|
#[macro_use] extern crate uuid;
|
||||||
extern crate config;
|
extern crate config;
|
||||||
extern crate regex;
|
extern crate regex;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,18 @@ impl StorageBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createEmpty() -> FileID {
|
fn createEmpty(&self) -> Option<FileID> {
|
||||||
|
use std::fs::File;
|
||||||
|
use uuid::Uuid;
|
||||||
|
let uuid = Uuid::new_v4().to_hyphenated_string();
|
||||||
|
let pathstr = self.basepath + uuid.as_str();
|
||||||
|
let path = Path::new(&pathstr);
|
||||||
|
|
||||||
|
if let Ok(f) = File::create(path) {
|
||||||
|
Some(uuid)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createFile() -> File {
|
fn createFile() -> File {
|
||||||
|
|
Loading…
Reference in a new issue