From: Dietmar Maurer <dietmar@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: [pbs-devel] applied: [PATCH proxmox-backup v2 1/7] tape: media_catalog: improve chunk_archive interface
Date: Mon, 26 Jul 2021 10:21:04 +0200 [thread overview]
Message-ID: <f3c6a566-69d5-3eb6-faf0-df6afc6ad91c@proxmox.com> (raw)
In-Reply-To: <20210722134106.1280517-2-d.csapak@proxmox.com>
applied
On 7/22/21 3:41 PM, Dominik Csapak wrote:
> instead of having a public start/end_chunk_archive and register_chunks,
> simply expose a 'register_chunk_archive' method since we always have
> a list of chunks anywhere we want to add them
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> src/api2/tape/restore.rs | 7 ++-----
> src/tape/media_catalog.rs | 22 +++++++++++++++++++---
> src/tape/pool_writer/catalog_set.rs | 6 +-----
> 3 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/src/api2/tape/restore.rs b/src/api2/tape/restore.rs
> index f959a856..1b0bc03f 100644
> --- a/src/api2/tape/restore.rs
> +++ b/src/api2/tape/restore.rs
> @@ -1121,16 +1121,13 @@ fn restore_archive<'a>(
> };
>
> if let Some(chunks) = chunks {
> - catalog.start_chunk_archive(
> + catalog.register_chunk_archive(
> Uuid::from(header.uuid),
> current_file_number,
> &source_datastore,
> + &chunks[..],
> )?;
> - for digest in chunks.iter() {
> - catalog.register_chunk(&digest)?;
> - }
> task_log!(worker, "register {} chunks", chunks.len());
> - catalog.end_chunk_archive()?;
> catalog.commit_if_large()?;
> }
> return Ok(());
> diff --git a/src/tape/media_catalog.rs b/src/tape/media_catalog.rs
> index 65b52a42..086c8a7d 100644
> --- a/src/tape/media_catalog.rs
> +++ b/src/tape/media_catalog.rs
> @@ -503,10 +503,26 @@ impl MediaCatalog {
> Ok(())
> }
>
> + /// Register a chunk archive
> + pub fn register_chunk_archive(
> + &mut self,
> + uuid: Uuid, // Uuid form MediaContentHeader
> + file_number: u64,
> + store: &str,
> + chunk_list: &[[u8; 32]],
> + ) -> Result<(), Error> {
> + self.start_chunk_archive(uuid, file_number, store)?;
> + for digest in chunk_list {
> + self.register_chunk(digest)?;
> + }
> + self.end_chunk_archive()?;
> + Ok(())
> + }
> +
> /// Register a chunk
> ///
> /// Only valid after start_chunk_archive.
> - pub fn register_chunk(
> + fn register_chunk(
> &mut self,
> digest: &[u8;32],
> ) -> Result<(), Error> {
> @@ -557,7 +573,7 @@ impl MediaCatalog {
> }
>
> /// Start a chunk archive section
> - pub fn start_chunk_archive(
> + fn start_chunk_archive(
> &mut self,
> uuid: Uuid, // Uuid form MediaContentHeader
> file_number: u64,
> @@ -606,7 +622,7 @@ impl MediaCatalog {
> }
>
> /// End a chunk archive section
> - pub fn end_chunk_archive(&mut self) -> Result<(), Error> {
> + fn end_chunk_archive(&mut self) -> Result<(), Error> {
>
> match self.current_archive.take() {
> None => bail!("end_chunk_archive failed: not started"),
> diff --git a/src/tape/pool_writer/catalog_set.rs b/src/tape/pool_writer/catalog_set.rs
> index fbca3e97..d5903413 100644
> --- a/src/tape/pool_writer/catalog_set.rs
> +++ b/src/tape/pool_writer/catalog_set.rs
> @@ -97,11 +97,7 @@ impl CatalogSet {
> ) -> Result<(), Error> {
> match self.catalog {
> Some(ref mut catalog) => {
> - catalog.start_chunk_archive(uuid, file_number, store)?;
> - for digest in chunk_list {
> - catalog.register_chunk(digest)?;
> - }
> - catalog.end_chunk_archive()?;
> + catalog.register_chunk_archive(uuid, file_number, store, chunk_list)?;
> }
> None => bail!("no catalog loaded - internal error"),
> }
next prev parent reply other threads:[~2021-07-26 8:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 13:40 [pbs-devel] [PATCH proxmox-backup v2 0/7] improve catalog handling Dominik Csapak
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 1/7] tape: media_catalog: improve chunk_archive interface Dominik Csapak
2021-07-26 8:21 ` Dietmar Maurer [this message]
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 2/7] tape: media_catalog: add fast_catalog beside normal catalog Dominik Csapak
2021-07-27 6:53 ` Dietmar Maurer
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 3/7] tape: pool_writer: finish the catalog when its done Dominik Csapak
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 4/7] tape: media_catalog: add local type aliases to make code more clear Dominik Csapak
2021-07-27 7:10 ` Dietmar Maurer
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 5/7] api2: tape/backup: commit pool_writer even on error Dominik Csapak
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 6/7] api2: tape/restore: finish temporary catalog at the end Dominik Csapak
2021-07-22 13:41 ` [pbs-devel] [PATCH proxmox-backup v2 7/7] api2: tape: media: use MediaCatalog::snapshot_list for content listing Dominik Csapak
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=f3c6a566-69d5-3eb6-faf0-df6afc6ad91c@proxmox.com \
--to=dietmar@proxmox.com \
--cc=d.csapak@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