From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 323B96B03B for ; Mon, 25 Jan 2021 14:44:04 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 29BC6AD9B for ; Mon, 25 Jan 2021 14:43:34 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A0464AD45 for ; Mon, 25 Jan 2021 14:43:33 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 69E62460E1 for ; Mon, 25 Jan 2021 14:43:33 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Mon, 25 Jan 2021 14:42:53 +0100 Message-Id: <20210125134302.3394328-9-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210125134302.3394328-1-f.gruenbichler@proxmox.com> References: <20210125134302.3394328-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 08/15] pxar: typedef on_error as ErrorHandler X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2021 13:44:04 -0000 Signed-off-by: Fabian Grünbichler --- src/bin/pxar.rs | 4 ++-- src/pxar/extract.rs | 6 ++++-- src/pxar/mod.rs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bin/pxar.rs b/src/bin/pxar.rs index 4d2308bf..3d92dbe0 100644 --- a/src/bin/pxar.rs +++ b/src/bin/pxar.rs @@ -17,7 +17,7 @@ use proxmox::api::cli::*; use proxmox::api::api; use proxmox_backup::tools; -use proxmox_backup::pxar::{fuse, format_single_line_entry, ENCODER_MAX_ENTRIES, Flags}; +use proxmox_backup::pxar::{fuse, format_single_line_entry, ENCODER_MAX_ENTRIES, ErrorHandler, Flags}; fn extract_archive_from_reader( reader: &mut R, @@ -27,7 +27,7 @@ fn extract_archive_from_reader( verbose: bool, match_list: &[MatchEntry], extract_match_default: bool, - on_error: Option Result<(), Error> + Send>>, + on_error: Option, ) -> Result<(), Error> { proxmox_backup::pxar::extract_archive( pxar::decoder::Decoder::from_std(reader)?, diff --git a/src/pxar/extract.rs b/src/pxar/extract.rs index 12f9054d..e22fc847 100644 --- a/src/pxar/extract.rs +++ b/src/pxar/extract.rs @@ -24,6 +24,8 @@ use crate::pxar::dir_stack::PxarDirStack; use crate::pxar::metadata; use crate::pxar::Flags; +pub type ErrorHandler = Box Result<(), Error> + Send>; + pub fn extract_archive( mut decoder: pxar::decoder::Decoder, destination: &Path, @@ -32,7 +34,7 @@ pub fn extract_archive( feature_flags: Flags, allow_existing_dirs: bool, mut callback: F, - on_error: Option Result<(), Error> + Send>>, + on_error: Option, ) -> Result<(), Error> where T: pxar::decoder::SeqRead, @@ -212,7 +214,7 @@ pub(crate) struct Extractor { /// Error callback. Includes `current_path` in the reformatted error, should return `Ok` to /// continue extracting or the passed error as `Err` to bail out. - on_error: Box Result<(), Error> + Send>, + on_error: ErrorHandler, } impl Extractor { diff --git a/src/pxar/mod.rs b/src/pxar/mod.rs index 6e910667..82998cf8 100644 --- a/src/pxar/mod.rs +++ b/src/pxar/mod.rs @@ -59,7 +59,7 @@ mod flags; pub use flags::Flags; pub use create::create_archive; -pub use extract::extract_archive; +pub use extract::{extract_archive, ErrorHandler}; /// The format requires to build sorted directory lookup tables in /// memory, so we restrict the number of allowed entries to limit -- 2.20.1