pull: pass params as non-ref in pull_store

so that it's possible to modify them in-place without cloning.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-05-12 16:22:09 +02:00
parent 2a088b9975
commit d9aad37f2f
2 changed files with 7 additions and 7 deletions

View File

@ -128,7 +128,7 @@ pub fn do_sync_job(
sync_job.remote_store,
);
pull_store(&worker, &client, &pull_params).await?;
pull_store(&worker, &client, pull_params).await?;
task_log!(worker, "sync job '{}' end", &job_id);
@ -278,7 +278,7 @@ async fn pull(
remote_store,
);
let pull_future = pull_store(&worker, &client, &pull_params);
let pull_future = pull_store(&worker, &client, pull_params);
let future = select! {
success = pull_future.fuse() => success,
abort = worker.abort_future().map(|_| Err(format_err!("pull aborted"))) => abort,

View File

@ -906,7 +906,7 @@ fn check_and_remove_vanished_ns(
pub async fn pull_store(
worker: &WorkerTask,
client: &HttpClient,
params: &PullParameters,
mut params: PullParameters,
) -> Result<(), Error> {
// explicit create shared lock to prevent GC on newly created chunks
let _shared_store_lock = params.store.try_shared_chunk_store_lock()?;
@ -914,7 +914,7 @@ pub async fn pull_store(
let namespaces = if params.remote_ns.is_root() && params.max_depth == 0 {
vec![params.remote_ns.clone()] // backwards compat - don't query remote namespaces!
} else {
query_namespaces(client, params).await?
query_namespaces(client, &params).await?
};
let (mut groups, mut snapshots) = (0, 0);
@ -939,7 +939,7 @@ pub async fn pull_store(
synced_ns.insert(target_ns.clone());
match check_and_create_ns(params, &target_store_ns) {
match check_and_create_ns(&params, &target_store_ns) {
Ok(true) => task_log!(worker, "Created namespace {}", target_ns),
Ok(false) => {}
Err(err) => {
@ -955,7 +955,7 @@ pub async fn pull_store(
}
}
match pull_ns(worker, client, params, namespace.clone(), target_ns).await {
match pull_ns(worker, client, &params, namespace.clone(), target_ns).await {
Ok((ns_progress, ns_errors)) => {
errors |= ns_errors;
@ -984,7 +984,7 @@ pub async fn pull_store(
}
if params.remove_vanished {
errors |= check_and_remove_vanished_ns(worker, params, synced_ns)?;
errors |= check_and_remove_vanished_ns(worker, &params, synced_ns)?;
}
if errors {