Documentation ¶
Index ¶
- Constants
- Variables
- func Hash(key []byte) uint32
- func OpFails() int64
- func OpQPS() int64
- func OpRedisErrors() int64
- func OpTotal() int64
- func ResetStats()
- func SessionsAlive() int64
- func SessionsTotal() int64
- type ApiClient
- func (c *ApiClient) FillSlots(slots ...*models.Slot) error
- func (c *ApiClient) ForceGC() error
- func (c *ApiClient) LogLevel(level log.LogLevel) error
- func (c *ApiClient) Model() (*models.Proxy, error)
- func (c *ApiClient) Overview() (*Overview, error)
- func (c *ApiClient) ResetStats() error
- func (c *ApiClient) RewatchSentinels() error
- func (c *ApiClient) SetSentinels(sentinel *models.Sentinel) error
- func (c *ApiClient) SetXAuth(name, auth string, token string)
- func (c *ApiClient) Shutdown() error
- func (c *ApiClient) Slots() ([]*models.Slot, error)
- func (c *ApiClient) Start() error
- func (c *ApiClient) Stats(flags StatsFlags) (*Stats, error)
- func (c *ApiClient) StatsSimple() (*Stats, error)
- func (c *ApiClient) XPing() error
- type BackendConn
- type Config
- type Delay
- type DelayExp2
- type Jodis
- type OpFlag
- type OpInfo
- type OpStats
- type Overview
- type Proxy
- func (s *Proxy) Close() error
- func (s *Proxy) Config() *Config
- func (s *Proxy) FillSlot(m *models.Slot) error
- func (s *Proxy) FillSlots(slots []*models.Slot) error
- func (s *Proxy) GetSentinels() ([]string, map[int]string)
- func (s *Proxy) HasSwitched() bool
- func (s *Proxy) IsClosed() bool
- func (s *Proxy) IsOnline() bool
- func (s *Proxy) Model() *models.Proxy
- func (s *Proxy) Overview(flags StatsFlags) *Overview
- func (s *Proxy) RewatchSentinels() error
- func (s *Proxy) SetSentinels(servers []string) error
- func (s *Proxy) Slots() []*models.Slot
- func (s *Proxy) Start() error
- func (s *Proxy) Stats(flags StatsFlags) *Stats
- func (s *Proxy) SwitchMasters(masters map[int]string) error
- func (s *Proxy) XAuth() string
- type Request
- type Router
- func (s *Router) Close()
- func (s *Router) FillSlot(m *models.Slot) error
- func (s *Router) GetGroupIds() map[int]bool
- func (s *Router) GetSlot(id int) *models.Slot
- func (s *Router) GetSlots() []*models.Slot
- func (s *Router) HasSwitched() bool
- func (s *Router) KeepAlive() error
- func (s *Router) Start()
- func (s *Router) SwitchMasters(masters map[int]string) error
- type RuntimeStats
- type Session
- type Slot
- type Stats
- type StatsFlags
- type SysUsage
Constants ¶
View Source
const ( FlagWrite = 1 << iota FlagMayWrite FlagNotAllow )
View Source
const ( StatsCmds = StatsFlags(1 << iota) StatsSlots StatsRuntime StatsFull = StatsFlags(^uint32(0)) )
View Source
const DefaultConfig = `` /* 2876-byte string literal not displayed */
View Source
const GOLDEN_RATIO_PRIME_32 = 0x9e370001
View Source
const MaxOpStrLen = 64
View Source
const MaxSlotNum = models.MaxSlotNum
Variables ¶
View Source
var ( ErrBackendConnReset = errors.New("backend conn reset") ErrRequestIsBroken = errors.New("request is broken") )
View Source
var ( ErrBadMultiBulk = errors.New("bad multi-bulk for command") ErrBadOpStrLen = errors.New("bad command length, too short or too long") )
View Source
var ( ErrClosedRouter = errors.New("use of closed router") ErrInvalidSlotId = errors.New("use of invalid slot id") )
View Source
var ( ErrTooManySessions = errors.New("too many sessions") ErrRouterNotOnline = errors.New("router is not online") ErrTooManyPipelinedRequests = errors.New("too many pipelined requests") )
View Source
var ( ErrSlotIsNotReady = errors.New("slot is not ready, may be offline") ErrRespIsRequired = errors.New("resp is required") )
View Source
var ErrClosedJodis = errors.New("use of closed jodis")
View Source
var ErrClosedProxy = errors.New("use of closed proxy")
View Source
var RespOK = redis.NewString([]byte("OK"))
Functions ¶
func OpRedisErrors ¶
func OpRedisErrors() int64
func ResetStats ¶
func ResetStats()
func SessionsAlive ¶
func SessionsAlive() int64
func SessionsTotal ¶
func SessionsTotal() int64
Types ¶
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
func NewApiClient ¶
func (*ApiClient) ResetStats ¶
func (*ApiClient) RewatchSentinels ¶
func (*ApiClient) StatsSimple ¶
type BackendConn ¶
type BackendConn struct {
// contains filtered or unexported fields
}
func NewBackendConn ¶
func NewBackendConn(addr string, config *Config) *BackendConn
func (*BackendConn) Addr ¶
func (bc *BackendConn) Addr() string
func (*BackendConn) Close ¶
func (bc *BackendConn) Close()
func (*BackendConn) IsConnected ¶
func (bc *BackendConn) IsConnected() bool
func (*BackendConn) KeepAlive ¶
func (bc *BackendConn) KeepAlive() bool
func (*BackendConn) PushBack ¶
func (bc *BackendConn) PushBack(r *Request)
type Config ¶
type Config struct { ProtoType string `toml:"proto_type" json:"proto_type"` ProxyAddr string `toml:"proxy_addr" json:"proxy_addr"` AdminAddr string `toml:"admin_addr" json:"admin_addr"` HostProxy string `toml:"-" json:"-"` HostAdmin string `toml:"-" json:"-"` JodisName string `toml:"jodis_name" json:"jodis_name"` JodisAddr string `toml:"jodis_addr" json:"jodis_addr"` JodisTimeout timesize.Duration `toml:"jodis_timeout" json:"jodis_timeout"` JodisCompatible bool `toml:"jodis_compatible" json:"jodis_compatible"` ProductName string `toml:"product_name" json:"product_name"` ProductAuth string `toml:"product_auth" json:"-"` ProxyDataCenter string `toml:"proxy_datacenter" json:"proxy_datacenter"` ProxyMaxClients int `toml:"proxy_max_clients" json:"proxy_max_clients"` ProxyMaxOffheapBytes bytesize.Int64 `toml:"proxy_max_offheap_size" json:"proxy_max_offheap_size"` ProxyHeapPlaceholder bytesize.Int64 `toml:"proxy_heap_placeholder" json:"proxy_heap_placeholder"` BackendPingPeriod timesize.Duration `toml:"backend_ping_period" json:"backend_ping_period"` BackendRecvBufsize bytesize.Int64 `toml:"backend_recv_bufsize" json:"backend_recv_bufsize"` BackendRecvTimeout timesize.Duration `toml:"backend_recv_timeout" json:"backend_recv_timeout"` BackendSendBufsize bytesize.Int64 `toml:"backend_send_bufsize" json:"backend_send_bufsize"` BackendSendTimeout timesize.Duration `toml:"backend_send_timeout" json:"backend_send_timeout"` BackendMaxPipeline int `toml:"backend_max_pipeline" json:"backend_max_pipeline"` BackendPrimaryOnly bool `toml:"backend_primary_only" json:"backend_primary_only"` BackendPrimaryParallel int `toml:"backend_primary_parallel" json:"backend_primary_parallel"` BackendReplicaParallel int `toml:"backend_replica_parallel" json:"backend_replica_parallel"` BackendKeepAlivePeriod timesize.Duration `toml:"backend_keepalive_period" json:"backend_keepalive_period"` SessionRecvBufsize bytesize.Int64 `toml:"session_recv_bufsize" json:"session_recv_bufsize"` SessionRecvTimeout timesize.Duration `toml:"session_recv_timeout" json:"session_recv_timeout"` SessionSendBufsize bytesize.Int64 `toml:"session_send_bufsize" json:"session_send_bufsize"` SessionSendTimeout timesize.Duration `toml:"session_send_timeout" json:"session_send_timeout"` SessionMaxPipeline int `toml:"session_max_pipeline" json:"session_max_pipeline"` SessionKeepAlivePeriod timesize.Duration `toml:"session_keepalive_period" json:"session_keepalive_period"` SessionBreakOnFailure bool `toml:"session_break_on_failure" json:"session_break_on_failure"` MetricsReportServer string `toml:"metrics_report_server" json:"metrics_report_server"` MetricsReportPeriod timesize.Duration `toml:"metrics_report_period" json:"metrics_report_period"` MetricsReportInfluxdbServer string `toml:"metrics_report_influxdb_server" json:"metrics_report_influxdb_server"` MetricsReportInfluxdbPeriod timesize.Duration `toml:"metrics_report_influxdb_period" json:"metrics_report_influxdb_period"` MetricsReportInfluxdbUsername string `toml:"metrics_report_influxdb_username" json:"metrics_report_influxdb_username"` MetricsReportInfluxdbPassword string `toml:"metrics_report_influxdb_password" json:"-"` MetricsReportInfluxdbDatabase string `toml:"metrics_report_influxdb_database" json:"metrics_report_influxdb_database"` }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
func (*Config) LoadFromFile ¶
type DelayExp2 ¶
func (*DelayExp2) SleepWithCancel ¶
type Jodis ¶
type Jodis struct {
// contains filtered or unexported fields
}
func (*Jodis) IsWatching ¶
type OpStats ¶
type OpStats struct { OpStr string `json:"opstr"` Calls int64 `json:"calls"` Usecs int64 `json:"usecs"` UsecsPercall int64 `json:"usecs_percall"` Fails int64 `json:"fails"` RedisErrType int64 `json:"redis_errtype"` }
func GetOpStatsAll ¶
func GetOpStatsAll() []*OpStats
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) HasSwitched ¶
func (*Proxy) Overview ¶
func (s *Proxy) Overview(flags StatsFlags) *Overview
func (*Proxy) RewatchSentinels ¶
func (*Proxy) SetSentinels ¶
func (*Proxy) Stats ¶
func (s *Proxy) Stats(flags StatsFlags) *Stats
type Request ¶
type Request struct { Multi []*redis.Resp Start int64 Batch *sync.WaitGroup Group *sync.WaitGroup OpStr string OpFlag Broken *atomic2.Bool *redis.Resp Err error Coalesce func() error }
func (*Request) MakeSubRequest ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) GetGroupIds ¶
func (*Router) HasSwitched ¶
type RuntimeStats ¶
type RuntimeStats struct { General struct { Alloc uint64 `json:"alloc"` Sys uint64 `json:"sys"` Lookups uint64 `json:"lookups"` Mallocs uint64 `json:"mallocs"` Frees uint64 `json:"frees"` } `json:"general"` Heap struct { Alloc uint64 `json:"alloc"` Sys uint64 `json:"sys"` Idle uint64 `json:"idle"` Inuse uint64 `json:"inuse"` Objects uint64 `json:"objects"` } `json:"heap"` GC struct { Num uint32 `json:"num"` CPUFraction float64 `json:"cpu_fraction"` TotalPauseMs uint64 `json:"total_pausems"` } `json:"gc"` NumProcs int `json:"num_procs"` NumGoroutines int `json:"num_goroutines"` NumCgoCall int64 `json:"num_cgo_call"` MemOffheap int `json:"mem_offheap"` }
type Session ¶
type Session struct { Conn *redis.Conn Ops int64 CreateUnix int64 LastOpUnix int64 // contains filtered or unexported fields }
func (*Session) CloseReaderWithError ¶
func (*Session) CloseWithError ¶
type Stats ¶
type Stats struct { Online bool `json:"online"` Closed bool `json:"closed"` Sentinels struct { Servers []string `json:"servers,omitempty"` Masters map[string]string `json:"masters,omitempty"` Switched bool `json:"switched,omitempty"` } `json:"sentinels"` Ops struct { Total int64 `json:"total"` Fails int64 `json:"fails"` Redis struct { Errors int64 `json:"errors"` } `json:"redis"` QPS int64 `json:"qps"` Cmd []*OpStats `json:"cmd,omitempty"` } `json:"ops"` Sessions struct { Total int64 `json:"total"` Alive int64 `json:"alive"` } `json:"sessions"` Rusage struct { Now string `json:"now"` CPU float64 `json:"cpu"` Mem int64 `json:"mem"` Raw *utils.Usage `json:"raw,omitempty"` } `json:"rusage"` Backend struct { PrimaryOnly bool `json:"primary_only"` } `json:"backend"` Runtime *RuntimeStats `json:"runtime,omitempty"` }
type StatsFlags ¶
type StatsFlags uint32
func (StatsFlags) HasBit ¶
func (s StatsFlags) HasBit(m StatsFlags) bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.