From cd1af16dd1d1127d1854e396e6598035c3915350 Mon Sep 17 00:00:00 2001 From: timeshifter Date: Mon, 28 Jul 2025 14:54:43 +0200 Subject: [PATCH] small cleanup --- src/main.rs | 12 ++++++++++++ src/zfs.rs | 6 ++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 039bdbc..b4a51ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,12 +21,24 @@ fn main() -> Result<()> { Ok(()) } +/// Export the ZFS pool after the backup so it can be re-encrypted. +/// +/// # Errors +/// +/// This function will return an error if the name of the backup pool is not provided or the pool +/// cannot be exported. fn export_backup_pool() -> Result<()> { let pool_name = &read_var_from_file("backup_pool.txt")?; zpool_export(pool_name)?; Ok(()) } +/// Import the decrypted ZFS pool so that a backup can be sent. +/// +/// # Errors +/// +/// This function will return an error if the name of the backup pool is not provided or the pool +/// cannot be imported. fn import_backup_pool() -> Result<()> { let pool_name = &read_var_from_file("backup_pool.txt")?; zpool_import(pool_name)?; diff --git a/src/zfs.rs b/src/zfs.rs index 26d2f82..797fdff 100644 --- a/src/zfs.rs +++ b/src/zfs.rs @@ -7,12 +7,10 @@ use std::{ use anyhow::{Result, anyhow, bail}; -use crate::cmd::zfs::{ - pool_exists, zfs_list_main_datasets, zfs_list_snapshots, zfs_receive, zfs_send_absolute, - zfs_send_incremental, zpool_import, -}; +use crate::cmd::zfs::*; use crate::io::read_vars_from_file; +/// A ZFS pool. It holds the name of the pool and the list of datasets belonging to it. pub struct Pool { name: String, pub datasets: Vec,