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>
let backup_time = proxmox_time::epoch_i64();
let client = BackupWriter::start(
- client,
+ &client,
None,
datastore,
&BackupNamespace::root(),
// 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,
log::debug!("Connecting to backup server");
let client = BackupWriter::start(
- client,
+ &client,
crypt_config.clone(),
repo.store(),
&BackupNamespace::root(),
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));
};
let client = BackupWriter::start(
- client,
+ &http_client,
crypt_config.clone(),
repo.store(),
&backup_ns,