public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [RFC PATCH proxmox-backup 2/3] api: datastore: add upload_statistic to snapshot listing
Date: Mon, 27 Nov 2023 10:08:33 +0100	[thread overview]
Message-ID: <hwsuojhfurcporsapepnxkp4hn2pvwuyclqafr242gpzidhd4a@uqdtfssonvqj> (raw)
In-Reply-To: <20230801092954.1686860-3-d.csapak@proxmox.com>

On Tue, Aug 01, 2023 at 11:29:53AM +0200, Dominik Csapak wrote:
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> instead we could make a seperate api call that return just detailed info
> about a single snapshot on demand
>  pbs-api-types/src/datastore.rs |  3 +++
>  src/api2/admin/datastore.rs    | 22 +++++++++++++++++-----
>  2 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
> index 41db680c..39e3c09a 100644
> --- a/pbs-api-types/src/datastore.rs
> +++ b/pbs-api-types/src/datastore.rs
> @@ -1138,6 +1138,9 @@ pub struct SnapshotListItem {
>      /// Protection from prunes
>      #[serde(default)]
>      pub protected: bool,
> +    /// Upload statistics
> +    #[serde(skip_serializing_if = "Option::is_none")]
> +    pub upload_statistic: Option<UploadStatistic>,

^ SnapshotListItem has since been made PartialEq, so UploadStatistic
also needs to derive it.

>  }
>  
>  #[api(
> diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
> index a95031e7..f5b47cf4 100644
> --- a/src/api2/admin/datastore.rs
> +++ b/src/api2/admin/datastore.rs
> @@ -35,11 +35,11 @@ use pbs_api_types::{
>      print_ns_and_snapshot, print_store_and_ns, Authid, BackupContent, BackupNamespace, BackupType,
>      Counts, CryptMode, DataStoreListItem, DataStoreStatus, GarbageCollectionStatus, GroupListItem,
>      KeepOptions, Operation, PruneJobOptions, RRDMode, RRDTimeFrame, SnapshotListItem,
> -    SnapshotVerifyState, BACKUP_ARCHIVE_NAME_SCHEMA, BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA,
> -    BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, DATASTORE_SCHEMA, IGNORE_VERIFIED_BACKUPS_SCHEMA,
> -    MAX_NAMESPACE_DEPTH, NS_MAX_DEPTH_SCHEMA, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP,
> -    PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, PRIV_DATASTORE_READ, PRIV_DATASTORE_VERIFY,
> -    UPID_SCHEMA, VERIFICATION_OUTDATED_AFTER_SCHEMA,
> +    SnapshotVerifyState, UploadStatistic, BACKUP_ARCHIVE_NAME_SCHEMA, BACKUP_ID_SCHEMA,
> +    BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, DATASTORE_SCHEMA,
> +    IGNORE_VERIFIED_BACKUPS_SCHEMA, MAX_NAMESPACE_DEPTH, NS_MAX_DEPTH_SCHEMA, PRIV_DATASTORE_AUDIT,
> +    PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, PRIV_DATASTORE_READ,
> +    PRIV_DATASTORE_VERIFY, UPID_SCHEMA, VERIFICATION_OUTDATED_AFTER_SCHEMA,
>  };
>  use pbs_client::pxar::{create_tar, create_zip};
>  use pbs_config::CachedUserInfo;
> @@ -532,6 +532,16 @@ unsafe fn list_snapshots_blocking(
>  
>                  let size = Some(files.iter().map(|x| x.size.unwrap_or(0)).sum());
>  
> +                let upload_statistic = manifest.unprotected["chunk_upload_stats"].clone();
> +                let upload_statistic: Option<UploadStatistic> =

Note that `Value` as well as `&Value` are also both Deserialize*R*s,
so you can skip cloning the Value structure and go straight to the
`UploadStatistic` via:

    let upload_statistic = match Option::<UploadStatistic>::deserialize(
        &manifest.unprotected["chunk_upload_stats"],
    ) {
        ...
    }




  reply	other threads:[~2023-11-27  9:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  9:29 [pbs-devel] [RFC PATCH proxmox-backup 0/3] show upload statistics in gui Dominik Csapak
2023-08-01  9:29 ` [pbs-devel] [RFC PATCH proxmox-backup 1/3] api-types: make UploadStatistic an api type Dominik Csapak
2023-11-27  9:52   ` Thomas Lamprecht
2023-11-27 10:01     ` Dominik Csapak
2023-11-27 10:12       ` Thomas Lamprecht
2023-11-27 10:17         ` Dominik Csapak
2023-11-27 12:44           ` Wolfgang Bumiller
2023-11-27 14:57             ` Dominik Csapak
2023-08-01  9:29 ` [pbs-devel] [RFC PATCH proxmox-backup 2/3] api: datastore: add upload_statistic to snapshot listing Dominik Csapak
2023-11-27  9:08   ` Wolfgang Bumiller [this message]
2023-08-01  9:29 ` [pbs-devel] [PATCH proxmox-backup 3/3] ui: datastore content: add action to show upload statistics Dominik Csapak
2023-11-27  9:28   ` Thomas Lamprecht
2023-11-27 10:04     ` Dominik Csapak
2023-11-27 10:27       ` Thomas Lamprecht
2023-11-27 10:33         ` Dominik Csapak
2023-11-27 12:02           ` Thomas Lamprecht
2023-11-27 12:08             ` Dominik Csapak
2023-11-27 10:07     ` Thomas Lamprecht
2023-11-27 10:15       ` Dominik Csapak
2023-11-27 12:06         ` Thomas Lamprecht

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=hwsuojhfurcporsapepnxkp4hn2pvwuyclqafr242gpzidhd4a@uqdtfssonvqj \
    --to=w.bumiller@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal