Skip to content
This repository was archived by the owner on Jan 18, 2026. It is now read-only.

feat: allow setting zstd codec options#485

Merged
nrwiersma merged 1 commit intohamba:mainfrom
vpapp:zstd-options
Jan 9, 2025
Merged

feat: allow setting zstd codec options#485
nrwiersma merged 1 commit intohamba:mainfrom
vpapp:zstd-options

Conversation

@vpapp
Copy link
Copy Markdown
Contributor

@vpapp vpapp commented Jan 6, 2025

Currently the ZStandard codec is used with its default settings, which in some cases are less than optimal.

This change allows setting options in the codec to configure it according to needs.

Copy link
Copy Markdown
Member

@nrwiersma nrwiersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick

ocf/codec.go Outdated
DOptions []zstd.DOption
}

func resolveCodec(name CodecName, lvl int, zstdOpts zstdOptions) (Codec, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would be best to have a codecOptions or codecConfig struct here containing the compression level and zstd options. Would make this cleaner in the long run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going for minimal diffs, but totally agree with having a codecOptions.

Updated, and also added a couple of test cases to ensure options make it to the zstd codec for both encoding and decoding.

Copy link
Copy Markdown
Member

@nrwiersma nrwiersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nrwiersma nrwiersma merged commit 0ebcdff into hamba:main Jan 9, 2025
@vpapp vpapp deleted the zstd-options branch January 9, 2025 14:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants