Skip to main content

btrfs_cli/
send.rs

1use crate::{Format, Runnable};
2use anyhow::Result;
3use clap::Parser;
4use std::path::PathBuf;
5
6/// Send the subvolume(s) to stdout.
7///
8/// Generate a stream representation of one or more subvolumes that can be
9/// transmitted over the network or stored for later restoration. Streams
10/// are incremental and can be based on a parent subvolume to only send
11/// changes. The stream output is in btrfs send format and can be received
12/// with the receive command. Requires CAP_SYS_ADMIN.
13#[derive(Parser, Debug)]
14pub struct SendCommand {
15    /// Subvolume(s) to send
16    #[clap(required = true)]
17    subvolumes: Vec<PathBuf>,
18
19    /// Omit end-cmd marker between subvolumes
20    #[clap(short = 'e')]
21    omit_end_cmd: bool,
22
23    /// Send an incremental stream from <parent> to the subvolume
24    #[clap(short = 'p', long)]
25    parent: Option<PathBuf>,
26
27    /// Use this snapshot as a clone source (may be given multiple times)
28    #[clap(short = 'c', long = "clone-src")]
29    clone_src: Vec<PathBuf>,
30
31    /// Write output to a file instead of stdout
32    #[clap(short = 'f', long)]
33    outfile: Option<PathBuf>,
34
35    /// Send in NO_FILE_DATA mode
36    #[clap(long)]
37    no_data: bool,
38
39    /// Use send protocol version N
40    #[clap(long)]
41    proto: Option<u64>,
42
43    /// Send compressed data directly without decompressing
44    #[clap(long)]
45    compressed_data: bool,
46}
47
48impl Runnable for SendCommand {
49    fn run(&self, _format: Format, _dry_run: bool) -> Result<()> {
50        todo!("implement send")
51    }
52}