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 2382C63F2D for ; Fri, 17 Jul 2020 17:43:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 15DEB1DA88 for ; Fri, 17 Jul 2020 17:43:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id DFC861DA75 for ; Fri, 17 Jul 2020 17:43:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id AA22242ECE for ; Fri, 17 Jul 2020 17:43:23 +0200 (CEST) From: Mira Limbeck To: pve-devel@lists.proxmox.com Date: Fri, 17 Jul 2020 17:43:19 +0200 Message-Id: <20200717154320.2627-1-m.limbeck@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.346 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods NO_DNS_FOR_FROM 0.379 Envelope sender has no MX or A DNS records RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [client.rs, proxmox-backup-proxy.rs, proxmox-backup-manager.rs, mount.rs, benchmark.rs, pull.rs, catalog.rs, proxmox-backup-client.rs, task.rs] Subject: [pve-devel] [PATCH proxmox-backup 1/2] change * imports of proxmox_backup::client X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2020 15:43:56 -0000 Change the src/client.rs to make the modules public instead of publically using each member. This simplified the code and keeps the behaviour almost the same. Instead of using 'use proxmox_backup::client::*' we now have to use the full path (e.g. 'use proxmox_backup::client::http_client::') instead. This makes it clear where each symbol can be found. As the client module is used in some other files, we need to adapt them as well. Signed-off-by: Mira Limbeck --- It would be possible to keep the 'pub use ::*' lines so a proxmox_backup::client::* import still works. In my opinion this makes it a lot easier to look up symbols as you know where they can be found instead of having to grep for the definitions. What is your opinion on this matter? Note: The use statements were formatted with rustfmt. src/api2/pull.rs | 6 +++++- src/bin/proxmox-backup-client.rs | 14 +++++++++++-- src/bin/proxmox-backup-manager.rs | 5 ++++- src/bin/proxmox-backup-proxy.rs | 6 +++++- src/bin/proxmox_backup_client/benchmark.rs | 2 +- src/bin/proxmox_backup_client/catalog.rs | 2 +- src/bin/proxmox_backup_client/mount.rs | 2 +- src/bin/proxmox_backup_client/task.rs | 2 +- src/client.rs | 24 ++++++++-------------- src/client/backup_reader.rs | 2 +- src/client/backup_writer.rs | 2 +- src/client/pull.rs | 5 ++++- src/client/remote_chunk_reader.rs | 2 +- src/client/task_log.rs | 2 +- 14 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/api2/pull.rs b/src/api2/pull.rs index cf7de524..d8991919 100644 --- a/src/api2/pull.rs +++ b/src/api2/pull.rs @@ -8,7 +8,11 @@ use proxmox::api::{ApiMethod, Router, RpcEnvironment, Permission}; use crate::server::{WorkerTask}; use crate::backup::DataStore; -use crate::client::{HttpClient, HttpClientOptions, BackupRepository, pull::pull_store}; +use crate::client::{ + backup_repo::BackupRepository, + http_client::{HttpClient, HttpClientOptions}, + pull::pull_store +}; use crate::api2::types::*; use crate::config::{ remote, diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index d0620c0d..147eeba6 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -26,7 +26,17 @@ use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation}; use proxmox_backup::tools; use proxmox_backup::api2::types::*; use proxmox_backup::api2::version; -use proxmox_backup::client::*; +use proxmox_backup::client::{ + backup_reader::BackupReader, + backup_repo::{BackupRepository, BACKUP_REPO_URL}, + backup_specification::{ + parse_backup_specification, BackupSpecificationType, BACKUP_SOURCE_SCHEMA, + }, + backup_writer::{BackupStats, BackupWriter}, + http_client::{delete_ticket_info, HttpClient, HttpClientOptions}, + pxar_backup_stream::PxarBackupStream, + task_log::display_task_log, +}; use proxmox_backup::pxar::catalog::*; use proxmox_backup::backup::{ archive_type, @@ -1826,7 +1836,7 @@ fn complete_chunk_size(_arg: &str, _param: &HashMap) -> Vec