tape: cleanup MediaCatalog
This commit is contained in:
		@ -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,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user