From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id DB7A71FF16C for ; Tue, 3 Sep 2024 14:33:36 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9579495B1; Tue, 3 Sep 2024 14:34:09 +0200 (CEST) From: Hannes Laimer To: pbs-devel@lists.proxmox.com Date: Tue, 3 Sep 2024 14:33:59 +0200 Message-Id: <20240903123401.91513-9-h.laimer@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240903123401.91513-1-h.laimer@proxmox.com> References: <20240903123401.91513-1-h.laimer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.018 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH proxmox-backup RFC 08/10] server/bin: replace datastore_lookup with new, state-typed datastore returning functions 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Signed-off-by: Hannes Laimer --- src/bin/proxmox-backup-proxy.rs | 4 ++-- src/server/prune_job.rs | 4 ++-- src/server/pull.rs | 6 +++--- src/server/verify_job.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs index 041f3aff..6ef4d61b 100644 --- a/src/bin/proxmox-backup-proxy.rs +++ b/src/bin/proxmox-backup-proxy.rs @@ -489,7 +489,7 @@ async fn schedule_datastore_garbage_collection() { { // limit datastore scope due to Op::Lookup - let datastore = match DataStore::lookup_datastore(&store, Some(Operation::Lookup)) { + let datastore = match DataStore::lookup_datastore(&store) { Ok(datastore) => datastore, Err(err) => { eprintln!("lookup_datastore failed - {err}"); @@ -532,7 +532,7 @@ async fn schedule_datastore_garbage_collection() { Err(_) => continue, // could not get lock }; - let datastore = match DataStore::lookup_datastore(&store, Some(Operation::Write)) { + let datastore = match DataStore::lookup_datastore_write(&store) { Ok(datastore) => datastore, Err(err) => { log::warn!("skipping scheduled GC on {store}, could look it up - {err}"); diff --git a/src/server/prune_job.rs b/src/server/prune_job.rs index 1c86647a..546c0bbd 100644 --- a/src/server/prune_job.rs +++ b/src/server/prune_job.rs @@ -4,7 +4,7 @@ use anyhow::Error; use tracing::{info, warn}; use pbs_api_types::{ - print_store_and_ns, Authid, KeepOptions, Operation, PruneJobOptions, MAX_NAMESPACE_DEPTH, + print_store_and_ns, Authid, KeepOptions, PruneJobOptions, MAX_NAMESPACE_DEPTH, PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, }; use pbs_datastore::prune::compute_prune_info; @@ -127,7 +127,7 @@ pub fn do_prune_job( auth_id: &Authid, schedule: Option, ) -> Result { - let datastore = DataStore::lookup_datastore(&store, Some(Operation::Write))?; + let datastore = DataStore::lookup_datastore_write(&store)?; let worker_type = job.jobtype().to_string(); let auth_id = auth_id.clone(); diff --git a/src/server/pull.rs b/src/server/pull.rs index de1bb5d5..41ab5e0e 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -16,7 +16,7 @@ use tracing::{info, warn}; use pbs_api_types::{ print_store_and_ns, Authid, BackupDir, BackupGroup, BackupNamespace, CryptMode, GroupFilter, - GroupListItem, Operation, RateLimitConfig, Remote, SnapshotListItem, MAX_NAMESPACE_DEPTH, + GroupListItem, RateLimitConfig, Remote, SnapshotListItem, MAX_NAMESPACE_DEPTH, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_READ, }; use pbs_client::{BackupReader, BackupRepository, HttpClient, RemoteChunkReader}; @@ -548,12 +548,12 @@ impl PullParameters { }) } else { Arc::new(LocalSource { - store: DataStore::lookup_datastore(remote_store, Some(Operation::Read))?, + store: DataStore::lookup_datastore_read(remote_store)?, ns: remote_ns, }) }; let target = PullTarget { - store: DataStore::lookup_datastore(store, Some(Operation::Write))?, + store: DataStore::lookup_datastore_write(store)?, ns, }; diff --git a/src/server/verify_job.rs b/src/server/verify_job.rs index a15a257d..bd5253ed 100644 --- a/src/server/verify_job.rs +++ b/src/server/verify_job.rs @@ -1,7 +1,7 @@ use anyhow::{format_err, Error}; use tracing::{error, info}; -use pbs_api_types::{Authid, Operation, VerificationJobConfig}; +use pbs_api_types::{Authid, VerificationJobConfig}; use pbs_datastore::DataStore; use proxmox_rest_server::WorkerTask; @@ -18,7 +18,7 @@ pub fn do_verification_job( schedule: Option, to_stdout: bool, ) -> Result { - let datastore = DataStore::lookup_datastore(&verification_job.store, Some(Operation::Read))?; + let datastore = DataStore::lookup_datastore_write(&verification_job.store)?; let outdated_after = verification_job.outdated_after; let ignore_verified_snapshots = verification_job.ignore_verified.unwrap_or(true); -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel