api3/config/datastore.rs: create datastore files
This commit is contained in:
parent
7f4e639b37
commit
15b64d4606
|
@ -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"]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue