-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose graph option for fwdctl (#724)
- Loading branch information
Showing
5 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (C) 2023, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE.md for licensing terms. | ||
|
||
use clap::Args; | ||
use firewood::db::{Db, DbConfig}; | ||
use firewood::v2::api; | ||
use std::io::stdout; | ||
|
||
#[derive(Debug, Args)] | ||
pub struct Options { | ||
/// The database path (if no path is provided, return an error). Defaults to firewood. | ||
#[arg( | ||
value_name = "DB_NAME", | ||
default_value_t = String::from("firewood"), | ||
help = "Name of the database" | ||
)] | ||
pub db: String, | ||
} | ||
|
||
pub(super) async fn run(opts: &Options) -> Result<(), api::Error> { | ||
log::debug!("dump database {:?}", opts); | ||
let cfg = DbConfig::builder().truncate(false); | ||
|
||
let db = Db::new(opts.db.clone(), cfg.build()).await?; | ||
db.dump(&mut stdout())?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters