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, 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); task_log!(worker, "sync job '{}' end", &job_id);
@ -278,7 +278,7 @@ async fn pull(
remote_store, remote_store,
); );
let pull_future = pull_store(&worker, &client, &pull_params); let pull_future = pull_store(&worker, &client, pull_params);
let future = select! { let future = select! {
success = pull_future.fuse() => success, success = pull_future.fuse() => success,
abort = worker.abort_future().map(|_| Err(format_err!("pull aborted"))) => abort, 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( pub async fn pull_store(
worker: &WorkerTask, worker: &WorkerTask,
client: &HttpClient, client: &HttpClient,
params: &PullParameters, mut params: PullParameters,
) -> Result<(), Error> { ) -> Result<(), Error> {
// explicit create shared lock to prevent GC on newly created chunks // explicit create shared lock to prevent GC on newly created chunks
let _shared_store_lock = params.store.try_shared_chunk_store_lock()?; 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 { let namespaces = if params.remote_ns.is_root() && params.max_depth == 0 {
vec![params.remote_ns.clone()] // backwards compat - don't query remote namespaces! vec![params.remote_ns.clone()] // backwards compat - don't query remote namespaces!
} else { } else {
query_namespaces(client, params).await? query_namespaces(client, &params).await?
}; };
let (mut groups, mut snapshots) = (0, 0); let (mut groups, mut snapshots) = (0, 0);
@ -939,7 +939,7 @@ pub async fn pull_store(
synced_ns.insert(target_ns.clone()); 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(true) => task_log!(worker, "Created namespace {}", target_ns),
Ok(false) => {} Ok(false) => {}
Err(err) => { 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)) => { Ok((ns_progress, ns_errors)) => {
errors |= ns_errors; errors |= ns_errors;
@ -984,7 +984,7 @@ pub async fn pull_store(
} }
if params.remove_vanished { 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 { if errors {