From 3fbf2d2fcd5500521fd2d2e591c26dd0831dcf8b Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 17 Dec 2020 08:04:56 +0100 Subject: [PATCH] tape: cleanup MediaCatalog --- src/tape/media_catalog.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tape/media_catalog.rs b/src/tape/media_catalog.rs index 4927a726..bbed1f0b 100644 --- a/src/tape/media_catalog.rs +++ b/src/tape/media_catalog.rs @@ -43,7 +43,7 @@ pub struct MediaCatalog { file: Option, - 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,