client: backup writer: only borrow http client

Instead of taking ownership of the http client when starting a new
BackupWriter instance, only borrow the client.

This allows to reuse the http client to later reuse it to start also a
BackupReader instance as required for backup runs with metadata based
file change detection mode, where both must use the same http client.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2024-03-28 13:36:25 +01:00 committed by Fabian Grünbichler
parent df5854986c
commit fcea0794c8
4 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ async fn upload_speed() -> Result<f64, Error> {
let backup_time = proxmox_time::epoch_i64();
let client = BackupWriter::start(
client,
&client,
None,
datastore,
&BackupNamespace::root(),

View File

@ -78,7 +78,7 @@ impl BackupWriter {
// FIXME: extract into (flattened) parameter struct?
#[allow(clippy::too_many_arguments)]
pub async fn start(
client: HttpClient,
client: &HttpClient,
crypt_config: Option<Arc<CryptConfig>>,
datastore: &str,
ns: &BackupNamespace,

View File

@ -229,7 +229,7 @@ async fn test_upload_speed(
log::debug!("Connecting to backup server");
let client = BackupWriter::start(
client,
&client,
crypt_config.clone(),
repo.store(),
&BackupNamespace::root(),

View File

@ -834,7 +834,7 @@ async fn create_backup(
let backup_time = backup_time_opt.unwrap_or_else(epoch_i64);
let client = connect_rate_limited(&repo, rate_limit)?;
let http_client = connect_rate_limited(&repo, rate_limit)?;
record_repository(&repo);
let snapshot = BackupDir::from((backup_type, backup_id.to_owned(), backup_time));
@ -886,7 +886,7 @@ async fn create_backup(
};
let client = BackupWriter::start(
client,
&http_client,
crypt_config.clone(),
repo.store(),
&backup_ns,