]> git.proxmox.com Git - proxmox-backup.git/commitdiff
update to first proxmox crate split
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 8 Oct 2021 09:19:37 +0000 (11:19 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 11 Oct 2021 09:58:49 +0000 (11:58 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
265 files changed:
Cargo.toml
examples/cipherbench.rs
examples/completion.rs
examples/download-speed.rs
examples/dynamic-files.rs
examples/upload-speed.rs
pbs-api-types/Cargo.toml
pbs-api-types/src/acl.rs
pbs-api-types/src/crypto.rs
pbs-api-types/src/datastore.rs
pbs-api-types/src/file_restore.rs
pbs-api-types/src/jobs.rs
pbs-api-types/src/key_derivation.rs
pbs-api-types/src/lib.rs
pbs-api-types/src/network.rs
pbs-api-types/src/remote.rs
pbs-api-types/src/tape/changer.rs
pbs-api-types/src/tape/device.rs
pbs-api-types/src/tape/drive.rs
pbs-api-types/src/tape/media.rs
pbs-api-types/src/tape/media_location.rs
pbs-api-types/src/tape/media_pool.rs
pbs-api-types/src/tape/media_status.rs
pbs-api-types/src/tape/mod.rs
pbs-api-types/src/user.rs
pbs-api-types/src/userid.rs
pbs-api-types/src/zfs.rs
pbs-client/Cargo.toml
pbs-client/src/backup_specification.rs
pbs-client/src/catalog_shell.rs
pbs-client/src/http_client.rs
pbs-client/src/pxar/create.rs
pbs-client/src/pxar/extract.rs
pbs-client/src/pxar/fuse.rs
pbs-client/src/pxar/tools.rs
pbs-client/src/task_log.rs
pbs-client/src/tools/key_source.rs
pbs-client/src/tools/mod.rs
pbs-client/src/vsock_client.rs
pbs-config/Cargo.toml
pbs-config/src/acl.rs
pbs-config/src/cached_user_info.rs
pbs-config/src/datastore.rs
pbs-config/src/domains.rs
pbs-config/src/drive.rs
pbs-config/src/key_config.rs
pbs-config/src/media_pool.rs
pbs-config/src/remote.rs
pbs-config/src/sync.rs
pbs-config/src/tape_job.rs
pbs-config/src/user.rs
pbs-config/src/verify.rs
pbs-datastore/Cargo.toml
pbs-datastore/src/backup_info.rs
pbs-datastore/src/catalog.rs
pbs-datastore/src/data_blob.rs
pbs-datastore/src/data_blob_reader.rs
pbs-datastore/src/data_blob_writer.rs
pbs-datastore/src/datastore.rs
pbs-datastore/src/dynamic_index.rs
pbs-datastore/src/fixed_index.rs
pbs-datastore/src/paperkey.rs
pbs-datastore/src/prune.rs
pbs-datastore/src/snapshot_reader.rs
pbs-fuse-loop/Cargo.toml
pbs-fuse-loop/src/fuse_loop.rs
pbs-tape/Cargo.toml
pbs-tape/src/bin/pmt.rs
pbs-tape/src/bin/pmtx.rs
pbs-tape/src/blocked_writer.rs
pbs-tape/src/emulate_tape_reader.rs
pbs-tape/src/lib.rs
pbs-tape/src/sg_pt_changer.rs
pbs-tape/src/sg_tape.rs
pbs-tape/src/sg_tape/encryption.rs
pbs-tape/src/sg_tape/mam.rs
pbs-tape/src/sg_tape/report_density.rs
pbs-tape/src/sg_tape/tape_alert_flags.rs
pbs-tape/src/sg_tape/volume_statistics.rs
pbs-tape/src/sgutils2.rs
pbs-tools/Cargo.toml
pbs-tools/src/cert.rs
pbs-tools/src/compression.rs
pbs-tools/src/format.rs
pbs-tools/src/sha.rs
pbs-tools/src/stream.rs
pbs-tools/src/ticket.rs
pbs-tools/src/xattr.rs
pbs-tools/src/zip.rs
proxmox-backup-client/Cargo.toml
proxmox-backup-client/src/benchmark.rs
proxmox-backup-client/src/bin/dump-catalog-shell-cli.rs
proxmox-backup-client/src/catalog.rs
proxmox-backup-client/src/key.rs
proxmox-backup-client/src/main.rs
proxmox-backup-client/src/mount.rs
proxmox-backup-client/src/snapshot.rs
proxmox-backup-client/src/task.rs
proxmox-file-restore/Cargo.toml
proxmox-file-restore/src/block_driver.rs
proxmox-file-restore/src/block_driver_qemu.rs
proxmox-file-restore/src/main.rs
proxmox-file-restore/src/qemu_helper.rs
proxmox-rest-server/Cargo.toml
proxmox-rest-server/examples/minimal-rest-server.rs
proxmox-rest-server/src/api_config.rs
proxmox-rest-server/src/daemon.rs
proxmox-rest-server/src/environment.rs
proxmox-rest-server/src/file_logger.rs
proxmox-rest-server/src/formatter.rs
proxmox-rest-server/src/h2service.rs
proxmox-rest-server/src/lib.rs
proxmox-rest-server/src/rest.rs
proxmox-rest-server/src/worker_task.rs
proxmox-restore-daemon/Cargo.toml
proxmox-restore-daemon/src/main.rs
proxmox-restore-daemon/src/proxmox_restore_daemon/api.rs
proxmox-restore-daemon/src/proxmox_restore_daemon/auth.rs
proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs
proxmox-restore-daemon/src/proxmox_restore_daemon/watchdog.rs
proxmox-rrd-api-types/Cargo.toml
proxmox-rrd-api-types/src/lib.rs
proxmox-rrd/Cargo.toml
proxmox-rrd/src/cache.rs
proxmox-systemd/Cargo.toml
proxmox-systemd/src/time.rs
proxmox-systemd/src/unit.rs
pxar-bin/Cargo.toml
pxar-bin/src/main.rs
src/api2/access/acl.rs
src/api2/access/domain.rs
src/api2/access/mod.rs
src/api2/access/openid.rs
src/api2/access/role.rs
src/api2/access/tfa.rs
src/api2/access/user.rs
src/api2/admin/datastore.rs
src/api2/admin/mod.rs
src/api2/admin/sync.rs
src/api2/admin/verify.rs
src/api2/backup/environment.rs
src/api2/backup/mod.rs
src/api2/backup/upload_chunk.rs
src/api2/config/access/mod.rs
src/api2/config/access/openid.rs
src/api2/config/access/tfa.rs
src/api2/config/acme.rs
src/api2/config/changer.rs
src/api2/config/datastore.rs
src/api2/config/drive.rs
src/api2/config/media_pool.rs
src/api2/config/mod.rs
src/api2/config/remote.rs
src/api2/config/sync.rs
src/api2/config/tape_backup_job.rs
src/api2/config/tape_encryption_keys.rs
src/api2/config/verify.rs
src/api2/helpers.rs
src/api2/mod.rs
src/api2/node/apt.rs
src/api2/node/certificates.rs
src/api2/node/config.rs
src/api2/node/disks/directory.rs
src/api2/node/disks/mod.rs
src/api2/node/disks/zfs.rs
src/api2/node/dns.rs
src/api2/node/journal.rs
src/api2/node/mod.rs
src/api2/node/network.rs
src/api2/node/report.rs
src/api2/node/rrd.rs
src/api2/node/services.rs
src/api2/node/status.rs
src/api2/node/subscription.rs
src/api2/node/syslog.rs
src/api2/node/tasks.rs
src/api2/node/time.rs
src/api2/ping.rs
src/api2/pull.rs
src/api2/reader/environment.rs
src/api2/reader/mod.rs
src/api2/status.rs
src/api2/tape/backup.rs
src/api2/tape/changer.rs
src/api2/tape/drive.rs
src/api2/tape/media.rs
src/api2/tape/mod.rs
src/api2/tape/restore.rs
src/api2/types/acme.rs
src/api2/types/mod.rs
src/api2/version.rs
src/auth_helpers.rs
src/backup/verify.rs
src/bin/docgen.rs
src/bin/proxmox-backup-api.rs
src/bin/proxmox-backup-debug.rs
src/bin/proxmox-backup-manager.rs
src/bin/proxmox-backup-proxy.rs
src/bin/proxmox-daily-update.rs
src/bin/proxmox-tape.rs
src/bin/proxmox_backup_debug/api.rs
src/bin/proxmox_backup_debug/inspect.rs
src/bin/proxmox_backup_debug/recover.rs
src/bin/proxmox_backup_manager/acl.rs
src/bin/proxmox_backup_manager/acme.rs
src/bin/proxmox_backup_manager/cert.rs
src/bin/proxmox_backup_manager/datastore.rs
src/bin/proxmox_backup_manager/disk.rs
src/bin/proxmox_backup_manager/dns.rs
src/bin/proxmox_backup_manager/network.rs
src/bin/proxmox_backup_manager/node.rs
src/bin/proxmox_backup_manager/openid.rs
src/bin/proxmox_backup_manager/remote.rs
src/bin/proxmox_backup_manager/subscription.rs
src/bin/proxmox_backup_manager/sync.rs
src/bin/proxmox_backup_manager/user.rs
src/bin/proxmox_backup_manager/verify.rs
src/bin/proxmox_tape/backup_job.rs
src/bin/proxmox_tape/changer.rs
src/bin/proxmox_tape/drive.rs
src/bin/proxmox_tape/encryption_key.rs
src/bin/proxmox_tape/media.rs
src/bin/proxmox_tape/pool.rs
src/bin/sg-tape-cmd.rs
src/config/acme/plugin.rs
src/config/mod.rs
src/config/node.rs
src/config/tfa.rs
src/server/auth.rs
src/server/email_notifications.rs
src/server/jobstate.rs
src/server/pull.rs
src/tape/changer/online_status_map.rs
src/tape/drive/lto/mod.rs
src/tape/drive/mod.rs
src/tape/drive/virtual_tape.rs
src/tape/file_formats/catalog_archive.rs
src/tape/file_formats/chunk_archive.rs
src/tape/file_formats/mod.rs
src/tape/file_formats/multi_volume_reader.rs
src/tape/file_formats/multi_volume_writer.rs
src/tape/file_formats/snapshot_archive.rs
src/tape/inventory.rs
src/tape/media_catalog.rs
src/tape/media_pool.rs
src/tape/media_set.rs
src/tape/pool_writer/catalog_set.rs
src/tape/pool_writer/mod.rs
src/tape/pool_writer/new_chunks_iterator.rs
src/tape/test/compute_media_state.rs
src/tape/test/current_set_usable.rs
src/tape/test/inventory.rs
src/tools/apt.rs
src/tools/config.rs
src/tools/disks/mod.rs
src/tools/disks/smart.rs
src/tools/serde_filter.rs
src/tools/subscription.rs
src/tools/systemd/config.rs
src/tools/systemd/types.rs
tests/blob_writer.rs
tests/catar.rs
tests/prune.rs
tests/verify-api.rs
tests/worker-task-abort.rs

index a6e0ee3561ed23ecda83b270d0b9714ad5986ed9..d2e3fa1fd3abca1e08140a3fd00c1cbf4d835deb 100644 (file)
@@ -58,6 +58,7 @@ thiserror = "1.0"
 futures = "0.3"
 h2 = { version = "0.3", features = [ "stream" ] }
 handlebars = "3.0"
+hex = "0.4.3"
 http = "0.2"
 hyper = { version = "0.14", features = [ "full" ] }
 lazy_static = "1.4"
@@ -96,11 +97,20 @@ zstd = { version = "0.6", features = [ "bindgen" ] }
 pathpatterns = "0.1.2"
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
-proxmox = { version = "0.14.0", features = [ "sortable-macro", "api-macro", "cli", "router", "tfa" ] }
-proxmox-acme-rs = "0.2.1"
-proxmox-apt = "0.7.0"
+proxmox = { version = "0.14.0", features = [ "sortable-macro" ] }
 proxmox-http = { version = "0.5.0", features = [ "client", "http-helpers", "websocket" ] }
-proxmox-openid = "0.7.0"
+proxmox-io = "1"
+proxmox-lang = "1"
+proxmox-router = { version = "1", features = [ "cli" ] }
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-section-config = "1"
+proxmox-tfa = { version = "1", features = [ "u2f" ] }
+proxmox-time = "1"
+proxmox-uuid = "1"
+
+proxmox-acme-rs = "0.2.1"
+proxmox-apt = "0.8.0"
+proxmox-openid = "0.8.0"
 
 pbs-api-types = { path = "pbs-api-types" }
 pbs-buildcfg = { path = "pbs-buildcfg" }
index 581c101a3e860d3a07c32e2ac9f23cd8a7b2dc8e..40e4984bd8d270809f7e41964f75d49a9659affc 100644 (file)
@@ -1,4 +1,4 @@
-use anyhow::{Error};
+use anyhow::Error;
 
 //  chacha20-poly1305
 
index 316dd0dc9070062232a4a6ab462b01e51e39dada..e2556c832d8063e12826835bf2261280203cc736 100644 (file)
@@ -1,6 +1,7 @@
 use anyhow::{Error};
 
-use proxmox::api::{*, cli::*};
+use proxmox_schema::*;
+use proxmox_router::cli::*;
 
 #[api(
     input: {
index 471d30f0bf85fca05a081ecd0eac800e0de61165..a248ae875a39788bd11fa7d053f6b5cfe5038321 100644 (file)
@@ -1,6 +1,6 @@
 use std::io::Write;
 
-use anyhow::{Error};
+use anyhow::Error;
 
 use pbs_api_types::Authid;
 use pbs_client::{HttpClient, HttpClientOptions, BackupReader};
@@ -34,7 +34,7 @@ async fn run() -> Result<(), Error> {
 
     let client = HttpClient::new(host, 8007, auth_id, options)?;
 
-    let backup_time = proxmox::tools::time::parse_rfc3339("2019-06-28T10:49:48Z")?;
+    let backup_time = proxmox_time::parse_rfc3339("2019-06-28T10:49:48Z")?;
 
     let client = BackupReader::start(client, None, "store2", "host", "elsa", backup_time, true)
         .await?;
index 8338dee2c7fff67f38fe280b00b86d4075a49467..777b95bf8501eecd02ece4de9059e72e8c9feb0b 100644 (file)
@@ -1,9 +1,9 @@
-use anyhow::{bail, Error};
-
 use std::thread;
 use std::path::PathBuf;
 use std::io::Write;
 
+use anyhow::{bail, Error};
+
 // tar handle files that shrink during backup, by simply padding with zeros.
 //
 // this binary run multiple thread which writes some large files, then truncates
index 7c2fd0e7dbb52530ea03e24b7993f876b96d527e..b670d0606a51cf8375f1b3b51f18e586443706a9 100644 (file)
@@ -16,7 +16,7 @@ async fn upload_speed() -> Result<f64, Error> {
 
     let client = HttpClient::new(host, 8007, auth_id, options)?;
 
-    let backup_time = proxmox::tools::time::epoch_i64();
+    let backup_time = proxmox_time::epoch_i64();
 
     let client = BackupWriter::start(client, None, datastore, "host", "speedtest", backup_time, false, true).await?;
 
index ade377219b685f91633577b87f5f811582fe4d61..2a51bd3ace9f0f295c30bef7f51c41394741d33a 100644 (file)
@@ -14,7 +14,11 @@ openssl = "0.10"
 regex = "1.2"
 serde = { version = "1.0", features = ["derive"] }
 
+proxmox = "0.14.0"
+proxmox-lang = "1.0.0"
 proxmox-schema = { version = "1.0.0", features = [ "api-macro" ] }
+proxmox-time = "1.0.0"
+proxmox-uuid = { version = "1.0.0", features = [ "serde" ] }
 
 proxmox-rrd-api-types = { path = "../proxmox-rrd-api-types" }
 proxmox-systemd = { path = "../proxmox-systemd" }
index ad8c66a74ba57340beb8cf61c132884539e852a1..6cdd0ee66b83bae0cbab6905227f58db6b6a12a5 100644 (file)
@@ -1,13 +1,12 @@
 use std::str::FromStr;
 
-use serde::{Deserialize, Serialize};
 use serde::de::{value, IntoDeserializer};
+use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
-use proxmox::api::schema::{
-    ApiStringFormat, BooleanSchema, EnumEntry, Schema, StringSchema,
+use proxmox_lang::constnamedbitmap;
+use proxmox_schema::{
+    api, const_regex, ApiStringFormat, BooleanSchema, EnumEntry, Schema, StringSchema,
 };
-use proxmox::{constnamedbitmap, const_regex};
 
 const_regex! {
     pub ACL_PATH_REGEX = concat!(r"^(?:/|", r"(?:/", PROXMOX_SAFE_ID_REGEX_STR!(), ")+", r")$");
@@ -222,7 +221,6 @@ pub enum Role {
     TapeReader = ROLE_TAPE_READER,
 }
 
-
 impl FromStr for Role {
     type Err = value::Error;
 
@@ -231,26 +229,24 @@ impl FromStr for Role {
     }
 }
 
-pub const ACL_PATH_FORMAT: ApiStringFormat =
-    ApiStringFormat::Pattern(&ACL_PATH_REGEX);
+pub const ACL_PATH_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&ACL_PATH_REGEX);
 
-pub const ACL_PATH_SCHEMA: Schema = StringSchema::new(
-    "Access control path.")
+pub const ACL_PATH_SCHEMA: Schema = StringSchema::new("Access control path.")
     .format(&ACL_PATH_FORMAT)
     .min_length(1)
     .max_length(128)
     .schema();
 
-pub const ACL_PROPAGATE_SCHEMA: Schema = BooleanSchema::new(
-    "Allow to propagate (inherit) permissions.")
-    .default(true)
-    .schema();
+pub const ACL_PROPAGATE_SCHEMA: Schema =
+    BooleanSchema::new("Allow to propagate (inherit) permissions.")
+        .default(true)
+        .schema();
 
-pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new(
-    "Type of 'ugid' property.")
+pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new("Type of 'ugid' property.")
     .format(&ApiStringFormat::Enum(&[
         EnumEntry::new("user", "User"),
-        EnumEntry::new("group", "Group")]))
+        EnumEntry::new("group", "Group"),
+    ]))
     .schema();
 
 #[api(
index 7b36e85f2af7af34f4caa74b698a0fa21aa94d17..016970f8f4e2f9c76a2fff6ce2daba66b28411d4 100644 (file)
@@ -3,7 +3,7 @@ use std::fmt::{self, Display};
 use anyhow::Error;
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 use pbs_tools::format::{as_fingerprint, bytes_as_fingerprint};
 
index 75f82ea4830aa6cd91bd65ed96ff85464774d035..462081e42461e9508966b42003f188a344fe5b78 100644 (file)
@@ -1,13 +1,10 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
-use proxmox::api::schema::{
-    ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType, Schema,
-    StringSchema, Updater,
+use proxmox_schema::{
+    api, const_regex, ApiStringFormat, ApiType, ArraySchema, EnumEntry, IntegerSchema, ReturnType,
+    Schema, StringSchema, Updater,
 };
 
-use proxmox::const_regex;
-
 use crate::{
     PROXMOX_SAFE_ID_FORMAT, SHA256_HEX_REGEX, SINGLE_LINE_COMMENT_SCHEMA, CryptMode, UPID,
     Fingerprint, Userid, Authid,
index eedb172bc2ddbd726be110040c9af3be925968cc..5748f3a777bdcbf1ea90de7c6c7e1f6e7618a4f3 100644 (file)
@@ -1,6 +1,6 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 #[api]
 #[derive(Serialize, Deserialize)]
index a9c64779be6ad9439a730e2a2c728ca799626f19..f47a294a6a84a74f021005e90edb30d94a37b82d 100644 (file)
@@ -1,8 +1,6 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::const_regex;
-
-use proxmox::api::{api, schema::*};
+use proxmox_schema::*;
 
 use crate::{
     Userid, Authid, REMOTE_ID_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
index 9a53130cbea67248b1b0a4876bf004ce5b2f121c..26b86c3010b1d48a497d517f1b1097198f8a74f9 100644 (file)
@@ -1,6 +1,6 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 use crate::CERT_FINGERPRINT_SHA256_SCHEMA;
 
index 83ef386bc65f369c252e06c9594b8b1cf82c6a98..cdf765a1c6d3bbb49fbc6954d625af8ead16a3f3 100644 (file)
@@ -3,9 +3,9 @@
 use serde::{Deserialize, Serialize};
 use anyhow::bail;
 
-use proxmox::api::api;
-use proxmox::api::schema::{ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, ReturnType};
-use proxmox::const_regex;
+use proxmox_schema::{
+    api, const_regex, ApiStringFormat, ApiType, ArraySchema, Schema, StringSchema, ReturnType,
+};
 use proxmox::{IPRE, IPRE_BRACKET, IPV4OCTET, IPV4RE, IPV6H16, IPV6LS32, IPV6RE};
 
 #[rustfmt::skip]
@@ -60,7 +60,7 @@ pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN
 mod user;
 pub use user::*;
 
-pub use proxmox::api::upid::*;
+pub use proxmox_schema::upid::*;
 
 mod crypto;
 pub use crypto::{CryptMode, Fingerprint};
index d3a8e43cea2c694381e208715b18271594518aeb..de27df7eef5d81a6ee45b8e78b52be9c94d048ea 100644 (file)
@@ -1,6 +1,6 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, schema::*};
+use proxmox_schema::*;
 
 use crate::{
     PROXMOX_SAFE_ID_REGEX,
index 2784e353cbf0b7974c4ad594b8221d4b61a554ac..15c336b78163d50cdc8b215c1c2944bc5cf09927 100644 (file)
@@ -1,7 +1,7 @@
 use serde::{Deserialize, Serialize};
 
 use super::*;
-use proxmox::api::{api, schema::*};
+use proxmox_schema::*;
 
 pub const REMOTE_PASSWORD_SCHEMA: Schema = StringSchema::new("Password or auth token for remote host.")
     .format(&PASSWORD_FORMAT)
index e36eb32cd97384c293d02dcb7fa5dcf7567f60d3..c9c7fcaa71e52f6de5736bc34b6dde2ce5a9babd 100644 (file)
@@ -2,22 +2,11 @@
 
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{
-    api,
-    schema::{
-        Schema,
-        ApiStringFormat,
-        ArraySchema,
-        IntegerSchema,
-        StringSchema,
-        Updater,
-    },
+use proxmox_schema::{
+    api, ApiStringFormat, ArraySchema, IntegerSchema, Schema, StringSchema, Updater,
 };
 
-use crate::{
-    PROXMOX_SAFE_ID_FORMAT,
-    OptionalDeviceIdentification,
-};
+use crate::{OptionalDeviceIdentification, PROXMOX_SAFE_ID_FORMAT};
 
 pub const CHANGER_NAME_SCHEMA: Schema = StringSchema::new("Tape Changer Identifier.")
     .format(&PROXMOX_SAFE_ID_FORMAT)
@@ -25,9 +14,8 @@ pub const CHANGER_NAME_SCHEMA: Schema = StringSchema::new("Tape Changer Identifi
     .max_length(32)
     .schema();
 
-pub const SCSI_CHANGER_PATH_SCHEMA: Schema = StringSchema::new(
-    "Path to Linux generic SCSI device (e.g. '/dev/sg4')")
-    .schema();
+pub const SCSI_CHANGER_PATH_SCHEMA: Schema =
+    StringSchema::new("Path to Linux generic SCSI device (e.g. '/dev/sg4')").schema();
 
 pub const MEDIA_LABEL_SCHEMA: Schema = StringSchema::new("Media Label/Barcode.")
     .format(&PROXMOX_SAFE_ID_FORMAT)
@@ -36,16 +24,18 @@ pub const MEDIA_LABEL_SCHEMA: Schema = StringSchema::new("Media Label/Barcode.")
     .schema();
 
 pub const SLOT_ARRAY_SCHEMA: Schema = ArraySchema::new(
-    "Slot list.", &IntegerSchema::new("Slot number")
-        .minimum(1)
-        .schema())
-    .schema();
+    "Slot list.",
+    &IntegerSchema::new("Slot number").minimum(1).schema(),
+)
+.schema();
 
-pub const EXPORT_SLOT_LIST_SCHEMA: Schema = StringSchema::new("\
+pub const EXPORT_SLOT_LIST_SCHEMA: Schema = StringSchema::new(
+    "\
 A list of slot numbers, comma separated. Those slots are reserved for
 Import/Export, i.e. any media in those slots are considered to be
 'offline'.
-")
+",
+)
 .format(&ApiStringFormat::PropertyString(&SLOT_ARRAY_SCHEMA))
 .schema();
 
@@ -63,14 +53,14 @@ Import/Export, i.e. any media in those slots are considered to be
         },
     },
 )]
-#[derive(Serialize,Deserialize,Updater)]
+#[derive(Serialize, Deserialize, Updater)]
 #[serde(rename_all = "kebab-case")]
 /// SCSI tape changer
 pub struct ScsiTapeChanger {
     #[updater(skip)]
     pub name: String,
     pub path: String,
-    #[serde(skip_serializing_if="Option::is_none")]
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub export_slots: Option<String>,
 }
 
@@ -84,7 +74,7 @@ pub struct ScsiTapeChanger {
         },
     },
 )]
-#[derive(Serialize,Deserialize)]
+#[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 /// Changer config with optional device identification attributes
 pub struct ChangerListEntry {
@@ -95,7 +85,7 @@ pub struct ChangerListEntry {
 }
 
 #[api()]
-#[derive(Serialize,Deserialize)]
+#[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 /// Mtx Entry Kind
 pub enum MtxEntryKind {
@@ -118,7 +108,7 @@ pub enum MtxEntryKind {
         },
     },
 )]
