small cleanup

This commit is contained in:
timeshifter
2025-07-28 14:54:43 +02:00
parent abc2cb29f8
commit cd1af16dd1
2 changed files with 14 additions and 4 deletions
+12
View File
@@ -21,12 +21,24 @@ fn main() -> Result<()> {
Ok(()) 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<()> { fn export_backup_pool() -> Result<()> {
let pool_name = &read_var_from_file("backup_pool.txt")?; let pool_name = &read_var_from_file("backup_pool.txt")?;
zpool_export(pool_name)?; zpool_export(pool_name)?;
Ok(()) 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<()> { fn import_backup_pool() -> Result<()> {
let pool_name = &read_var_from_file("backup_pool.txt")?; let pool_name = &read_var_from_file("backup_pool.txt")?;
zpool_import(pool_name)?; zpool_import(pool_name)?;
+2 -4
View File
@@ -7,12 +7,10 @@ use std::{
use anyhow::{Result, anyhow, bail}; use anyhow::{Result, anyhow, bail};
use crate::cmd::zfs::{ 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::io::read_vars_from_file; 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 { pub struct Pool {
name: String, name: String,
pub datasets: Vec<Dataset>, pub datasets: Vec<Dataset>,