btrfs_cli/receive.rs
1use crate::{Format, Runnable};
2use anyhow::Result;
3use clap::Parser;
4use std::path::PathBuf;
5
6/// Receive subvolumes from a stream.
7///
8/// Read a btrfs send stream and recreate subvolumes on the destination filesystem.
9/// Streams can be received incrementally based on a parent subvolume to only
10/// apply changes. Multiple streams can be received in sequence. The destination
11/// filesystem must be mounted and writable. Requires CAP_SYS_ADMIN.
12#[derive(Parser, Debug)]
13pub struct ReceiveCommand {
14 /// Mount point of the destination filesystem (not required with --dump)
15 mount: Option<PathBuf>,
16
17 /// Read the stream from FILE instead of stdin
18 #[clap(short = 'f')]
19 file: Option<PathBuf>,
20
21 /// Terminate after receiving an end-cmd marker
22 #[clap(short = 'e')]
23 terminate_on_end: bool,
24
25 /// Confine the process to <mount> using chroot
26 #[clap(short = 'C', long)]
27 chroot: bool,
28
29 /// Terminate after NERR errors (0 means unlimited)
30 #[clap(short = 'E', long)]
31 max_errors: Option<u64>,
32
33 /// The root mount point of the destination filesystem
34 #[clap(short = 'm', long = "root-mount")]
35 root_mount: Option<PathBuf>,
36
37 /// Always decompress instead of using encoded I/O
38 #[clap(long)]
39 force_decompress: bool,
40
41 /// Dump stream metadata without requiring the mount parameter
42 #[clap(long)]
43 dump: bool,
44}
45
46impl Runnable for ReceiveCommand {
47 fn run(&self, _format: Format, _dry_run: bool) -> Result<()> {
48 todo!("implement receive")
49 }
50}