Refuse to overwrite pointer names when generated from timestamps

This commit is contained in:
Olivier 'reivilibre' 2021-11-14 07:03:29 +00:00
parent 9b8ab8bd0a
commit 34ec8966b2
2 changed files with 9 additions and 2 deletions

View File

@ -157,7 +157,9 @@ pub fn backup_source_to_destination<PT: ProgressTracker>(
};
let pointer_name = get_pointer_name_at(&source_name, Utc::now());
if pile.read_pointer(pointer_name.as_str())?.is_some() {
bail!("Pointer by name {:?} already exists; refusing to overwrite.", pointer_name);
}
info!("Will write as pointer {:?}.", pointer_name);
info!("Searching for suitable parents.");
@ -218,6 +220,9 @@ pub fn backup_source_to_destination<PT: ProgressTracker>(
let pile = open_pile(&absolute_dest_path, &pile_descriptor)?;
let pointer_name = get_pointer_name_at(&source_name, Utc::now());
if pile.read_pointer(pointer_name.as_str())?.is_some() {
bail!("Pointer by name {:?} already exists; refusing to overwrite.", pointer_name);
}
info!("Will write as pointer {:?}.", pointer_name);
let mut chunker = yama::chunking::RecursiveChunker::new(SENSIBLE_THRESHOLD, &pile);

View File

@ -182,7 +182,9 @@ pub fn backup_remote_source_to_destination<PT: ProgressTracker + Send + 'static>
let pile = open_pile(&absolute_dest_path, &pile_descriptor)?;
let pointer_name = get_pointer_name_at(&source_name, Utc::now());
if pile.read_pointer(pointer_name.as_str())?.is_some() {
bail!("Pointer by name {:?} already exists; refusing to overwrite.", pointer_name);
}
info!("Will write as pointer {:?}.", pointer_name);
info!("Searching for suitable parents.");