From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 proxmox-backup 2/4] pxar: bin: use dedicated api type for restore pattern
Date: Thu, 13 Jun 2024 12:56:03 +0200 [thread overview]
Message-ID: <20240613105605.283550-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20240613105605.283550-1-c.ebner@proxmox.com>
Instead of taking a plain string as input parameter, use the
corresponding api type performing additional input validation.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 2:
- not present
pxar-bin/Cargo.toml | 1 +
pxar-bin/src/main.rs | 10 +++-------
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/pxar-bin/Cargo.toml b/pxar-bin/Cargo.toml
index bb010ff78..aa53a1cf0 100644
--- a/pxar-bin/Cargo.toml
+++ b/pxar-bin/Cargo.toml
@@ -25,6 +25,7 @@ proxmox-router = { workspace = true, features = ["cli", "server"] }
proxmox-schema = { workspace = true, features = [ "api-macro" ] }
proxmox-sys.workspace = true
+pbs-api-types.workspace = true
pbs-client.workspace = true
pbs-pxar-fuse.workspace = true
pbs-tools.workspace = true
diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs
index e62348e25..1ec1ff13d 100644
--- a/pxar-bin/src/main.rs
+++ b/pxar-bin/src/main.rs
@@ -12,6 +12,7 @@ use futures::select;
use tokio::signal::unix::{signal, SignalKind};
use pathpatterns::{MatchEntry, MatchType, PatternFlag};
+use pbs_api_types::PathPatterns;
use pbs_client::pxar::{
format_single_line_entry, Flags, OverwriteFlags, PxarExtractOptions, PxarWriters,
ENCODER_MAX_ENTRIES,
@@ -52,12 +53,7 @@ fn extract_archive_from_reader<R: std::io::Read>(
description: "Archive name.",
},
pattern: {
- description: "List of paths or pattern matching files to restore",
- type: Array,
- items: {
- type: String,
- description: "Path or pattern matching files to restore.",
- },
+ type: PathPatterns,
optional: true,
},
target: {
@@ -143,7 +139,7 @@ fn extract_archive_from_reader<R: std::io::Read>(
#[allow(clippy::too_many_arguments)]
fn extract_archive(
archive: String,
- pattern: Option<Vec<String>>,
+ pattern: Option<PathPatterns>,
target: Option<String>,
no_xattrs: bool,
no_fcaps: bool,
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2024-06-13 10:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 10:56 [pbs-devel] [PATCH v3 proxmox-backup 0/4] fix #2996: client: allow optional match patterns for restore Christian Ebner
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 1/4] api-types: implement dedicated api type for match patterns Christian Ebner
2024-06-13 10:56 ` Christian Ebner [this message]
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 3/4] client: catalog shell: use dedicated api type for patterns Christian Ebner
2024-06-13 10:56 ` [pbs-devel] [PATCH v3 proxmox-backup 4/4] fix #2996: client: allow optional match patterns for restore Christian Ebner
2024-06-13 12:28 ` Gabriel Goller
2024-06-13 12:59 ` [pbs-devel] [PATCH v3 proxmox-backup 0/4] " Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240613105605.283550-3-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox