Skip to content

Commit 53da82e

Browse files
committed
feat: Expose CompressDictLevel public API from PR valyala#63
Make CompressDictLevel part of the public API instead of being internal. This allows users to specify both dictionary and compression level parameters together, which is useful for advanced compression scenarios. Previously CompressDict used level 0 which barely compresses. Based on valyala#63
1 parent a93cbb3 commit 53da82e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

gozstd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@ const DefaultCompressionLevel = 3 // Obtained from ZSTD_CLEVEL_DEFAULT.
4848

4949
// Compress appends compressed src to dst and returns the result.
5050
func Compress(dst, src []byte) []byte {
51-
return compressDictLevel(dst, src, nil, DefaultCompressionLevel)
51+
return CompressDictLevel(dst, src, nil, DefaultCompressionLevel)
5252
}
5353

5454
// CompressLevel appends compressed src to dst and returns the result.
5555
//
5656
// The given compressionLevel is used for the compression.
5757
func CompressLevel(dst, src []byte, compressionLevel int) []byte {
58-
return compressDictLevel(dst, src, nil, compressionLevel)
58+
return CompressDictLevel(dst, src, nil, compressionLevel)
5959
}
6060

6161
// CompressDict appends compressed src to dst and returns the result.
6262
//
6363
// The given dictionary is used for the compression.
6464
func CompressDict(dst, src []byte, cd *CDict) []byte {
65-
return compressDictLevel(dst, src, cd, 0)
65+
return CompressDictLevel(dst, src, cd, 0)
6666
}
6767

68-
func compressDictLevel(dst, src []byte, cd *CDict, compressionLevel int) []byte {
68+
func CompressDictLevel(dst, src []byte, cd *CDict, compressionLevel int) []byte {
6969
var cctx, cctxDict *cctxWrapper
7070
if cd == nil {
7171
cctx = cctxPool.Get().(*cctxWrapper)

0 commit comments

Comments
 (0)