Add "verify" feature in imag-store
This commit is contained in:
parent
6b1fdfbc1d
commit
555ea158aa
4 changed files with 23 additions and 0 deletions
|
@ -12,6 +12,8 @@ toml = "0.1.25"
|
||||||
|
|
||||||
[dependencies.libimagstore]
|
[dependencies.libimagstore]
|
||||||
path = "../libimagstore"
|
path = "../libimagstore"
|
||||||
|
default-features = false
|
||||||
|
features = ["verify"]
|
||||||
|
|
||||||
[dependencies.libimagrt]
|
[dependencies.libimagrt]
|
||||||
path = "../libimagrt"
|
path = "../libimagrt"
|
||||||
|
|
|
@ -33,6 +33,7 @@ mod get;
|
||||||
mod retrieve;
|
mod retrieve;
|
||||||
mod ui;
|
mod ui;
|
||||||
mod update;
|
mod update;
|
||||||
|
mod verify;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use create::create;
|
use create::create;
|
||||||
|
@ -41,6 +42,7 @@ use get::get;
|
||||||
use retrieve::retrieve;
|
use retrieve::retrieve;
|
||||||
use ui::build_ui;
|
use ui::build_ui;
|
||||||
use update::update;
|
use update::update;
|
||||||
|
use verify::verify;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let rt = generate_runtime_setup("imag-store",
|
let rt = generate_runtime_setup("imag-store",
|
||||||
|
@ -63,6 +65,7 @@ fn main() {
|
||||||
"get" => get(&rt),
|
"get" => get(&rt),
|
||||||
"retrieve" => retrieve(&rt),
|
"retrieve" => retrieve(&rt),
|
||||||
"update" => update(&rt),
|
"update" => update(&rt),
|
||||||
|
"verify" => verify(&rt),
|
||||||
_ => {
|
_ => {
|
||||||
debug!("Unknown command");
|
debug!("Unknown command");
|
||||||
// More error handling
|
// More error handling
|
||||||
|
|
|
@ -181,4 +181,9 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.help("Remove Store Entry with this path. Root (/) is the store itself")
|
.help("Remove Store Entry with this path. Root (/) is the store itself")
|
||||||
.value_name("PATH"))
|
.value_name("PATH"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
.subcommand(SubCommand::with_name("verify")
|
||||||
|
.about("Verify the store")
|
||||||
|
.version("0.1")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
13
imag-store/src/verify.rs
Normal file
13
imag-store/src/verify.rs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
|
use libimagrt::runtime::Runtime;
|
||||||
|
|
||||||
|
pub fn verify(rt: &Runtime) {
|
||||||
|
if rt.store().verify() {
|
||||||
|
info!("Store seems to be fine");
|
||||||
|
} else {
|
||||||
|
warn!("Store seems to be broken somehow");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue