Documentation ¶
Index ¶
- Constants
- Variables
- func Debugf(format string, a ...interface{})
- func Host(s string) (host string, err error)
- type Config
- type InterRecord
- func (r *InterRecord) Add(key, value string)
- 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, value string)
- func (r *InterRecord) String() string
- func (r *InterRecord) StringUniqID() (string, string)
- type Listener
- type MainConfig
- type NetBuffedReadWriter
- type Relayer
- type RelayerClient
- type RelayerConfig
- type Request
Constants ¶
const ( ModeSync = 0 ModeSmart = 1 )
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
Types ¶
type Config ¶
type Config struct { Comment string GOGC int //GCPercent Relayer []RelayerConfig }
func ReadConfig ¶
type InterRecord ¶
type InterRecord struct { Types int `json:"type,omitempty"` Timestamp float64 `json:"_ts,number"` Data map[string]interface{} `json:"data,omitempty"` Raw []byte `json:"raw,omitempty"` // 0 json, 1 Raw bytes }
func NewInterRecord ¶
func NewInterRecord() *InterRecord
NewInterRecord create a InterRecord struct to the connection
func (*InterRecord) Add ¶
func (r *InterRecord) Add(key, value string)
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, value string)
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 MainConfig
GlobalConfig is the configuration for the main programm
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 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 Listen string // Local url | also is streamName for Kinesis Firehose URL string // Redis/SQS url endpoint MaxConnections int // Pool management MaxIdleConnections int // Pool management Compress bool Uncompress bool 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 StreamName string // Kinesis/Firehose stream name GroupID string // Group ID for AWS SQS fifo Region string // AWS region Profile string // AWS Profile name Spin float64 // % of ignored messages }
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 ResponseChannel chan *redis.Resp // Channel 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