]> git.proxmox.com Git - proxmox-backup.git/commitdiff
tape: cleanup MediaCatalog
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 17 Dec 2020 07:04:56 +0000 (08:04 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 17 Dec 2020 07:05:53 +0000 (08:05 +0100)
src/tape/media_catalog.rs

index 4927a726410790d4f53bcc218a5afe605299e9fb..bbed1f0bec2c739372b84ace403df13aee6b8047 100644 (file)
@@ -43,7 +43,7 @@ pub struct MediaCatalog  {
 
     file: Option<File>,
 
-    pub log_to_stdout: bool,
+    log_to_stdout: bool,
 
     current_archive: Option<(Uuid, u64)>,
 
@@ -80,6 +80,11 @@ impl MediaCatalog {
         }
     }
 
+    /// Enable/Disable logging to stdout (disabled by default)
+    pub fn log_to_stdout(&mut self, enable: bool) {
+        self.log_to_stdout = enable;
+    }
+
     fn create_basedir(base_path: &Path) -> Result<(), Error> {
         let backup_user = crate::backup::backup_user()?;
         let mode = nix::sys::stat::Mode::from_bits_truncate(0o0640);
@@ -148,6 +153,8 @@ impl MediaCatalog {
     }
 
     /// Creates a temporary, empty catalog database
+    ///
+    /// Creates a new catalog file using a ".tmp" file extension.
     pub fn create_temporary_database(
         base_path: &Path,
         media_id: &MediaId,
@@ -206,6 +213,9 @@ impl MediaCatalog {
     }
 
     /// Commit or Abort a temporary catalog database
+    ///
+    /// With commit set, we rename the ".tmp" file extension to
+    /// ".log". When commit is false, we remove the ".tmp" file.
     pub fn finish_temporary_database(
         base_path: &Path,
         uuid: &Uuid,