-#[derive(Serialize,Deserialize)]
+#[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
 /// Mtx Status Entry
 pub struct MtxStatusEntry {
@@ -126,12 +116,12 @@ pub struct MtxStatusEntry {
     /// The ID of the slot or drive
     pub entry_id: u64,
     /// The media label (volume tag) if the slot/drive is full
-    #[serde(skip_serializing_if="Option::is_none")]
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub label_text: Option<String>,
     /// The slot the drive was loaded from
-    #[serde(skip_serializing_if="Option::is_none")]
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub loaded_slot: Option<u64>,
     /// The current state of the drive
-    #[serde(skip_serializing_if="Option::is_none")]
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub state: Option<String>,
 }
index 368a00152329086b342dc4f52b7bdf069c953c0a..54fad8b088bc6f850b0a6d4b29cf7ee4473979b2 100644 (file)
@@ -1,6 +1,6 @@
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 #[api()]
 #[derive(Serialize,Deserialize)]
index 3e207a992b24bd48fdf477225041937593f054e4..e177d39f0c5e582d81e43741c9f26d51e06bdce8 100644 (file)
@@ -4,10 +4,7 @@ use std::convert::TryFrom;
 use anyhow::{bail, Error};
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{
-    api,
-    schema::{Schema, IntegerSchema, StringSchema, Updater},
-};
+use proxmox_schema::{api, Schema, IntegerSchema, StringSchema, Updater};
 
 use crate::{
     PROXMOX_SAFE_ID_FORMAT,
index 4e301c9824b0701df4ce5f3e461f50efac86e3b3..61d7be041c6848d2e62bd51fbb157e5baf403b5b 100644 (file)
@@ -1,9 +1,7 @@
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::{
-    api::{api, schema::*},
-    tools::Uuid,
-};
+use proxmox_schema::*;
+use proxmox_uuid::Uuid;
 
 use crate::{
     UUID_FORMAT,
index a917c609219d71f883970260b11e309eca5bd250..a05f11567f673f9b776a0a2b3d7a542db76023d9 100644 (file)
@@ -1,18 +1,8 @@
 use anyhow::{bail, Error};
 
-use proxmox::api::{
-    schema::{
-        Schema,
-        StringSchema,
-        ApiStringFormat,
-        parse_simple_value,
-    },
-};
+use proxmox_schema::{parse_simple_value, ApiStringFormat, Schema, StringSchema};
 
-use crate::{
-    PROXMOX_SAFE_ID_FORMAT,
-    CHANGER_NAME_SCHEMA,
-};
+use crate::{CHANGER_NAME_SCHEMA, PROXMOX_SAFE_ID_FORMAT};
 
 pub const VAULT_NAME_SCHEMA: Schema = StringSchema::new("Vault name.")
     .format(&PROXMOX_SAFE_ID_FORMAT)
@@ -35,28 +25,27 @@ pub enum MediaLocation {
 proxmox::forward_deserialize_to_from_str!(MediaLocation);
 proxmox::forward_serialize_to_display!(MediaLocation);
 
-impl proxmox::api::schema::ApiType for MediaLocation {
+impl proxmox_schema::ApiType for MediaLocation {
     const API_SCHEMA: Schema = StringSchema::new(
-        "Media location (e.g. 'offline', 'online-<changer_name>', 'vault-<vault_name>')")
-        .format(&ApiStringFormat::VerifyFn(|text| {
-            let location: MediaLocation = text.parse()?;
-            match location {
-                MediaLocation::Online(ref changer) => {
-                    parse_simple_value(changer, &CHANGER_NAME_SCHEMA)?;
-                }
-                MediaLocation::Vault(ref vault) => {
-                    parse_simple_value(vault, &VAULT_NAME_SCHEMA)?;
-                }
-                MediaLocation::Offline => { /* OK */}
+        "Media location (e.g. 'offline', 'online-<changer_name>', 'vault-<vault_name>')",
+    )
+    .format(&ApiStringFormat::VerifyFn(|text| {
+        let location: MediaLocation = text.parse()?;
+        match location {
+            MediaLocation::Online(ref changer) => {
+                parse_simple_value(changer, &CHANGER_NAME_SCHEMA)?;
             }
-            Ok(())
-        }))
-        .schema();
+            MediaLocation::Vault(ref vault) => {
+                parse_simple_value(vault, &VAULT_NAME_SCHEMA)?;
+            }
+            MediaLocation::Offline => { /* OK */ }
+        }
+        Ok(())
+    }))
+    .schema();
 }
 
-
 impl std::fmt::Display for MediaLocation {
-
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
             MediaLocation::Offline => {
index 9e3d8b568abdf42567ca033156da29eaa80ea981..148ae05167666b3437ffc88bc1454d87a3d53d94 100644 (file)
@@ -9,10 +9,7 @@ use std::str::FromStr;
 use anyhow::Error;
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{
-    api,
-    schema::{Schema, StringSchema, ApiStringFormat, Updater},
-};
+use proxmox_schema::{api, Schema, StringSchema, ApiStringFormat, Updater};
 
 use proxmox_systemd::time::{parse_calendar_event, parse_time_span, CalendarEvent, TimeSpan};
 
index 5a3bff96f8eb865f7f12fff17f4b7186fe093e93..9815b91f5251849394d2092bb0be1bc9dd5333eb 100644 (file)
@@ -1,6 +1,6 @@
-use ::serde::{Deserialize, Serialize};
+use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 #[api()]
 /// Media status
index a77be7f78186cd63d0faf870026fa4587a111a23..58777a52ec642bd633e3f57163b9c68e9fcf8d8e 100644 (file)
@@ -22,13 +22,10 @@ pub use media_location::*;
 mod media;
 pub use media::*;
 
-use ::serde::{Deserialize, Serialize};
+use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
-use proxmox::api::schema::{Schema, StringSchema, ApiStringFormat};
-use proxmox::tools::Uuid;
-
-use proxmox::const_regex;
+use proxmox_schema::{api, const_regex, Schema, StringSchema, ApiStringFormat};
+use proxmox_uuid::Uuid;
 
 use crate::{
     FINGERPRINT_SHA256_FORMAT, BACKUP_ID_SCHEMA, BACKUP_TYPE_SCHEMA,
index 8a7480adb9545fe7e3438df8dae9f2ddcc9ecc9a..94ed07c00b460b70fd9bc9e648056c8e2afec366 100644 (file)
@@ -1,8 +1,7 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
-use proxmox::api::schema::{
-    BooleanSchema, IntegerSchema, Schema, StringSchema, Updater,
+use proxmox_schema::{
+    api, BooleanSchema, IntegerSchema, Schema, StringSchema, Updater,
 };
 
 use super::{SINGLE_LINE_COMMENT_FORMAT, SINGLE_LINE_COMMENT_SCHEMA};
@@ -133,7 +132,7 @@ impl ApiToken {
             return false;
         }
         if let Some(expire) = self.expire {
-            let now =  proxmox::tools::time::epoch_i64();
+            let now =  proxmox_time::epoch_i64();
             if expire > 0 && expire <= now {
                 return false;
             }
@@ -198,7 +197,7 @@ impl User {
             return false;
         }
         if let Some(expire) = self.expire {
-            let now =  proxmox::tools::time::epoch_i64();
+            let now =  proxmox_time::epoch_i64();
             if expire > 0 && expire <= now {
                 return false;
             }
index 1794c7207e513c7072934c458137b208856eed94..8c58da2e0f58a9f3ac9493d249fdd69b4c39960f 100644 (file)
@@ -29,9 +29,9 @@ use anyhow::{bail, format_err, Error};
 use lazy_static::lazy_static;
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
-use proxmox::api::schema::{ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType};
-use proxmox::const_regex;
+use proxmox_schema::{
+    api, const_regex, ApiStringFormat, ApiType, Schema, StringSchema, UpdaterType,
+};
 
 // we only allow a limited set of characters
 // colon is not allowed, because we store usernames in
index 517ca9146422c35e66268963cbaa98cf54784c29..5fe495616acd43049d38d963ea12a5373d488e7a 100644 (file)
@@ -1,8 +1,6 @@
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, schema::*};
-
-use proxmox::const_regex;
+use proxmox_schema::*;
 
 const_regex! {
     pub ZPOOL_NAME_REGEX = r"^[a-zA-Z][a-z0-9A-Z\-_.:]+$";
index 58da9f30417a0123f1907135557ea3e8838590e3..272cf3563968c34427e2b46cc9a13a4a7a154939 100644 (file)
@@ -28,9 +28,14 @@ tower-service = "0.3.0"
 xdg = "2.2"
 
 pathpatterns = "0.1.2"
-proxmox = { version = "0.14.0", default-features = false, features = [ "cli" ] }
+proxmox = "0.14.0"
 proxmox-fuse = "0.1.1"
 proxmox-http = { version = "0.5.0", features = [ "client", "http-helpers", "websocket" ] }
+proxmox-io = { version = "1", features = [ "tokio" ] }
+proxmox-lang = "1"
+proxmox-router = { version = "1", features = [ "cli" ] }
+proxmox-schema = "1"
+proxmox-time = "1"
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
 pbs-api-types = { path = "../pbs-api-types" }
index 627c183c437e9c3598e9cdf60a6575fbc90b4c9f..ea32b97ced8589e2ea77ddd3ccd2702d0915e657 100644 (file)
@@ -1,8 +1,8 @@
 use anyhow::{bail, Error};
 
-use proxmox::api::schema::*;
+use proxmox_schema::*;
 
-proxmox::const_regex! {
+const_regex! {
     BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(pxar|img|conf|log)):(.+)$";
 }
 
index defa62380a5edea0f3de56a948a5720c1b2d9ba9..6a35f135b6773767b6533b5c75e25892f244dbd9 100644 (file)
@@ -13,9 +13,9 @@ use nix::fcntl::OFlag;
 use nix::sys::stat::Mode;
 
 use pathpatterns::{MatchEntry, MatchList, MatchPattern, MatchType, PatternFlag};
-use proxmox::api::api;
-use proxmox::api::cli::{self, CliCommand, CliCommandMap, CliHelper, CommandLineInterface};
 use proxmox::tools::fs::{create_path, CreateOptions};
+use proxmox_router::cli::{self, CliCommand, CliCommandMap, CliHelper, CommandLineInterface};
+use proxmox_schema::api;
 use pxar::{EntryKind, Metadata};
 
 use pbs_runtime::block_in_place;
index a83b8d3c7cad47e037c78645bf48c0ef611929d0..d135bc4f6164256540742b4edc94094254db9fb5 100644 (file)
@@ -15,10 +15,10 @@ use percent_encoding::percent_encode;
 use xdg::BaseDirectories;
 
 use proxmox::{
-    api::error::HttpError,
     sys::linux::tty,
     tools::fs::{file_get_json, replace_file, CreateOptions},
 };
+use proxmox_router::HttpError;
 
 use proxmox_http::client::HttpsConnector;
 use proxmox_http::uri::build_authority;
@@ -230,7 +230,7 @@ fn store_ticket_info(prefix: &str, server: &str, username: &str, ticket: &str, t
 
     let mut data = file_get_json(&path, Some(json!({})))?;
 
-    let now = proxmox::tools::time::epoch_i64();
+    let now = proxmox_time::epoch_i64();
 
     data[server][username] = json!({ "timestamp": now, "ticket": ticket, "token": token});
 
@@ -261,7 +261,7 @@ fn load_ticket_info(prefix: &str, server: &str, userid: &Userid) -> Option<(Stri
     // usually /run/user/<uid>/...
     let path = base.place_runtime_file("tickets").ok()?;
     let data = file_get_json(&path, None).ok()?;
-    let now = proxmox::tools::time::epoch_i64();
+    let now = proxmox_time::epoch_i64();
     let ticket_lifetime = ticket::TICKET_LIFETIME - 60;
     let uinfo = data[server][userid.as_str()].as_object()?;
     let timestamp = uinfo["timestamp"].as_i64()?;
index 96888c7cc150ce134e021b6e35bfa34fd08519a7..4ad2925830d43efa271f92c0f075650328c996f9 100644 (file)
@@ -19,11 +19,11 @@ use pathpatterns::{MatchEntry, MatchFlag, MatchList, MatchType, PatternFlag};
 use pxar::Metadata;
 use pxar::encoder::{SeqWrite, LinkOffset};
 
-use proxmox::c_str;
 use proxmox::sys::error::SysError;
 use proxmox::tools::fd::RawFdNum;
-use proxmox::tools::vec;
 use proxmox::tools::fd::Fd;
+use proxmox_io::vec;
+use proxmox_lang::c_str;
 
 use pbs_datastore::catalog::BackupCatalogWriter;
 use pbs_tools::{acl, fs, xattr};
index a03b5a547fb740df0c9a830cd09bd0868d822cff..52c6bf34cb8f78702d593d8fca1475afe4c864cd 100644 (file)
@@ -22,10 +22,8 @@ use pxar::format::Device;
 use pxar::{Entry, EntryKind, Metadata};
 
 use proxmox::c_result;
-use proxmox::tools::{
-    fs::{create_path, CreateOptions},
-    io::{sparse_copy, sparse_copy_async},
-};
+use proxmox::tools::fs::{create_path, CreateOptions};
+use proxmox_io::{sparse_copy, sparse_copy_async};
 
 use pbs_tools::zip::{ZipEncoder, ZipEntry};
 
index 91970c8ed299266be99e77ccaf140af51b05de44..e8bb89ff45e97ce8400c4b0cf7fb2de921caeb47 100644 (file)
@@ -20,7 +20,7 @@ use futures::select;
 use futures::sink::SinkExt;
 use futures::stream::{StreamExt, TryStreamExt};
 
-use proxmox::tools::vec;
+use proxmox_io::vec;
 use pxar::accessor::{self, EntryRangeInfo, ReadAt};
 
 use proxmox_fuse::requests::{self, FuseRequest};
index 3fd0fc00c348571855833b3a2e107b142b09b735..4dab2af773217307362489d33b6ed62b653d8bc0 100644 (file)
@@ -115,7 +115,7 @@ fn mode_string(entry: &Entry) -> String {
 }
 
 fn format_mtime(mtime: &StatxTimestamp) -> String {
-    if let Ok(s) = proxmox::tools::time::strftime_local("%Y-%m-%d %H:%M:%S", mtime.secs) {
+    if let Ok(s) = proxmox_time::strftime_local("%Y-%m-%d %H:%M:%S", mtime.secs) {
         return s;
     }
     format!("{}.{}", mtime.secs, mtime.nanos)
index 1d1af14168437cbaa2858fd936dd9dec69704607..e8874619ae40eea63b3fd3baf1c98be59a96e905 100644 (file)
@@ -5,7 +5,7 @@ use serde_json::{json, Value};
 use tokio::signal::unix::{signal, SignalKind};
 use futures::*;
 
-use proxmox::api::cli::format_and_print_result;
+use proxmox_router::cli::format_and_print_result;
 
 use pbs_tools::percent_encoding::percent_encode_component;
 
index a3a2bf1a9555f52a5cbfe9f70181d1e77b82f8ea..32e2b264267877df77e1b210f5adc03e0d2ebe82 100644 (file)
@@ -6,9 +6,9 @@ use std::io::Read;
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::api::schema::*;
 use proxmox::sys::linux::tty;
 use proxmox::tools::fs::file_get_contents;
+use proxmox_schema::*;
 
 use pbs_api_types::CryptMode;
 
index f3d63ae53383ed96f16baf2bb6dc0ca6922f248b..f6ae4bcdf6874cc8c677563ee5d402a621935d29 100644 (file)
@@ -10,11 +10,9 @@ use anyhow::{bail, format_err, Context, Error};
 use serde_json::{json, Value};
 use xdg::BaseDirectories;
 
-use proxmox::{
-    api::schema::*,
-    api::cli::shellword_split,
-    tools::fs::file_get_json,
-};
+use proxmox_schema::*;
+use proxmox_router::cli::shellword_split;
+use proxmox::tools::fs::file_get_json;
 
 use pbs_api_types::{BACKUP_REPO_URL, Authid, UserWithTokens};
 use pbs_datastore::BackupDir;
index 38fa121a6f795c8c44c5c4c47ad68d5e077b35ff..07e9125a658fa2dd2c8db8a8588bf340d2b742bc 100644 (file)
@@ -13,7 +13,7 @@ use serde_json::Value;
 use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf};
 use tokio::net::UnixStream;
 
-use proxmox::api::error::HttpError;
+use proxmox_router::HttpError;
 
 pub const DEFAULT_VSOCK_PORT: u16 = 807;
 
index 51b4bd8b560e5a7994581a31537e85f882aa184c..49d4cf6ff70b0b963131d3267d3e3c4233ed34d2 100644 (file)
@@ -6,17 +6,23 @@ edition = "2018"
 description = "Configuration file management for PBS"
 
 [dependencies]
-libc = "0.2"
 anyhow = "1.0"
+hex = "0.4.3"
 lazy_static = "1.4"
-serde = { version = "1.0", features = ["derive"] }
-serde_json = "1.0"
-openssl = "0.10"
+libc = "0.2"
 nix = "0.19.1"
-regex = "1.2"
 once_cell = "1.3.1"
+openssl = "0.10"
+regex = "1.2"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
 
-proxmox = { version = "0.14.0", default-features = false, features = [ "cli" ] }
+proxmox = "0.14.0"
+proxmox-lang = "1"
+proxmox-router = "1"
+proxmox-schema = "1"
+proxmox-section-config = "1"
+proxmox-time = "1"
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-buildcfg = { path = "../pbs-buildcfg" }
index 7a3fe97210d8930f671cf5ebfc2bc2f7ecaf878d..13af45a904fd495daaf0ebd3ddeb58d871ce1525 100644 (file)
@@ -8,7 +8,7 @@ use anyhow::{bail, Error};
 
 use lazy_static::lazy_static;
 
-use proxmox::api::schema::{Schema, StringSchema, ApiStringFormat, ApiType};
+use proxmox_schema::{ApiStringFormat, ApiType, Schema, StringSchema};
 
 use pbs_api_types::{Authid, Userid, Role, ROLE_NAME_NO_ACCESS};
 
index 960864f28e9c381e613d5cc4061799ec66a26125..495fdd125b399f42ce9d0fa7fc3d63c5f2a8e2c0 100644 (file)
@@ -3,11 +3,11 @@
 use std::sync::{RwLock, Arc};
 
 use anyhow::{Error, bail};
-
-use proxmox::api::section_config::SectionConfigData;
 use lazy_static::lazy_static;
-use proxmox::api::UserInformation;
-use proxmox::tools::time::epoch_i64;
+
+use proxmox_router::UserInformation;
+use proxmox_section_config::SectionConfigData;
+use proxmox_time::epoch_i64;
 
 use pbs_api_types::{Authid, Userid, User, ApiToken, ROLE_ADMIN};
 
index d8f6694d68d36cbf1be8f9040e9e318dcff409c3..953551d295811017029a58be2ed758b7852208be 100644 (file)
@@ -2,14 +2,8 @@ use anyhow::{Error};
 use lazy_static::lazy_static;
 use std::collections::HashMap;
 
-use proxmox::api::{
-    schema::{ApiType, Schema},
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use proxmox_schema::{ApiType, Schema};
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{DataStoreConfig, DATASTORE_SCHEMA};
 
index 6119cea7b62fe85a5f44649a96295d447ce5d16b..3d3f93b085de719174bdc68b660332b05491fa4b 100644 (file)
@@ -1,17 +1,11 @@
+use std::collections::HashMap;
+
 use anyhow::{Error};
 use lazy_static::lazy_static;
-use std::collections::HashMap;
 use serde::{Serialize, Deserialize};
 
-use proxmox::api::{
-    api,
-    schema::*,
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use proxmox_schema::{api, ApiType, Updater, Schema};
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{REALM_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA};
 use crate::{open_backup_lockfile, replace_backup_config, BackupLockGuard};
@@ -59,7 +53,7 @@ pub enum OpenIdUserAttribute {
         },
     },
 )]
-#[derive(Serialize,Deserialize,Updater)]
+#[derive(Serialize, Deserialize, Updater)]
 #[serde(rename_all="kebab-case")]
 /// OpenID configuration properties.
 pub struct OpenIdRealmConfig {
index b1ff85482827d2e5bf71fc86978c4d13188a493d..b800cd8bec8f8f8dcdb5b6707351df1aed7dd7c8 100644 (file)
@@ -16,16 +16,8 @@ use std::collections::HashMap;
 use anyhow::{bail, Error};
 use lazy_static::lazy_static;
 
-use proxmox::{
-    api::{
-        schema::*,
-        section_config::{
-            SectionConfig,
-            SectionConfigData,
-            SectionConfigPlugin,
-        },
-    },
-};
+use proxmox_schema::*;
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use crate::{open_backup_lockfile, replace_backup_config, BackupLockGuard};
 
index 9e71368f7e525ba7b000ad784b006ae91135f774..9c4b3b570848afcbb592198f320784444db4fe7d 100644 (file)
@@ -5,7 +5,7 @@ use anyhow::{bail, format_err, Context, Error};
 use serde::{Deserialize, Serialize};
 
 use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
-use proxmox::try_block;
+use proxmox_lang::try_block;
 
 use pbs_api_types::{Kdf, KeyInfo, Fingerprint};
 
@@ -122,7 +122,7 @@ impl KeyConfig  {
         let crypt_config = CryptConfig::new(raw_key.clone())?;
         let fingerprint = Some(Fingerprint::new(crypt_config.fingerprint()));
 
-        let created = proxmox::tools::time::epoch_i64();
+        let created = proxmox_time::epoch_i64();
         Ok(Self {
             kdf: None,
             created,
@@ -183,7 +183,7 @@ impl KeyConfig  {
         enc_data.extend_from_slice(&tag);
         enc_data.extend_from_slice(&encrypted_key);
 
-        let created = proxmox::tools::time::epoch_i64();
+        let created = proxmox_time::epoch_i64();
 
         // always compute fingerprint
         let crypt_config = CryptConfig::new(raw_key.clone())?;
@@ -370,8 +370,8 @@ fn encrypt_decrypt_test() -> Result<(), Error> {
 
     let key = KeyConfig {
         kdf: None,
-        created: proxmox::tools::time::epoch_i64(),
-        modified: proxmox::tools::time::epoch_i64(),
+        created: proxmox_time::epoch_i64(),
+        modified: proxmox_time::epoch_i64(),
         data: (0u8..32u8).collect(),
         fingerprint: Some(Fingerprint::new([
             14, 171, 212, 70, 11, 110, 185, 202, 52, 80, 35, 222, 226, 183, 120, 199, 144, 229, 74,
@@ -396,8 +396,8 @@ fn encrypt_decrypt_test() -> Result<(), Error> {
 fn fingerprint_checks() -> Result<(), Error> {
     let key = KeyConfig {
         kdf: None,
-        created: proxmox::tools::time::epoch_i64(),
-        modified: proxmox::tools::time::epoch_i64(),
+        created: proxmox_time::epoch_i64(),
+        modified: proxmox_time::epoch_i64(),
         data: (0u8..32u8).collect(),
         fingerprint: Some(Fingerprint::new([0u8; 32])), // wrong FP
         hint: None,
@@ -413,8 +413,8 @@ fn fingerprint_checks() -> Result<(), Error> {
 
     let key = KeyConfig {
         kdf: None,
-        created: proxmox::tools::time::epoch_i64(),
-        modified: proxmox::tools::time::epoch_i64(),
+        created: proxmox_time::epoch_i64(),
+        modified: proxmox_time::epoch_i64(),
         data: (0u8..32u8).collect(),
         fingerprint: None,
         hint: None,
index 3512c70a4c17a1c31438960a003b9aae32c17938..5193061ae7bc9ef207aa65eb6163d41ac360f15e 100644 (file)
@@ -4,23 +4,15 @@
 //! provides a type safe interface to store [`MediaPoolConfig`],
 //!
 //! [MediaPoolConfig]: crate::api2::types::MediaPoolConfig
-//! [SectionConfig]: proxmox::api::section_config::SectionConfig
+//! [SectionConfig]: proxmox_section_config::SectionConfig
 
 use std::collections::HashMap;
 
 use anyhow::Error;
 use lazy_static::lazy_static;
 
-use proxmox::{
-    api::{
-        schema::*,
-        section_config::{
-            SectionConfig,
-            SectionConfigData,
-            SectionConfigPlugin,
-        }
-    },
-};
+use proxmox_schema::*;
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{MEDIA_POOL_NAME_SCHEMA, MediaPoolConfig};
 
index 77d574f4df23981b0b8bd79a1186d01571e21de1..fb19cb53c90548ea04b30cecd35d51bd45d4af44 100644 (file)
@@ -1,15 +1,10 @@
-use anyhow::{Error};
-use lazy_static::lazy_static;
 use std::collections::HashMap;
 
-use proxmox::api::{
-    schema::*,
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use anyhow::Error;
+use lazy_static::lazy_static;
+
+use proxmox_schema::*;
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{Remote, REMOTE_ID_SCHEMA};
 
index 63b30c94d8de6e5ec29bd449b397c056e9840240..a9e3a0de05cec6c4e5340e01321c55f17905d3a2 100644 (file)
@@ -1,15 +1,10 @@
-use anyhow::{Error};
-use lazy_static::lazy_static;
 use std::collections::HashMap;
 
-use proxmox::api::{
-    schema::*,
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use anyhow::Error;
+use lazy_static::lazy_static;
+
+use proxmox_schema::{ApiType, Schema};
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{JOB_ID_SCHEMA, SyncJobConfig};
 
index c0c98fd35148cff60a9c28bd5b62f5342d35ea3e..60084e4f4afca46e10c7b69b3227f77458d5e258 100644 (file)
@@ -2,14 +2,8 @@ use anyhow::{Error};
 use lazy_static::lazy_static;
 use std::collections::HashMap;
 
-use proxmox::api::{
-    schema::{Schema, ApiType},
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use proxmox_schema::{Schema, ApiType};
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{TapeBackupJobConfig, JOB_ID_SCHEMA};
 
index 1328773850a56a0c762f191b81156e9d9813133b..db66ab7d03234cce06a555c7f62db276856fdc6f 100644 (file)
@@ -4,14 +4,8 @@ use std::sync::{Arc, RwLock};
 use anyhow::{bail, Error};
 use lazy_static::lazy_static;
 
-use proxmox::api::{
-    schema::*,
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use proxmox_schema::*;
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{
     Authid, Userid, ApiToken, User,
index 310cf4bf21986f6ea438e54944ef5f2fb786575e..f72bfebbcbc93982bb4b9c4c0b01e72f753e88b1 100644 (file)
@@ -1,15 +1,10 @@
-use anyhow::{Error};
-use lazy_static::lazy_static;
 use std::collections::HashMap;
 
-use proxmox::api::{
-    schema::*,
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use anyhow::Error;
+use lazy_static::lazy_static;
+
+use proxmox_schema::*;
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_api_types::{JOB_ID_SCHEMA, VerificationJobConfig};
 
index 52b9278bfc3847b3e5d543e52a701d39533ce2dd..8d53e995ac24fa9c45b189f0032de1a733b22b75 100644 (file)
@@ -25,7 +25,12 @@ zstd = { version = "0.6", features = [ "bindgen" ] }
 pathpatterns = "0.1.2"
 pxar = "0.10.1"
 
-proxmox = { version = "0.14.0", default-features = false, features = [ "api-macro" ] }
+proxmox = "0.14.0"
+proxmox-io = "1"
+proxmox-lang = "1"
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-time = "1"
+proxmox-uuid = "1"
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-tools = { path = "../pbs-tools" }
index f77098ee55d11e8c253a2d81d7040ed7073a6428..9d1ab991f248edbfffa5d9838b1134f5362254af 100644 (file)
@@ -138,7 +138,7 @@ impl BackupGroup {
                     }
                 }
 
-                let timestamp = proxmox::tools::time::parse_rfc3339(backup_time)?;
+                let timestamp = proxmox_time::parse_rfc3339(backup_time)?;
                 if let Some(last_timestamp) = last {
                     if timestamp > last_timestamp {
                         last = Some(timestamp);
@@ -215,7 +215,7 @@ impl BackupDir {
         V: Into<String>,
     {
         let backup_time_string = backup_time_string.into();
-        let backup_time = proxmox::tools::time::parse_rfc3339(&backup_time_string)?;
+        let backup_time = proxmox_time::parse_rfc3339(&backup_time_string)?;
         let group = BackupGroup::new(backup_type.into(), backup_id.into());
         Ok(Self {
             group,
@@ -255,7 +255,7 @@ impl BackupDir {
 
     pub fn backup_time_to_string(backup_time: i64) -> Result<String, Error> {
         // fixme: can this fail? (avoid unwrap)
-        proxmox::tools::time::epoch_to_rfc3339_utc(backup_time)
+        Ok(proxmox_time::epoch_to_rfc3339_utc(backup_time)?)
     }
 }
 
index e82417f2ad2452d61e34c7ff9a63a5f51cb7989f..02f3e41ed37cd9a496519abad3e3ee4e01c29e98 100644 (file)
@@ -8,8 +8,9 @@ use anyhow::{bail, format_err, Error};
 use serde::{Deserialize, Serialize};
 
 use pathpatterns::{MatchList, MatchType};
-use proxmox::api::api;
-use proxmox::tools::io::ReadExt;
+
+use proxmox_io::ReadExt;
+use proxmox_schema::api;
 
 use crate::file_formats::PROXMOX_CATALOG_FILE_MAGIC_1_0;
 
@@ -570,7 +571,7 @@ impl <R: Read + Seek> CatalogReader<R> {
                 }
                 CatalogEntryType::File => {
                     let mut mtime_string = mtime.to_string();
-                    if let Ok(s) = proxmox::tools::time::strftime_local("%FT%TZ", mtime as i64) {
+                    if let Ok(s) = proxmox_time::strftime_local("%FT%TZ", mtime as i64) {
                         mtime_string = s;
                     }
 
index 7e1e54eb243ada6b405df3f3bf0a85f8997b8c67..9f956d76c44c050b618edfe579d31093d164867d 100644 (file)
@@ -4,7 +4,7 @@ use std::io::Write;
 use anyhow::{bail, Error};
 use openssl::symm::{decrypt_aead, Mode};
 
-use proxmox::tools::io::{ReadExt, WriteExt};
+use proxmox_io::{ReadExt, WriteExt};
 
 use pbs_tools::crypt_config::CryptConfig;
 use pbs_api_types::CryptMode;
@@ -58,13 +58,13 @@ impl DataBlob {
 
     /// accessor to crc32 checksum
     pub fn crc(&self) -> u32 {
-        let crc_o = proxmox::offsetof!(DataBlobHeader, crc);
+        let crc_o = proxmox_lang::offsetof!(DataBlobHeader, crc);
         u32::from_le_bytes(self.raw_data[crc_o..crc_o+4].try_into().unwrap())
     }
 
     // set the CRC checksum field
     pub fn set_crc(&mut self, crc: u32) {
-        let crc_o = proxmox::offsetof!(DataBlobHeader, crc);
+        let crc_o = proxmox_lang::offsetof!(DataBlobHeader, crc);
         self.raw_data[crc_o..crc_o+4].copy_from_slice(&crc.to_le_bytes());
     }
 
index 9c7a8568e07977fc7e43d8bd07b7e91d1c157068..ba4143c06add900a8882b0968535a1162a5b334c 100644 (file)
@@ -2,7 +2,8 @@ use std::io::{BufReader, Read};
 use std::sync::Arc;
 
 use anyhow::{bail, format_err, Error};
-use proxmox::tools::io::ReadExt;
+
+use proxmox_io::ReadExt;
 
 use pbs_tools::crypt_config::CryptConfig;
 
index 6425cecf52b4d5dab549aa3726aadbb5b930b685..30d9645fc050f1987a6db452a0aea3dc75ed703e 100644 (file)
@@ -1,8 +1,10 @@
-use anyhow::Error;
-use proxmox::tools::io::WriteExt;
 use std::io::{Seek, SeekFrom, Write};
 use std::sync::Arc;
 
+use anyhow::Error;
+
+use proxmox_io::WriteExt;
+
 use pbs_tools::crypt_config::CryptConfig;
 
 use crate::checksum_writer::ChecksumWriter;
index b068a9c98a5eac4aa92560c68c82dd5520f01fb2..79a2d9e8f5fce7c2d27f8823e5bf8dd2eca331b7 100644 (file)
@@ -620,7 +620,7 @@ impl DataStore {
             // writer" information and thus no safe atime cutoff
             let _exclusive_lock =  self.chunk_store.try_exclusive_lock()?;
 
-            let phase1_start_time = proxmox::tools::time::epoch_i64();
+            let phase1_start_time = proxmox_time::epoch_i64();
             let oldest_writer = self.chunk_store.oldest_writer().unwrap_or(phase1_start_time);
 
             let mut gc_status = GarbageCollectionStatus::default();
@@ -742,7 +742,7 @@ impl DataStore {
         path.push(backup_dir.relative_path());
         path.push(filename);
 
-        proxmox::try_block!({
+        proxmox_lang::try_block!({
             let mut file = std::fs::File::open(&path)?;
             DataBlob::load_from_reader(&mut file)
         }).map_err(|err| format_err!("unable to load blob '{:?}' - {}", path, err))
@@ -758,7 +758,7 @@ impl DataStore {
 
         let (chunk_path, digest_str) = self.chunk_store.chunk_path(digest);
 
-        proxmox::try_block!({
+        proxmox_lang::try_block!({
             let mut file = std::fs::File::open(&chunk_path)?;
             DataBlob::load_from_reader(&mut file)
         }).map_err(|err| format_err!(
index bdddc1383b591ed98909552bdd8957bae581347b..16cd133a78fa6424225575e1dff522c81d7440dc 100644 (file)
@@ -9,9 +9,9 @@ use std::task::Context;
 
 use anyhow::{bail, format_err, Error};
 
-use proxmox::tools::io::ReadExt;
-use proxmox::tools::uuid::Uuid;
 use proxmox::tools::mmap::Mmap;
+use proxmox_io::ReadExt;
+use proxmox_uuid::Uuid;
 use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation};
 
 use pbs_tools::lru_cache::LruCache;
@@ -35,7 +35,7 @@ pub struct DynamicIndexHeader {
     pub index_csum: [u8; 32],
     reserved: [u8; 4032], // overall size is one page (4096 bytes)
 }
-proxmox::static_assert_size!(DynamicIndexHeader, 4096);
+proxmox_lang::static_assert_size!(DynamicIndexHeader, 4096);
 // TODO: Once non-Copy unions are stabilized, use:
 // union DynamicIndexHeader {
 //     reserved: [u8; 4096],
@@ -119,7 +119,7 @@ impl DynamicIndexReader {
             bail!("got unknown magic number");
         }
 
-        let ctime = proxmox::tools::time::epoch_i64();
+        let ctime = proxmox_time::epoch_i64();
 
         let index_size = stat.st_size as usize - header_size;
         let index_count = index_size / 40;
@@ -301,7 +301,7 @@ impl DynamicIndexWriter {
 
         let mut writer = BufWriter::with_capacity(1024 * 1024, file);
 
-        let ctime = proxmox::tools::time::epoch_i64();
+        let ctime = proxmox_time::epoch_i64();
 
         let uuid = Uuid::generate();
 
@@ -344,7 +344,7 @@ impl DynamicIndexWriter {
 
         self.writer.flush()?;
 
-        let csum_offset = proxmox::offsetof!(DynamicIndexHeader, index_csum);
+        let csum_offset = proxmox_lang::offsetof!(DynamicIndexHeader, index_csum);
         self.writer.seek(SeekFrom::Start(csum_offset as u64))?;
 
         let csum = self.csum.take().unwrap();
index 47c690438a54f30edb732bf54d736a96524cb9f0..41622b4c0929a46cbd2e9586b64b3b37fade3943 100644 (file)
@@ -9,8 +9,8 @@ use anyhow::{bail, format_err, Error};
 
 use pbs_tools::process_locker::ProcessLockSharedGuard;
 
-use proxmox::tools::io::ReadExt;
-use proxmox::tools::Uuid;
+use proxmox_io::ReadExt;
+use proxmox_uuid::Uuid;
 
 use crate::chunk_stat::ChunkStat;
 use crate::chunk_store::ChunkStore;
@@ -30,7 +30,7 @@ pub struct FixedIndexHeader {
     pub chunk_size: u64,
     reserved: [u8; 4016], // overall size is one page (4096 bytes)
 }
-proxmox::static_assert_size!(FixedIndexHeader, 4096);
+proxmox_lang::static_assert_size!(FixedIndexHeader, 4096);
 
 // split image into fixed size chunks
 
@@ -149,7 +149,7 @@ impl FixedIndexReader {
         println!("ChunkSize: {}", self.chunk_size);
 
         let mut ctime_str = self.ctime.to_string();
-        if let Ok(s) = proxmox::tools::time::strftime_local("%c", self.ctime) {
+        if let Ok(s) = proxmox_time::strftime_local("%c", self.ctime) {
             ctime_str = s;
         }
 
@@ -281,7 +281,7 @@ impl FixedIndexWriter {
             panic!("got unexpected header size");
         }
 
-        let ctime = proxmox::tools::time::epoch_i64();
+        let ctime = proxmox_time::epoch_i64();
 
         let uuid = Uuid::generate();
 
@@ -361,7 +361,7 @@ impl FixedIndexWriter {
 
         self.unmap()?;
 
-        let csum_offset = proxmox::offsetof!(FixedIndexHeader, index_csum);
+        let csum_offset = proxmox_lang::offsetof!(FixedIndexHeader, index_csum);
         self.file.seek(SeekFrom::Start(csum_offset as u64))?;
         self.file.write_all(&index_csum)?;
         self.file.flush()?;
index eb5896fc56ea1a8bc3a28665eae641c8ea2c7953..da29fd98bffc499a29b405321c420d1122341ef4 100644 (file)
@@ -4,7 +4,7 @@ use std::process::{Command, Stdio};
 use anyhow::{bail, format_err, Error};
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 use pbs_config::key_config::KeyConfig;
 
index 3b4cf4f2f9796334d777ea8e26022583242a092d..70c3d91cdc8c23f6e9aa147bb2a2bd4f689acb87 100644 (file)
@@ -135,17 +135,17 @@ pub fn compute_prune_info(
         })?;
     }
 
-    use proxmox::tools::time::strftime_local;
+    use proxmox_time::strftime_local;
 
     if let Some(keep_hourly) = options.keep_hourly {
         mark_selections(&mut mark, &list, keep_hourly as usize, |info| {
-            strftime_local("%Y/%m/%d/%H", info.backup_dir.backup_time())
+            strftime_local("%Y/%m/%d/%H", info.backup_dir.backup_time()).map_err(Error::from)
         })?;
     }
 
     if let Some(keep_daily) = options.keep_daily {
         mark_selections(&mut mark, &list, keep_daily as usize, |info| {
-            strftime_local("%Y/%m/%d", info.backup_dir.backup_time())
+            strftime_local("%Y/%m/%d", info.backup_dir.backup_time()).map_err(Error::from)
         })?;
     }
 
@@ -153,19 +153,19 @@ pub fn compute_prune_info(
         mark_selections(&mut mark, &list, keep_weekly as usize, |info| {
             // Note: Use iso-week year/week here. This year number
             // might not match the calendar year number.
-            strftime_local("%G/%V", info.backup_dir.backup_time())
+            strftime_local("%G/%V", info.backup_dir.backup_time()).map_err(Error::from)
         })?;
     }
 
     if let Some(keep_monthly) = options.keep_monthly {
         mark_selections(&mut mark, &list, keep_monthly as usize, |info| {
-            strftime_local("%Y/%m", info.backup_dir.backup_time())
+            strftime_local("%Y/%m", info.backup_dir.backup_time()).map_err(Error::from)
         })?;
     }
 
     if let Some(keep_yearly) = options.keep_yearly {
         mark_selections(&mut mark, &list, keep_yearly as usize, |info| {
-            strftime_local("%Y", info.backup_dir.backup_time())
+            strftime_local("%Y", info.backup_dir.backup_time()).map_err(Error::from)
         })?;
     }
 
index c49cf16feb884575685b8b1766abcdbe0a7947fb..c386256d26deebf8f8602f619184e4282031d899 100644 (file)
@@ -107,7 +107,7 @@ impl <'a> Iterator for SnapshotChunkIterator<'a> {
     type Item = Result<[u8; 32], Error>;
 
     fn next(&mut self) -> Option<Self::Item> {
-        proxmox::try_block!({
+        proxmox_lang::try_block!({
             loop {
                 if self.current_index.is_none() {
                     if let Some(filename) = self.todo_list.pop() {
index b9e30d21adab2eb9eb44c8cc04fb4c0e9bd9056e..1da2aec874ed6c48c3b72ba9509c01f2955551e9 100644 (file)
@@ -14,7 +14,7 @@ nix = "0.19.1"
 regex = "1.2"
 tokio = { version = "1.6", features = [] }
 
-proxmox = "0.14.0"
+proxmox-time = "1"
 proxmox-fuse = "0.1.1"
 
 pbs-tools = { path = "../pbs-tools" }
index 66937f07affa861042c046c6169ae69620344157..fedb7dfd2e6039d56e6578dabb5dd071f61c530a 100644 (file)
@@ -1,29 +1,29 @@
 //! Map a raw data reader as a loop device via FUSE
 
-use anyhow::{Error, format_err, bail};
+use anyhow::{bail, format_err, Error};
+use std::collections::HashMap;
 use std::ffi::OsStr;
-use std::path::{Path, PathBuf};
-use std::fs::{File, remove_file, read_to_string, OpenOptions};
-use std::io::SeekFrom;
+use std::fs::{read_to_string, remove_file, File, OpenOptions};
 use std::io::prelude::*;
-use std::collections::HashMap;
+use std::io::SeekFrom;
+use std::path::{Path, PathBuf};
 
-use nix::unistd::Pid;
 use nix::sys::signal::{self, Signal};
+use nix::unistd::Pid;
+use regex::Regex;
 
-use tokio::io::{AsyncRead, AsyncSeek, AsyncReadExt, AsyncSeekExt};
+use futures::channel::mpsc::{Receiver, Sender};
 use futures::stream::{StreamExt, TryStreamExt};
-use futures::channel::mpsc::{Sender, Receiver};
+use tokio::io::{AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt};
 
-use proxmox::const_regex;
-use proxmox::tools::time;
-use proxmox_fuse::{*, requests::FuseRequest};
 use super::loopdev;
+use proxmox_fuse::{requests::FuseRequest, *};
+use proxmox_time::epoch_i64;
 
 const RUN_DIR: &str = "/run/pbs-loopdev";
 
-const_regex! {
-    pub LOOPDEV_REGEX = r"^loop\d+$";
+lazy_static::lazy_static! {
+    static ref LOOPDEV_REGEX: Regex = Regex::new(r"^loop\d+$").unwrap();
 }
 
 /// Represents an ongoing FUSE-session that has been mapped onto a loop device.
@@ -40,12 +40,14 @@ pub struct FuseLoopSession<R: AsyncRead + AsyncSeek + Unpin> {
 }
 
 impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
-
     /// Prepare for mapping the given reader as a block device node at
     /// /dev/loopN. Creates a temporary file for FUSE and a PID file for unmap.
-    pub async fn map_loop<P: AsRef<str>>(size: u64, mut reader: R, name: P, options: &OsStr)
-        -> Result<Self, Error>
-    {
+    pub async fn map_loop<P: AsRef<str>>(
+        size: u64,
+        mut reader: R,
+        name: P,
+        options: &OsStr,
+    ) -> Result<Self, Error> {
         // attempt a single read to check if the reader is configured correctly
         let _ = reader.read_u8().await?;
 
@@ -61,14 +63,14 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
         cleanup_unused_run_files(Some(name.as_ref().to_owned()));
 
         match OpenOptions::new().write(true).create_new(true).open(&path) {
-            Ok(_) => { /* file created, continue on */ },
+            Ok(_) => { /* file created, continue on */ }
             Err(e) => {
                 if e.kind() == std::io::ErrorKind::AlreadyExists {
                     bail!("the given archive is already mapped, cannot map twice");
                 } else {
                     bail!("error while creating backing file ({:?}) - {}", &path, e);
                 }
-            },
+            }
         }
 
         let session = Fuse::builder("pbs-block-dev")?
@@ -77,9 +79,8 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
             .build()?
             .mount(&path)?;
 
-        let loopdev_path = loopdev::get_or_create_free_dev().map_err(|err| {
-            format_err!("loop-control GET_FREE failed - {}", err)
-        })?;
+        let loopdev_path = loopdev::get_or_create_free_dev()
+            .map_err(|err| format_err!("loop-control GET_FREE failed - {}", err))?;
 
         // write pidfile so unmap can later send us a signal to exit
         Self::write_pidfile(&pid_path)?;
@@ -111,7 +112,6 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
         mut startup_chan: Sender<Result<(), Error>>,
         abort_chan: Receiver<()>,
     ) -> Result<(), Error> {
-
         if self.session.is_none() {
             panic!("internal error: fuse_loop::main called before ::map_loop");
         }
@@ -121,7 +121,10 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
         let (loopdev_path, fuse_path) = (self.loopdev_path.clone(), self.fuse_path.clone());
         tokio::task::spawn_blocking(move || {
             if let Err(err) = loopdev::assign(loopdev_path, fuse_path) {
-                let _ = startup_chan.try_send(Err(format_err!("error while assigning loop device - {}", err)));
+                let _ = startup_chan.try_send(Err(format_err!(
+                    "error while assigning loop device - {}",
+                    err
+                )));
             } else {
                 // device is assigned successfully, which means not only is the
                 // loopdev ready, but FUSE is also okay, since the assignment
@@ -130,16 +133,17 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
             }
         });
 
-        let (loopdev_path, fuse_path, pid_path) =
-            (self.loopdev_path.clone(), self.fuse_path.clone(), self.pid_path.clone());
+        let (loopdev_path, fuse_path, pid_path) = (
+            self.loopdev_path.clone(),
+            self.fuse_path.clone(),
+            self.pid_path.clone(),
+        );
         let cleanup = |session: futures::stream::Fuse<Fuse>| {
             // only warn for errors on cleanup, if these fail nothing is lost
             if let Err(err) = loopdev::unassign(&loopdev_path) {
                 eprintln!(
                     "cleanup: warning: could not unassign file {} from loop device {} - {}",
-                    &fuse_path,
-                    &loopdev_path,
-                    err,
+                    &fuse_path, &loopdev_path, err,
                 );
             }
 
@@ -149,21 +153,19 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
             if let Err(err) = remove_file(&fuse_path) {
                 eprintln!(
                     "cleanup: warning: could not remove temporary file {} - {}",
-                    &fuse_path,
-                    err,
+                    &fuse_path, err,
                 );
             }
             if let Err(err) = remove_file(&pid_path) {
                 eprintln!(
                     "cleanup: warning: could not remove PID file {} - {}",
-                    &pid_path,
-                    err,
+                    &pid_path, err,
                 );
             }
         };
 
         loop {
-            tokio::select!{
+            tokio::select! {
                 _ = abort_chan.next() => {
                     // aborted, do cleanup and exit
                     break;
@@ -227,8 +229,8 @@ impl<R: AsyncRead + AsyncSeek + Unpin> FuseLoopSession<R> {
 pub fn cleanup_unused_run_files(filter_name: Option<String>) {
     if let Ok(maps) = find_all_mappings() {
         for (name, loopdev) in maps {
-            if loopdev.is_none() &&
-                (filter_name.is_none() || &name == filter_name.as_ref().unwrap())
+            if loopdev.is_none()
+                && (filter_name.is_none() || &name == filter_name.as_ref().unwrap())
             {
                 let mut path = PathBuf::from(RUN_DIR);
                 path.push(&name);
@@ -254,10 +256,17 @@ pub fn cleanup_unused_run_files(filter_name: Option<String>) {
 }
 
 fn get_backing_file(loopdev: &str) -> Result<String, Error> {
-    let num = loopdev.split_at(9).1.parse::<u8>().map_err(|err|
-        format_err!("malformed loopdev path, does not end with valid number - {}", err))?;
+    let num = loopdev.split_at(9).1.parse::<u8>().map_err(|err| {
+        format_err!(
+            "malformed loopdev path, does not end with valid number - {}",
+            err
+        )
+    })?;
 
-    let block_path = PathBuf::from(format!("/sys/devices/virtual/block/loop{}/loop/backing_file", num));
+    let block_path = PathBuf::from(format!(
+        "/sys/devices/virtual/block/loop{}/loop/backing_file",
+        num
+    ));
     let backing_file = read_to_string(block_path).map_err(|err| {
         if err.kind() == std::io::ErrorKind::NotFound {
             format_err!("nothing mapped to {}", loopdev)
@@ -281,7 +290,7 @@ fn get_backing_file(loopdev: &str) -> Result<String, Error> {
 
 // call in broken state: we found the mapping, but the client is already dead,
 // only thing to do is clean up what we can
-fn emerg_cleanup (loopdev: Option<&str>, mut backing_file: PathBuf) {
+fn emerg_cleanup(loopdev: Option<&str>, mut backing_file: PathBuf) {
     eprintln!(
         "warning: found mapping with dead process ({:?}), attempting cleanup",
         &backing_file
@@ -312,35 +321,36 @@ fn unmap_from_backing(backing_file: &Path, loopdev: Option<&str>) -> Result<(),
         }
         format_err!("error reading pidfile {:?}: {}", &pid_path, err)
     })?;
-    let pid = pid_str.parse::<i32>().map_err(|err|
-        format_err!("malformed PID ({}) in pidfile - {}", pid_str, err))?;
+    let pid = pid_str
+        .parse::<i32>()
+        .map_err(|err| format_err!("malformed PID ({}) in pidfile - {}", pid_str, err))?;
 
     let pid = Pid::from_raw(pid);
 
     // send SIGINT to trigger cleanup and exit in target process
     match signal::kill(pid, Signal::SIGINT) {
-        Ok(()) => {},
+        Ok(()) => {}
         Err(nix::Error::Sys(nix::errno::Errno::ESRCH)) => {
             emerg_cleanup(loopdev, backing_file.to_owned());
             return Ok(());
-        },
+        }
         Err(e) => return Err(e.into()),
     }
 
     // block until unmap is complete or timeout
-    let start = time::epoch_i64();
+    let start = epoch_i64();
     loop {
         match signal::kill(pid, None) {
             Ok(_) => {
                 // 10 second timeout, then assume failure
-                if (time::epoch_i64() - start) > 10 {
+                if (epoch_i64() - start) > 10 {
                     return Err(format_err!("timed out waiting for PID '{}' to exit", &pid));
                 }
                 std::thread::sleep(std::time::Duration::from_millis(100));
-            },
+            }
             Err(nix::Error::Sys(nix::errno::Errno::ESRCH)) => {
                 break;
-            },
+            }
             Err(e) => return Err(e.into()),
         }
     }
@@ -360,13 +370,13 @@ pub fn find_all_mappings() -> Result<impl Iterator<Item = (String, Option<String
             let loopdev = format!("/dev/{}", ent.file_name().to_string_lossy());
             if let Ok(file) = get_backing_file(&loopdev) {
                 // insert filename only, strip RUN_DIR/
-                loopmap.insert(file[RUN_DIR.len()+1..].to_owned(), loopdev);
+                loopmap.insert(file[RUN_DIR.len() + 1..].to_owned(), loopdev);
             }
         }
     }
 
-    Ok(pbs_tools::fs::read_subdir(libc::AT_FDCWD, Path::new(RUN_DIR))?
-        .filter_map(move |ent| {
+    Ok(
+        pbs_tools::fs::read_subdir(libc::AT_FDCWD, Path::new(RUN_DIR))?.filter_map(move |ent| {
             match ent {
                 Ok(ent) => {
                     let file = ent.file_name().to_string_lossy();
@@ -376,10 +386,11 @@ pub fn find_all_mappings() -> Result<impl Iterator<Item = (String, Option<String
                         let loopdev = loopmap.get(file.as_ref()).map(String::to_owned);
                         Some((file.into_owned(), loopdev))
                     }
-                },
+                }
                 Err(_) => None,
             }
-        }))
+        }),
+    )
 }
 
 /// Try and unmap a running proxmox-backup-client instance from the given
index 461fbb93da0aa9ad9d242c2531a2678e014dddfc..94be071da514ed6f4ffa028b495d41c78117f516 100644 (file)
@@ -18,7 +18,16 @@ bitflags = "1.2.1"
 regex = "1.2"
 udev = ">= 0.3, <0.5"
 
-proxmox = { version = "0.14.0", default-features = false, features = [] }
+proxmox = "0.14.0"
+proxmox-io = "1"
+proxmox-lang = "1"
+# api-macro is only used by the binaries, so maybe we should split them out
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-time = "1"
+proxmox-uuid = "1"
+
+# router::cli is only used by binaries, so maybe we should split them out
+proxmox-router = "1"
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-tools = { path = "../pbs-tools" }
index d36de11485a048f330dffb39c6c09db0d2c21a80..281c0df0f6252ea8989afda3620850c3680f559b 100644 (file)
@@ -18,19 +18,9 @@ use std::convert::TryInto;
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        schema::{
-            Schema,
-            IntegerSchema,
-            StringSchema,
-            ArraySchema,
-        },
-        RpcEnvironment,
-    },
-};
+use proxmox_schema::{api, ArraySchema, IntegerSchema, Schema, StringSchema};
+use proxmox_router::cli::*;
+use proxmox_router::RpcEnvironment;
 
 use pbs_api_types::{
     LTO_DRIVE_PATH_SCHEMA, DRIVE_NAME_SCHEMA, LtoTapeDrive,
index ea0478c713def93b06a850b8b381c8d9e6338111..7191060b17cf763f6825b23eea63b2edfe68e6fb 100644 (file)
@@ -17,13 +17,9 @@ use std::fs::File;
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-    },
-};
+use proxmox_schema::api;
+use proxmox_router::cli::*;
+use proxmox_router::RpcEnvironment;
 
 use pbs_config::drive::complete_changer_name;
 use pbs_api_types::{
@@ -93,7 +89,7 @@ fn inquiry(
 
     let output_format = get_output_format(&param);
 
-    let result: Result<_, Error> = proxmox::try_block!({
+    let result: Result<_, Error> = proxmox_lang::try_block!({
         let mut file = get_changer_handle(&param)?;
         let info = scsi_inquiry(&mut file)?;
         Ok(info)
@@ -281,7 +277,7 @@ fn status(
 
     let output_format = get_output_format(&param);
 
-    let result: Result<_, Error> = proxmox::try_block!({
+    let result: Result<_, Error> = proxmox_lang::try_block!({
         let mut file = get_changer_handle(&param)?;
         let status = sg_pt_changer::read_element_status(&mut file)?;
         Ok(status)
index 8220d3eb11d8816435a9b073aa0e3eed53a4265f..91893e06c940bec39fdf62a4ac8b30145473bd17 100644 (file)
@@ -1,4 +1,4 @@
-use proxmox::tools::vec;
+use proxmox_io::vec;
 
 use crate::{
     TapeWrite,
index 34d6606c2c9e8558f6e8ddd2eed47dec5f83ec68..fe0a5fe4b9bf0054aad4414bd7c578fd29bcaf4e 100644 (file)
@@ -1,6 +1,6 @@
 use std::io::Read;
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use crate::{BlockRead, BlockReadError, PROXMOX_TAPE_BLOCK_SIZE};
 
index 27f9b44e83993530a6b1536c562a5caf1fa34a57..27522002e8f861212530551977d495ed1b64d7b7 100644 (file)
@@ -6,8 +6,8 @@ use endian_trait::Endian;
 use serde::{Serialize, Deserialize};
 use serde_json::Value;
 
-use proxmox::tools::Uuid;
-use proxmox::api::schema::parse_property_string;
+use proxmox_schema::parse_property_string;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{ScsiTapeChanger, SLOT_ARRAY_SCHEMA};
 
@@ -119,13 +119,13 @@ impl MediaContentHeader {
 
     /// Create a new instance with autogenerated Uuid
     pub fn new(content_magic: [u8; 8], size: u32) -> Self {
-        let uuid = *proxmox::tools::uuid::Uuid::generate()
+        let uuid = *Uuid::generate()
             .into_inner();
         Self {
             magic: PROXMOX_BACKUP_CONTENT_HEADER_MAGIC_1_0,
             content_magic,
             uuid,
-            ctime: proxmox::tools::time::epoch_i64(),
+            ctime: proxmox_time::epoch_i64(),
             size,
             part_number: 0,
             reserved_0: 0,
index 223079d25cee7f57badfe255ac4a7875d44d70e0..b73de9309514917dd155493493b2cb648a8f3a90 100644 (file)
@@ -8,7 +8,7 @@ use std::fs::{OpenOptions, File};
 use anyhow::{bail, format_err, Error};
 use endian_trait::Endian;
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use pbs_api_types::ScsiTapeChanger;
 
@@ -139,7 +139,7 @@ fn read_element_address_assignment<F: AsRawFd>(
 
     let data = execute_scsi_command(&mut sg_raw, &cmd, "read element address assignment", true)?;
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut reader = &data[..];
         let page: AddressAssignmentPage = unsafe { reader.read_be_value()? };
 
@@ -662,7 +662,7 @@ fn decode_element_status_page(
     start_element_address: u16,
 ) -> Result<DecodedStatusPage, Error> {
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
 
         let mut result = DecodedStatusPage {
             last_element_address: None,
index c41de85fbb43ae8c6eea021b1bbea30f7fcca866..7d4ba84c9fa1a2aa0c1594d187b0d56a24192714 100644 (file)
@@ -25,10 +25,8 @@ pub use mam::*;
 mod report_density;
 pub use report_density::*;
 
-use proxmox::{
-    sys::error::SysResult,
-    tools::io::{ReadExt, WriteExt},
-};
+use proxmox::sys::error::SysResult;
+use proxmox_io::{ReadExt, WriteExt};
 
 use pbs_api_types::{MamAttribute, Lp17VolumeStatistics, LtoDriveAndMediaStatus};
 
@@ -386,7 +384,7 @@ impl SgTape {
         let data = sg_raw.do_command(&cmd)
             .map_err(|err| format_err!("read position failed - {}", err))?;
 
-        let page = proxmox::try_block!({
+        let page = proxmox_lang::try_block!({
             if data.len() != expected_size {
                 bail!("got unexpected data len ({} != {}", data.len(), expected_size);
             }
@@ -793,7 +791,7 @@ impl SgTape {
         let (head, block_descriptor, page): (_,_, MediumConfigurationModePage)
             = scsi_mode_sense(&mut self.file, false, 0x1d, 0)?;
 
-        proxmox::try_block!({
+        proxmox_lang::try_block!({
             if (page.page_code & 0b0011_1111) != 0x1d {
                 bail!("wrong page code {}", page.page_code);
             }
@@ -817,7 +815,7 @@ impl SgTape {
         let (head, block_descriptor, page): (_,_, DataCompressionModePage)
             = scsi_mode_sense(&mut self.file, false, 0x0f, 0)?;
 
-        proxmox::try_block!({
+        proxmox_lang::try_block!({
             if (page.page_code & 0b0011_1111) != 0x0f {
                 bail!("wrong page code {}", page.page_code);
             }
index 6d99d31753d3760a026fc7d6fe1382fb565d1896..def1fbff300177eca126b291b55538047058bfe9 100644 (file)
@@ -4,7 +4,7 @@ use std::io::Write;
 use anyhow::{bail, format_err, Error};
 use endian_trait::Endian;
 
-use proxmox::tools::io::{ReadExt, WriteExt};
+use proxmox_io::{ReadExt, WriteExt};
 
 use crate::sgutils2::{SgRaw, alloc_page_aligned_buffer};
 
@@ -216,7 +216,7 @@ struct SspDataEncryptionAlgorithmDescriptor {
 // Returns the algorythm_index for AES-CGM
 fn decode_spin_data_encryption_caps(data: &[u8]) -> Result<u8, Error> {
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut reader = &data[..];
         let _page: SspDataEncryptionCapabilityPage = unsafe { reader.read_be_value()? };
 
@@ -267,7 +267,7 @@ struct SspDataEncryptionStatusPage {
 
 fn decode_spin_data_encryption_status(data: &[u8]) -> Result<DataEncryptionStatus, Error> {
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut reader = &data[..];
         let page: SspDataEncryptionStatusPage = unsafe { reader.read_be_value()? };
 
index b9796940d15221b8c015d972644629bf2e6424ae..e006ea43e9051d15a03ba07d9cf4aae155950bfc 100644 (file)
@@ -5,7 +5,7 @@ use std::os::unix::io::AsRawFd;
 use anyhow::{bail, format_err, Error};
 use endian_trait::Endian;
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use pbs_api_types::MamAttribute;
 
@@ -211,7 +211,7 @@ pub fn mam_extract_media_usage(mam: &[MamAttribute]) -> Result<MediaUsageInfo, E
             let mon: i32 = date_str[4..6].parse()?;
             let mday: i32 = date_str[6..8].parse()?;
 
-            use proxmox::tools::time::TmEditor;
+            use proxmox_time::TmEditor;
             let mut t = TmEditor::new(true);
             t.set_year(year)?;
             t.set_mon(mon)?;
index 6baddfe1ac8ac2d88ef155ba89e53cb633c5179e..bab7e1f748324b34b3c1a613e06cacd58be91dc9 100644 (file)
@@ -3,7 +3,7 @@ use std::io::Read;
 use endian_trait::Endian;
 use std::os::unix::io::AsRawFd;
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use crate::sgutils2::SgRaw;
 
@@ -38,7 +38,7 @@ pub fn report_density<F: AsRawFd>(file: &mut F) -> Result<u8, Error> {
 
     let mut max_density = 0u8;
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut reader = &data[..];
 
         let page_len: u16 = unsafe { reader.read_be_value()? };
index 481618f4271da32045507fde770847f885d0db3a..afd26285c4593cbbd67d08c520157e352f7079b0 100644 (file)
@@ -3,7 +3,7 @@ use std::os::unix::io::AsRawFd;
 
 use anyhow::{bail, format_err, Error};
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use crate::sgutils2::SgRaw;
 
@@ -106,7 +106,7 @@ fn sg_read_tape_alert_flags<F: AsRawFd>(file: &mut F) -> Result<Vec<u8>, Error>
 
 fn decode_tape_alert_flags(data: &[u8]) -> Result<TapeAlertFlags, Error> {
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         if !((data[0] & 0x7f) == 0x12 && data[1] == 0) {
             bail!("invalid response");
         }
index cc60da10a6adc733d24685e96fa444360338788e..e8790e3f8e0a55739cc2b235e4dac6175e34d74e 100644 (file)
@@ -4,7 +4,7 @@ use std::os::unix::io::AsRawFd;
 use anyhow::{bail, format_err, Error};
 use endian_trait::Endian;
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use pbs_api_types::Lp17VolumeStatistics;
 
@@ -71,7 +71,7 @@ fn decode_volume_statistics(data: &[u8]) -> Result<Lp17VolumeStatistics, Error>
         Ok(value)
     };
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         if !((data[0] & 0x7f) == 0x17 && data[1] == 0) {
             bail!("invalid response");
         }
index 785275540e214ae8cd60f980e0a8d2b3847eea50..8ba0ad29ec2df31bd1259011eedb43b13c8cfc88 100644 (file)
@@ -6,16 +6,16 @@
 //!
 //! The SCSI Commands Reference Manual also contains some useful information.
 
+use std::ffi::CStr;
 use std::os::unix::io::AsRawFd;
 use std::ptr::NonNull;
 
 use anyhow::{bail, format_err, Error};
 use endian_trait::Endian;
-use serde::{Deserialize, Serialize};
 use libc::{c_char, c_int};
-use std::ffi::CStr;
+use serde::{Deserialize, Serialize};
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 #[derive(thiserror::Error, Debug)]
 pub struct SenseInfo {
@@ -379,7 +379,7 @@ pub fn get_asc_ascq_string(asc: u8, ascq: u8) -> String {
         )
     };
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         if res.is_null() { // just to be safe
             bail!("unexpected NULL ptr");
         }
@@ -675,7 +675,7 @@ pub fn scsi_inquiry<F: AsRawFd>(
     let data = sg_raw.do_command(&cmd)
         .map_err(|err| format_err!("SCSI inquiry failed - {}", err))?;
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut reader = &data[..];
 
         let page: InquiryPage  = unsafe { reader.read_be_value()? };
@@ -724,7 +724,7 @@ pub fn scsi_mode_sense<F: AsRawFd, P: Endian>(
     let data = sg_raw.do_command(&cmd)
         .map_err(|err| format_err!("mode sense failed - {}", err))?;
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut reader = &data[..];
 
         let head: ModeParameterHeader = unsafe { reader.read_be_value()? };
@@ -777,7 +777,7 @@ pub fn scsi_request_sense<F: AsRawFd>(
     let data = sg_raw.do_command(&cmd)
         .map_err(|err| format_err!("request sense failed - {}", err))?;
 
-    let sense = proxmox::try_block!({
+    let sense = proxmox_lang::try_block!({
         let data_len = data.len();
 
         if data_len < std::mem::size_of::<RequestSenseFixed>() {
index 0ff715452484f4028e46c20bb9d30870cbed98f5..5c87c065d8cc072eca6c0c7c9e6a4e2e38fc0271 100644 (file)
@@ -15,7 +15,7 @@ endian_trait = { version = "0.6", features = ["arrays"] }
 flate2 = "1.0"
 foreign-types = "0.3"
 futures = "0.3"
-hex = "0.4"
+hex = "0.4.3"
 lazy_static = "1.4"
 libc = "0.2"
 log = "0.4"
@@ -33,9 +33,9 @@ walkdir = "2"
 zstd = { version = "0.6", features = [ "bindgen" ] }
 
 proxmox = { version = "0.14.0", default-features = false, features = [ "tokio" ] }
-proxmox-io = { version = "1.0.0" }
-proxmox-lang = { version = "1.0.0" }
-proxmox-time = { version = "1.0.0" }
+proxmox-io = { version = "1", features = [ "tokio" ] }
+proxmox-lang = { version = "1" }
+proxmox-time = { version = "1" }
 
 pbs-buildcfg = { path = "../pbs-buildcfg" }
 pbs-runtime = { path = "../pbs-runtime" }
index d24850a7af723a06357e2af15d93ee9508f7f682..189d07575f059eefc52dacaa848f084705f80e19 100644 (file)
@@ -24,7 +24,7 @@ fn asn1_time_to_unix(time: &openssl::asn1::Asn1TimeRef) -> Result<i64, Error> {
         bail!("failed to parse ASN1 time");
     }
     let mut c_tm = unsafe { c_tm.assume_init() };
-    proxmox::tools::time::timegm(&mut c_tm)
+    Ok(proxmox_time::timegm(&mut c_tm)?)
 }
 
 pub struct CertInfo {
@@ -66,10 +66,11 @@ impl CertInfo {
 
     pub fn fingerprint(&self) -> Result<String, Error> {
         let fp = self.x509.digest(openssl::hash::MessageDigest::sha256())?;
-        let fp_string = proxmox::tools::digest_to_hex(&fp);
-        let fp_string = fp_string.as_bytes().chunks(2).map(|v| std::str::from_utf8(v).unwrap())
-            .collect::<Vec<&str>>().join(":");
-        Ok(fp_string)
+        Ok(hex::encode(&fp)
+            .as_bytes()
+            .chunks(2)
+            .map(|v| std::str::from_utf8(v).unwrap())
+            .collect::<Vec<&str>>().join(":"))
     }
 
     pub fn public_key(&self) -> Result<PKey<Public>, Error> {
index e2b6d795d64a402aa0c0cfa37484fe288fe2c554..aa1b0b24a558c7318fcb775558e3136d2d80b8c6 100644 (file)
@@ -10,7 +10,7 @@ use futures::stream::Stream;
 use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
 
 use proxmox::io_format_err;
-use proxmox::tools::byte_buffer::ByteBuffer;
+use proxmox_io::ByteBuffer;
 
 const BUFFER_SIZE: usize = 8192;
 
index 88714003dd946319c18634e52a5cc419ac605fc3..0823ea29c31cb178a7064fa781e3b13d785a91ab 100644 (file)
@@ -25,7 +25,7 @@ pub fn render_epoch(value: &Value, _record: &Value) -> Result<String, Error> {
     if value.is_null() { return Ok(String::new()); }
     let text = match value.as_i64() {
         Some(epoch) => {
-            if let Ok(epoch_string) = proxmox::tools::time::strftime_local("%c", epoch as i64) {
+            if let Ok(epoch_string) = proxmox_time::strftime_local("%c", epoch as i64) {
                 epoch_string
             } else {
                 epoch.to_string()
@@ -104,14 +104,16 @@ impl From<u64> for HumanByte {
 }
 
 pub fn as_fingerprint(bytes: &[u8]) -> String {
-    proxmox::tools::digest_to_hex(bytes)
+    hex::encode(bytes)
         .as_bytes()
         .chunks(2)
-        .map(|v| std::str::from_utf8(v).unwrap())
+        .map(|v| unsafe { std::str::from_utf8_unchecked(v) }) // it's a hex string
         .collect::<Vec<&str>>().join(":")
 }
 
 pub mod bytes_as_fingerprint {
+    use std::mem::MaybeUninit;
+
     use serde::{Deserialize, Serializer, Deserializer};
 
     pub fn serialize<S>(
@@ -131,9 +133,14 @@ pub mod bytes_as_fingerprint {
     where
         D: Deserializer<'de>,
     {
+        // TODO: more efficiently implement with a Visitor implementing visit_str using split() and
+        // hex::decode by-byte
         let mut s = String::deserialize(deserializer)?;
         s.retain(|c| c != ':');
-        proxmox::tools::hex_to_digest(&s).map_err(serde::de::Error::custom)
+        let mut out = MaybeUninit::<[u8; 32]>::uninit();
+        hex::decode_to_slice(s.as_bytes(), unsafe { &mut (*out.as_mut_ptr())[..] })
+            .map_err(serde::de::Error::custom)?;
+        Ok(unsafe { out.assume_init() })
     }
 }
 
index 56cdc6838f0f2b35b53fdf0b80a6b94a2e153a16..7ec89eed6ccc50cfa0b13537374158265c55f407 100644 (file)
@@ -4,10 +4,12 @@ use std::io::Read;
 
 use anyhow::Error;
 
+use proxmox_io::vec;
+
 /// Calculate the sha256sum from a readable object.
 pub fn sha256(file: &mut dyn Read) -> Result<([u8; 32], u64), Error> {
     let mut hasher = openssl::sha::Sha256::new();
-    let mut buffer = proxmox::tools::vec::undefined(256 * 1024);
+    let mut buffer = vec::undefined(256 * 1024);
     let mut size: u64 = 0;
 
     loop {
index c00c1354c89bf17683096c8a73567982b802cffe..cfee01ccbf33b02f0123cb99791070afa8d61c3e 100644 (file)
@@ -13,8 +13,8 @@ use futures::future::FutureExt;
 use futures::stream::Stream;
 
 use proxmox::io_format_err;
-use proxmox::tools::byte_buffer::ByteBuffer;
 use proxmox::sys::error::io_err_other;
+use proxmox_io::ByteBuffer;
 
 use pbs_runtime::block_in_place;
 
index b4e41619e175320c6af02f05991cd6bcbd1c4a47..dd9286358cecfd801d105cdac4af86e1e5e43a7a 100644 (file)
@@ -66,7 +66,7 @@ where
         Ok(Self {
             prefix: Cow::Borrowed(prefix),
             data: data.to_string(),
-            time: proxmox::tools::time::epoch_i64(),
+            time: proxmox_time::epoch_i64(),
             signature: None,
             _type_marker: PhantomData,
         })
@@ -171,7 +171,7 @@ where
             None => bail!("invalid ticket without signature"),
         };
 
-        let age = proxmox::tools::time::epoch_i64() - self.time;
+        let age = proxmox_time::epoch_i64() - self.time;
         if age < time_frame.start {
             bail!("invalid ticket - timestamp newer than expected");
         }
@@ -325,7 +325,7 @@ mod test {
             false
         });
         simple_test(&key, None, |t| {
-            t.change_time(proxmox::tools::time::epoch_i64() + 0x1000_0000);
+            t.change_time(proxmox_time::epoch_i64() + 0x1000_0000);
             false
         });
     }
index f088b12c0f5bbd71cb6f9de0166ef4693a19f6a6..4763735671ad043c97c9e090fc77ccf8006b06f7 100644 (file)
@@ -5,8 +5,8 @@ use std::os::unix::io::RawFd;
 
 use nix::errno::Errno;
 
-use proxmox::c_str;
-use proxmox::tools::vec;
+use proxmox_io::vec;
+use proxmox_lang::c_str;
 
 /// `"security.capability"` as a CStr to avoid typos.
 ///
@@ -187,7 +187,7 @@ mod tests {
 
     use nix::errno::Errno;
 
-    use proxmox::c_str;
+    use proxmox_lang::c_str;
 
     #[test]
     fn test_fsetxattr_fgetxattr() {
index 605480a8f426a4b13d24ce31b4eb948154ceccc3..0e85dd25ecdfa40e7da4f999f56b1446b55b8683 100644 (file)
@@ -20,7 +20,7 @@ use futures::ready;
 use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf};
 
 use crc32fast::Hasher;
-use proxmox::tools::time::gmtime;
+use proxmox_time::gmtime;
 
 use crate::compression::{DeflateEncoder, Level};
 
index 03d2c0edf09b3b30740830d0c1eb6bdd75042a95..0b84e176c5fdf97a163252afb64a6b1b3195bbd5 100644 (file)
@@ -22,7 +22,10 @@ zstd = { version = "0.6", features = [ "bindgen" ] }
 pathpatterns = "0.1.2"
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
-proxmox = { version = "0.14.0", features = [ "sortable-macro", "api-macro", "cli", "router" ] }
+proxmox = { version = "0.14.0", features = [ "sortable-macro" ] }
+proxmox-router = { version = "1", features = [ "cli" ] }
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-time = "1"
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-buildcfg = { path = "../pbs-buildcfg" }
index e951b3050cd058f844e1c7e1210cf5eed856724f..58cdb4ad35b44b9feb92955ebf76daeafb5d824e 100644 (file)
@@ -5,9 +5,8 @@ use anyhow::{Error};
 use serde_json::Value;
 use serde::Serialize;
 
-use proxmox::api::{ApiMethod, RpcEnvironment};
-use proxmox::api::{
-    api,
+use proxmox_schema::{api, ApiType, ReturnType};
+use proxmox_router::{
     cli::{
         OUTPUT_FORMAT,
         ColumnConfig,
@@ -15,8 +14,8 @@ use proxmox::api::{
         format_and_print_result_full,
         default_table_format_options,
     },
-    router::ReturnType,
-    schema::ApiType,
+    ApiMethod,
+    RpcEnvironment,
 };
 
 use pbs_tools::crypt_config::CryptConfig;
@@ -222,7 +221,7 @@ async fn test_upload_speed(
     verbose: bool,
 ) -> Result<(), Error> {
 
-    let backup_time = proxmox::tools::time::epoch_i64();
+    let backup_time = proxmox_time::epoch_i64();
 
     let client = connect(&repo)?;
     record_repository(&repo);
index 37ce36ea9f794640fae9e39288c15dadafd71b82..4c538407431759c89b3c25ed0e6b6f14e5c36402 100644 (file)
@@ -1,7 +1,7 @@
 use anyhow::{Error};
 
-use proxmox::api::format::*;
-use proxmox::api::cli::*;
+use proxmox_router::cli::*;
+use proxmox_schema::format::*;
 
 use pbs_client::catalog_shell::catalog_shell_cli;
 
index 186de913f54389b2aa5eb54f7fc862ecd6a9fde4..60b7c2e0a570e3ba0f1ef8b634801accd5fb41ef 100644 (file)
@@ -5,7 +5,8 @@ use std::sync::Arc;
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*};
+use proxmox_schema::api;
+use proxmox_router::cli::*;
 
 use pbs_client::tools::key_source::get_encryption_key_password;
 use pbs_client::{BackupReader, RemoteChunkReader};
index 79b70faef62d6bd556c2020af902949d0c1636cb..89bbed50d8d9b44a0efd1fbb9d43cad2c2079c61 100644 (file)
@@ -4,15 +4,13 @@ use std::path::PathBuf;
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::api::api;
-use proxmox::api::cli::{
+use proxmox::sys::linux::tty;
+use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
+use proxmox_router::cli::{
     format_and_print_result_full, get_output_format, CliCommand, CliCommandMap, ColumnConfig,
     OUTPUT_FORMAT,
 };
-use proxmox::api::router::ReturnType;
-use proxmox::api::schema::ApiType;
-use proxmox::sys::linux::tty;
-use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
+use proxmox_schema::{api, ApiType, ReturnType};
 
 use pbs_api_types::{RsaPubKeyInfo, PASSWORD_HINT_SCHEMA, Kdf, KeyInfo};
 use pbs_config::key_config::{KeyConfig, rsa_decrypt_key_config};
@@ -266,7 +264,7 @@ fn show_key(path: Option<String>, param: Value) -> Result<(), Error> {
     let mut info: KeyInfo = (&config).into();
     info.path = Some(format!("{:?}", path));
 
-    let options = proxmox::api::cli::default_table_format_options()
+    let options = proxmox_router::cli::default_table_format_options()
         .column(ColumnConfig::new("path"))
         .column(ColumnConfig::new("kdf"))
         .column(ColumnConfig::new("created").renderer(pbs_tools::format::render_epoch))
@@ -394,7 +392,7 @@ fn show_master_pubkey(path: Option<String>, param: Value) -> Result<(), Error> {
     let mut info = RsaPubKeyInfo::try_from(rsa)?;
     info.path = Some(path.display().to_string());
 
-    let options = proxmox::api::cli::default_table_format_options()
+    let options = proxmox_router::cli::default_table_format_options()
         .column(ColumnConfig::new("path"))
         .column(ColumnConfig::new("modulus"))
         .column(ColumnConfig::new("exponent"))
index 52cff2175f1247b03e2452019f417f6557807596..12deb43c8b7913c8aa4faeacb9be2e004cbb1178 100644 (file)
@@ -13,18 +13,10 @@ use tokio_stream::wrappers::ReceiverStream;
 use xdg::BaseDirectories;
 
 use pathpatterns::{MatchEntry, MatchType, PatternFlag};
-use proxmox::{
-    tools::{
-        time::{strftime_local, epoch_i64},
-        fs::{file_get_json, replace_file, CreateOptions, image_size},
-    },
-    api::{
-        api,
-        ApiMethod,
-        RpcEnvironment,
-        cli::*,
-    },
-};
+use proxmox::tools::fs::{file_get_json, replace_file, CreateOptions, image_size};
+use proxmox_router::{ApiMethod, RpcEnvironment, cli::*};
+use proxmox_schema::api;
+use proxmox_time::{strftime_local, epoch_i64};
 use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation};
 
 use pbs_api_types::{
index 7c977864e01459a82610438d7ad08691364511c4..1971eb12f8186db4d832efda14f217124f8d2efe 100644 (file)
@@ -14,8 +14,9 @@ use serde_json::Value;
 use tokio::signal::unix::{signal, SignalKind};
 
 use proxmox::{sortable, identity};
-use proxmox::api::{ApiHandler, ApiMethod, RpcEnvironment, schema::*, cli::*};
 use proxmox::tools::fd::Fd;
+use proxmox_router::{ApiHandler, ApiMethod, RpcEnvironment, cli::*};
+use proxmox_schema::*;
 
 use pbs_tools::crypt_config::CryptConfig;
 use pbs_config::key_config::load_and_decrypt_key;
index 4465f69ac447e561ea32ffeaaaa207dd21284944..1e809d3fdf5239b7698bdcb3569f7a8e9dc6b575 100644 (file)
@@ -3,10 +3,9 @@ use std::sync::Arc;
 use anyhow::Error;
 use serde_json::{json, Value};
 
-use proxmox::{
-    api::{api, cli::*},
-    tools::fs::file_get_contents,
-};
+use proxmox::tools::fs::file_get_contents;
+use proxmox_router::cli::*;
+use proxmox_schema::api;
 
 use pbs_tools::crypt_config::CryptConfig;
 use pbs_config::key_config::decrypt_key;
index 92d0d69f2ef96f36e7e710d9f6a2b1049e6a802e..5d83a988a771330c32724c9e56973efcbb885a85 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::{Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, cli::*};
+use proxmox_schema::api;
+use proxmox_router::cli::*;
 
 use pbs_client::display_task_log;
 use pbs_tools::percent_encoding::percent_encode_component;
index a9256a29186bd127bb426abf8e12ded036a4894c..2d075e4c9ebaf2fff2aba16220c518720655240c 100644 (file)
@@ -16,7 +16,12 @@ tokio = { version = "1.6", features = [ "io-std", "rt", "rt-multi-thread", "time
 
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
-proxmox = { version = "0.14.0", features = [ "api-macro", "cli" ] }
+proxmox = { version = "0.14.0" }
+proxmox-lang = "1"
+proxmox-router = { version = "1", features = [ "cli" ] }
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-time = "1"
+proxmox-uuid = "1"
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-buildcfg = { path = "../pbs-buildcfg" }
index 14c572fb2642e859b7d4dc2459e9e38af6233eda..f67396908a42377c9de93e92beeb933c90aa81ef 100644 (file)
@@ -8,7 +8,8 @@ use anyhow::{bail, Error};
 use serde::{Deserialize, Serialize};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, cli::*};
+use proxmox_router::cli::*;
+use proxmox_schema::api;
 
 use pbs_client::BackupRepository;
 use pbs_datastore::backup_info::BackupDir;
index b6eaf83afe9746766ec9096915272311da0ab2ab..74296ab64ad243a52b70405d48ebea3708b1fab4 100644 (file)
@@ -110,7 +110,7 @@ async fn cleanup_map(map: &mut HashMap<String, VMState>) -> bool {
 }
 
 fn new_ticket() -> String {
-    proxmox::tools::Uuid::generate().to_string()
+    proxmox_uuid::Uuid::generate().to_string()
 }
 
 async fn ensure_running(details: &SnapRestoreDetails) -> Result<VsockClient, Error> {
index 957ce3f08ba63314225bdce1d91803d0d67374f3..044bd2bdda0f2170e3dde9ee06b2440d11fe1599 100644 (file)
@@ -6,14 +6,12 @@ use std::sync::Arc;
 use anyhow::{bail, format_err, Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{
-    api,
-    cli::{
-        default_table_format_options, format_and_print_result_full, get_output_format,
-        run_cli_command, CliCommand, CliCommandMap, CliEnvironment, ColumnConfig, OUTPUT_FORMAT,
-    },
-};
 use proxmox::tools::fs::{create_path, CreateOptions};
+use proxmox_router::cli::{
+    default_table_format_options, format_and_print_result_full, get_output_format,
+    run_cli_command, CliCommand, CliCommandMap, CliEnvironment, ColumnConfig, OUTPUT_FORMAT,
+};
+use proxmox_schema::api;
 use pxar::accessor::aio::Accessor;
 use pxar::decoder::aio::Decoder;
 
index b88e7ed334365afc04181995c113f53505f4750c..377788d9b92520b57591e7f865995e5d721e429d 100644 (file)
@@ -24,7 +24,7 @@ const MAX_CID_TRIES: u64 = 32;
 fn create_restore_log_dir() -> Result<String, Error> {
     let logpath = format!("{}/file-restore", pbs_buildcfg::PROXMOX_BACKUP_LOG_DIR);
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let backup_user = backup_user()?;
         let opts = CreateOptions::new()
             .owner(backup_user.uid)
@@ -163,8 +163,8 @@ pub async fn start_vm(
 
     // preface log file with start timestamp so one can see how long QEMU took to start
     writeln!(logfd, "[{}] PBS file restore VM log", {
-        let now = proxmox::tools::time::epoch_i64();
-        proxmox::tools::time::epoch_to_rfc3339(now)?
+        let now = proxmox_time::epoch_i64();
+        proxmox_time::epoch_to_rfc3339(now)?
     },)?;
 
     let base_args = [
index 2af3ba35cf57480768528fe1172eb71b1851b246..a00986cf3dc2bfe252c609dc35b1140c003b659a 100644 (file)
@@ -7,7 +7,7 @@ description = "REST server implementation"
 
 # for example
 [dev-dependencies]
-proxmox = { version = "0.14.0", features = ["router","api-macro"] }
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
 tokio = { version = "1.6", features = [ "rt-multi-thread", "signal", "process" ] }
 
 [dependencies]
@@ -30,7 +30,12 @@ tokio-openssl = "0.6.1"
 tower-service = "0.3.0"
 url = "2.1"
 
-proxmox = { version = "0.14.0", features = [ "router"] }
+proxmox = "0.14.0"
+proxmox-io = "1"
+proxmox-lang = "1"
+proxmox-router = "1"
+proxmox-schema = { version = "1", features = [ "api-macro", "upid-api-impl" ] }
+proxmox-time = "1"
 
 # fixme: remove this dependency (pbs_tools::broadcast_future)
 pbs-tools = { path = "../pbs-tools" }
index 6400fdbf1db1ad6372e0c42cae8d2689e7cfa667..1ddcfeb838fe537fb3853695dea18ecb06e2beb9 100644 (file)
@@ -9,8 +9,9 @@ use hyper::{Body, Response, Method};
 use http::request::Parts;
 use http::HeaderMap;
 
-use proxmox::api::{api, router::SubdirMap, Router, RpcEnvironmentType, UserInformation};
-use proxmox::list_subdirs_api_method;
+use proxmox_schema::api;
+use proxmox_router::{list_subdirs_api_method, SubdirMap, Router, RpcEnvironmentType, UserInformation};
+
 use proxmox_rest_server::{ServerAdapter, ApiConfig, AuthError, RestServer, RestEnvironment};
 
 // Create a Dummy User information system
index 999901149b5371d2f5f08d21ffa5d47d11400b58..990315dd9eb23f941d83357ff8d9478838f1fdfd 100644 (file)
@@ -12,8 +12,8 @@ use hyper::http::request::Parts;
 use handlebars::Handlebars;
 use serde::Serialize;
 
-use proxmox::api::{ApiMethod, Router, RpcEnvironmentType, UserInformation};
 use proxmox::tools::fs::{create_path, CreateOptions};
+use proxmox_router::{ApiMethod, Router, RpcEnvironmentType, UserInformation};
 
 use crate::{ServerAdapter, AuthError, FileLogger, FileLogOptions, CommandSocket, RestEnvironment};
 
index d5ed86b15c6430ef31c5c9799cc40f21adcb225e..cbaaaa7b4cc552f206621a1e54fb151e1bf9b66c 100644 (file)
@@ -13,8 +13,8 @@ use anyhow::{bail, format_err, Error};
 use futures::future::{self, Either};
 use nix::unistd::{fork, ForkResult};
 
-use proxmox::tools::io::{ReadExt, WriteExt};
 use proxmox::tools::fd::Fd;
+use proxmox_io::{ReadExt, WriteExt};
 
 use pbs_tools::fd::fd_change_cloexec;
 
index 57d0d7d5584730ff0cc064ce312383cc94f76ea7..3c77d145b111caa626a72c4f6d560501ecba0e9a 100644 (file)
@@ -3,7 +3,7 @@ use std::net::SocketAddr;
 
 use serde_json::{json, Value};
 
-use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
+use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
 
 use crate::ApiConfig;
 
index b3d5eb20c7cfee00315f22732ecb53dd48bc861e..79972d329200c5a080e032e2bc108e96b7b4f3f9 100644 (file)
@@ -110,8 +110,8 @@ impl FileLogger {
         }
 
         let line = if self.options.prefix_time {
-            let now = proxmox::tools::time::epoch_i64();
-            let rfc3339 = match proxmox::tools::time::epoch_to_rfc3339(now) {
+            let now = proxmox_time::epoch_i64();
+            let rfc3339 = match proxmox_time::epoch_to_rfc3339(now) {
                 Ok(rfc3339) => rfc3339,
                 Err(_) => "1970-01-01T00:00:00Z".into(), // for safety, should really not happen!
             };
index 601a756137a4c9817bf883d2f5a843e5727dfca8..6d05099706417d6ae937b3372c6a73d4adea4e44 100644 (file)
@@ -6,7 +6,8 @@ use serde_json::{json, Value};
 use hyper::{Body, Response, StatusCode};
 use hyper::header;
 
-use proxmox::api::{HttpError, schema::ParameterError, RpcEnvironment};
+use proxmox_router::{HttpError, RpcEnvironment};
+use proxmox_schema::ParameterError;
 
 /// Extension to set error message for server side logging
 pub(crate) struct ErrorMessageExtension(pub String);
index f7c7b97812a363b7baad0af4e558871c6a6cc349..f5fcdeeac97d114216ac530b553136390a25ed26 100644 (file)
@@ -8,8 +8,8 @@ use std::task::{Context, Poll};
 use futures::*;
 use hyper::{Body, Request, Response, StatusCode};
 
-use proxmox::api::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
-use proxmox::http_err;
+use proxmox_router::{ApiResponseFuture, HttpError, Router, RpcEnvironment};
+use proxmox_router::http_err;
 
 use crate::{normalize_uri_path, WorkerTask};
 use crate::formatter::*;
index d72936c2ebcaea3a7ce3faaa848b4f4e81b1a496..6e7c94f23199f01c29d0a97e09a9e2660489663d 100644 (file)
@@ -27,8 +27,8 @@ use http::HeaderMap;
 
 use proxmox::tools::fd::Fd;
 use proxmox::sys::linux::procfs::PidStat;
-use proxmox::api::UserInformation;
 use proxmox::tools::fs::CreateOptions;
+use proxmox_router::UserInformation;
 
 mod compression;
 pub use compression::*;
index 063b797f72a489972c44a00a62286cba11fe4281..74bc8bb1ae7006dace6c9b75f070644eee04e20b 100644 (file)
@@ -21,15 +21,15 @@ use tokio::time::Instant;
 use url::form_urlencoded;
 use tower_service::Service;
 
-use proxmox::api::schema::{
-    parse_parameter_strings, parse_simple_value, verify_json_object, ObjectSchemaType,
-    ParameterSchema,
-};
-use proxmox::api::{
+use proxmox_router::{
     check_api_permission, ApiHandler, ApiMethod, HttpError, Permission, RpcEnvironment,
     RpcEnvironmentType, UserInformation,
 };
-use proxmox::http_err;
+use proxmox_router::http_err;
+use proxmox_schema::{
+    parse_parameter_strings, parse_simple_value, verify_json_object, ObjectSchemaType,
+    ParameterSchema,
+};
 
 use pbs_tools::compression::{DeflateEncoder, Level};
 use pbs_tools::stream::AsyncReaderStream;
@@ -192,9 +192,9 @@ fn log_response(
             Some(AuthStringExtension(auth_id)) => auth_id.clone(),
             None => "-".to_string(),
         };
-        let now = proxmox::tools::time::epoch_i64();
+        let now = proxmox_time::epoch_i64();
         // time format which apache/nginx use (by default), copied from pve-http-server
-        let datetime = proxmox::tools::time::strftime_local("%d/%m/%Y:%H:%M:%S %z", now)
+        let datetime = proxmox_time::strftime_local("%d/%m/%Y:%H:%M:%S %z", now)
             .unwrap_or_else(|_| "-".to_string());
 
         logfile.lock().unwrap().log(format!(
index 51394549cdbaa579bb714aac59cf902eb627f205..fb0dea9b531d86e98393c3ebb5c5a153dad0450c 100644 (file)
@@ -17,9 +17,9 @@ use nix::fcntl::OFlag;
 use once_cell::sync::OnceCell;
 
 use proxmox::sys::linux::procfs;
-use proxmox::try_block;
 use proxmox::tools::fs::{create_path, replace_file, atomic_open_or_create_file, CreateOptions};
-use proxmox::api::upid::UPID;
+use proxmox_lang::try_block;
+use proxmox_schema::upid::UPID;
 
 use pbs_tools::task::WorkerTaskContext;
 use pbs_tools::logrotate::{LogRotate, LogRotateFiles};
@@ -120,7 +120,7 @@ impl WorkerTaskSetup {
 
                 if !worker_is_active_local(&info.upid) {
                     // println!("Detected stopped task '{}'", &info.upid_str);
-                    let now = proxmox::tools::time::epoch_i64();
+                    let now = proxmox_time::epoch_i64();
                     let status = upid_read_status(&info.upid).unwrap_or(TaskState::Unknown { endtime: now });
                     finish_list.push(TaskListInfo {
                         upid: info.upid,
@@ -320,7 +320,7 @@ pub fn upid_read_status(upid: &UPID) -> Result<TaskState, Error> {
 
     let mut iter = last_line.splitn(2, ": ");
     if let Some(time_str) = iter.next() {
-        if let Ok(endtime) = proxmox::tools::time::parse_rfc3339(time_str) {
+        if let Ok(endtime) = proxmox_time::parse_rfc3339(time_str) {
             // set the endtime even if we cannot parse the state
             status = TaskState::Unknown { endtime };
             if let Some(rest) = iter.next().and_then(|rest| rest.strip_prefix("TASK ")) {
@@ -839,7 +839,7 @@ impl WorkerTask {
     pub fn create_state(&self, result: &Result<(), Error>) -> TaskState {
         let warn_count = self.data.lock().unwrap().warn_count;
 
-        let endtime = proxmox::tools::time::epoch_i64();
+        let endtime = proxmox_time::epoch_i64();
 
         if let Err(err) = result {
             TaskState::Error { message: err.to_string(), endtime }
index e44717da4e661f942460111d9ef86e8c44f1cb9b..54ab9f3af7ec23d45897c8b435f1e3def27bd6d8 100644 (file)
@@ -26,7 +26,10 @@ tokio-util = { version = "0.6", features = [ "codec", "io" ] }
 pathpatterns = "0.1.2"
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
-proxmox = { version = "0.14.0", features = [ "router", "sortable-macro" ] }
+proxmox = { version = "0.14.0", features = [ "sortable-macro" ] }
+proxmox-router = { version = "1", features = [ "cli" ] }
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-time = "1"
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-runtime = { path = "../pbs-runtime" }
index 6dd25ff5a0cb450680a5ab522e00ad019e9947fa..a1ad6005e0fa0ae42fb99ca3519bc77f7eb8fbe3 100644 (file)
@@ -14,7 +14,7 @@ use log::{error, info};
 use tokio::sync::mpsc;
 use tokio_stream::wrappers::ReceiverStream;
 
-use proxmox::api::RpcEnvironmentType;
+use proxmox_router::RpcEnvironmentType;
 
 use pbs_client::DEFAULT_VSOCK_PORT;
 use proxmox_rest_server::{ApiConfig, RestServer};
index 15fe5f002e46231beb8e31e8133c1f81681d22b8..429ba359bb5b15c865dfff3dfa6d055d4eec30df 100644 (file)
@@ -13,11 +13,12 @@ use serde_json::Value;
 use tokio::sync::Semaphore;
 
 use pathpatterns::{MatchEntry, MatchPattern, MatchType, Pattern};
-use proxmox::api::{
-    api, schema::*, ApiHandler, ApiMethod, ApiResponseFuture, Permission, Router, RpcEnvironment,
-    SubdirMap,
+use proxmox::{identity, sortable};
+use proxmox_router::{
+    list_subdirs_api_method,
+    ApiHandler, ApiMethod, ApiResponseFuture, Permission, Router, RpcEnvironment, SubdirMap,
 };
-use proxmox::{identity, list_subdirs_api_method, sortable};
+use proxmox_schema::*;
 
 use pbs_api_types::file_restore::RestoreDaemonStatus;
 use pbs_client::pxar::{create_archive, Flags, PxarCreateOptions, ENCODER_MAX_ENTRIES};
index b57552e1d3b42f800d14dd4f3fa0377237949a62..119149d0d24baa6f9b9031a0dd76ed1faa8dab73 100644 (file)
@@ -9,7 +9,7 @@ use hyper::{Body, Response, Method, StatusCode};
 use http::request::Parts;
 use http::HeaderMap;
 
-use proxmox::api::UserInformation;
+use proxmox_router::UserInformation;
 
 use proxmox_rest_server::{ServerAdapter, AuthError, RestEnvironment};
 
index dea8fbf931f9ffb253bfaca7d95a142db8293114..b1b247aa40887c315fa4aa61b2b3b5c9c5e00ff3 100644 (file)
@@ -9,8 +9,8 @@ use anyhow::{bail, format_err, Error};
 use lazy_static::lazy_static;
 use log::{info, warn};
 
-use proxmox::const_regex;
 use proxmox::tools::fs;
+use proxmox_schema::const_regex;
 
 use pbs_api_types::BLOCKDEVICE_NAME_REGEX;
 use pbs_tools::run_command;
index 294c75105b887b625d0550905da3b548ce9b79c0..9d813b6ca21799c50687cb9b9da12fea2e38839e 100644 (file)
@@ -1,7 +1,7 @@
 //! Tokio-based watchdog that shuts down the VM if not pinged for TIMEOUT
 use std::sync::atomic::{AtomicI64, Ordering};
 
-use proxmox::tools::time::epoch_i64;
+use proxmox_time::epoch_i64;
 
 const TIMEOUT: i64 = 600; // seconds
 static TRIGGERED: AtomicI64 = AtomicI64::new(0);
index 0eec1c49d9150d2a0a4e09739d9b7c07c1c91883..816f7fde8d89b7e33e576528e1771569ae846248 100644 (file)
@@ -7,5 +7,5 @@ description = "API type definitions for proxmox-rrd crate."
 
 
 [dependencies]
-serde = { version = "1.0", features = [] }
-proxmox = { version = "0.14.0", features = ["api-macro"] }
+serde = { version = "1.0", features = ["derive"] }
+proxmox-schema = { version = "1", features = ["api-macro"] }
index 4a0165ff8e538753eb17b6f46bb4ecf66b2a37e3..b5e62e73f705de400eddcbcf7989e679b91b3768 100644 (file)
@@ -1,5 +1,6 @@
 use serde::{Deserialize, Serialize};
-use proxmox::api::api;
+
+use proxmox_schema::api;
 
 #[api()]
 #[derive(Copy, Clone, Serialize, Deserialize)]
index de9dcfe339096547ebbe12caf6fb11471ad3d342..7225be8e856d96334d6ad6c869277ba465c0f708 100644 (file)
@@ -10,6 +10,7 @@ anyhow = "1.0"
 bitflags = "1.2.1"
 log = "0.4"
 
-proxmox = { version = "0.14.0", features = ["api-macro"] }
+proxmox = { version = "0.14.0" }
+proxmox-time = "1"
 
 proxmox-rrd-api-types = { path = "../proxmox-rrd-api-types" }
index 1084a037c959a7e4699fced98d8fd4b3efdd13ee..fe28aedaf17bedd3252eeb445f420d51900ce186 100644 (file)
@@ -62,7 +62,7 @@ impl RRDCache {
         create_path(path.parent().unwrap(), Some(self.dir_options.clone()), Some(self.file_options.clone()))?;
 
         let mut map = self.cache.write().unwrap();
-        let now = proxmox::tools::time::epoch_f64();
+        let now = proxmox_time::epoch_f64();
 
         if let Some(rrd) = map.get_mut(rel_path) {
             rrd.update(now, value);
index 236b237f1592385a896d4ac358e22ac7cff01143..415305adb1149faeb9cc7275b0582aed64eca637 100644 (file)
@@ -11,6 +11,8 @@ bitflags = "1.2.1"
 lazy_static = "1.4"
 nom = "5.1"
 
-proxmox = { version = "0.14.0", default-features = false }
+proxmox-time = "1"
+proxmox-lang = "1"
 
-#pbs-tools = { path = "../pbs-tools" }
+[dev-dependencies]
+proxmox = "0.14.0"
index 7cf2e29f09557aaf0706c0482751f86079d43001..b81e970ead70a6ee7473997ac5bcb29e38c8ab51 100644 (file)
@@ -3,7 +3,7 @@ use std::convert::TryInto;
 use anyhow::Error;
 use bitflags::bitflags;
 
-use proxmox::tools::time::TmEditor;
+use proxmox_time::TmEditor;
 
 pub use super::parse_time::*;
 
@@ -368,7 +368,7 @@ mod test {
     use anyhow::bail;
 
     use super::*;
-    use proxmox::tools::time::*;
+    //use proxmox_time::*;
 
     fn test_event(v: &'static str) -> Result<(), Error> {
         match parse_calendar_event(v) {
@@ -397,8 +397,12 @@ mod test {
                     if next == expect {
                         println!("next {:?} => {}", event, next);
                     } else {
-                        bail!("next {:?} failed\nnext:  {:?}\nexpect: {:?}",
-                              event, gmtime(next), gmtime(expect));
+                        bail!(
+                            "next {:?} failed\nnext:  {:?}\nexpect: {:?}",
+                            event,
+                            proxmox_time::gmtime(next),
+                            proxmox_time::gmtime(expect),
+                        );
                     }
                 }
                 Ok(None) => bail!("next {:?} failed to find a timestamp", event),
index 15be61fd15654682ed6e8eaf9c26675624a2afea..b31f2c3f2ba780f33f689002a139438eae76130f 100644 (file)
@@ -7,7 +7,7 @@ fn run_command(mut command: Command) -> Result<(), Error> {
         .output()
         .map_err(|err| format_err!("failed to execute {:?} - {}", command, err))?;
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         if !output.status.success() {
             match output.status.code() {
                 Some(code) => {
index 6b77fd11bf7a2197e6ecc44a94674d5786fadc17..f1fca5650df7f6664273e7958dc79f0da8ac8621 100644 (file)
@@ -16,7 +16,9 @@ serde_json = "1.0"
 tokio = { version = "1.6", features = [ "rt", "rt-multi-thread" ] }
 
 pathpatterns = "0.1.2"
-proxmox = { version = "0.14.0", default-features = false, features = [] }
+proxmox = "0.14.0"
+proxmox-schema = { version = "1", features = [ "api-macro" ] }
+proxmox-router = "1"
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
 pbs-client = { path = "../pbs-client" }
index abc949e2569a4898eb2a8baace9db9825f2166ff..3bc820086b6b9cac01a8ca2debedbdabb47f060d 100644 (file)
@@ -14,8 +14,8 @@ use tokio::signal::unix::{signal, SignalKind};
 use pathpatterns::{MatchEntry, MatchType, PatternFlag};
 use pbs_client::pxar::{fuse, format_single_line_entry, ENCODER_MAX_ENTRIES, Flags, PxarExtractOptions};
 
-use proxmox::api::cli::*;
-use proxmox::api::api;
+use proxmox_schema::api;
+use proxmox_router::cli::*;
 
 fn extract_archive_from_reader<R: std::io::Read>(
     reader: &mut R,
index 764bd46fdc0406a8e0576f6560b1461a886445ac..8562b7359ab5254feb5db68b031ba4f8e130a2ea 100644 (file)
@@ -2,7 +2,8 @@
 
 use anyhow::{bail, Error};
 
-use proxmox::api::{api, Router, RpcEnvironment, Permission};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, AclListItem, Role, 
index aeff387f2fee8339f16f3281613c94d76ccecac6..0d95a65ddefc46616e4e6e9981dde9c28f159efe 100644 (file)
@@ -5,7 +5,8 @@ use anyhow::{Error};
 use serde::{Deserialize, Serialize};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{REALM_ID_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA};
 
index 7e11edaa7d36e4263d7d3e7245037ecd258b2a6e..71eb760e63277b2a12c46c702f5fb9f45e5a1c02 100644 (file)
@@ -6,10 +6,11 @@ use serde_json::{json, Value};
 use std::collections::HashMap;
 use std::collections::HashSet;
 
-use proxmox::api::router::{Router, SubdirMap};
-use proxmox::api::{api, Permission, RpcEnvironment};
-use proxmox::{http_err, list_subdirs_api_method};
 use proxmox::{identity, sortable};
+use proxmox_router::{
+    http_err, list_subdirs_api_method, Router, RpcEnvironment, SubdirMap, Permission,
+};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Userid, Authid, PASSWORD_SCHEMA, ACL_PATH_SCHEMA,
index 4da1ff04e5f533c3080307a66ceec9e61610fe68..5d7fe1ae9221fbdd1b1f9d8961deeccfea4eefad 100644 (file)
@@ -5,9 +5,11 @@ use anyhow::{bail, format_err, Error};
 
 use serde_json::{json, Value};
 
-use proxmox::api::router::{Router, SubdirMap};
-use proxmox::api::{api, Permission, RpcEnvironment};
-use proxmox::{http_err, list_subdirs_api_method, identity, sortable};
+use proxmox::{identity, sortable};
+use proxmox_router::{
+    http_err, list_subdirs_api_method, Router, RpcEnvironment, SubdirMap, Permission,
+};
+use proxmox_schema::api;
 
 use proxmox_openid::{OpenIdAuthenticator,  OpenIdConfig};
 
@@ -88,7 +90,7 @@ pub fn openid_login(
 
     let mut tested_username = None;
 
-    let result = proxmox::try_block!({
+    let result = proxmox_lang::try_block!({
 
         let (realm, private_auth_state) =
             OpenIdAuthenticator::verify_public_auth_state(PROXMOX_BACKUP_RUN_DIR_M!(), &state)?;
index af48734edb0170880d0d4744ddf93a49da11f1c6..7239b0606b18b8241d21659e5b60634f5006121d 100644 (file)
@@ -4,8 +4,8 @@ use anyhow::Error;
 
 use serde_json::{json, Value};
 
-use proxmox::api::{api, Permission};
-use proxmox::api::router::Router;
+use proxmox_router::{Permission, Router};
+use proxmox_schema::api;
 
 use pbs_api_types::{Role, SINGLE_LINE_COMMENT_SCHEMA, PRIVILEGES};
 use pbs_config::acl::ROLE_NAMES;
index 0426fcd40ca6b66568ec1fedd196777bfa7fd163..096226e80014a0e7ebbb08ac43958d2861935581 100644 (file)
@@ -3,9 +3,9 @@
 use anyhow::{bail, format_err, Error};
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
-use proxmox::tools::tfa::totp::Totp;
-use proxmox::{http_bail, http_err};
+use proxmox_router::{http_bail, http_err, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
+use proxmox_tfa::totp::Totp;
 
 use pbs_api_types::{Authid, Userid, User, PASSWORD_SCHEMA, PRIV_PERMISSIONS_MODIFY, PRIV_SYS_AUDIT};
 
index 1d866214f9a2b8afe6d897f73e02bce5e26a52b2..7901ab96f300f35d7bba797e05948218591a9fc0 100644 (file)
@@ -5,8 +5,8 @@ use serde::{Serialize, Deserialize};
 use serde_json::{json, Value};
 use std::collections::HashMap;
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
-use proxmox::api::router::SubdirMap;
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, SubdirMap, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     PROXMOX_CONFIG_DIGEST_SCHEMA, SINGLE_LINE_COMMENT_SCHEMA, Authid,
@@ -498,7 +498,7 @@ pub fn generate_token(
         bail!("token '{}' for user '{}' already exists.", token_name.as_str(), userid);
     }
 
-    let secret = format!("{:x}", proxmox::tools::uuid::Uuid::generate());
+    let secret = format!("{:x}", proxmox_uuid::Uuid::generate());
     token_shadow::set_secret(&tokenid, &secret)?;
 
     let token = ApiToken {
index 7e9a0ee0184d240b8ffbcf4829af9da98ea37e24..7e98b4a9f3caec2a08f8ed0204d088e3e90034dd 100644 (file)
@@ -12,16 +12,15 @@ use hyper::{header, Body, Response, StatusCode};
 use serde_json::{json, Value};
 use tokio_stream::wrappers::ReceiverStream;
 
-use proxmox::api::{
-    api, ApiResponseFuture, ApiHandler, ApiMethod, Router,
-    RpcEnvironment, RpcEnvironmentType, Permission
-};
-use proxmox::api::router::SubdirMap;
-use proxmox::api::schema::*;
+use proxmox::{identity, sortable};
 use proxmox::tools::fs::{
     file_read_firstline, file_read_optional_string, replace_file, CreateOptions,
 };
-use proxmox::{http_err, identity, list_subdirs_api_method, sortable};
+use proxmox_router::{
+    list_subdirs_api_method, http_err, ApiResponseFuture, ApiHandler, ApiMethod, Router,
+    RpcEnvironment, RpcEnvironmentType, SubdirMap, Permission,
+};
+use proxmox_schema::*;
 
 use pxar::accessor::aio::Accessor;
 use pxar::EntryKind;
index 365d5a61393f76d5265d5ec096f77c448dc55af4..b5214c217e89b75be909f27218208eca145984de 100644 (file)
@@ -1,7 +1,7 @@
 //! Backup Server Administration
 
-use proxmox::api::router::{Router, SubdirMap};
-use proxmox::list_subdirs_api_method;
+use proxmox_router::{Router, SubdirMap};
+use proxmox_router::list_subdirs_api_method;
 
 pub mod datastore;
 pub mod sync;
index 94990adb5e5a5f8de6d5737c55432481e059caf2..12a358d15232b7a8a48cb7e4fa319e027140356a 100644 (file)
@@ -3,9 +3,12 @@
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment, RpcEnvironmentType};
-use proxmox::api::router::SubdirMap;
-use proxmox::{list_subdirs_api_method, sortable};
+use proxmox::sortable;
+use proxmox_router::{
+    list_subdirs_api_method, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
+    Permission,
+};
+use proxmox_schema::api;
 
 use pbs_api_types::{DATASTORE_SCHEMA, JOB_ID_SCHEMA, Authid, SyncJobConfig, SyncJobStatus};
 use pbs_config::sync;
index 6bdfdeded176efa33969a25a3792ef49c14958bd..2a217b65025132d069f1635a071ff6c1343d4793 100644 (file)
@@ -3,9 +3,12 @@
 use anyhow::{format_err, Error};
 use serde_json::Value;
 
-use proxmox::api::router::SubdirMap;
-use proxmox::{list_subdirs_api_method, sortable};
-use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment, RpcEnvironmentType};
+use proxmox::sortable;
+use proxmox_router::{
+    list_subdirs_api_method, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
+    Permission,
+};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     VerificationJobConfig, VerificationJobStatus, JOB_ID_SCHEMA, Authid,
index a2e34b3e9727b47eb3c424e37b1e2664cd8e26a4..5906cb57fef074f894df1ac86528980ad6f6a2a9 100644 (file)
@@ -8,7 +8,7 @@ use serde_json::{json, Value};
 
 use proxmox::tools::digest_to_hex;
 use proxmox::tools::fs::{replace_file, CreateOptions};
-use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
+use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
 
 use pbs_datastore::{DataStore, DataBlob};
 use pbs_datastore::backup_info::{BackupDir, BackupInfo};
index 4432c8d5f7b90b0bf41b8ec617c1808cae85f821..eea625002947b53212b8e09ee14dac9cfc1959fb 100644 (file)
@@ -7,10 +7,12 @@ use hyper::http::request::Parts;
 use hyper::{Body, Response, Request, StatusCode};
 use serde_json::{json, Value};
 
-use proxmox::{sortable, identity, list_subdirs_api_method};
-use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
-use proxmox::api::router::SubdirMap;
-use proxmox::api::schema::*;
+use proxmox::{sortable, identity};
+use proxmox_router::list_subdirs_api_method;
+use proxmox_router::{
+    ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, SubdirMap, Permission,
+};
+use proxmox_schema::*;
 
 use pbs_api_types::{
     Authid, VerifyState, SnapshotVerifyState,
index abf20888d31b10aacc634f3ac3ede7f1202ce0f7..75cb44e112171cd866a10d1e37702e994d6665eb 100644 (file)
@@ -9,8 +9,8 @@ use hyper::http::request::Parts;
 use serde_json::{json, Value};
 
 use proxmox::{sortable, identity};
-use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, RpcEnvironment};
-use proxmox::api::schema::*;
+use proxmox_router::{ApiResponseFuture, ApiHandler, ApiMethod, RpcEnvironment};
+use proxmox_schema::*;
 
 use pbs_datastore::{DataStore, DataBlob};
 use pbs_datastore::file_formats::{DataBlobHeader, EncryptedDataBlobHeader};
@@ -59,7 +59,7 @@ impl Future for UploadChunk {
                             break format_err!("uploaded chunk has unexpected size.");
                         }
 
-                        let (is_duplicate, compressed_size) = match proxmox::try_block! {
+                        let (is_duplicate, compressed_size) = match proxmox_lang::try_block! {
                             let mut chunk = DataBlob::from_raw(raw_data)?;
 
                             pbs_runtime::block_in_place(|| {
index 6e7d98be72b97c5980c185481c2ec81b815e31a6..6b9a12b576de47f34402acb6c5c0090d60a4ed5f 100644 (file)
@@ -1,5 +1,5 @@
-use proxmox::api::{Router, SubdirMap};
-use proxmox::list_subdirs_api_method;
+use proxmox_router::{Router, SubdirMap};
+use proxmox_router::list_subdirs_api_method;
 use proxmox::{identity, sortable};
 
 pub mod tfa;
index 3dfa8de4c9d541597ebc337c72d2134810448f39..027d5b91dd885817817a5cc63e70d0bcb92fd32f 100644 (file)
@@ -4,7 +4,8 @@ use anyhow::{bail, Error};
 use serde_json::Value;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     PROXMOX_CONFIG_DIGEST_SCHEMA, REALM_ID_SCHEMA, PRIV_SYS_AUDIT, PRIV_REALM_ALLOCATE,
index a7234638a5cdf2e408322769087106d97132419e..ec15446efc1233cc7a6d2b14640e6fd8d24cf032 100644 (file)
@@ -3,8 +3,9 @@
 
 use anyhow::Error;
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment, SubdirMap};
-use proxmox::list_subdirs_api_method;
+use proxmox_router::{Router, RpcEnvironment, Permission, SubdirMap};
+use proxmox_schema::api;
+use proxmox_router::list_subdirs_api_method;
 
 use pbs_api_types::PROXMOX_CONFIG_DIGEST_SCHEMA;
 
index e8fa0798b54a843f545b34b25a3208fb05247ae1..efa0b57b254435865f6f02f9a315985091b45fd2 100644 (file)
@@ -8,10 +8,10 @@ use lazy_static::lazy_static;
 use serde::{Deserialize, Serialize};
 use serde_json::{json, Value};
 
-use proxmox::api::router::SubdirMap;
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
-use proxmox::http_bail;
-use proxmox::list_subdirs_api_method;
+use proxmox_router::{
+    http_bail, list_subdirs_api_method, Permission, Router, SubdirMap, RpcEnvironment,
+};
+use proxmox_schema::api;
 
 use proxmox_acme_rs::account::AccountData as AcmeAccountData;
 use proxmox_acme_rs::Account;
index a9f7622fa07bba4b8132629953f6356d576c2378..b9526ed39b973fd8b040aebaa006c16f88140fc8 100644 (file)
@@ -2,13 +2,8 @@ use anyhow::{bail, Error};
 use ::serde::{Deserialize, Serialize};
 use serde_json::Value;
 
-use proxmox::api::{
-    api,
-    Router,
-    RpcEnvironment,
-    Permission,
-    schema::parse_property_string,
-};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::{api, parse_property_string};
 
 use pbs_api_types::{
     Authid, ScsiTapeChanger, ScsiTapeChangerUpdater, LtoTapeDrive,
index 0819d5ec3f3658d82325f093887055a8a3c57026..b9367469b7cc5fba078f954fdb51e866a96bba3a 100644 (file)
@@ -4,9 +4,9 @@ use anyhow::{bail, Error};
 use serde_json::Value;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Router, RpcEnvironment, RpcEnvironmentType, Permission};
-use proxmox::api::section_config::SectionConfigData;
-use proxmox::api::schema::{ApiType, parse_property_string};
+use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
+use proxmox_schema::{api, ApiType, parse_property_string};
+use proxmox_section_config::SectionConfigData;
 
 use pbs_datastore::chunk_store::ChunkStore;
 use pbs_config::BackupLockGuard;
index 26b4ddd58b6535b34f55287f6729c70ef92e038a..2840fe8f6123db6d0a36cd3b6fdfd0792c2dde0a 100644 (file)
@@ -2,7 +2,8 @@ use anyhow::{bail, Error};
 use ::serde::{Deserialize, Serialize};
 use serde_json::Value;
 
-use proxmox::api::{api, Router, RpcEnvironment, Permission};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, LtoTapeDrive, LtoTapeDriveUpdater, ScsiTapeChanger,
index 6782e56c5e53cf819fba6c469f0d3f8cc8af4dd9..6f72ac420994ac9a5a61e6968e08700b9dbcb4ea 100644 (file)
@@ -1,14 +1,8 @@
 use anyhow::{bail, Error};
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::{
-    api::{
-        api,
-        Router,
-        RpcEnvironment,
-        Permission,
-    },
-};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, MediaPoolConfig, MediaPoolConfigUpdater, MEDIA_POOL_NAME_SCHEMA,
index 9befa0e5f8a7d256f3f0396c24955b90ba764a72..473337f53337937074070aee03c759181725924f 100644 (file)
@@ -1,7 +1,7 @@
 //! Backup Server Configuration
 
-use proxmox::api::router::{Router, SubdirMap};
-use proxmox::list_subdirs_api_method;
+use proxmox_router::{Router, SubdirMap};
+use proxmox_router::list_subdirs_api_method;
 
 pub mod access;
 pub mod acme;
index acf7cfcf9d9b1c8d83d0ebc6a0f92b1efd638901..29e638d71878b213a2548ca239448252041ef984 100644 (file)
@@ -2,8 +2,8 @@ use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
-use proxmox::http_err;
+use proxmox_router::{http_err, ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_client::{HttpClient, HttpClientOptions};
 use pbs_api_types::{
index 3c2bfd782cb7a6d846256110eb86abd8a34a3135..fba476da6f3a92d24f5302624179f20757b23885 100644 (file)
@@ -2,7 +2,8 @@ use anyhow::{bail, Error};
 use serde_json::Value;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, SyncJobConfig, SyncJobConfigUpdater, JOB_ID_SCHEMA, PROXMOX_CONFIG_DIGEST_SCHEMA,
index 9213580419b522e6ca3660b985d74cf1b55cb282..6c5680d39112e9e2faa8fd58a656466ecefb9269 100644 (file)
@@ -2,7 +2,8 @@ use anyhow::{bail, Error};
 use serde_json::Value;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Router, RpcEnvironment, Permission};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, TapeBackupJobConfig, TapeBackupJobConfigUpdater,
index ba66b6f65252cb2351a6a7cadba97cd35e121ab9..03c39c58dffc60712cd1975a44cdc65861e363be 100644 (file)
@@ -1,15 +1,8 @@
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        ApiMethod,
-        Router,
-        RpcEnvironment,
-        Permission,
-    },
-};
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Fingerprint, KeyInfo, Kdf,
index 7958646a66b09df4394dfd4c28bd008d1c7559c9..d1a283227adbe7699c0bc4b93a1a972d042cdc5b 100644 (file)
@@ -2,7 +2,8 @@ use anyhow::{bail, Error};
 use serde_json::Value;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, VerificationJobConfig, VerificationJobConfigUpdater, JOB_ID_SCHEMA,
index 2a82265490520443ee2685f6993ff04a36829c21..750e4fac053976344c55bf4c224b92c6a396980b 100644 (file)
@@ -4,7 +4,7 @@ use anyhow::Error;
 use futures::stream::TryStreamExt;
 use hyper::{Body, Response, StatusCode, header};
 
-use proxmox::http_bail;
+use proxmox_router::http_bail;
 
 pub async fn create_download_response(path: PathBuf) -> Result<Response<Body>, Error> {
     let file = match tokio::fs::File::open(path.clone()).await {
index 0ede416552cf18ffa6b94dc8bb944b78ae9d812c..dd517df4a0c7c7a5ef75da564657cde86b3468e7 100644 (file)
@@ -14,9 +14,7 @@ pub mod pull;
 pub mod tape;
 pub mod helpers;
 
-use proxmox::api::router::SubdirMap;
-use proxmox::api::Router;
-use proxmox::list_subdirs_api_method;
+use proxmox_router::{list_subdirs_api_method, Router, SubdirMap};
 
 const SUBDIRS: SubdirMap = &[
     ("access", &access::ROUTER),
index efc9538b2f86dfb98b0970c89d2abc2b3d61713e..46d015b9341c501d57640e647c4f8e0a0115a966 100644 (file)
@@ -2,10 +2,11 @@ use anyhow::{Error, bail, format_err};
 use serde_json::{json, Value};
 use std::collections::HashMap;
 
-use proxmox::list_subdirs_api_method;
-use proxmox::api::{api, RpcEnvironment, RpcEnvironmentType, Permission};
-use proxmox::api::router::{Router, SubdirMap};
 use proxmox::tools::fs::{replace_file, CreateOptions};
+use proxmox_router::{
+    list_subdirs_api_method, RpcEnvironment, RpcEnvironmentType, Permission, Router, SubdirMap
+};
+use proxmox_schema::api;
 
 use proxmox_apt::repositories::{
     APTRepositoryFile, APTRepositoryFileError, APTRepositoryHandle, APTRepositoryInfo,
index 80419a4f5d1e2adda39f98863d1590e54f874de3..4d26b29f6eb7ebd60cd89a2c46408cb74c38efe5 100644 (file)
@@ -7,9 +7,10 @@ use openssl::pkey::PKey;
 use openssl::x509::X509;
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::router::SubdirMap;
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
-use proxmox::list_subdirs_api_method;
+use proxmox_router::SubdirMap;
+use proxmox_router::{Permission, Router, RpcEnvironment};
+use proxmox_router::list_subdirs_api_method;
+use proxmox_schema::api;
 
 use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_MODIFY};
 use pbs_buildcfg::configdir;
@@ -516,7 +517,7 @@ pub fn renew_acme_cert(force: bool, rpcenv: &mut dyn RpcEnvironment) -> Result<S
 /// Check whether the current certificate expires within the next 30 days.
 pub fn cert_expires_soon() -> Result<bool, Error> {
     let cert = pem_to_cert_info(get_certificate_pem()?.as_bytes())?;
-    cert.is_expired_after_epoch(proxmox::tools::time::epoch_i64() + 30 * 24 * 60 * 60)
+    cert.is_expired_after_epoch(proxmox_time::epoch_i64() + 30 * 24 * 60 * 60)
         .map_err(|err| format_err!("Failed to check certificate expiration date: {}", err))
 }
 
index 88ec39553afddd44a2323dc711b00c3211e0691e..fe99bad933606773a5aa7940725f483959b4f9a2 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Permission, Router, RpcEnvironment};
+use proxmox_router::{Permission, Router, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};
 
index 7f1ae1a251112ca96321a06b4898eba1b9561332..e36d4d827a4d752dadfa07f4628088a8051e8221 100644 (file)
@@ -2,9 +2,9 @@ use anyhow::{bail, Error};
 use serde_json::json;
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, Permission, RpcEnvironment, RpcEnvironmentType};
-use proxmox::api::section_config::SectionConfigData;
-use proxmox::api::router::Router;
+use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
+use proxmox_schema::api;
+use proxmox_section_config::SectionConfigData;
 
 use pbs_api_types::{
     DataStoreConfig, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA,
index c66b83cd07c2859056779a702f17505bdc0c7e90..27bb455c94e1ef639d1c58c505e9089bc70c7631 100644 (file)
@@ -1,10 +1,11 @@
 use anyhow::{bail, Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, Permission, RpcEnvironment, RpcEnvironmentType};
-use proxmox::api::router::{Router, SubdirMap};
 use proxmox::{sortable, identity};
-use proxmox::{list_subdirs_api_method};
+use proxmox_router::{
+    list_subdirs_api_method, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap, Permission,
+};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     UPID_SCHEMA, NODE_SCHEMA, BLOCKDEVICE_NAME_SCHEMA,
index 190a761dae2cc95e37af7bf66878e1decd1be0af..9c3a0958a0f8cbac96104c3fad1f8f676d265184 100644 (file)
@@ -1,11 +1,8 @@
 use anyhow::{bail, Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{
-    api, Permission, RpcEnvironment, RpcEnvironmentType,
-    schema::parse_property_string,
-};
-use proxmox::api::router::Router;
+use proxmox_router::{Router, RpcEnvironment, RpcEnvironmentType, Permission};
+use proxmox_schema::{api, parse_property_string};
 
 use pbs_api_types::{
     ZpoolListItem, ZfsRaidLevel, ZfsCompressionType, DataStoreConfig,
index ff5b5f148e1564182fb58ac82f3cbde13f858f07..34a42a6504d45d52efd42221b4125838a9e2012e 100644 (file)
@@ -7,7 +7,8 @@ use regex::Regex;
 use serde_json::{json, Value};
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
 use proxmox::{IPRE, IPV4RE, IPV6RE, IPV4OCTET, IPV6H16, IPV6LS32};
 
index aa708a82a4dda84b2b177d24331d21e442adbd73..8a4a832c0451a428815f293da40a3c873d091b31 100644 (file)
@@ -4,7 +4,8 @@ use anyhow::{Error};
 use serde_json::{json, Value};
 use std::io::{BufRead,BufReader};
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT};
 
index b101040b77444a0d0c2518e8a42e9a0d9b92681c..5e7a09e2280ffa56b93a37a0645109943431c038 100644 (file)
@@ -12,12 +12,12 @@ use hyper::Request;
 use serde_json::{json, Value};
 use tokio::io::{AsyncBufReadExt, BufReader};
 
-use proxmox::api::router::{Router, SubdirMap};
-use proxmox::api::{
-    api, schema::*, ApiHandler, ApiMethod, ApiResponseFuture, Permission, RpcEnvironment,
-};
-use proxmox::list_subdirs_api_method;
 use proxmox::{identity, sortable};
+use proxmox_router::{
+    ApiHandler, ApiMethod, ApiResponseFuture, Permission, RpcEnvironment, Router, SubdirMap,
+};
+use proxmox_schema::*;
+use proxmox_router::list_subdirs_api_method;
 use proxmox_http::websocket::WebSocket;
 
 use proxmox_rest_server::WorkerTask;
index d496b5f8ea9dc003785ec9acde097d990df586c9..1becf1070f02c0c77f1a19ea8b7ef2d35da330f6 100644 (file)
@@ -2,8 +2,8 @@ use anyhow::{Error, bail};
 use serde_json::{Value, to_value};
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
-use proxmox::api::schema::parse_property_string;
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::{api, parse_property_string};
 
 use pbs_api_types::{
     Authid, Interface, NetworkInterfaceType, LinuxBondMode, NetworkConfigMethod, BondXmitHashPolicy,
index 54d87dc468c602c278b4adc1fbe7be84e9a9ff95..bfea05861e98ecfdcf5d2e8bd15f8ff611fa7b0b 100644 (file)
@@ -1,7 +1,9 @@
 use anyhow::Error;
-use proxmox::api::{api, ApiMethod, Permission, Router, RpcEnvironment};
 use serde_json::{json, Value};
 
+use proxmox_router::{ApiMethod, Permission, Router, RpcEnvironment};
+use proxmox_schema::api;
+
 use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT};
 
 use crate::server::generate_report;
index 005550307007d9d83d4ca4bf562e07f581dc1c72..c59a35a4412d789a1481c81c416d63f4d83312ae 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::{Value, json};
 
-use proxmox::api::{api, Permission, Router};
+use proxmox_router::{Permission, Router};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     NODE_SCHEMA, RRDMode, RRDTimeFrameResolution, PRIV_SYS_AUDIT,
@@ -19,7 +20,7 @@ pub fn create_value_from_rrd(
 ) -> Result<Value, Error> {
 
     let mut result = Vec::new();
-    let now = proxmox::tools::time::epoch_f64();
+    let now = proxmox_time::epoch_f64();
 
     for name in list {
         let (start, reso, list) = match RRD_CACHE.extract_cached_data(basedir, name, now, timeframe, cf) {
index 8df0fb24b9d59b075aa375b015b5eeac1921050e..19a1d8a1a07823eb330581421fdf0a9490c15055 100644 (file)
@@ -3,9 +3,9 @@ use std::process::{Command, Stdio};
 use anyhow::{bail, Error};
 use serde_json::{json, Value};
 
-use proxmox::{sortable, identity, list_subdirs_api_method};
-use proxmox::api::{api, Router, Permission, RpcEnvironment};
-use proxmox::api::router::SubdirMap;
+use proxmox::{sortable, identity};
+use proxmox_router::{list_subdirs_api_method, Router, Permission, RpcEnvironment, SubdirMap};
+use proxmox_schema::api;
 
 use pbs_api_types::{Authid, NODE_SCHEMA, SERVICE_ID_SCHEMA, PRIV_SYS_AUDIT, PRIV_SYS_MODIFY};
 
index f430c28c456ac7c65707b8f04d159f4e4a5ac122..f9b1ca727ad3bcb1b8eabd532caa094273470459 100644 (file)
@@ -6,7 +6,8 @@ use serde_json::Value;
 
 use proxmox::sys::linux::procfs;
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{NODE_SCHEMA, NodePowerCommand, PRIV_SYS_AUDIT, PRIV_SYS_POWER_MANAGEMENT};
 
index 721ef40acdb14bd031eaea28a2538ad79bcb3a44..5fa38033ed967756673b35f05e5ec8ed7abf9d29 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::{Error, format_err, bail};
 use serde_json::Value;
 
-use proxmox::api::{api, Router, RpcEnvironment, Permission};
+use proxmox_router::{Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     NODE_SCHEMA, SUBSCRIPTION_KEY_SCHEMA, Authid,
@@ -51,7 +52,7 @@ pub fn check_subscription(
     };
 
     if !force && info.status == SubscriptionStatus::ACTIVE {
-        let age = proxmox::tools::time::epoch_i64() - info.checktime.unwrap_or(i64::MAX);
+        let age = proxmox_time::epoch_i64() - info.checktime.unwrap_or(i64::MAX);
         if age < subscription::MAX_LOCAL_KEY_AGE {
             return Ok(());
         }
index 4c956f09ebd8b0a64853c371b283d0ad83b0c2dc..08dc5edbb25a1fe0c6f52a98a3d3f8d26def0567 100644 (file)
@@ -3,7 +3,8 @@ use std::process::{Command, Stdio};
 use anyhow::{Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{NODE_SCHEMA, SYSTEMD_DATETIME_FORMAT, PRIV_SYS_AUDIT};
 
index 0a7fa2183fcdf88c95638ebb6ea20a59c8e8ff54..7689ef216d8e75e2f676ba8921ca42ae0d334674 100644 (file)
@@ -4,9 +4,9 @@ use std::io::{BufRead, BufReader};
 use anyhow::{bail, Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, Router, RpcEnvironment, Permission};
-use proxmox::api::router::SubdirMap;
-use proxmox::{identity, list_subdirs_api_method, sortable};
+use proxmox::{identity, sortable};
+use proxmox_router::{list_subdirs_api_method, Router, RpcEnvironment, Permission, SubdirMap};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Userid, Authid, Tokenname, TaskListItem, TaskStateType, UPID,
index bf82c25a2dc9b1cbae70fad426dd4ea508e79804..d17c7f7247d8a0a56a68946e68bc57de46bcee10 100644 (file)
@@ -1,8 +1,9 @@
 use anyhow::{bail, format_err, Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, Router, Permission};
 use proxmox::tools::fs::{file_read_firstline, replace_file, CreateOptions};
+use proxmox_router::{Router, Permission};
+use proxmox_schema::api;
 
 use pbs_api_types::{NODE_SCHEMA, TIME_ZONE_SCHEMA, PRIV_SYS_MODIFY};
 
@@ -55,8 +56,8 @@ fn read_etc_localtime() -> Result<String, Error> {
 )]
 /// Read server time and time zone settings.
 fn get_time(_param: Value) -> Result<Value, Error> {
-    let time = proxmox::tools::time::epoch_i64();
-    let tm = proxmox::tools::time::localtime(time)?;
+    let time = proxmox_time::epoch_i64();
+    let tm = proxmox_time::localtime(time)?;
     let offset = tm.tm_gmtoff;
 
     let localtime = time + offset;
index dfbe05c66738c15c42c761f57b3f4379c6bad0ee..7e4d152d206165fd8c41160d43a65a578e886f9a 100644 (file)
@@ -3,7 +3,8 @@
 use anyhow::{Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, Router, Permission};
+use proxmox_router::{Router, Permission};
+use proxmox_schema::api;
 
 #[api(
     returns: {
index ea8faab8287dd390c7bc0b459766be5b51d8c3cf..4280d922aacba8e02dff15eb41ecd10e8cf7d01e 100644 (file)
@@ -4,8 +4,8 @@ use std::sync::{Arc};
 use anyhow::{format_err, Error};
 use futures::{select, future::FutureExt};
 
-use proxmox::api::api;
-use proxmox::api::{ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::api;
+use proxmox_router::{ApiMethod, Router, RpcEnvironment, Permission};
 
 use pbs_client::{HttpClient, BackupRepository};
 use pbs_api_types::{
index 379b3ce21539902ab126f960a5f9d81f3aea560f..b4aaa614bdaf92d97c3ba2dbd1c3d1866707e333 100644 (file)
@@ -3,7 +3,7 @@ use std::collections::HashSet;
 
 use serde_json::{json, Value};
 
-use proxmox::api::{RpcEnvironment, RpcEnvironmentType};
+use proxmox_router::{RpcEnvironment, RpcEnvironmentType};
 
 use pbs_datastore::backup_info::BackupDir;
 use pbs_datastore::DataStore;
index 1fd25a5ceac676919f20ae62eb929df90af83acf..f418f50fbf3b0d6da35d85ff45bbccab06954f56 100644 (file)
@@ -7,25 +7,12 @@ use hyper::http::request::Parts;
 use hyper::{Body, Response, Request, StatusCode};
 use serde_json::Value;
 
-use proxmox::{
-    http_err,
-    sortable,
-    identity,
-    list_subdirs_api_method,
-    api::{
-        ApiResponseFuture,
-        ApiHandler,
-        ApiMethod,
-        Router,
-        RpcEnvironment,
-        Permission,
-        router::SubdirMap,
-        schema::{
-            ObjectSchema,
-            BooleanSchema,
-        },
-    },
+use proxmox::{identity, sortable};
+use proxmox_router::{
+    http_err, list_subdirs_api_method, ApiHandler, ApiMethod, ApiResponseFuture, Permission,
+    Router, RpcEnvironment, SubdirMap,
 };
+use proxmox_schema::{BooleanSchema, ObjectSchema};
 
 use pbs_api_types::{
     Authid, DATASTORE_SCHEMA, BACKUP_TYPE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_ID_SCHEMA,
index 548e531940df081f4a6a51a9675bc6df2ad43c23..9c7d4f7d2ed105f2797d829b5939a78a9cc6c456 100644 (file)
@@ -1,18 +1,17 @@
 //! Datastote status
 
-use proxmox::list_subdirs_api_method;
-
 use anyhow::{Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{
-    api,
+use proxmox_schema::api;
+use proxmox_router::{
     ApiMethod,
     Permission,
     Router,
     RpcEnvironment,
     SubdirMap,
 };
+use proxmox_router::list_subdirs_api_method;
 
 use pbs_api_types::{
     Authid, DATASTORE_SCHEMA, RRDMode, RRDTimeFrameResolution,
@@ -122,7 +121,7 @@ pub fn datastore_status(
         });
 
         let rrd_dir = format!("datastore/{}", store);
-        let now = proxmox::tools::time::epoch_f64();
+        let now = proxmox_time::epoch_f64();
 
         let get_rrd = |what: &str| RRD_CACHE.extract_cached_data(
             &rrd_dir,
index 7627e35b8da31e48f462485af9a8f0ef0b580483..a0578391b858715ec88e94ce09fe25fb84027cac 100644 (file)
@@ -4,16 +4,9 @@ use std::sync::{Mutex, Arc};
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::{
-    try_block,
-    api::{
-        api,
-        RpcEnvironment,
-        RpcEnvironmentType,
-        Router,
-        Permission,
-    },
-};
+use proxmox_lang::try_block;
+use proxmox_router::{Permission, Router, RpcEnvironment, RpcEnvironmentType};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     Authid, Userid, TapeBackupJobConfig, TapeBackupJobSetup, TapeBackupJobStatus, MediaPoolConfig,
@@ -119,7 +112,7 @@ pub fn list_tape_backup_jobs(
 
     let mut list = Vec::new();
     let status_path = Path::new(TAPE_STATUS_DIR);
-    let current_time = proxmox::tools::time::epoch_i64();
+    let current_time = proxmox_time::epoch_i64();
 
     for job in job_list_iter {
         let privs = user_info.lookup_privs(&auth_id, &["tape", "job", &job.id]);
index 3d9dcb70743fee477b13bb71762bc37d7da87930..6a99ca37ec9884395c35f22ecc3251743eabd1f4 100644 (file)
@@ -4,8 +4,8 @@ use std::path::Path;
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, Router, SubdirMap, RpcEnvironment, Permission};
-use proxmox::list_subdirs_api_method;
+use proxmox_schema::api;
+use proxmox_router::{list_subdirs_api_method, Permission, Router, RpcEnvironment, SubdirMap};
 
 use pbs_api_types::{
     Authid, ChangerListEntry, LtoTapeDrive, MtxEntryKind, MtxStatusEntry, ScsiTapeChanger,
index 6564d0fef7d153614bd56cd3230fdcd2f30c54bc..f3bd8c63e2619b7524ae5cd416aec8b8425696ce 100644 (file)
@@ -6,21 +6,13 @@ use std::collections::HashMap;
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::{
-    sortable,
-    identity,
-    list_subdirs_api_method,
-    tools::Uuid,
-    api::{
-        api,
-        section_config::SectionConfigData,
-        RpcEnvironment,
-        RpcEnvironmentType,
-        Permission,
-        Router,
-        SubdirMap,
-    },
+use proxmox::{sortable, identity};
+use proxmox_router::{
+    list_subdirs_api_method, Permission, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap,
 };
+use proxmox_schema::api;
+use proxmox_section_config::SectionConfigData;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{
     UPID_SCHEMA, CHANGER_NAME_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_LABEL_SCHEMA, MEDIA_POOL_NAME_SCHEMA,
@@ -521,7 +513,7 @@ pub fn label_media(
                 }
             }
 
-            let ctime = proxmox::tools::time::epoch_i64();
+            let ctime = proxmox_time::epoch_i64();
             let label = MediaLabel {
                 label_text: label_text.to_string(),
                 uuid: Uuid::generate(),
@@ -1084,7 +1076,7 @@ fn barcode_label_media_worker(
             }
         }
 
-        let ctime = proxmox::tools::time::epoch_i64();
+        let ctime = proxmox_time::epoch_i64();
         let label = MediaLabel {
             label_text: label_text.to_string(),
             uuid: Uuid::generate(),
index 72948f524e2d5a8b3187ab9cdd936f4b9b88fb0b..ed99374db6cab1c1442dedeb3af20613409acce2 100644 (file)
@@ -3,11 +3,9 @@ use std::collections::HashSet;
 
 use anyhow::{bail, format_err, Error};
 
-use proxmox::{
-    api::{api, Router, SubdirMap, RpcEnvironment, Permission},
-    list_subdirs_api_method,
-    tools::Uuid,
-};
+use proxmox_router::{list_subdirs_api_method, Router, SubdirMap, RpcEnvironment, Permission};
+use proxmox_schema::api;
+use proxmox_uuid::Uuid;
 
 use pbs_datastore::backup_info::BackupDir;
 use pbs_api_types::{
@@ -177,7 +175,7 @@ pub async fn list_media(
         let changer_name = None; // assume standalone drive
         let mut pool = MediaPool::with_config(status_path, &config, changer_name, true)?;
 
-        let current_time = proxmox::tools::time::epoch_i64();
+        let current_time = proxmox_time::epoch_i64();
 
         // Call start_write_session, so that we show the same status a
         // backup job would see.
index 049bb936bdc80ef1d25b13a90aacb6cba248b525..9b569fd542842b6e9321f2a4f760019dc7270131 100644 (file)
@@ -3,14 +3,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        router::SubdirMap,
-        Router,
-    },
-    list_subdirs_api_method,
-};
+use proxmox_schema::api;
+use proxmox_router::{list_subdirs_api_method, Router, SubdirMap};
 
 use pbs_api_types::TapeDeviceInfo;
 use pbs_tape::linux_list_drives::{lto_tape_device_list, linux_tape_changer_list};
index 61e17d1ba566f5eeec14b32909b4cbf182b9178c..30e99343f9275c275ee6eec89aedd34cab2e4488 100644 (file)
@@ -8,25 +8,12 @@ use std::sync::Arc;
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        RpcEnvironment,
-        RpcEnvironmentType,
-        Router,
-        Permission,
-        schema::parse_property_string,
-        section_config::SectionConfigData,
-    },
-    tools::{
-        Uuid,
-        io::ReadExt,
-        fs::{
-            replace_file,
-            CreateOptions,
-        },
-    },
-};
+use proxmox::tools::fs::{replace_file, CreateOptions};
+use proxmox_io::ReadExt;
+use proxmox_router::{Permission, Router, RpcEnvironment, RpcEnvironmentType};
+use proxmox_schema::{api, parse_property_string};
+use proxmox_section_config::SectionConfigData;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{
     Authid, Userid, CryptMode,
@@ -441,7 +428,7 @@ fn restore_list_worker(
     let mut snapshot_file_hash: BTreeMap<Uuid, Vec<u64>> = BTreeMap::new();
     let mut snapshot_locks = HashMap::new();
 
-    let res = proxmox::try_block!({
+    let res = proxmox_lang::try_block!({
         // assemble snapshot files/locks
         for store_snapshot in snapshots.iter() {
             let mut split = store_snapshot.splitn(2, ':');
@@ -593,7 +580,7 @@ fn restore_list_worker(
             "Phase 3: copy snapshots from temp dir to datastores"
         );
         for (store_snapshot, _lock) in snapshot_locks.into_iter() {
-            proxmox::try_block!({
+            proxmox_lang::try_block!({
                 let mut split = store_snapshot.splitn(2, ':');
                 let source_datastore = split
                     .next()
index 78c80949929bbd26b0f82b5b912938d8978289b6..21e953bb58367b37c57300431b6efa7e0d9f7fb5 100644 (file)
@@ -1,7 +1,7 @@
 use serde::{Deserialize, Serialize};
 use serde_json::Value;
 
-use proxmox::api::{api, schema::{ApiType, Schema, StringSchema, ApiStringFormat}};
+use proxmox_schema::{api, ApiType, Schema, StringSchema, ApiStringFormat};
 
 use pbs_api_types::{
     DNS_ALIAS_FORMAT, DNS_NAME_FORMAT, PROXMOX_SAFE_ID_FORMAT,
@@ -62,7 +62,7 @@ pub struct KnownAcmeDirectory {
     pub url: &'static str,
 }
 
-proxmox::api_string_type! {
+proxmox_schema::api_string_type! {
     #[api(format: &PROXMOX_SAFE_ID_FORMAT)]
     /// ACME account name.
     #[derive(Clone, Eq, PartialEq, Hash, Deserialize, Serialize)]
index 50b928edbe2726712179baaa8ac591121a803674..28bea293ab38eda86ca2c98ddebfcbda2fba0786 100644 (file)
@@ -3,7 +3,7 @@
 use anyhow::bail;
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::{api, schema::*};
+use proxmox_schema::*;
 
 use pbs_api_types::StorageStatus;
 
index 1a4c5b85613c9c50b9a90cb82020e528ff700414..4ea85708914bab2bae2d02bd2cde1d7a72a14e88 100644 (file)
@@ -3,8 +3,8 @@
 use anyhow::{Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
-use proxmox::api::schema::ObjectSchema;
+use proxmox_router::{ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
+use proxmox_schema::ObjectSchema;
 
 fn get_version(
     _param: Value,
index d88bf8cccbe9c615012ba06efc1a7ac0a5e54dc1..a4ac956efc7dd0834a0e05220f7d398340776d50 100644 (file)
@@ -7,7 +7,7 @@ use openssl::rsa::Rsa;
 use openssl::sha;
 
 use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions};
-use proxmox::try_block;
+use proxmox_lang::try_block;
 
 use pbs_buildcfg::configdir;
 use pbs_api_types::Userid;
@@ -31,7 +31,7 @@ pub fn assemble_csrf_prevention_token(
     userid: &Userid,
 ) -> String {
 
-    let epoch = proxmox::tools::time::epoch_i64();
+    let epoch = proxmox_time::epoch_i64();
 
     let digest = compute_csrf_secret_digest(epoch, secret, userid);
 
@@ -68,7 +68,7 @@ pub fn verify_csrf_prevention_token(
             bail!("invalid signature.");
         }
 
-        let now = proxmox::tools::time::epoch_i64();
+        let now = proxmox_time::epoch_i64();
 
         let age = now - ttime;
         if age < min_age {
index 17179c13a424240b73ab1d0cbdfeea58cf5cb0de..9fbd513508a71877b25ff8a6736caaffcfe174ee 100644 (file)
@@ -361,7 +361,7 @@ pub fn verify_backup_dir_with_lock(
 
     let mut verify_result = VerifyState::Ok;
     for info in manifest.files() {
-        let result = proxmox::try_block!({
+        let result = proxmox_lang::try_block!({
             task_log!(verify_worker.worker, "  check {}", info.filename);
             match archive_type(&info.filename)? {
                 ArchiveType::FixedIndex => verify_fixed_index(verify_worker, &backup_dir, info),
@@ -556,7 +556,7 @@ pub fn verify_filter(
             match outdated_after {
                 None => false, // never re-verify if ignored and no max age
                 Some(max_age) => {
-                    let now = proxmox::tools::time::epoch_i64();
+                    let now = proxmox_time::epoch_i64();
                     let days_since_last_verify = (now - last_verify.upid.starttime) / 86400;
 
                     days_since_last_verify > max_age
index 84ce53e92c25714001bb485e150f38dd7c7c6cf4..4be4f1f202fbcf8670227ec5b5304c25b1d3a27c 100644 (file)
@@ -1,29 +1,10 @@
 use anyhow::{bail, Error};
 use serde_json::{json, Value};
 
-use proxmox::{
-    api::{
-        schema::{
-            ApiType,
-            Schema,
-            ObjectSchemaType,
-            ApiStringFormat,
-        },
-        router::{
-             ApiAccess,
-        },
-        format::{
-            dump_enum_properties,
-            dump_section_config,
-            get_property_string_type_text,
-        },
-        ApiMethod,
-        ApiHandler,
-        Router,
-        SubRoute,
-        Permission,
-    },
-};
+use proxmox_router::{ApiAccess, ApiHandler, ApiMethod, Permission, Router, SubRoute};
+use proxmox_schema::format::{dump_enum_properties, get_property_string_type_text};
+use proxmox_schema::{ApiStringFormat, ApiType, ObjectSchemaType, Schema};
+use proxmox_section_config::dump_section_config;
 
 use pbs_api_types::PRIVILEGES;
 
index da9ae5dda8d99b1e0e85aee9e8afaba270aabe22..c98fba251c57580c4b94a1ff4299f6a2e24241d1 100644 (file)
@@ -8,10 +8,9 @@ use http::Response;
 use hyper::{Body, Method, StatusCode};
 use http::HeaderMap;
 
-use proxmox::try_block;
-use proxmox::api::RpcEnvironmentType;
+use proxmox_lang::try_block;
+use proxmox_router::{RpcEnvironmentType, UserInformation};
 use proxmox::tools::fs::CreateOptions;
-use proxmox::api::UserInformation;
 
 use proxmox_rest_server::{daemon, AuthError, ApiConfig, RestServer, RestEnvironment, ServerAdapter};
 
index 0ef37525f2bf1017bfe9202bbc952105f4a2f75d..35ef320afa57bf5bb96dd9ba5103df2822db9617 100644 (file)
@@ -1,4 +1,4 @@
-use proxmox::api::{
+use proxmox_router::{
     cli::{run_cli_command, CliCommandMap, CliEnvironment},
     RpcEnvironment,
 };
index eca1540ef2700b619f816c5530bd4a2b3cb3e345..92e6bb2a18070e6ede27bd1caebd7582d7be6f57 100644 (file)
@@ -4,8 +4,9 @@ use std::io::{self, Write};
 use anyhow::{format_err, Error};
 use serde_json::{json, Value};
 
-use proxmox::api::{api, cli::*, RpcEnvironment};
 use proxmox::tools::fs::CreateOptions;
+use proxmox_router::{cli::*, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_client::{display_task_log, view_task_result};
 use pbs_tools::percent_encoding::percent_encode_component;
@@ -434,7 +435,7 @@ pub fn complete_remote_datastore_name(_arg: &str, param: &HashMap<String, String
 
     let mut list = Vec::new();
 
-    let _ = proxmox::try_block!({
+    let _ = proxmox_lang::try_block!({
         let remote = param.get("remote").ok_or_else(|| format_err!("no remote"))?;
 
         let data = pbs_runtime::block_on(async move {
index 4c879483fcd63f341bc67d3cfd48acbe80b462c6..a484174067308afc3d1764bdfc238511670a926f 100644 (file)
@@ -17,10 +17,10 @@ use tokio_stream::wrappers::ReceiverStream;
 use serde_json::{json, Value};
 use http::{Method, HeaderMap};
 
-use proxmox::try_block;
-use proxmox::api::{RpcEnvironment, RpcEnvironmentType, UserInformation};
 use proxmox::sys::linux::socket::set_tcp_keepalive;
 use proxmox::tools::fs::CreateOptions;
+use proxmox_lang::try_block;
+use proxmox_router::{RpcEnvironment, RpcEnvironmentType, UserInformation};
 
 use pbs_tools::{task_log, task_warn};
 use pbs_datastore::DataStore;
@@ -577,7 +577,7 @@ async fn schedule_datastore_garbage_collection() {
             }
         };
 
-        let now = proxmox::tools::time::epoch_i64();
+        let now = proxmox_time::epoch_i64();
 
         if next > now  { continue; }
 
@@ -1021,7 +1021,7 @@ fn check_schedule(worker_type: &str, event_str: &str, id: &str) -> bool {
         }
     };
 
-    let now = proxmox::tools::time::epoch_i64();
+    let now = proxmox_time::epoch_i64();
     next <= now
 }
 
index 17f79247a60491d0f1efebe6330085eae2585ddd..207453754f37fa83c3a060b516d4ddea6456d30d 100644 (file)
@@ -1,8 +1,8 @@
 use anyhow::Error;
 use serde_json::json;
 
-use proxmox::api::{cli::*, RpcEnvironment, ApiHandler};
 use proxmox::tools::fs::CreateOptions;
+use proxmox_router::{cli::*, RpcEnvironment, ApiHandler};
 
 use proxmox_backup::api2;
 use proxmox_backup::tools::subscription;
index 98d28c9569357d45c35cc7403e984952687b55d1..5de727c146e0f291f6ddde7258f26ddecb0c48f3 100644 (file)
@@ -1,18 +1,12 @@
 use anyhow::{format_err, Error};
 use serde_json::{json, Value};
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-        section_config::SectionConfigData,
-    },
-    tools::{
-        time::strftime_local,
-        io::ReadExt,
-    },
-};
+use proxmox_io::ReadExt;
+use proxmox_router::RpcEnvironment;
+use proxmox_router::cli::*;
+use proxmox_schema::api;
+use proxmox_section_config::SectionConfigData;
+use proxmox_time::strftime_local;
 
 use pbs_client::view_task_result;
 use pbs_tools::format::{
index 141c0579f0c39ab946234b78dcd289b00a83460e..5b9594f3acd61f95e9eed528ea96cc048ed89dad 100644 (file)
@@ -7,13 +7,9 @@ use tokio::signal::unix::{signal, SignalKind};
 
 use std::collections::HashMap;
 
-use proxmox::api::{
-    api,
-    cli::*,
-    format::DocumentationFormat,
-    schema::{parse_parameter_strings, ApiType, ParameterSchema, Schema},
-    ApiHandler, ApiMethod, RpcEnvironment, SubRoute,
-};
+use proxmox_router::{cli::*, ApiHandler, ApiMethod, RpcEnvironment, SubRoute};
+use proxmox_schema::{api, parse_parameter_strings, ApiType, ParameterSchema, Schema};
+use proxmox_schema::format::DocumentationFormat;
 
 use pbs_api_types::{PROXMOX_UPID_REGEX, UPID};
 use pbs_client::view_task_result;
@@ -381,8 +377,8 @@ struct ApiDirEntry {
     capabilities: String,
 }
 
-const LS_SCHEMA: &proxmox::api::schema::Schema =
-    &proxmox::api::schema::ArraySchema::new("List of child links", &ApiDirEntry::API_SCHEMA)
+const LS_SCHEMA: &proxmox_schema::Schema =
+    &proxmox_schema::ArraySchema::new("List of child links", &ApiDirEntry::API_SCHEMA)
         .schema();
 
 async fn get_api_children(
@@ -448,7 +444,7 @@ async fn ls(path: Option<String>, mut param: Value, rpcenv: &mut dyn RpcEnvironm
 
     format_and_print_result_full(
         &mut serde_json::to_value(res)?,
-        &proxmox::api::schema::ReturnType {
+        &proxmox_schema::ReturnType {
             optional: false,
             schema: &LS_SCHEMA,
         },
index 9fe2ac1a61924afd5acf0b03b95d841c5fe39858..43e30c235f8a1f16f249772a9574f46910cacacd 100644 (file)
@@ -7,10 +7,11 @@ use anyhow::{bail, format_err, Error};
 use serde_json::{json, Value};
 use walkdir::WalkDir;
 
-use proxmox::api::cli::{
+use proxmox_router::cli::{
     format_and_print_result, get_output_format, CliCommand, CliCommandMap, CommandLineInterface,
+    OUTPUT_FORMAT,
 };
-use proxmox::api::{api, cli::*};
+use proxmox_schema::api;
 
 use pbs_tools::cli::outfile_or_stdout;
 use pbs_tools::crypt_config::CryptConfig;
@@ -282,7 +283,7 @@ fn inspect_file(
             };
 
             let mut ctime_str = index.index_ctime().to_string();
-            if let Ok(s) = proxmox::tools::time::strftime_local("%c", index.index_ctime()) {
+            if let Ok(s) = proxmox_time::strftime_local("%c", index.index_ctime()) {
                 ctime_str = s;
             }
 
index 098dea09638db2aa36a7b75acfab0eed36ec6a5a..a8665cd16c57cceec22e9307a7648119f7fcaf08 100644 (file)
@@ -5,9 +5,9 @@ use std::path::Path;
 use anyhow::{bail, format_err, Error};
 use serde_json::Value;
 
-use proxmox::api::api;
-use proxmox::api::cli::{CliCommand, CliCommandMap, CommandLineInterface};
 use proxmox::tools::digest_to_hex;
+use proxmox_router::cli::{CliCommand, CliCommandMap, CommandLineInterface};
+use proxmox_schema::api;
 
 use pbs_tools::crypt_config::CryptConfig;
 use pbs_datastore::dynamic_index::DynamicIndexReader;
index 6cdddb13733455668cb382b010b2524f0459ce29..8180631b34252849bf615a558ce0b854b6c3eb9c 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use proxmox_backup::api2;
 
index b1baeda710137ac6a51f9bc46e80cb79453473b3..8d929d38dc4c5786c625f7b1385456532243e869 100644 (file)
@@ -3,8 +3,9 @@ use std::io::Write;
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, ApiHandler, RpcEnvironment};
 use proxmox::tools::fs::file_get_contents;
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use proxmox_backup::acme::AcmeClient;
 use proxmox_backup::api2;
index 24bd9cc6ff34f4f333ff9ace2eafc69139bb1196..10632b50e38e1d5d1d7bfdc65530e572f54880bb 100644 (file)
@@ -1,6 +1,7 @@
 use anyhow::{bail, Error};
 
-use proxmox::api::{api, cli::*};
+use proxmox_router::cli::*;
+use proxmox_schema::api;
 
 use proxmox_backup::config;
 use proxmox_backup::auth_helpers::*;
index e5ef266034854a051602f400ee604c7aa172fd7c..4409be9fa49121541830a11f665d43971e6bf5db 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_client::view_task_result;
 use pbs_api_types::{DataStoreConfig, DATASTORE_SCHEMA};
index 668c6f16b1f3ab8bf5251db9967b009d8685dafc..fd9bc7de01f4790fecc1ea27001843327069d78d 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     DISK_LIST_SCHEMA, ZFS_ASHIFT_SCHEMA, ZfsRaidLevel, ZfsCompressionType,
index 9a91cb067bcdca002eb3549ac713c20358136fa0..e4350fb74033db449f6692d359deb0e14cec5949 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use proxmox_backup::api2;
 
index 001c905dda09bf0ba1eda2c6d3fb56aec7deb375..f445c63053b98bbc2cea436ab1c9257646935af1 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use proxmox_backup::api2;
 
index 4210996057e1eb7724b03c3a45ccdbdd67f64cd3..a3438f21e0188d1e7bdfc88e814aa98d5964c156 100644 (file)
@@ -1,7 +1,9 @@
-use proxmox::api::{api, cli::*, ApiHandler, RpcEnvironment};
 use anyhow::Error;
 use serde_json::Value;
 
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
+
 use proxmox_backup::api2;
 
 #[api(
index 24264996842be8a8c2858ad73174f19a426a8930..1a74645713f8557fef9b7c9dd60068f2f446986a 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::REALM_ID_SCHEMA;
 
index 4f55ceb5cc38d71e1ecd8b816905654c7f4edf46..c83ec1e2f97dd33ab952dfa71342f3fcda561149 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::REMOTE_ID_SCHEMA;
 
index cd69d8d3cc165e6f5a27570eeda5636382df3874..0e626b88f78b51d62d17391d53800b96f8881489 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use proxmox_backup::api2;
 
index 7a1e87182d6ec81652b24a25529cb7a9b227407f..dfd8688da4ea2b605ed2ad7bf34ce88511884e1c 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::JOB_ID_SCHEMA;
 
index cff66ce7a4f738f4f8d29d553de43c33c286da5d..950601d72630b3ad3943a1f4d696c5d432c69f75 100644 (file)
@@ -3,7 +3,8 @@ use serde_json::Value;
 
 use std::collections::HashMap;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::{ACL_PATH_SCHEMA, Authid, Userid};
 
@@ -15,7 +16,7 @@ fn render_expire(value: &Value, _record: &Value) -> Result<String, Error> {
     let text = match value.as_i64() {
         Some(epoch) if epoch == 0 => never,
         Some(epoch) => {
-            if let Ok(epoch_string) = proxmox::tools::time::strftime_local("%c", epoch as i64) {
+            if let Ok(epoch_string) = proxmox_time::strftime_local("%c", epoch as i64) {
                 epoch_string
             } else {
                 epoch.to_string()
index 192b1bd123ea346c2130adc56ec905014c66f5fa..6258de74d5569e3d4a26bbccdcdde75075e0a744 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::JOB_ID_SCHEMA;
 
index b5662f169d9bb0b733aca5d87bce88c1c53a233e..54f9ddd29a2d4fa57e0fe5bdc26ad64365cb7302 100644 (file)
@@ -1,7 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::api::{api, cli::*, RpcEnvironment, ApiHandler};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::JOB_ID_SCHEMA;
 use pbs_client::view_task_result;
index 4c62218e8de6054554595eee1807b3bf91830a2f..ed8ce3402e14d47c838ca60e1b225cdb470a6c09 100644 (file)
@@ -1,15 +1,9 @@
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-        ApiHandler,
-        section_config::SectionConfigData,
-    },
-};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
+use proxmox_section_config::SectionConfigData;
 
 use pbs_config::drive::{
     complete_drive_name,
index 7972ed2a4502ca129b782539f6eee76e855b84e7..bebf645e3827fb2feb257d190b58099c7ac798b7 100644 (file)
@@ -1,14 +1,8 @@
 use anyhow::Error;
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-        ApiHandler,
-    },
-};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::DRIVE_NAME_SCHEMA;
 
index 06c62f4d5d79132ae2632f0d66032f05e59f5c22..3feb72ffbfdc26b462db5a582954db6940924f4f 100644 (file)
@@ -1,15 +1,9 @@
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-        ApiHandler,
-    },
-    sys::linux::tty,
-};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
+use proxmox::sys::linux::tty;
 
 use pbs_api_types::{
     Fingerprint, Kdf, DRIVE_NAME_SCHEMA, TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,
@@ -127,7 +121,7 @@ fn show_key(
         _ => unreachable!(),
     };
 
-    let options = proxmox::api::cli::default_table_format_options()
+    let options = proxmox_router::cli::default_table_format_options()
         .column(ColumnConfig::new("kdf"))
         .column(ColumnConfig::new("created").renderer(pbs_tools::format::render_epoch))
         .column(ColumnConfig::new("modified").renderer(pbs_tools::format::render_epoch))
index e65108ec29c23185de4a4ec7ba357f64db1c8efd..e305a9fa543cbf20d73de0540e4a014ab72b663b 100644 (file)
@@ -1,14 +1,8 @@
 use anyhow::{Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-        ApiHandler,
-    },
-};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::{
     MEDIA_POOL_NAME_SCHEMA, CHANGER_NAME_SCHEMA, MediaStatus, MediaListEntry,
index 6fe9a63ce01dd58dca10c7469ad034698c8a1e65..2a4f96b5a32adbbe2ca80ee71695736a774279e2 100644 (file)
@@ -1,14 +1,8 @@
 use anyhow::{Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-        ApiHandler,
-    },
-};
+use proxmox_router::{cli::*, ApiHandler, RpcEnvironment};
+use proxmox_schema::api;
 
 use pbs_api_types::MEDIA_POOL_NAME_SCHEMA;
 use pbs_config::media_pool::complete_pool_name;
index ee4c32c277752fcbbe6eaa381fa730a4433eae50..10966d90cb7e005d9c1e47a4b0d9a468a03ddf98 100644 (file)
@@ -9,14 +9,9 @@ use std::os::unix::io::{AsRawFd, FromRawFd};
 use anyhow::{bail, Error};
 use serde_json::Value;
 
-use proxmox::{
-    api::{
-        api,
-        cli::*,
-        RpcEnvironment,
-    },
-    tools::Uuid,
-};
+use proxmox_router::{cli::*, RpcEnvironment};
+use proxmox_schema::api;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{
     Fingerprint, LTO_DRIVE_PATH_SCHEMA, DRIVE_NAME_SCHEMA, TAPE_ENCRYPTION_KEY_FINGERPRINT_SCHEMA,
@@ -112,7 +107,7 @@ fn set_encryption(
     param: Value,
 ) -> Result<(), Error> {
 
-    let result = proxmox::try_block!({
+    let result = proxmox_lang::try_block!({
         let mut handle = get_tape_handle(&param)?;
 
         match (fingerprint, uuid) {
index e0e3db48c4bae2a83f53abb01cdee240f4ff545b..f90de70e0cf588068fa65fe2dbdce5651a436eb1 100644 (file)
@@ -3,11 +3,8 @@ use lazy_static::lazy_static;
 use serde::{Deserialize, Serialize};
 use serde_json::Value;
 
-use proxmox::api::{
-    api,
-    schema::*,
-    section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin},
-};
+use proxmox_schema::{api, ApiType, Schema, StringSchema, Updater};
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use pbs_config::{open_backup_lockfile, BackupLockGuard};
 use pbs_api_types::PROXMOX_SAFE_ID_FORMAT;
index 0f4119d294125ce70d59b5e625c54f5f28d08178..f93dd14321e1bfa5e414b86f75038e3fafe431d0 100644 (file)
@@ -10,7 +10,7 @@ use openssl::rsa::{Rsa};
 use openssl::x509::{X509Builder};
 use openssl::pkey::PKey;
 
-use proxmox::try_block;
+use proxmox_lang::try_block;
 
 use pbs_buildcfg::{self, configdir};
 
@@ -115,7 +115,7 @@ pub fn update_self_signed_cert(force: bool) -> Result<(), Error> {
 
     // we try to generate an unique 'subject' to avoid browser problems
     //(reused serial numbers, ..)
-    let uuid = proxmox::tools::uuid::Uuid::generate();
+    let uuid = proxmox_uuid::Uuid::generate();
 
     let mut subject_name = openssl::x509::X509NameBuilder::new()?;
     subject_name.append_entry_by_text("O", "Proxmox Backup Server")?;
index 15b153a1dd5ed52f3c5c6814136b59dc7f068e5d..934442160f613187352ac1a414ebc1d9acf99cee 100644 (file)
@@ -3,8 +3,7 @@ use std::collections::HashSet;
 use anyhow::{bail, Error};
 use serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
-use proxmox::api::schema::{ApiStringFormat, ApiType, Updater};
+use proxmox_schema::{api, ApiStringFormat, ApiType, Updater};
 
 use proxmox_http::ProxyConfig;
 
index 4cd57d64cfac62ca6eca8b1750e824c0b192c834..2a41cbdf2258e8d7a1362851f84b41cd284d31b7 100644 (file)
@@ -16,14 +16,11 @@ use webauthn_rs::{proto::UserVerificationPolicy, Webauthn};
 
 use webauthn_rs::proto::Credential as WebauthnCredential;
 
-use proxmox::api::api;
-use proxmox::api::schema::Updater;
 use proxmox::sys::error::SysError;
 use proxmox::tools::fs::CreateOptions;
-use proxmox::tools::tfa::totp::Totp;
-use proxmox::tools::tfa::u2f;
-use proxmox::tools::uuid::Uuid;
-use proxmox::tools::AsHex;
+use proxmox_schema::{api, Updater};
+use proxmox_tfa::{totp::Totp, u2f};
+use proxmox_uuid::Uuid;
 
 use pbs_buildcfg::configdir;
 use pbs_config::{open_backup_lockfile, BackupLockGuard};
@@ -276,7 +273,7 @@ impl TfaConfig {
     }
 
     /// Remove non-existent users.
-    pub fn cleanup_users(&mut self, config: &proxmox::api::section_config::SectionConfigData) {
+    pub fn cleanup_users(&mut self, config: &proxmox_section_config::SectionConfigData) {
         self.users
             .retain(|user, _| config.lookup::<User>("user", user.as_str()).is_ok());
     }
@@ -341,7 +338,7 @@ impl<T> TfaEntry<T> {
                 id: Uuid::generate().to_string(),
                 enable: true,
                 description,
-                created: proxmox::tools::time::epoch_i64(),
+                created: proxmox_time::epoch_i64(),
             },
             entry,
         }
@@ -371,7 +368,7 @@ impl U2fRegistrationChallenge {
         Self {
             challenge,
             description,
-            created: proxmox::tools::time::epoch_i64(),
+            created: proxmox_time::epoch_i64(),
         }
     }
 }
@@ -410,7 +407,7 @@ impl WebauthnRegistrationChallenge {
             state,
             challenge,
             description,
-            created: proxmox::tools::time::epoch_i64(),
+            created: proxmox_time::epoch_i64(),
         }
     }
 }
@@ -441,7 +438,7 @@ impl WebauthnAuthChallenge {
         Self {
             state,
             challenge,
-            created: proxmox::tools::time::epoch_i64(),
+            created: proxmox_time::epoch_i64(),
         }
     }
 }
@@ -614,7 +611,7 @@ impl TfaUserChallengeData {
         challenge: &str,
         response: &str,
     ) -> Result<TfaEntry<u2f::Registration>, Error> {
-        let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
+        let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
 
         let index = self
             .inner
@@ -659,7 +656,7 @@ impl TfaUserChallengeData {
         response: webauthn_rs::proto::RegisterPublicKeyCredential,
         existing_registrations: &[TfaEntry<WebauthnCredential>],
     ) -> Result<TfaEntry<WebauthnCredential>, Error> {
-        let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
+        let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
 
         let index = self
             .inner
@@ -991,7 +988,7 @@ impl TfaUserData {
         mut webauthn: Webauthn<WebauthnConfig>,
         mut response: Value,
     ) -> Result<(), Error> {
-        let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
+        let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
 
         let challenge = match response
             .as_object_mut()
@@ -1083,9 +1080,9 @@ impl Recovery {
         proxmox::sys::linux::fill_with_random_data(&mut secret)?;
 
         let mut this = Self {
-            secret: AsHex(&secret).to_string(),
+            secret: hex::encode(&secret).to_string(),
             entries: Vec::with_capacity(10),
-            created: proxmox::tools::time::epoch_i64(),
+            created: proxmox_time::epoch_i64(),
         };
 
         let mut original = Vec::new();
@@ -1093,14 +1090,11 @@ impl Recovery {
         let mut key_data = [0u8; 80]; // 10 keys of 12 bytes
         proxmox::sys::linux::fill_with_random_data(&mut key_data)?;
         for b in key_data.chunks(8) {
+            // unwrap: encoding hex bytes to fixed sized arrays
             let entry = format!(
-                "{}-{}-{}-{}",
-                AsHex(&b[0..2]),
-                AsHex(&b[2..4]),
-                AsHex(&b[4..6]),
-                AsHex(&b[6..8]),
+                "{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}",
+                b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
             );
-
             this.entries.push(Some(this.hash(entry.as_bytes())?));
             original.push(entry);
         }
@@ -1120,7 +1114,7 @@ impl Recovery {
             .sign_oneshot_to_vec(data)
             .map_err(|err| format_err!("error calculating hmac: {}", err))?;
 
-        Ok(AsHex(&hmac).to_string())
+        Ok(hex::encode(&hmac))
     }
 
     /// Iterator over available keys.
@@ -1159,7 +1153,7 @@ where
     D: Deserializer<'de>,
     T: Deserialize<'de> + IsExpired,
 {
-    let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
+    let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
     Ok(
         deserializer.deserialize_seq(crate::tools::serde_filter::FilteredVecVisitor::new(
             "a challenge entry",
index 2e6beac764f0b9183373e60fe2e13d67f622bf2f..33d655d423ed28e243f1a6cdf13d17a4ca3a4060 100644 (file)
@@ -2,7 +2,7 @@
 
 use anyhow::format_err;
 
-use proxmox::api::UserInformation;
+use proxmox_router::UserInformation;
 
 use pbs_tools::ticket::{self, Ticket};
 use pbs_config::{token_shadow, CachedUserInfo};
index a70f2d1bff1eec36cca92e9d199bb60b4e5e7030..db93fea2aac4aa81ccff720517103417851613da 100644 (file)
@@ -4,8 +4,8 @@ use serde_json::json;
 use handlebars::{Handlebars, Helper, Context, RenderError, RenderContext, Output, HelperResult, TemplateError};
 
 use proxmox::tools::email::sendmail;
-use proxmox::api::schema::{ApiType, parse_property_string};
-use proxmox::try_block;
+use proxmox_lang::try_block;
+use proxmox_schema::{parse_property_string, ApiType};
 
 use pbs_tools::format::HumanByte;
 use pbs_api_types::{
index 64feb8780440476bedae222acd7b34f7e391fd9d..1377470dc22c32206cb9250bcd7159b4f99752c6 100644 (file)
@@ -147,7 +147,7 @@ pub fn update_job_last_run_time(jobtype: &str, jobname: &str) -> Result<(), Erro
         Ok(job) => job,
         Err(_) => return Ok(()), // was locked (running), so do not update
     };
-    let time = proxmox::tools::time::epoch_i64();
+    let time = proxmox_time::epoch_i64();
 
     job.state = match JobState::load(jobtype, jobname)? {
         JobState::Created { .. } => JobState::Created { time },
@@ -220,7 +220,7 @@ impl JobState {
             }
         } else {
             Ok(JobState::Created {
-                time: proxmox::tools::time::epoch_i64() - 30,
+                time: proxmox_time::epoch_i64() - 30,
             })
         }
     }
@@ -241,7 +241,7 @@ impl Job {
             jobtype: jobtype.to_string(),
             jobname: jobname.to_string(),
             state: JobState::Created {
-                time: proxmox::tools::time::epoch_i64(),
+                time: proxmox_time::epoch_i64(),
             },
             _lock,
         })
index 613370384a9e7030eec2dd65667d7b1ad8647a67..a15d3bb5a13483297ad61490cc376fded164569f 100644 (file)
@@ -9,8 +9,9 @@ use std::time::SystemTime;
 
 use anyhow::{bail, format_err, Error};
 use serde_json::json;
+use http::StatusCode;
 
-use proxmox::api::error::{HttpError, StatusCode};
+use proxmox_router::HttpError;
 
 use pbs_api_types::{Authid, SnapshotListItem, GroupListItem};
 use pbs_datastore::{DataStore, BackupInfo, BackupDir, BackupGroup, StoreProgress};
@@ -306,7 +307,7 @@ async fn pull_snapshot(
     let tmp_manifest_blob = DataBlob::load_from_reader(&mut tmp_manifest_file)?;
 
     if manifest_name.exists() {
-        let manifest_blob = proxmox::try_block!({
+        let manifest_blob = proxmox_lang::try_block!({
             let mut manifest_file = std::fs::File::open(&manifest_name).map_err(|err| {
                 format_err!(
                     "unable to open local manifest {:?} - {}",
@@ -476,12 +477,12 @@ impl SkipInfo {
     fn affected(&self) -> Result<String, Error> {
         match self.count {
             0 => Ok(String::new()),
-            1 => proxmox::tools::time::epoch_to_rfc3339_utc(self.oldest),
+            1 => Ok(proxmox_time::epoch_to_rfc3339_utc(self.oldest)?),
             _ => {
                 Ok(format!(
                     "{} .. {}",
-                    proxmox::tools::time::epoch_to_rfc3339_utc(self.oldest)?,
-                    proxmox::tools::time::epoch_to_rfc3339_utc(self.newest)?,
+                    proxmox_time::epoch_to_rfc3339_utc(self.oldest)?,
+                    proxmox_time::epoch_to_rfc3339_utc(self.newest)?,
                 ))
             }
         }
@@ -706,7 +707,7 @@ pub async fn pull_store(
     }
 
     if delete {
-        let result: Result<(), Error> = proxmox::try_block!({
+        let result: Result<(), Error> = proxmox_lang::try_block!({
             let local_groups = BackupInfo::list_backup_groups(&tgt_store.base_path())?;
             for local_group in local_groups {
                 if new_groups.contains(&local_group) {
index 437606634cdf6fb31bfb76b00035610d15dd020f..e86181b3ada2f50beef20d51d8806c6a681e57da 100644 (file)
@@ -3,8 +3,8 @@ use std::collections::{HashMap, HashSet};
 
 use anyhow::{bail, Error};
 
-use proxmox::tools::Uuid;
-use proxmox::api::section_config::SectionConfigData;
+use proxmox_section_config::SectionConfigData;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{VirtualTapeDrive, ScsiTapeChanger};
 use pbs_tape::{ElementStatus, MtxStatus};
index 7dcd28096b3024288c9b36bf043044cef1078ac6..8b87ca4f34e7a50094c75405b2ae2288bee649ac 100644 (file)
@@ -17,7 +17,7 @@ use std::convert::TryInto;
 
 use anyhow::{bail, format_err, Error};
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{
     Fingerprint, MamAttribute, LtoDriveAndMediaStatus, LtoTapeDrive, Lp17VolumeStatistics,
@@ -47,7 +47,7 @@ use crate::{
 /// - for autoloader only, try to reload ejected tapes
 pub fn open_lto_tape_drive(config: &LtoTapeDrive) -> Result<LtoTapeHandle, Error> {
 
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let file = open_lto_tape_device(&config.path)?;
 
         let mut handle = LtoTapeHandle::new(file)?;
index 1780fe2d10abd3e5136095f37782060d2dff8e79..168459739e279da9bab7917bd93b2d11403a7c67 100644 (file)
@@ -8,15 +8,13 @@ pub use lto::*;
 use std::path::PathBuf;
 
 use anyhow::{bail, format_err, Error};
-use ::serde::{Deserialize};
+use serde::Deserialize;
 use serde_json::Value;
 use nix::fcntl::OFlag;
 use nix::sys::stat::Mode;
 
 use proxmox::{
     tools::{
-        Uuid,
-        io::ReadExt,
         fs::{
             lock_file,
             atomic_open_or_create_file,
@@ -25,8 +23,10 @@ use proxmox::{
             CreateOptions,
        }
     },
-    api::section_config::SectionConfigData,
 };
+use proxmox_io::ReadExt;
+use proxmox_section_config::SectionConfigData;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{VirtualTapeDrive, LtoTapeDrive, Fingerprint};
 use pbs_config::key_config::KeyConfig;
@@ -364,7 +364,7 @@ pub fn request_and_load_media(
     MediaId,
 ), Error> {
 
-    let check_label = |handle: &mut dyn TapeDriver, uuid: &proxmox::tools::Uuid| {
+    let check_label = |handle: &mut dyn TapeDriver, uuid: &proxmox_uuid::Uuid| {
         if let Ok((Some(media_id), _)) = handle.read_label() {
             task_log!(
                 worker,
index 8038231c9a74f70dc170d2026624aabf63a1526f..0cc8ae709c603730f0bdcce7c8863f96950edc57 100644 (file)
@@ -42,7 +42,7 @@ use crate::{
 
 /// This needs to lock the drive
 pub fn open_virtual_tape_drive(config: &VirtualTapeDrive) -> Result<VirtualTapeHandle, Error> {
-    proxmox::try_block!({
+    proxmox_lang::try_block!({
         let mut lock_path = std::path::PathBuf::from(&config.path);
         lock_path.push(".drive.lck");
 
index 0b58958f7603d65e5a444a149cb1595029da6215..b27adff04eb2be0af15e492da828ccca9bb6afec 100644 (file)
@@ -1,10 +1,8 @@
 use std::fs::File;
 use std::io::Read;
 
-use proxmox::{
-    sys::error::SysError,
-    tools::Uuid,
-};
+use proxmox::sys::error::SysError;
+use proxmox_uuid::Uuid;
 
 use pbs_tape::{
     PROXMOX_TAPE_BLOCK_SIZE,
@@ -53,9 +51,9 @@ pub fn tape_write_catalog<'a>(
         return Ok(None);
     }
 
-    let mut file_copy_buffer = proxmox::tools::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
+    let mut file_copy_buffer = proxmox_io::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
 
-    let result: Result<(), std::io::Error> = proxmox::try_block!({
+    let result: Result<(), std::io::Error> = proxmox_lang::try_block!({
 
         let file_size = file.metadata()?.len();
         let mut remaining = file_size;
index c9d8524b3a7f8a44b4f4cc6c3b57e371071502f8..9bd5c8144a429c4cd1413c33402236ce2ac9094a 100644 (file)
@@ -3,10 +3,8 @@ use std::io::Read;
 use anyhow::{bail, Error};
 use endian_trait::Endian;
 
-use proxmox::tools::{
-    Uuid,
-    io::ReadExt,
-};
+use proxmox_io::ReadExt;
+use proxmox_uuid::Uuid;
 
 use pbs_datastore::DataBlob;
 use pbs_tape::{
index de43d6bcc9593c49978e6a4fe73e40c4685f2ffa..9a76646e4144d108860fb286103f23662ffc8cc7 100644 (file)
@@ -6,7 +6,7 @@ use std::collections::HashMap;
 use endian_trait::Endian;
 use serde::{Deserialize, Serialize};
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::Fingerprint;
 
index 84f861b5e432e59a0bf5987d215d84c9590f8f88..83d19e79021346fefaa511e92a65ae7fd5692d98 100644 (file)
@@ -2,7 +2,7 @@ use std::io::{Read};
 
 use anyhow::{bail, Error};
 
-use proxmox::tools::io::ReadExt;
+use proxmox_io::ReadExt;
 
 use pbs_tape::{TapeRead, MediaContentHeader};
 
@@ -50,7 +50,7 @@ impl <'a> Read for MultiVolumeReader<'a> {
             let mut reader = (self.next_reader_fn)()
                 .map_err(|err| proxmox::io_format_err!("multi-volume next failed: {}", err))?;
 
-            proxmox::try_block!({
+            proxmox_lang::try_block!({
                 let part_header: MediaContentHeader = unsafe { reader.read_le_value()? };
                 self.reader = Some(reader);
 
index 6f2de9f0ed9b96e4a6e21a97a5f5bf713e64a7aa..aef34ec595f7758a09fbf839518ea3b76de503ad 100644 (file)
@@ -1,6 +1,6 @@
 use anyhow::Error;
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use pbs_tape::{TapeWrite, MediaContentHeader};
 
index c2f289d2ea2f4789771f30f65a7231e9d457c3ee..502b3cbbe260557217a090475ab834eea8cbb4e4 100644 (file)
@@ -2,10 +2,8 @@ use std::io::{Read, Write};
 use std::pin::Pin;
 use std::task::{Context, Poll};
 
-use proxmox::{
-    sys::error::SysError,
-    tools::Uuid,
-};
+use proxmox::sys::error::SysError;
+use proxmox_uuid::Uuid;
 
 use pbs_tape::{
     PROXMOX_TAPE_BLOCK_SIZE,
@@ -46,9 +44,9 @@ pub fn tape_write_snapshot_archive<'a>(
 
     let root_metadata = pxar::Metadata::dir_builder(0o0664).build();
 
-    let mut file_copy_buffer = proxmox::tools::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
+    let mut file_copy_buffer = proxmox_io::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
 
-    let result: Result<(), std::io::Error> = proxmox::try_block!({
+    let result: Result<(), std::io::Error> = proxmox_lang::try_block!({
 
         let leom = writer.write_header(&header, &header_data)?;
         if leom {
index 2b96da741ae7ef931bf1bd23f3ccfee7a927db7d..593985ed5d15aa75a9c254b935d113f0aae25755 100644 (file)
@@ -30,14 +30,8 @@ use anyhow::{bail, Error};
 use serde::{Serialize, Deserialize};
 use serde_json::json;
 
-use proxmox::tools::{
-    Uuid,
-    fs::{
-        replace_file,
-        file_get_json,
-        CreateOptions,
-    },
-};
+use proxmox::tools::fs::{replace_file, file_get_json, CreateOptions};
+use proxmox_uuid::Uuid;
 
 use proxmox_systemd::time::compute_next_event;
 use pbs_config::BackupLockGuard;
@@ -571,7 +565,7 @@ impl Inventory {
         if let Some(ctime) = self.media_set_start_time(media_set_uuid) {
             let mut template = template.unwrap_or_else(|| String::from("%c"));
             template = template.replace("%id%", &media_set_uuid.to_string());
-            proxmox::tools::time::strftime_local(&template, ctime)
+            Ok(proxmox_time::strftime_local(&template, ctime)?)
         } else {
             // We don't know the set start time, so we cannot use the template
             Ok(media_set_uuid.to_string())
index f5169d4cec407cfb16612edca6e58419a233f44e..8fff17f158a81fa196f17e37bd04044b6961b203 100644 (file)
@@ -11,18 +11,13 @@ use endian_trait::Endian;
 use pbs_tools::fs::read_subdir;
 use pbs_datastore::backup_info::BackupDir;
 
-use proxmox::tools::{
-    Uuid,
-    fs::{
-        fchown,
-        create_path,
-        CreateOptions,
-    },
-    io::{
-        WriteExt,
-        ReadExt,
-    },
+use proxmox::tools::fs::{
+    fchown,
+    create_path,
+    CreateOptions,
 };
+use proxmox_io::{WriteExt, ReadExt};
+use proxmox_uuid::Uuid;
 
 use crate::{
     tape::{
@@ -207,7 +202,7 @@ impl MediaCatalog {
 
         let path = Self::catalog_path(base_path, uuid);
 
-        let me = proxmox::try_block!({
+        let me = proxmox_lang::try_block!({
 
             Self::create_basedir(base_path)?;
 
@@ -295,7 +290,7 @@ impl MediaCatalog {
 
         let tmp_path = Self::tmp_catalog_path(base_path, uuid);
 
-        let me = proxmox::try_block!({
+        let me = proxmox_lang::try_block!({
 
             let file = Self::create_temporary_database_file(base_path, uuid)?;
 
@@ -380,7 +375,7 @@ impl MediaCatalog {
                 let pending = &self.pending;
                 // Note: lock file, to get a consistent view with load_catalog
                 nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockExclusive)?;
-                let result: Result<(), Error> = proxmox::try_block!({
+                let result: Result<(), Error> = proxmox_lang::try_block!({
                     file.write_all(pending)?;
                     file.flush()?;
                     file.sync_data()?;
index 5ae2f9dc205afebe85d828772e3926278e2b4d95..2989a1c27baa4515f370df2613407a67fe80d3fe 100644 (file)
@@ -12,7 +12,7 @@ use std::path::{PathBuf, Path};
 use anyhow::{bail, Error};
 use serde::{Deserialize, Serialize};
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{
     Fingerprint, MediaStatus, MediaLocation, MediaSetPolicy, RetentionPolicy,
index 5568e7f605b804e8c8408860a972f69c9250c539..2c766339d8adace0af1133d452b3d2d7a642b824 100644 (file)
@@ -1,7 +1,7 @@
 use anyhow::{bail, Error};
 use serde::{Serialize, Deserialize};
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 /// MediaSet - Ordered group of media
 #[derive(Debug, Serialize, Deserialize)]
index d590341309af09100687a19f1ac1885ff5a666e3..7f42703d56cecefeecb55fb7e7e86f09f5601430 100644 (file)
@@ -1,6 +1,6 @@
 use anyhow::{bail, Error};
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use crate::{
     tape::{
index eed0d61e1c24a9f6cc875967f6a36136a4452944..cc069ff58b21a216e39c6561fd32f19ae7c2eb09 100644 (file)
@@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
 
 use anyhow::{bail, Error};
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use pbs_tools::{task_log, task_warn};
 use pbs_config::tape_encryption_keys::load_key_configs;
@@ -74,7 +74,7 @@ impl PoolWriter {
         force_media_set: bool,
     ) -> Result<Self, Error> {
 
-        let current_time = proxmox::tools::time::epoch_i64();
+        let current_time = proxmox_time::epoch_i64();
 
         let new_media_set_reason = pool.start_write_session(current_time, force_media_set)?;
         if let Some(reason) = new_media_set_reason {
@@ -202,7 +202,7 @@ impl PoolWriter {
             None => None,
         };
 
-        let current_time = proxmox::tools::time::epoch_i64();
+        let current_time = proxmox_time::epoch_i64();
         let media_uuid = self.pool.alloc_writable_media(current_time)?;
 
         let media = self.pool.lookup_media(&media_uuid).unwrap();
index 4adf67f9a6451e9eaf1b4d3515abc97272375e6d..71810a83274f625e42c18e33229f6b2d3bd71e82 100644 (file)
@@ -36,7 +36,7 @@ impl NewChunksIterator {
 
             let datastore_name = snapshot_reader.datastore_name();
 
-            let result: Result<(), Error> = proxmox::try_block!({
+            let result: Result<(), Error> = proxmox_lang::try_block!({
 
                 let mut chunk_iter = snapshot_reader.chunk_iterator()?;
 
index 6dbfaf4f6470af0b8ce2fb8bb265fd5ddca2c12e..e7e1c34ff8b59ff0a8df34ec904dd63afee35f34 100644 (file)
@@ -5,9 +5,7 @@
 use std::path::PathBuf;
 use anyhow::Error;
 
-use proxmox::tools::{
-    Uuid,
-};
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{MediaStatus, MediaSetPolicy, RetentionPolicy};
 
index 2f3063bec56f1d563d4a9ff9ccf24b3265b7850a..822ef77e3083453f1818b83970fd94f3160da0b6 100644 (file)
@@ -5,7 +5,7 @@
 use std::path::PathBuf;
 use anyhow::Error;
 
-use proxmox::tools::Uuid;
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{RetentionPolicy, MediaSetPolicy};
 
index 8c74ac1c93ee331f24f9e2152d3e053b1f548b76..10179d5dade181f9babcbcd2808005f7a25e23c7 100644 (file)
@@ -5,9 +5,7 @@
 use std::path::PathBuf;
 use anyhow::{bail, Error};
 
-use proxmox::tools::{
-    Uuid,
-};
+use proxmox_uuid::Uuid;
 
 use pbs_api_types::{MediaLocation, MediaStatus};
 
index 754b325fa291505a66a2a5c042a387ce7810a250..209274a85020340a718a6210b6f0f63e8d5e0577 100644 (file)
@@ -4,8 +4,8 @@ use std::collections::HashMap;
 use anyhow::{Error, bail, format_err};
 use apt_pkg_native::Cache;
 
-use proxmox::const_regex;
 use proxmox::tools::fs::{file_read_optional_string, replace_file, CreateOptions};
+use proxmox_schema::const_regex;
 
 use pbs_api_types::APTUpdateInfo;
 
index f908d67cb00b4f898618e0a4d238a9a0b810c65c..ec8f3f86e091458e000a9272c6d218d7b371a9ae 100644 (file)
@@ -6,7 +6,7 @@ use anyhow::{bail, format_err, Error};
 use serde::{Deserialize, Serialize};
 use serde_json::Value;
 
-use proxmox::api::schema::{
+use proxmox_schema::{
     parse_property_string, parse_simple_value, verify_json_object, ObjectSchemaType, Schema,
 };
 
@@ -152,7 +152,7 @@ fn object_to_writer(output: &mut dyn Write, object: &Object) -> Result<(), Error
 
 #[test]
 fn test() {
-    use proxmox::api::schema::ApiType;
+    use proxmox_schema::ApiType;
 
     // let's just reuse some schema we actually have available:
     use crate::config::node::NodeConfig;
index 115653af646fd4de5fc49760f762aa4a76743afc..d3e69c6d1bf28fdc7f2859efa801881cf99b10ab 100644 (file)
@@ -17,7 +17,7 @@ use ::serde::{Deserialize, Serialize};
 use proxmox::sys::error::io_err_other;
 use proxmox::sys::linux::procfs::{MountInfo, mountinfo::Device};
 use proxmox::{io_bail, io_format_err};
-use proxmox::api::api;
+use proxmox_schema::api;
 
 use pbs_api_types::{BLOCKDEVICE_NAME_REGEX, StorageStatus};
 
index fb85f6670b6cf033ed3abdff9f491d1e5c143f8c..20d9ceaa58774ee0f74897d9c2d8a4d7c0dc40cb 100644 (file)
@@ -4,7 +4,7 @@ use lazy_static::lazy_static;
 use anyhow::{bail, Error};
 use ::serde::{Deserialize, Serialize};
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 #[api()]
 #[derive(Debug, Serialize, Deserialize)]
index b840269616e72f0d7ca57be6b8ca2317a3afe7fd..dc579e4e90e38e9ab707056346300fdb3922d403 100644 (file)
@@ -34,7 +34,7 @@ use serde::Deserialize;
 /// where
 ///     D: Deserializer<'de>,
 /// {
-///     let expire_before = proxmox::tools::time::epoch_i64() - CHALLENGE_TIMEOUT;
+///     let expire_before = proxmox_time::epoch_i64() - CHALLENGE_TIMEOUT;
 ///
 ///     Ok(deserializer.deserialize_seq(
 ///         FilteredVecVisitor::new(
index c6cf538194d3bed422d60c45db8e6470d0bb3258..1a9ada66eece5620fd6b5f351d8d3d29b0334e0a 100644 (file)
@@ -4,7 +4,7 @@ use regex::Regex;
 use serde::{Deserialize, Serialize};
 use serde_json::json;
 
-use proxmox::api::api;
+use proxmox_schema::api;
 
 use proxmox::tools::fs::{replace_file, CreateOptions};
 use proxmox_http::client::SimpleHttp;
@@ -229,7 +229,7 @@ fn test_parse_register_response() -> Result<(), Error> {
 /// queries the up to date subscription status and parses the response
 pub fn check_subscription(key: String, server_id: String) -> Result<SubscriptionInfo, Error> {
 
-    let now = proxmox::tools::time::epoch_i64();
+    let now = proxmox_time::epoch_i64();
 
     let (response, challenge) = pbs_runtime::block_on(register_subscription(&key, &server_id, now))
         .map_err(|err| format_err!("Error checking subscription: {}", err))?;
@@ -268,7 +268,7 @@ pub fn read_subscription() -> Result<Option<SubscriptionInfo>, Error> {
         }));
     }
 
-    let age = proxmox::tools::time::epoch_i64() - info.checktime.unwrap_or(0);
+    let age = proxmox_time::epoch_i64() - info.checktime.unwrap_or(0);
     if age < -5400 { // allow some delta for DST changes or time syncs, 1.5h
         return Ok(Some( SubscriptionInfo {
             status: SubscriptionStatus::INVALID,
index 9526a525d69030e912049e51220c97a2973936e8..ed95bcff33d2d21aaac0de26f463b091b3aff0a2 100644 (file)
@@ -3,14 +3,8 @@ use lazy_static::lazy_static;
 
 use super::types::*;
 
-use proxmox::api::{
-    schema::*,
-    section_config::{
-        SectionConfig,
-        SectionConfigData,
-        SectionConfigPlugin,
-    }
-};
+use proxmox_schema::*;
+use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
 
 use proxmox::tools::{fs::replace_file, fs::CreateOptions};
 
index d44af70e51fd0197de4aa3c51649a2a2ceb72303..d36ea437543274f00cc868f680e95e3c9939c628 100644 (file)
@@ -1,6 +1,6 @@
 use serde::{Serialize, Deserialize};
 
-use proxmox::api::{ api, schema::* };
+use proxmox_schema::*;
 use pbs_api_types::SINGLE_LINE_COMMENT_FORMAT;
 
 pub const SYSTEMD_SECTION_NAME_SCHEMA: Schema = StringSchema::new(
index a20c097243da58db7753296f5b460d31e193258b..344d9808575111bf9066403d23bba6bedd092e71 100644 (file)
@@ -1,7 +1,8 @@
-use anyhow::{bail, Error};
 use std::sync::Arc;
 use std::io::Cursor;
 use std::io::{Read, Write, Seek, SeekFrom };
+
+use anyhow::{bail, Error};
 use lazy_static::lazy_static;
 
 use pbs_tools::crypt_config::CryptConfig;
index 0eea394562b822b802d916881950ecfc03966c35..15182f7df0f92d6b9bb40959c35b32ce68fc1c51 100644 (file)
@@ -1,6 +1,6 @@
 use std::process::Command;
 
-use anyhow::{Error};
+use anyhow::Error;
 
 use pbs_client::pxar::*;
 
index 35b40ad799656d2255d3cb874f699b11c378decd..4853ee49905ca9e8ce8014328fddc5b569d81734 100644 (file)
@@ -1,6 +1,7 @@
-use anyhow::{Error};
 use std::path::PathBuf;
 
+use anyhow::Error;
+
 use pbs_api_types::PruneOptions;
 use pbs_datastore::manifest::MANIFEST_BLOB_NAME;
 use pbs_datastore::prune::compute_prune_info;
index 2d282e03683e0bf35f114d755e194ccdf1d5e943..0df148b821899b11636017497d4f67273a412731 100644 (file)
@@ -2,9 +2,10 @@ use std::collections::HashSet;
 
 use anyhow::{bail, format_err, Error};
 
+use proxmox_schema::*;
+use proxmox_router::{ApiMethod, Permission, Router, SubdirMap, SubRoute};
+
 use proxmox_backup::api2;
-use proxmox::api::*;
-use proxmox::api::schema::*;
 
 // Simply test if api lookup tables inside Routers and Schemas are
 // correctly sorted.
index 1fdea606d681bc862bfba1f4d054cb2eb563567e..c3278c4b25c1d09024026188519eaf845bb01ff5 100644 (file)
@@ -5,8 +5,8 @@ extern crate proxmox_backup;
 extern crate tokio;
 extern crate nix;
 
-use proxmox::try_block;
 use proxmox::tools::fs::CreateOptions;
+use proxmox_lang::try_block;
 
 use pbs_api_types::{Authid, UPID};
 use pbs_tools::{task_log, task::WorkerTaskContext};