Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow setting zstd codec options #485

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Conversation

vpapp
Copy link
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
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
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
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
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
12 checks passed
@vpapp vpapp deleted the zstd-options branch January 9, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants