tape: cleanup MediaCatalog
This commit is contained in:
parent
e0af222ec3
commit
3fbf2d2fcd
|
@ -43,7 +43,7 @@ pub struct MediaCatalog {
|
||||||
|
|
||||||
file: Option<File>,
|
file: Option<File>,
|
||||||
|
|
||||||
pub log_to_stdout: bool,
|
log_to_stdout: bool,
|
||||||
|
|
||||||
current_archive: Option<(Uuid, u64)>,
|
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> {
|
fn create_basedir(base_path: &Path) -> Result<(), Error> {
|
||||||
let backup_user = crate::backup::backup_user()?;
|
let backup_user = crate::backup::backup_user()?;
|
||||||
let mode = nix::sys::stat::Mode::from_bits_truncate(0o0640);
|
let mode = nix::sys::stat::Mode::from_bits_truncate(0o0640);
|
||||||
|
@ -148,6 +153,8 @@ impl MediaCatalog {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a temporary, empty catalog database
|
/// Creates a temporary, empty catalog database
|
||||||
|
///
|
||||||
|
/// Creates a new catalog file using a ".tmp" file extension.
|
||||||
pub fn create_temporary_database(
|
pub fn create_temporary_database(
|
||||||
base_path: &Path,
|
base_path: &Path,
|
||||||
media_id: &MediaId,
|
media_id: &MediaId,
|
||||||
|
@ -206,6 +213,9 @@ impl MediaCatalog {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Commit or Abort a temporary catalog database
|
/// 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(
|
pub fn finish_temporary_database(
|
||||||
base_path: &Path,
|
base_path: &Path,
|
||||||
uuid: &Uuid,
|
uuid: &Uuid,
|
||||||
|
|
Loading…
Reference in New Issue