use crate::{migration::migration, prelude::*};
#[derive(Command, Debug)]
pub struct Mount {
#[clap(flatten)]
stash: StashArgs,
#[clap(flatten)]
options: zerostash_files::restore::Options,
#[clap(short = 'T', long = "target")]
mount_point: String,
#[clap(short = 'w', long = "read-write")]
read_write: bool,
}
#[cfg(unix)]
#[async_trait]
impl AsyncRunnable for Mount {
async fn run(&self) {
let mut stash = self.stash.open();
let threads = APP.get_worker_threads();
stash.load(stash.index().tree()).unwrap();
stash.load(stash.index().files()).unwrap();
migration(&mut stash);
if let Err(e) =
zerostash_fuse::mount::mount(stash, &self.mount_point, threads, self.read_write).await
{
panic!("Error = {}", e)
}
}
}