[pbs-devel] [PATCH v3 proxmox-backup 0/5] introduce dedcated archive name api type

Christian Ebner c.ebner at proxmox.com
Thu Oct 24 10:01:45 CEST 2024


There is currently no dedicated api type for the archive names, given
as input parameters to several api methods.

This patches introduce a dedicated type for archive names, in order
to collect the code for checks and eventual mappings into one
location and reduce possible unintentional misuse by passing
incorrect argument values to the functions and methods consuming
the archive names.

As a positive side effect, the mapping now allows also for the server
archive type extensions to be optionally passed as input to several
commands, e.g.
```
proxmox-backup-client restore <snapshot> <name>.pxar.didx <target>
```
is now valid, being equal to
```
proxmox-backup-client restore <snapshot> <name.pxar <target>
```

@Gabriel: Did not include your git trailers since there was some
rebasing, please double check if the changes are still fine by you.

Changes since version 2:
- Rebased onto current master
- Amended commit messages

Changes since version 1 (thanks @Gabriel):
- Rebased onto current master
- Added unit tests for archive name parsing
- Added missing check for invalid archive names ending with '/'
- Inlined variable names for format strings
- Import implemented traits at top

Christian Ebner (5):
  datastore: move `ArchiveType` to api types
  api types: introduce `BackupArchiveName` type
  client/server: use dedicated api type for all archive names
  client: drop unused parse_archive_type helper
  api types: add unit tests for backup archive name parsing

 pbs-api-types/src/datastore.rs       | 183 ++++++++++++++++++++++++++-
 pbs-client/src/backup_reader.rs      |  14 +-
 pbs-client/src/backup_writer.rs      |  41 +++---
 pbs-client/src/pxar/tools.rs         |   3 +-
 pbs-client/src/tools/mod.rs          |  24 ++--
 pbs-datastore/src/datastore.rs       |   6 +-
 pbs-datastore/src/manifest.rs        |  52 +++-----
 pbs-datastore/src/snapshot_reader.rs |   4 +-
 proxmox-backup-client/src/catalog.rs |  31 +++--
 proxmox-backup-client/src/helper.rs  |   7 +-
 proxmox-backup-client/src/main.rs    | 127 ++++++++++---------
 proxmox-backup-client/src/mount.rs   |  33 ++---
 proxmox-file-restore/src/main.rs     |  12 +-
 src/api2/admin/datastore.rs          |  60 ++++-----
 src/api2/backup/mod.rs               |   3 +-
 src/api2/reader/mod.rs               |   7 +-
 src/api2/tape/restore.rs             |  10 +-
 src/backup/verify.rs                 |   7 +-
 src/bin/proxmox_backup_debug/diff.rs |  16 +--
 src/server/pull.rs                   |  18 +--
 20 files changed, 417 insertions(+), 241 deletions(-)

-- 
2.39.5





More information about the pbs-devel mailing list