From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C028CBC03B for ; Thu, 28 Mar 2024 13:37:44 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4D2479DE0 for ; Thu, 28 Mar 2024 13:37:41 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 28 Mar 2024 13:37:39 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id F1D1A42933 for ; Thu, 28 Mar 2024 13:37:38 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 28 Mar 2024 13:36:25 +0100 Message-Id: <20240328123707.336951-17-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328123707.336951-1-c.ebner@proxmox.com> References: <20240328123707.336951-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH v3 proxmox-backup 16/58] client: backup writer: only borrow http client X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Mar 2024 12:37:44 -0000 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 --- changes since version 2: - not present in previous version examples/upload-speed.rs | 2 +- pbs-client/src/backup_writer.rs | 2 +- proxmox-backup-client/src/benchmark.rs | 2 +- proxmox-backup-client/src/main.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/upload-speed.rs b/examples/upload-speed.rs index f9fc52a85..e4b570ec5 100644 --- a/examples/upload-speed.rs +++ b/examples/upload-speed.rs @@ -18,7 +18,7 @@ async fn upload_speed() -> Result { let backup_time = proxmox_time::epoch_i64(); let client = BackupWriter::start( - client, + &client, None, datastore, &BackupNamespace::root(), diff --git a/pbs-client/src/backup_writer.rs b/pbs-client/src/backup_writer.rs index 8a03d8ea6..8bd0e4f36 100644 --- a/pbs-client/src/backup_writer.rs +++ b/pbs-client/src/backup_writer.rs @@ -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>, datastore: &str, ns: &BackupNamespace, diff --git a/proxmox-backup-client/src/benchmark.rs b/proxmox-backup-client/src/benchmark.rs index b3047308c..1262fb46d 100644 --- a/proxmox-backup-client/src/benchmark.rs +++ b/proxmox-backup-client/src/benchmark.rs @@ -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(), diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index 546275cb1..148708976 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -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, -- 2.39.2