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 CC13163F91 for ; Fri, 17 Jul 2020 17:45:01 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C95EC1DD30 for ; Fri, 17 Jul 2020 17:45:01 +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 701761DD22 for ; Fri, 17 Jul 2020 17:45:00 +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 3AE6B43146 for ; Fri, 17 Jul 2020 17:45:00 +0200 (CEST) To: pve-devel@lists.proxmox.com References: <20200717154320.2627-1-m.limbeck@proxmox.com> From: Mira Limbeck Message-ID: <2f680e31-d0ca-266c-0583-3db7f647d0f2@proxmox.com> Date: Fri, 17 Jul 2020 17:44:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200717154320.2627-1-m.limbeck@proxmox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-SPAM-LEVEL: Spam detection results: 0 AWL 0.494 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) 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_PASS -0.001 SPF: sender matches 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, benchmark.rs, pull.rs, mount.rs, task.rs, proxmox-backup-client.rs, catalog.rs] Subject: Re: [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:45:01 -0000 Sent it to the wrong mailing list by accident, please disregard. On 7/17/20 5:43 PM, Mira Limbeck wrote: > 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 result > } > > -use proxmox_backup::client::RemoteChunkReader; > +use proxmox_backup::client::remote_chunk_reader::RemoteChunkReader; > /// This is a workaround until we have cleaned up the chunk/reader/... infrastructure for better > /// async use! > /// > diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs > index 7ae0852f..4ef8d340 100644 > --- a/src/bin/proxmox-backup-manager.rs > +++ b/src/bin/proxmox-backup-manager.rs > @@ -8,7 +8,10 @@ use proxmox::api::{api, cli::*, RpcEnvironment}; > use proxmox_backup::tools; > use proxmox_backup::config; > use proxmox_backup::api2::{self, types::* }; > -use proxmox_backup::client::*; > +use proxmox_backup::client::{ > + http_client::{HttpClient, HttpClientOptions}, > + task_log::display_task_log, > +}; > use proxmox_backup::tools::ticket::*; > use proxmox_backup::auth_helpers::*; > > diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs > index 75f53b9b..9bb4c459 100644 > --- a/src/bin/proxmox-backup-proxy.rs > +++ b/src/bin/proxmox-backup-proxy.rs > @@ -467,7 +467,11 @@ async fn schedule_datastore_sync_jobs() { > > use proxmox_backup::{ > backup::DataStore, > - client::{ HttpClient, HttpClientOptions, BackupRepository, pull::pull_store }, > + client::{ > + backup_repo::BackupRepository, > + http_client::{HttpClient, HttpClientOptions}, > + pull::pull_store > + }, > server::{ WorkerTask }, > config::{ sync::{self, SyncJobConfig}, remote::{self, Remote} }, > tools::systemd::time::{ parse_calendar_event, compute_next_event }, > diff --git a/src/bin/proxmox_backup_client/benchmark.rs b/src/bin/proxmox_backup_client/benchmark.rs > index 6392f282..1b42aff0 100644 > --- a/src/bin/proxmox_backup_client/benchmark.rs > +++ b/src/bin/proxmox_backup_client/benchmark.rs > @@ -24,7 +24,7 @@ use proxmox_backup::backup::{ > KeyDerivationConfig, > }; > > -use proxmox_backup::client::*; > +use proxmox_backup::client::{backup_repo::BackupRepository, backup_writer::BackupWriter}; > > use crate::{ > KEYFILE_SCHEMA, REPO_URL_SCHEMA, > diff --git a/src/bin/proxmox_backup_client/catalog.rs b/src/bin/proxmox_backup_client/catalog.rs > index 1c0865e6..f9f88c87 100644 > --- a/src/bin/proxmox_backup_client/catalog.rs > +++ b/src/bin/proxmox_backup_client/catalog.rs > @@ -9,7 +9,7 @@ use proxmox::api::{api, cli::*}; > > use proxmox_backup::tools; > > -use proxmox_backup::client::*; > +use proxmox_backup::client::{backup_reader::BackupReader, remote_chunk_reader::RemoteChunkReader}; > > use crate::{ > REPO_URL_SCHEMA, > diff --git a/src/bin/proxmox_backup_client/mount.rs b/src/bin/proxmox_backup_client/mount.rs > index 73bb8d4c..40af1740 100644 > --- a/src/bin/proxmox_backup_client/mount.rs > +++ b/src/bin/proxmox_backup_client/mount.rs > @@ -25,7 +25,7 @@ use proxmox_backup::backup::{ > BufferedDynamicReader, > }; > > -use proxmox_backup::client::*; > +use proxmox_backup::client::{backup_reader::BackupReader, remote_chunk_reader::RemoteChunkReader}; > > use crate::{ > REPO_URL_SCHEMA, > diff --git a/src/bin/proxmox_backup_client/task.rs b/src/bin/proxmox_backup_client/task.rs > index 96a28be9..55b58949 100644 > --- a/src/bin/proxmox_backup_client/task.rs > +++ b/src/bin/proxmox_backup_client/task.rs > @@ -5,7 +5,7 @@ use proxmox::api::{api, cli::*}; > > use proxmox_backup::tools; > > -use proxmox_backup::client::*; > +use proxmox_backup::client::task_log::display_task_log; > use proxmox_backup::api2::types::UPID_SCHEMA; > > use crate::{ > diff --git a/src/client.rs b/src/client.rs > index 3fb01f8a..9f649685 100644 > --- a/src/client.rs > +++ b/src/client.rs > @@ -6,28 +6,20 @@ > mod merge_known_chunks; > pub mod pipe_to_stream; > > -mod http_client; > -pub use http_client::*; > +pub mod http_client; > > -mod task_log; > -pub use task_log::*; > +pub mod task_log; > > -mod backup_reader; > -pub use backup_reader::*; > +pub mod backup_reader; > > -mod backup_writer; > -pub use backup_writer::*; > +pub mod backup_writer; > > -mod remote_chunk_reader; > -pub use remote_chunk_reader::*; > +pub mod remote_chunk_reader; > > -mod pxar_backup_stream; > -pub use pxar_backup_stream::*; > +pub mod pxar_backup_stream; > > -mod backup_repo; > -pub use backup_repo::*; > +pub mod backup_repo; > > -mod backup_specification; > -pub use backup_specification::*; > +pub mod backup_specification; > > pub mod pull; > diff --git a/src/client/backup_reader.rs b/src/client/backup_reader.rs > index b0b43c38..9e058a0b 100644 > --- a/src/client/backup_reader.rs > +++ b/src/client/backup_reader.rs > @@ -12,7 +12,7 @@ use proxmox::tools::digest_to_hex; > > use crate::backup::*; > > -use super::{HttpClient, H2Client}; > +use super::http_client::{HttpClient, H2Client}; > > /// Backup Reader > pub struct BackupReader { > diff --git a/src/client/backup_writer.rs b/src/client/backup_writer.rs > index 17c09d77..e073f627 100644 > --- a/src/client/backup_writer.rs > +++ b/src/client/backup_writer.rs > @@ -17,7 +17,7 @@ use proxmox::tools::digest_to_hex; > use super::merge_known_chunks::{MergedChunkInfo, MergeKnownChunks}; > use crate::backup::*; > > -use super::{HttpClient, H2Client}; > +use super::http_client::{HttpClient, H2Client}; > > pub struct BackupWriter { > h2: H2Client, > diff --git a/src/client/pull.rs b/src/client/pull.rs > index 5cf0dd1f..37e7b0c9 100644 > --- a/src/client/pull.rs > +++ b/src/client/pull.rs > @@ -11,7 +11,10 @@ use chrono::{Utc, TimeZone}; > use crate::server::{WorkerTask}; > use crate::backup::*; > use crate::api2::types::*; > -use super::*; > +use super::backup_reader::{compute_file_csum, BackupReader}; > +use super::backup_repo::BackupRepository; > +use super::http_client::{HttpClient, HttpClientOptions}; > +use super::remote_chunk_reader::RemoteChunkReader; > > > // fixme: implement filters > diff --git a/src/client/remote_chunk_reader.rs b/src/client/remote_chunk_reader.rs > index eeb4851b..4e6583ee 100644 > --- a/src/client/remote_chunk_reader.rs > +++ b/src/client/remote_chunk_reader.rs > @@ -5,7 +5,7 @@ use std::sync::{Arc, Mutex}; > > use anyhow::Error; > > -use super::BackupReader; > +use super::backup_reader::BackupReader; > use crate::backup::{AsyncReadChunk, CryptConfig, DataBlob, ReadChunk}; > use crate::tools::runtime::block_on; > > diff --git a/src/client/task_log.rs b/src/client/task_log.rs > index 4db2a8e0..9d01537e 100644 > --- a/src/client/task_log.rs > +++ b/src/client/task_log.rs > @@ -1,7 +1,7 @@ > use anyhow::{bail, Error}; > use serde_json::json; > > -use super::HttpClient; > +use super::http_client::HttpClient; > > pub async fn display_task_log( > client: HttpClient,