-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1477 from klauspost/use-pure-go-zstd
Remove cgo zstd package
- Loading branch information
Showing
6 changed files
with
33 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package sarama | ||
|
||
import ( | ||
"github.com/klauspost/compress/zstd" | ||
"sync" | ||
) | ||
|
||
var ( | ||
zstdDec *zstd.Decoder | ||
zstdEnc *zstd.Encoder | ||
|
||
zstdEncOnce, zstdDecOnce sync.Once | ||
) | ||
|
||
func zstdDecompress(dst, src []byte) ([]byte, error) { | ||
zstdDecOnce.Do(func() { | ||
zstdDec, _ = zstd.NewReader(nil) | ||
}) | ||
return zstdDec.DecodeAll(src, dst) | ||
} | ||
|
||
func zstdCompress(dst, src []byte) ([]byte, error) { | ||
zstdEncOnce.Do(func() { | ||
zstdEnc, _ = zstd.NewWriter(nil, zstd.WithZeroFrames(true)) | ||
}) | ||
return zstdEnc.EncodeAll(src, dst), nil | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.