1 Star 0 Fork 0

zhangjungang/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
compressor.go 1.00 KB
一键复制 编辑 原始数据 按行查看 历史
medcl 提交于 2016-08-17 19:23 . Support protocol: Cassandra (#1959)
// Copyright (c) 2012 The gocql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.\
package cassandra
import (
"github.com/golang/snappy"
)
type Compressor interface {
Name() string
Encode(data []byte) ([]byte, error)
Decode(data []byte) ([]byte, error)
}
const Snappy string = "snappy"
// SnappyCompressor implements the Compressor interface and can be used to
// compress incoming and outgoing frames. The snappy compression algorithm
// aims for very high speeds and reasonable compression.
type SnappyCompressor struct{}
func (s SnappyCompressor) Name() string {
return Snappy
}
func (s SnappyCompressor) Encode(data []byte) ([]byte, error) {
return snappy.Encode(nil, data), nil
}
func (s SnappyCompressor) Decode(data []byte) ([]byte, error) {
return snappy.Decode(nil, data)
}
const LZ4 string = "lz4"
type LZ4Compressor struct {
//TODO
}
const Deflate string = "deflate"
type DeflateCompressor struct {
//TODO
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v5.2.1

搜索帮助