[pbs-devel] [RFC proxmox-backup v3 1/2] pbs-api-types: more flexible HumanByte type
t.lamprecht at proxmox.com
Sat Nov 20 22:55:21 CET 2021
On 18.11.21 08:29, Dietmar Maurer wrote:
> This implements a parser for human readabkle byte sizes.
> Examples: "1KB", "1.5 Mib", "3T"
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> pbs-api-types/src/human_byte.rs | 353 ++++++++++++++++++++++++++++++
> pbs-api-types/src/lib.rs | 3 +
> pbs-client/src/backup_writer.rs | 19 +-
> pbs-datastore/src/datastore.rs | 13 +-
> pbs-tools/Cargo.toml | 1 +
> pbs-tools/src/format.rs | 55 +----
> src/bin/proxmox-tape.rs | 7 +-
> src/server/email_notifications.rs | 5 +-
> 8 files changed, 382 insertions(+), 74 deletions(-)
> create mode 100644 pbs-api-types/src/human_byte.rs
I replaced this commit by four separate ones:
42ba4cd3 human byte: make proper proxmox API type
ab1c07a6 human byte: add from string parser
930a7146 human byte: add proper unit type and support base-10
a58a5cf7 move HumanByte to pbs-abi-types crate
I based it quite a bit on the semantics of yours. But made a few changes, the
two commits in the middle contain a bit more info in the commit message.
Also incorporated a bit of your code 1:1 and all of your (adapted) tests, plus
added a few more.
IMO the result is OK'ish and definitively better than my lousy original one, if
you find issues or don't like some changes feel free to adapt, thanks!
More information about the pbs-devel