| 1 |
//go:build datadog |
| 2 |
// +build datadog |
| 3 |
|
| 4 |
package desync |
| 5 |
|
| 6 |
import ( |
| 7 |
"github.com/DataDog/zstd" |
| 8 |
) |
| 9 |
|
| 10 |
// Compress a block using the only (currently) supported algorithm |
| 11 |
func Compress(b []byte) ([]byte, error) { |
| 12 |
return zstd.CompressLevel(nil, b, 3) |
| 13 |
} |
| 14 |
|
| 15 |
// Decompress a block using the only supported algorithm. If you already have |
| 16 |
// a buffer it can be passed into out and will be used. If out=nil, a buffer |
| 17 |
// will be allocated. |
| 18 |
func Decompress(out, in []byte) ([]byte, error) { |
| 19 |
return zstd.Decompress(out, in) |
| 20 |
} |