Skip to content

Commit

Permalink
transfer: force all
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzh committed Apr 23, 2021
1 parent 7d023c1 commit ab0d43c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ fn main() {
no_delete: opts.transfer_config.no_delete,
print_plan: opts.transfer_config.print_plan,
dry_run: opts.transfer_config.dry_run,
force_all: opts.transfer_config.force_all,
snapshot_config,
};

Expand Down
2 changes: 2 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ pub struct TransferConfig {
default_value = "0"
)]
pub print_plan: usize,
#[structopt(long, help = "Force transfer all objects")]
pub force_all: bool,
}

#[derive(StructOpt, Debug)]
Expand Down
8 changes: 7 additions & 1 deletion src/simple_diff_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct SimpleDiffTransferConfig {
pub dry_run: bool,
pub snapshot_config: SnapshotConfig,
pub print_plan: usize,
pub force_all: bool,
}

pub struct SimpleDiffTransfer<Snapshot, Source, Target, Item>
Expand Down Expand Up @@ -184,7 +185,7 @@ where

let source_snapshot = source_snapshot
.map_err(|err| Error::ProcessError(format!("error while sorting: {:?}", err)))?;
let target_snapshot = target_snapshot
let mut target_snapshot = target_snapshot
.map_err(|err| Error::ProcessError(format!("error while sorting: {:?}", err)))?;

if source_count != source_snapshot.len() {
Expand All @@ -203,6 +204,11 @@ where
);
}

if self.config.force_all {
info!(logger, "force transfer all objects");
target_snapshot = vec![];
}

info!(
logger,
"source {} objects -> target {} objects",
Expand Down

0 comments on commit ab0d43c

Please sign in to comment.