feat: use Restic for encrypted incremental backups
Keep legacy restores readable while using Restic for new captures, scoped Wormhole repositories, and chunk garbage collection.
This commit is contained in:
@@ -47,6 +47,8 @@ enum Commands {
|
||||
#[arg(long, default_value = "week-of-dailies")]
|
||||
preset: String,
|
||||
},
|
||||
/// Reclaim unreferenced data from expired Restic snapshots.
|
||||
Gc,
|
||||
Wormhole {
|
||||
#[command(subcommand)]
|
||||
cmd: WormholeCmd,
|
||||
@@ -91,6 +93,9 @@ fn main() -> Result<()> {
|
||||
target,
|
||||
} => cmd_reconstitute(&cli, snapshot_id, target)?,
|
||||
Commands::Decay { preset } => cmd_decay(&cli, &preset)?,
|
||||
Commands::Gc => {
|
||||
Vault::open(&vault_path(&cli.data_dir), require_passphrase(&cli)?)?.collect_garbage()?
|
||||
}
|
||||
Commands::Wormhole { ref cmd } => match cmd {
|
||||
WormholeCmd::Pair { code, name } => wormhole_pair(&cli, code, name)?,
|
||||
},
|
||||
@@ -172,7 +177,14 @@ fn cmd_orbit(
|
||||
) -> Result<()> {
|
||||
let config = match provider.as_str() {
|
||||
"filesystem" => serde_json::json!({ "paths": [path.unwrap_or_else(|| ".".into())] }),
|
||||
"postgres" => serde_json::json!({ "connection_url": path.context("--path or connection url required")? }),
|
||||
"postgres" => {
|
||||
serde_json::json!({ "connection_url": path.context("--path or connection url required")? })
|
||||
}
|
||||
"wormhole" => {
|
||||
anyhow::ensure!(path.is_none() && schedule.is_none() && !dry_run,
|
||||
"Wormhole paths and scheduling are set on the outpost");
|
||||
serde_json::json!({})
|
||||
}
|
||||
_ => anyhow::bail!("unknown provider"),
|
||||
};
|
||||
let body = serde_json::json!({
|
||||
@@ -210,12 +222,17 @@ fn cmd_snap(cli: &Cli, orbit_name: Option<String>) -> Result<()> {
|
||||
fn cmd_list(cli: &Cli) -> Result<()> {
|
||||
let vault = Vault::open(&vault_path(&cli.data_dir), require_passphrase(cli)?)?;
|
||||
for s in vault.list_snapshots()? {
|
||||
let stored = s
|
||||
.stored_bytes
|
||||
.map(|n| format!(" +{n} bytes stored"))
|
||||
.unwrap_or_default();
|
||||
println!(
|
||||
"{} {} {} bytes orbit={}",
|
||||
"{} {} {} bytes orbit={}{}",
|
||||
s.taken_at.to_rfc3339(),
|
||||
s.id,
|
||||
s.size_bytes,
|
||||
s.manifest.orbit_name
|
||||
s.manifest.orbit_name,
|
||||
stored,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user