mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/encoding: substitute CompressZSTD with CompressZSTDLevel
This commit is contained in:
parent
08b889ef09
commit
19b6643e5c
2 changed files with 2 additions and 10 deletions
|
@ -4,14 +4,6 @@ import (
|
|||
"github.com/valyala/gozstd"
|
||||
)
|
||||
|
||||
// CompressZSTD compresses src, appends the result to dst and returns
|
||||
// the appended dst.
|
||||
//
|
||||
// src must be non-empty.
|
||||
func CompressZSTD(dst, src []byte) []byte {
|
||||
return gozstd.CompressLevel(dst, src, 5)
|
||||
}
|
||||
|
||||
// CompressZSTDLevel appends compressed src to dst and returns
|
||||
// the appended dst.
|
||||
//
|
||||
|
|
|
@ -17,7 +17,7 @@ func TestCompressDecompressZSTD(t *testing.T) {
|
|||
}
|
||||
|
||||
func testCompressDecompressZSTD(t *testing.T, b []byte) {
|
||||
bc := CompressZSTD(nil, b)
|
||||
bc := CompressZSTDLevel(nil, b, 5)
|
||||
bNew, err := DecompressZSTD(nil, bc)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error when decompressing b=%x from bc=%x: %s", b, bc, err)
|
||||
|
@ -27,7 +27,7 @@ func testCompressDecompressZSTD(t *testing.T, b []byte) {
|
|||
}
|
||||
|
||||
prefix := []byte{1, 2, 33}
|
||||
bcNew := CompressZSTD(prefix, b)
|
||||
bcNew := CompressZSTDLevel(prefix, b, 5)
|
||||
if string(bcNew[:len(prefix)]) != string(prefix) {
|
||||
t.Fatalf("invalid prefix for b=%x; got\n%x; expecting\n%x", b, bcNew[:len(prefix)], prefix)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue