public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] data_blob: add TODO comment for zstd api
@ 2024-08-08  8:18 Dominik Csapak
  2024-08-30  9:00 ` [pbs-devel] applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2024-08-08  8:18 UTC (permalink / raw)
  To: pbs-devel

we currently use the behavior of zstd that is not part of the public
api, so this is at risk to be changed without notice.

There is a public api that we could use, but it's only available
with zstd_sys >= 2.0.9, which at this time, is not yet packaged for/by
us.

Add a comment that we can use the public api for this when the
new version of the crate gets available.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
after looking whom to report that the api would benefit from better
error handling, i noticed that zstd_sys already has what we need, but
only in a newer version, which we currently don't package

 pbs-datastore/src/data_blob.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pbs-datastore/src/data_blob.rs b/pbs-datastore/src/data_blob.rs
index fd84f4be..0fb4d44c 100644
--- a/pbs-datastore/src/data_blob.rs
+++ b/pbs-datastore/src/data_blob.rs
@@ -556,6 +556,8 @@ impl<'a, 'b> DataChunkBuilder<'a, 'b> {
 ///
 /// There is a test below to ensure we catch any change in the interface or internal value.
 fn zstd_error_is_target_too_small(err: usize) -> bool {
+    // TODO: when zstd_sys >= 2.0.9 is available, we can use
+    // ZSTD_getErrorCode and the enum to use the public zstd API
     let (real_code, _) = 0usize.overflowing_sub(err);
     // see ZSTD_ErrorCode in https://github.com/facebook/zstd/blob/dev/lib/zstd_errors.h
     real_code == 70 // ZSTD_error_dstSize_tooSmall
-- 
2.39.2
    


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


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

* [pbs-devel] applied: [PATCH proxmox-backup] data_blob: add TODO comment for zstd api
  2024-08-08  8:18 [pbs-devel] [PATCH proxmox-backup] data_blob: add TODO comment for zstd api Dominik Csapak
@ 2024-08-30  9:00 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2024-08-30  9:00 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: pbs-devel

applied, thanks

On Thu, Aug 08, 2024 at 10:18:25AM GMT, Dominik Csapak wrote:
> we currently use the behavior of zstd that is not part of the public
> api, so this is at risk to be changed without notice.
> 
> There is a public api that we could use, but it's only available
> with zstd_sys >= 2.0.9, which at this time, is not yet packaged for/by
> us.
> 
> Add a comment that we can use the public api for this when the
> new version of the crate gets available.
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> after looking whom to report that the api would benefit from better
> error handling, i noticed that zstd_sys already has what we need, but
> only in a newer version, which we currently don't package
> 
>  pbs-datastore/src/data_blob.rs | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/pbs-datastore/src/data_blob.rs b/pbs-datastore/src/data_blob.rs
> index fd84f4be..0fb4d44c 100644
> --- a/pbs-datastore/src/data_blob.rs
> +++ b/pbs-datastore/src/data_blob.rs
> @@ -556,6 +556,8 @@ impl<'a, 'b> DataChunkBuilder<'a, 'b> {
>  ///
>  /// There is a test below to ensure we catch any change in the interface or internal value.
>  fn zstd_error_is_target_too_small(err: usize) -> bool {
> +    // TODO: when zstd_sys >= 2.0.9 is available, we can use
> +    // ZSTD_getErrorCode and the enum to use the public zstd API
>      let (real_code, _) = 0usize.overflowing_sub(err);
>      // see ZSTD_ErrorCode in https://github.com/facebook/zstd/blob/dev/lib/zstd_errors.h
>      real_code == 70 // ZSTD_error_dstSize_tooSmall
> -- 
> 2.39.2


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


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

end of thread, other threads:[~2024-08-30  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-08  8:18 [pbs-devel] [PATCH proxmox-backup] data_blob: add TODO comment for zstd api Dominik Csapak
2024-08-30  9:00 ` [pbs-devel] applied: " Wolfgang Bumiller

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