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 ABC496B899 for ; Tue, 21 Sep 2021 07:59:35 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2255F8FB4 for ; Tue, 21 Sep 2021 07:59:03 +0200 (CEST) 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 id A82F58E33 for ; Tue, 21 Sep 2021 07:58:58 +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 7C4CC449E7; Tue, 21 Sep 2021 07:58:58 +0200 (CEST) From: Dietmar Maurer To: pbs-devel@lists.proxmox.com Date: Tue, 21 Sep 2021 07:58:43 +0200 Message-Id: <20210921055854.3799470-6-dietmar@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210921055854.3799470-1-dietmar@proxmox.com> References: <20210921055854.3799470-1-dietmar@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.604 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lib.rs, rest.rs, formatter.rs, h2service.rs, datastore.rs, environment.rs, mod.rs] Subject: [pbs-devel] [PATCH proxmox-backup v2 05/16] move src/server/formatter.rs to proxmox-rest-server crate 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: Tue, 21 Sep 2021 05:59:35 -0000 --- {src/server => proxmox-rest-server/src}/formatter.rs | 0 proxmox-rest-server/src/lib.rs | 1 + src/api2/admin/datastore.rs | 3 ++- src/api2/backup/environment.rs | 2 +- src/api2/reader/environment.rs | 2 +- src/server/h2service.rs | 3 ++- src/server/mod.rs | 2 -- src/server/rest.rs | 3 +-- 8 files changed, 8 insertions(+), 8 deletions(-) rename {src/server => proxmox-rest-server/src}/formatter.rs (100%) diff --git a/src/server/formatter.rs b/proxmox-rest-server/src/formatter.rs similarity index 100% rename from src/server/formatter.rs rename to proxmox-rest-server/src/formatter.rs diff --git a/proxmox-rest-server/src/lib.rs b/proxmox-rest-server/src/lib.rs index 42e78d89..bc8334ba 100644 --- a/proxmox-rest-server/src/lib.rs +++ b/proxmox-rest-server/src/lib.rs @@ -5,6 +5,7 @@ use anyhow::{bail, format_err, Error}; use proxmox::tools::fd::Fd; pub mod daemon; +pub mod formatter; mod environment; pub use environment::*; diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index dc1c0ae9..20aca6fb 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -54,6 +54,7 @@ use pbs_tools::blocking::WrappedReaderStream; use pbs_tools::stream::{AsyncReaderStream, AsyncChannelWriter}; use pbs_tools::json::{required_integer_param, required_string_param}; use pbs_config::CachedUserInfo; +use proxmox_rest_server::formatter; use crate::api2::node::rrd::create_value_from_rrd; use crate::backup::{ @@ -1326,7 +1327,7 @@ pub fn upload_backup_log( replace_file(&path, blob.raw_data(), CreateOptions::new())?; // fixme: use correct formatter - Ok(crate::server::formatter::json_response(Ok(Value::Null))) + Ok(formatter::json_response(Ok(Value::Null))) }.boxed() } diff --git a/src/api2/backup/environment.rs b/src/api2/backup/environment.rs index 1766639e..129ebd2b 100644 --- a/src/api2/backup/environment.rs +++ b/src/api2/backup/environment.rs @@ -15,10 +15,10 @@ use pbs_datastore::backup_info::{BackupDir, BackupInfo}; use pbs_datastore::dynamic_index::DynamicIndexWriter; use pbs_datastore::fixed_index::FixedIndexWriter; use pbs_api_types::Authid; +use proxmox_rest_server::formatter::*; use crate::backup::{verify_backup_dir_with_lock, DataStore}; use crate::server::WorkerTask; -use crate::server::formatter::*; use hyper::{Body, Response}; #[derive(Copy, Clone, Serialize)] diff --git a/src/api2/reader/environment.rs b/src/api2/reader/environment.rs index 64a01c4d..f7d79072 100644 --- a/src/api2/reader/environment.rs +++ b/src/api2/reader/environment.rs @@ -7,9 +7,9 @@ use proxmox::api::{RpcEnvironment, RpcEnvironmentType}; use pbs_datastore::backup_info::BackupDir; use pbs_api_types::Authid; +use proxmox_rest_server::formatter::*; use crate::backup::DataStore; -use crate::server::formatter::*; use crate::server::WorkerTask; //use proxmox::tools; diff --git a/src/server/h2service.rs b/src/server/h2service.rs index 332b3b1a..a79387c0 100644 --- a/src/server/h2service.rs +++ b/src/server/h2service.rs @@ -11,8 +11,9 @@ use hyper::{Body, Request, Response, StatusCode}; use proxmox::api::{ApiResponseFuture, HttpError, Router, RpcEnvironment}; use proxmox::http_err; +use proxmox_rest_server::formatter::*; + use crate::tools; -use crate::server::formatter::*; use crate::server::WorkerTask; /// Hyper Service implementation to handle stateful H2 connections. diff --git a/src/server/mod.rs b/src/server/mod.rs index c426383f..1fc57575 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -55,8 +55,6 @@ pub use worker_task::*; mod h2service; pub use h2service::*; -pub mod formatter; - #[macro_use] pub mod rest; diff --git a/src/server/rest.rs b/src/server/rest.rs index 6af6fa55..8beecb55 100644 --- a/src/server/rest.rs +++ b/src/server/rest.rs @@ -35,8 +35,7 @@ use pbs_tools::compression::{DeflateEncoder, Level}; use pbs_tools::stream::AsyncReaderStream; use pbs_api_types::{Authid, Userid}; use proxmox_rest_server::{ApiConfig, FileLogger, FileLogOptions, AuthError, RestEnvironment}; - -use super::formatter::*; +use proxmox_rest_server::formatter::*; use crate::auth_helpers::*; use pbs_config::CachedUserInfo; -- 2.30.2