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 49ED5BC442 for ; Thu, 28 Mar 2024 13:47:19 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 22408AE96 for ; Thu, 28 Mar 2024 13:46:49 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Thu, 28 Mar 2024 13:46:48 +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 6DF9742A3F for ; Thu, 28 Mar 2024 13:37:44 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 28 Mar 2024 13:36:48 +0100 Message-Id: <20240328123707.336951-40-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328123707.336951-1-c.ebner@proxmox.com> References: <20240328123707.336951-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [lib.rs] Subject: [pbs-devel] [PATCH v3 proxmox-backup 39/58] client: chunk stream: add struct to hold injection state 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: Thu, 28 Mar 2024 12:47:19 -0000 Adds a dedicated structure to hold the optional queues and state for injection of reused dynamic entries in the payload stream for split stream pxar archives when reusing the payloads chunks from a previous backup run for regular files with unchanged metadata. The queues must only be attached to the payload archive, leaving the current behaviour for the metadata archive or in case of regular encoding without reusing payload chunks of previous snapshots. Signed-off-by: Christian Ebner --- changes since version 2: - not present in previous version pbs-client/src/chunk_stream.rs | 24 ++++++++++++++++++++++++ pbs-client/src/lib.rs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pbs-client/src/chunk_stream.rs b/pbs-client/src/chunk_stream.rs index 895f6eae2..a45420ca0 100644 --- a/pbs-client/src/chunk_stream.rs +++ b/pbs-client/src/chunk_stream.rs @@ -1,4 +1,6 @@ +use std::collections::VecDeque; use std::pin::Pin; +use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use anyhow::Error; @@ -8,6 +10,28 @@ use futures::stream::{Stream, TryStream}; use pbs_datastore::Chunker; +use crate::inject_reused_chunks::InjectChunks; + +/// Holds the queues for optional injection of reused dynamic index entries +pub struct InjectionData { + boundaries: Arc>>, + injections: Arc>>, + consumed: u64, +} + +impl InjectionData { + pub fn new( + boundaries: Arc>>, + injections: Arc>>, + ) -> Self { + Self { + boundaries, + injections, + consumed: 0, + } + } +} + /// Split input stream into dynamic sized chunks pub struct ChunkStream { input: S, diff --git a/pbs-client/src/lib.rs b/pbs-client/src/lib.rs index 3e7bd2a8b..3d2da27b9 100644 --- a/pbs-client/src/lib.rs +++ b/pbs-client/src/lib.rs @@ -39,6 +39,6 @@ mod backup_specification; pub use backup_specification::*; mod chunk_stream; -pub use chunk_stream::{ChunkStream, FixedChunkStream}; +pub use chunk_stream::{ChunkStream, FixedChunkStream, InjectionData}; pub const PROXMOX_BACKUP_TCP_KEEPALIVE_TIME: u32 = 120; -- 2.39.2