forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
37 lines (31 loc) · 1022 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package cassandra
import (
"fmt"
"github.com/elastic/beats/packetbeat/config"
"github.com/elastic/beats/packetbeat/protos"
gocql "github.com/elastic/beats/packetbeat/protos/cassandra/internal/gocql"
)
type cassandraConfig struct {
config.ProtocolCommon `config:",inline"`
SendRequestHeader bool `config:"send_request_header"`
SendResponseHeader bool `config:"send_response_header"`
Compressor string `config:"compressor"`
OPsIgnored []gocql.FrameOp `config:"ignored_ops"`
}
var (
defaultConfig = cassandraConfig{
ProtocolCommon: config.ProtocolCommon{
TransactionTimeout: protos.DefaultTransactionExpiration,
SendRequest: true,
SendResponse: true,
},
SendRequestHeader: true,
SendResponseHeader: true,
}
)
func (c *cassandraConfig) Validate() error {
if !(c.Compressor == "" || c.Compressor == "snappy") {
return fmt.Errorf("invalid compressor config: %s, only snappy supported", c.Compressor)
}
return nil
}