avoid type re-exports

This commit is contained in:
Dietmar Maurer 2021-09-14 08:35:43 +02:00
parent cef5c72682
commit ccc3896ff3
9 changed files with 15 additions and 24 deletions

View File

@ -17,6 +17,7 @@ use proxmox_acme_rs::account::AccountData as AcmeAccountData;
use proxmox_acme_rs::Account;
use pbs_api_types::{Authid, PRIV_SYS_MODIFY};
use pbs_tools::ops::ControlFlow;
use crate::acme::AcmeClient;
use crate::api2::types::{AcmeAccountName, AcmeChallengeSchema, KnownAcmeDirectory};
@ -24,7 +25,6 @@ use crate::config::acme::plugin::{
self, DnsPlugin, DnsPluginCore, DnsPluginCoreUpdater, PLUGIN_ID_SCHEMA,
};
use crate::server::WorkerTask;
use crate::tools::ControlFlow;
pub(crate) const ROUTER: Router = Router::new()
.get(&list_subdirs_api_method!(SUBDIRS))

View File

@ -27,10 +27,10 @@ use pbs_datastore::manifest::{
use pbs_datastore::task::TaskState;
use pbs_tools::format::HumanByte;
use pbs_tools::fs::{lock_dir_noblock, DirLockGuard};
use crate::tools;
use pbs_tools::process_locker::ProcessLockSharedGuard;
use pbs_config::{open_backup_lockfile, BackupLockGuard};
use crate::tools::fail_on_shutdown;
lazy_static! {
static ref DATASTORE_MAP: Mutex<HashMap<String, Arc<DataStore>>> = Mutex::new(HashMap::new());
@ -508,7 +508,7 @@ impl DataStore {
for pos in 0..index.index_count() {
worker.check_abort()?;
tools::fail_on_shutdown()?;
fail_on_shutdown()?;
let digest = index.index_digest(pos).unwrap();
if !self.chunk_store.cond_touch_chunk(digest, false)? {
task_warn!(
@ -549,7 +549,7 @@ impl DataStore {
for (i, img) in image_list.into_iter().enumerate() {
worker.check_abort()?;
tools::fail_on_shutdown()?;
fail_on_shutdown()?;
if let Some(backup_dir_path) = img.parent() {
let backup_dir_path = backup_dir_path.strip_prefix(self.base_path())?;
@ -638,7 +638,7 @@ impl DataStore {
phase1_start_time,
&mut gc_status,
worker,
crate::tools::fail_on_shutdown,
fail_on_shutdown,
)?;
task_log!(
@ -720,7 +720,7 @@ impl DataStore {
Ok(())
}
pub fn try_shared_chunk_store_lock(&self) -> Result<tools::ProcessLockSharedGuard, Error> {
pub fn try_shared_chunk_store_lock(&self) -> Result<ProcessLockSharedGuard, Error> {
self.chunk_store.try_shared_lock()
}

View File

@ -14,7 +14,7 @@ use crate::api2::types::{
KnownAcmeDirectory,
AcmeAccountName,
};
use crate::tools::ControlFlow;
use pbs_tools::ops::ControlFlow;
pub(crate) const ACME_DIR: &str = pbs_buildcfg::configdir!("/acme");
pub(crate) const ACME_ACCOUNT_DIR: &str = pbs_buildcfg::configdir!("/acme/accounts");

View File

@ -111,7 +111,7 @@ pub struct WebauthnConfig {
impl WebauthnConfig {
pub fn digest(&self) -> Result<[u8; 32], Error> {
let digest_data = crate::tools::json::to_canonical_json(&serde_json::to_value(self)?)?;
let digest_data = pbs_tools::json::to_canonical_json(&serde_json::to_value(self)?)?;
Ok(openssl::sha::sha256(&digest_data))
}
}

View File

@ -6,7 +6,7 @@ use futures::*;
use tokio::signal::unix::{signal, SignalKind};
use crate::tools::{self, BroadcastData};
use pbs_tools::broadcast_future::BroadcastData;
#[derive(PartialEq, Copy, Clone, Debug)]
pub enum ServerMode {
@ -42,7 +42,7 @@ pub fn server_state_init() -> Result<(), Error> {
while stream.recv().await.is_some() {
println!("got shutdown request (SIGINT)");
SERVER_STATE.lock().unwrap().reload_request = false;
tools::request_shutdown();
crate::tools::request_shutdown();
}
}.boxed();
@ -57,7 +57,7 @@ pub fn server_state_init() -> Result<(), Error> {
while stream.recv().await.is_some() {
println!("got reload request (SIGHUP)");
SERVER_STATE.lock().unwrap().reload_request = true;
tools::request_shutdown();
crate::tools::request_shutdown();
}
}.boxed();

View File

@ -4,7 +4,7 @@ use nom::bytes::complete::{take_while, tag};
use pbs_tape::{ElementStatus, MtxStatus, DriveStatus, StorageElementStatus};
use crate::tools::nom::{
use pbs_tools::nom::{
parse_complete, multispace0, multispace1, parse_u64,
parse_failure, parse_error, IResult,
};

View File

@ -1,6 +1,6 @@
use anyhow::{bail, Error};
use crate::tools::nom::{
use pbs_tools::nom::{
multispace0, multispace1, notspace1, IResult,
};

View File

@ -4,7 +4,7 @@ use anyhow::{bail, Error};
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use crate::tools::nom::{
use pbs_tools::nom::{
parse_complete, parse_error, parse_failure,
multispace0, multispace1, notspace1, parse_u64, IResult,
};

View File

@ -15,12 +15,6 @@ use proxmox_http::{
ProxyConfig,
};
pub use pbs_tools::json;
pub use pbs_tools::nom;
pub use pbs_tools::process_locker::{
ProcessLocker, ProcessLockExclusiveGuard, ProcessLockSharedGuard
};
pub mod apt;
pub mod async_io;
pub mod compression;
@ -40,9 +34,6 @@ pub use parallel_handler::ParallelHandler;
mod file_logger;
pub use file_logger::{FileLogger, FileLogOptions};
pub use pbs_tools::broadcast_future::{BroadcastData, BroadcastFuture};
pub use pbs_tools::ops::ControlFlow;
/// Shortcut for md5 sums.
pub fn md5sum(data: &[u8]) -> Result<DigestBytes, Error> {
hash(MessageDigest::md5(), data).map_err(Error::from)