diff options
author | Alex Auvolat <alex@adnab.me> | 2022-12-13 14:23:45 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-12-13 14:23:45 +0100 |
commit | 687660b27f904422c689e09d2457293e5313d325 (patch) | |
tree | dd63404f4d49dc7c146d90e39f855c10db031417 /src/garage/cli/structs.rs | |
parent | 9d82196945f751c825621573657cfead992b356b (diff) | |
download | garage-687660b27f904422c689e09d2457293e5313d325.tar.gz garage-687660b27f904422c689e09d2457293e5313d325.zip |
Implement `block list-errors` and `block info`
Diffstat (limited to 'src/garage/cli/structs.rs')
-rw-r--r-- | src/garage/cli/structs.rs | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/src/garage/cli/structs.rs b/src/garage/cli/structs.rs index 9334564b..6d74b1a4 100644 --- a/src/garage/cli/structs.rs +++ b/src/garage/cli/structs.rs @@ -49,7 +49,11 @@ pub enum Command { /// Manage background workers #[structopt(name = "worker", version = garage_version())] - Worker(WorkerOpt), + Worker(WorkerOperation), + + /// Low-level debug operations on data blocks + #[structopt(name = "block", version = garage_version())] + Block(BlockOperation), } #[derive(StructOpt, Debug)] @@ -502,14 +506,8 @@ pub struct StatsOpt { pub detailed: bool, } -#[derive(Serialize, Deserialize, StructOpt, Debug, Clone)] -pub struct WorkerOpt { - #[structopt(subcommand)] - pub cmd: WorkerCmd, -} - #[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)] -pub enum WorkerCmd { +pub enum WorkerOperation { /// List all workers on Garage node #[structopt(name = "list", version = garage_version())] List { @@ -549,3 +547,34 @@ pub enum WorkerSetCmd { #[structopt(name = "resync-tranquility", version = garage_version())] ResyncTranquility { tranquility: u32 }, } + +#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)] +pub enum BlockOperation { + /// List all blocks that currently have a resync error + #[structopt(name = "list-errors", version = garage_version())] + ListErrors, + /// Get detailed information about a single block + #[structopt(name = "info", version = garage_version())] + Info { + /// Hash of the block for which to retrieve information + hash: String, + }, + /// Retry now the resync of one or many blocks + #[structopt(name = "retry-now", version = garage_version())] + RetryNow { + /// Retry all blocks that have a resync error + #[structopt(long = "all")] + all: bool, + /// Hashes of the block to retry to resync now + blocks: Vec<String>, + }, + /// Delete all objects referencing a missing block + #[structopt(name = "purge", version = garage_version())] + Purge { + /// Mandatory to confirm this operation + #[structopt(long = "yes")] + yes: bool, + /// Hashes of the block to purge + blocks: Vec<String>, + }, +} |