Skip to main content

heddle_cli_args/cli/cli_args/
commands_oplog.rs

1// SPDX-License-Identifier: Apache-2.0
2//! Oplog command definitions.
3
4use clap::Subcommand;
5
6#[derive(Subcommand, Clone)]
7pub enum OplogCommands {
8    /// Salvage a truncated or torn operation log and report what was recovered.
9    ///
10    /// Runs the same recovery the everyday read path runs automatically:
11    /// keeps every complete oplog record, quarantines the damaged file to
12    /// `oplog.bin.corrupt`, writes an `oplog.bin.oplog.recovery` sidecar, and
13    /// rebuilds `oplog.bin`. Unlike the silent auto-fallback, this reports the
14    /// outcome (records recovered/lost, damaged byte range, quarantine path).
15    ///
16    /// When the oplog is already healthy it makes no changes and, if a prior
17    /// recovery left a sidecar, reports that last recovery instead.
18    #[command(after_help = "\
19Examples:
20  heddle oplog recover                 # salvage and print a human report
21  heddle oplog recover --output json   # machine-readable recovery report
22")]
23    Recover,
24}