public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v4 proxmox-backup 0/5] introduce dedcated archive name api type
@ 2024-11-13 10:50 Christian Ebner
  2024-11-13 10:50 ` [pbs-devel] [PATCH v4 proxmox-backup 1/5] datastore: move `ArchiveType` to api types Christian Ebner
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Christian Ebner @ 2024-11-13 10:50 UTC (permalink / raw)
  To: pbs-devel

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.

Further, drop all archive name constants in favor of helper methods on
the api type to generate `BackupArchiveName` instances for them. This
allows for direct comparison with other `BackupArchiveName` instances.

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>
```

Changes since version 3:
- Removed catchall fallback to blob type, reworked type parsing logic
- Removed archive name constants in favor of helper methods to generate
  archive names for them
- Extended tests

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       | 238 ++++++++++++++++++++++++++-
 pbs-client/src/backup_reader.rs      |  18 +-
 pbs-client/src/backup_writer.rs      |  45 +++--
 pbs-client/src/pxar/tools.rs         |   3 +-
 pbs-client/src/tools/mod.rs          |  28 ++--
 pbs-datastore/src/backup_info.rs     |  21 +--
 pbs-datastore/src/datastore.rs       |   6 +-
 pbs-datastore/src/lib.rs             |   3 -
 pbs-datastore/src/manifest.rs        |  55 +++----
 pbs-datastore/src/snapshot_reader.rs |  11 +-
 proxmox-backup-client/src/catalog.rs |  35 ++--
 proxmox-backup-client/src/helper.rs  |   7 +-
 proxmox-backup-client/src/main.rs    | 138 +++++++++-------
 proxmox-backup-client/src/mount.rs   |  33 ++--
 proxmox-file-restore/src/main.rs     |  13 +-
 src/api2/admin/datastore.rs          |  70 ++++----
 src/api2/backup/mod.rs               |   3 +-
 src/api2/reader/mod.rs               |   7 +-
 src/api2/tape/restore.rs             |  17 +-
 src/backup/mod.rs                    |   3 -
 src/backup/verify.rs                 |   7 +-
 src/bin/proxmox_backup_debug/diff.rs |  16 +-
 src/server/pull.rs                   |  24 +--
 src/server/sync.rs                   |  10 +-
 tests/prune.rs                       |   5 +-
 25 files changed, 522 insertions(+), 294 deletions(-)

-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-11-22 10:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-13 10:50 [pbs-devel] [PATCH v4 proxmox-backup 0/5] introduce dedcated archive name api type Christian Ebner
2024-11-13 10:50 ` [pbs-devel] [PATCH v4 proxmox-backup 1/5] datastore: move `ArchiveType` to api types Christian Ebner
2024-11-13 10:50 ` [pbs-devel] [PATCH v4 proxmox-backup 2/5] api types: introduce `BackupArchiveName` type Christian Ebner
2024-11-13 10:50 ` [pbs-devel] [PATCH v4 proxmox-backup 3/5] client/server: use dedicated api type for all archive names Christian Ebner
2024-11-13 10:50 ` [pbs-devel] [PATCH v4 proxmox-backup 4/5] client: drop unused parse_archive_type helper Christian Ebner
2024-11-13 10:50 ` [pbs-devel] [PATCH v4 proxmox-backup 5/5] api types: add unit tests for backup archive name parsing Christian Ebner
2024-11-22 10:33 ` [pbs-devel] [PATCH v4 proxmox-backup 0/5] introduce dedcated archive name api type Christian Ebner

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