forked from kent/consciousness
cli: add 'node restore' command for undeleting nodes
Restores a deleted node to its last non-deleted content with proper version continuity (version number continues from absolute latest, content from last live version). Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
290505fc51
commit
6a5b840db3
3 changed files with 23 additions and 1 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -175,6 +175,11 @@ enum NodeCmd {
|
|||
/// Node key
|
||||
key: Vec<String>,
|
||||
},
|
||||
/// Restore a deleted node to its last live state
|
||||
Restore {
|
||||
/// Node key
|
||||
key: Vec<String>,
|
||||
},
|
||||
/// Rename a node key
|
||||
Rename {
|
||||
/// Old key
|
||||
|
|
@ -309,6 +314,9 @@ enum AdminCmd {
|
|||
Topology,
|
||||
/// Run consistency checks and repair
|
||||
Fsck,
|
||||
/// Rebuild index from capnp logs (use after fsck finds issues)
|
||||
#[command(name = "repair-index")]
|
||||
RepairIndex,
|
||||
/// Find and merge duplicate nodes (same key, multiple UUIDs)
|
||||
Dedup {
|
||||
/// Apply the merge (default: dry run)
|
||||
|
|
@ -397,7 +405,8 @@ impl Run for Command {
|
|||
impl Run for NodeCmd {
|
||||
async fn run(self) -> anyhow::Result<()> {
|
||||
match self {
|
||||
Self::Delete { key } => cli::node::cmd_node_delete(&key).await,
|
||||
Self::Delete { key } => cli::node::cmd_node_delete(&key).await,
|
||||
Self::Restore { key } => cli::node::cmd_node_restore(&key).await,
|
||||
Self::Rename { old_key, new_key } => cli::node::cmd_node_rename(&old_key, &new_key).await,
|
||||
}
|
||||
}
|
||||
|
|
@ -445,6 +454,7 @@ impl Run for AdminCmd {
|
|||
Self::Health => cli::admin::cmd_health().await,
|
||||
Self::Topology => cli::admin::cmd_topology().await,
|
||||
Self::Fsck => cli::admin::cmd_fsck().await,
|
||||
Self::RepairIndex => cli::admin::cmd_repair_index().await,
|
||||
Self::Dedup { apply } => cli::admin::cmd_dedup(apply).await,
|
||||
Self::DailyCheck => cli::admin::cmd_daily_check().await,
|
||||
Self::LoadContext { stats } => cli::node::cmd_load_context(stats).await,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue