[pbs-devel] [PATCH proxmox-backup 05/15] move src/server/formatter.rs to pbs-server crate

Dietmar Maurer dietmar at proxmox.com
Mon Sep 20 09:38:03 CEST 2021


---
 {src/server => pbs-server/src}/formatter.rs | 0
 pbs-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 => pbs-server/src}/formatter.rs (100%)

diff --git a/src/server/formatter.rs b/pbs-server/src/formatter.rs
similarity index 100%
rename from src/server/formatter.rs
rename to pbs-server/src/formatter.rs
diff --git a/pbs-server/src/lib.rs b/pbs-server/src/lib.rs
index 42e78d89..bc8334ba 100644
--- a/pbs-server/src/lib.rs
+++ b/pbs-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 690671a0..7c8becbf 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 pbs_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..e599fd9a 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 pbs_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..e001101c 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 pbs_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..bc9561d3 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 pbs_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 71db76af..fe6463b9 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 1b95ce04..767ce85a 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 pbs_server::{ApiConfig, FileLogger, FileLogOptions, AuthError, RestEnvironment};
-
-use super::formatter::*;
+use pbs_server::formatter::*;
 
 use crate::auth_helpers::*;
 use pbs_config::CachedUserInfo;
-- 
2.30.2






More information about the pbs-devel mailing list