api3/config/datastore.rs: create datastore files

This commit is contained in:
root 2018-12-13 14:41:14 +01:00
parent 7f4e639b37
commit 15b64d4606
1 changed files with 5 additions and 0 deletions

View File

@ -3,7 +3,9 @@ use failure::*;
use crate::api::schema::*; use crate::api::schema::*;
use crate::api::router::*; use crate::api::router::*;
use crate::backup::chunk_store::*;
use serde_json::{json, Value}; use serde_json::{json, Value};
use std::path::{Path, PathBuf};
use crate::config::datastore; use crate::config::datastore;
@ -41,6 +43,9 @@ fn create_datastore(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
bail!("datastore '{}' already exists.", name); bail!("datastore '{}' already exists.", name);
} }
let path: PathBuf = param["path"].as_str().unwrap().into();
let _store = ChunkStore::create(path)?;
let datastore = json!({ let datastore = json!({
"path": param["path"] "path": param["path"]
}); });