Add implementation for Storage::createEmpty()

This commit is contained in:
Matthias Beyer 2015-11-23 18:58:25 +01:00
parent 7c96a10488
commit 48fd3e66f5
2 changed files with 13 additions and 1 deletions

View file

@ -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;

View file

@ -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 {