Documentation ¶
Index ¶
- Constants
- Variables
- func Debugf(format string, a ...interface{})
- func GetGzipReader(r io.Reader) (*gzip.Reader, error)
- func GetGzipWriter(w io.Writer) *gzip.Writer
- func GetGzipWriterLevel(w io.Writer, level int) *gzip.Writer
- func Host(s string) (host string, err error)
- func PutGzipReader(zr *gzip.Reader)
- func PutGzipWriter(zw *gzip.Writer)
- type Config
- type InterRecord
- func (r *InterRecord) Add(key string, value interface{})
- func (r *InterRecord) Bytes() []byte
- func (r *InterRecord) BytesUniqID() ([]byte, string)
- func (r *InterRecord) Len() int
- func (r *InterRecord) Mhset(key, k string, v interface{})
- func (r *InterRecord) Sadd(key string, value interface{})
- func (r *InterRecord) String() string
- func (r *InterRecord) StringUniqID() (string, string)
- type Listener
- type MainConfig
- type NetBuffedReadWriter
- type NetReadWriter
- type Relayer
- type RelayerClient
- type RelayerConfig
- type Request
Constants ¶
const ( ModeSync = 0 ModeSmart = 1 )
const (
GzCompressionLevel = 1
)
const (
MinCompressSize = 256
)
const (
UnknownDB = -1
)
Variables ¶
var NoDeadline = time.Time{}
Functions ¶
func Debugf ¶
func Debugf(format string, a ...interface{})
Debugf function, if the debug flag is set, then display. Do nothing otherwise If Docker is in damon mode, also send the debug info on the socket Convenience debug function, courtesy of http://github.com/dotcloud/docker
func PutGzipReader ¶
func PutGzipWriter ¶
Types ¶
type Config ¶
type Config struct { Comment string GOGC int //GCPercent Relayer []RelayerConfig BufferPoolSize int // If > 0 it will use bybufferpools in redis.Resp if size > BufferPoolSize }
func ReadConfig ¶
type InterRecord ¶
type InterRecord struct { Types int `json:"type,omitempty"` Ts int64 `json:"ts,number"` Data map[string]interface{} `json:"data,omitempty"` Raw []byte `json:"raw,omitempty"` // 0 json, 1 Raw bytes // contains filtered or unexported fields }
func NewInterRecord ¶
func NewInterRecord() *InterRecord
NewInterRecord create a InterRecord struct to the connection
func (*InterRecord) Add ¶
func (r *InterRecord) Add(key string, value interface{})
func (*InterRecord) BytesUniqID ¶
func (r *InterRecord) BytesUniqID() ([]byte, string)
BytesUniqID return the record content in bytes and the uniq ID
func (*InterRecord) Len ¶
func (r *InterRecord) Len() int
Len return the bytes used in Raw or the len of the map data
func (*InterRecord) Mhset ¶
func (r *InterRecord) Mhset(key, k string, v interface{})
func (*InterRecord) Sadd ¶
func (r *InterRecord) Sadd(key string, value interface{})
func (*InterRecord) String ¶
func (r *InterRecord) String() string
String return the record in string format
func (*InterRecord) StringUniqID ¶
func (r *InterRecord) StringUniqID() (string, string)
StringUniqID build a uniq ID based on the content in string format
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
func NewListener(c RelayerConfig) (l *Listener, e error)
MewListener check sockets and files and return a listener alread listening
type MainConfig ¶
var ( // GlobalConfig is the configuration for the main programm GlobalConfig MainConfig )
type NetBuffedReadWriter ¶
type NetBuffedReadWriter struct {
// contains filtered or unexported fields
}
NetBuffedReadWriter is a reader-writer buffered net connection
func NewNetReadWriter ¶
func NewNetReadWriter(conn net.Conn, readTimeout, writeTimeout time.Duration) *NetBuffedReadWriter
func (*NetBuffedReadWriter) Flush ¶
func (nb *NetBuffedReadWriter) Flush() (e error)
type NetReadWriter ¶
type NetReadWriter struct {
// contains filtered or unexported fields
}
NetBuffedReadWriter is a reader-writer buffered net connection
func NewSingleReadWriter ¶
func NewSingleReadWriter(conn net.Conn, readTimeout, writeTimeout time.Duration) *NetReadWriter
NewSingleReadWriter returns a single io.reaWriter with timeout handling
func (*NetReadWriter) Flush ¶
func (rw *NetReadWriter) Flush() (e error)
Flush is a no-op for this non buffered
type Relayer ¶
type Relayer interface { Start() error Reload(*RelayerConfig) error Exit() }
type RelayerClient ¶
type RelayerClient interface { IsValid() bool Exit() Send(r interface{}) error Reload(*RelayerConfig) }
type RelayerConfig ¶
type RelayerConfig struct { Protocol string // redis | redis2 | redis-cluster | redis-plus | firehose Mode string // smart | sync Critical bool Listen string // Local url | also is streamName for Kinesis Firehose URL string // Redis/SQS url endpoint MaxConnections int // Pool management MaxIdleConnections int // Pool management MinIdleConnections int // Pool management MaxConnectedSecs int // Pool management Compress bool Uncompress bool Gzip int // If > 0 is enabled and is the compression level Gunzip bool // Read with uncompress UseBufferPool bool // used by the http proxy, enable or diable buffer pool // Parallel bool // For redis-cluster, send parallel requests Pipeline int // If > 0 it does pipelining (buffering) Timeout int // Timeout in seconds to wait for responses from the server MaxRecords int // To send in batch to Kinesis Buffer int // Size for the channel (queue for Kinesis/Firehose) StreamName string // Kinesis/Firehose stream name GroupID string // Group ID for AWS SQS fifo Region string // AWS region Profile string // AWS Profile name Concat bool // Kinesis/Firehose contact messages, valid just for S3 backend Path string // Path were to store the logs S3Bucket string // S3 Bucket name Shards int // Shards for FS plugin Writers int // Writers BY shard (each shard will have the number of workers defined here) BreakMultiplier int // Limit to declare as failing. Total writes plus this value AsynCommands string }
func (*RelayerConfig) Host ¶
func (c *RelayerConfig) Host() (host string)
func (*RelayerConfig) ListenHost ¶
func (c *RelayerConfig) ListenHost() (host string)
func (*RelayerConfig) ListenScheme ¶
func (c *RelayerConfig) ListenScheme() (scheme string)
func (*RelayerConfig) Scheme ¶
func (c *RelayerConfig) Scheme() (scheme string)
func (*RelayerConfig) Type ¶
func (c *RelayerConfig) Type() int
Type return the value of Mode coded in a integer
type Request ¶
type Request struct { Resp *redis.Resp Items []*redis.Resp Command string Conn io.Writer // Writer to send the response to the original client Database int // The current database at the time the request was issued }
Request stores the data for each client request
func NewRequest ¶
func NewRequest(resp *redis.Resp, c *RelayerConfig) *Request