Versions in this module Expand all Collapse all v1 v1.0.0 May 24, 2019 Changes in this version + const RespEOF + const RespError + const RespFieldList + const RespNoop + const RespOK + const RespPrepare + const RespResult + var DefaultCapability = ... + func NewProxyInfo(cfg *models.Proxy, addr string) (*models.ProxyInfo, error) + type AdminServer struct + func NewAdminServer(proxy *Server, cfg *models.Proxy) (*AdminServer, error) + func (s *AdminServer) Close() error + func (s *AdminServer) Run() + type ClientConn struct + func NewClientConn(c *mysql.Conn, manager *Manager) *ClientConn + type HandshakeResponseInfo struct + AuthResponse []byte + CollationID mysql.CollationID + Database string + Salt []byte + User string + type Manager struct + func CreateManager(cfg *models.Proxy, namespaceConfigs map[string]*models.Namespace) (*Manager, error) + func LoadAndCreateManager(cfg *models.Proxy) (*Manager, error) + func NewManager() *Manager + func (m *Manager) CheckPassword(user string, salt, auth []byte) (bool, string) + func (m *Manager) CheckUser(user string) bool + func (m *Manager) Close() + func (m *Manager) ConfigFingerprint() string + func (m *Manager) DeleteNamespace(name string) error + func (m *Manager) GetNamespace(name string) *Namespace + func (m *Manager) GetNamespaceByUser(userName, password string) string + func (m *Manager) GetStatisticManager() *StatisticManager + func (m *Manager) RecordBackendSQLMetrics(reqCtx *util.RequestContext, namespace string, sql, backendAddr string, ...) + func (m *Manager) RecordSessionSQLMetrics(reqCtx *util.RequestContext, namespace string, sql string, startTime time.Time, ...) + func (m *Manager) ReloadNamespaceCommit(name string) error + func (m *Manager) ReloadNamespacePrepare(namespaceConfig *models.Namespace) error + type Namespace struct + func NewNamespace(namespaceConfig *models.Namespace) (*Namespace, error) + func (n *Namespace) Close(delay bool) + func (n *Namespace) DumpToJSON() []byte + func (n *Namespace) GetAllowedDBs() []string + func (n *Namespace) GetBackendErrorSQLFingerprint(md5 string) (string, bool) + func (n *Namespace) GetBackendErrorSQLFingerprints() map[string]string + func (n *Namespace) GetBackendSlowSQLFingerprint(md5 string) (string, bool) + func (n *Namespace) GetBackendSlowSQLFingerprints() map[string]string + func (n *Namespace) GetCachedPlan(db, sql string) (plan.Plan, bool) + func (n *Namespace) GetDefaultCharset() string + func (n *Namespace) GetDefaultCollationID() mysql.CollationID + func (n *Namespace) GetDefaultPhyDB(dbname string) (string, error) + func (n *Namespace) GetErrorSQLFingerprint(md5 string) (string, bool) + func (n *Namespace) GetErrorSQLFingerprints() map[string]string + func (n *Namespace) GetName() string + func (n *Namespace) GetRouter() *router.Router + func (n *Namespace) GetSequences() *sequence.SequenceManager + func (n *Namespace) GetSlice(name string) *backend.Slice + func (n *Namespace) GetSlowSQLFingerprint(md5 string) (string, bool) + func (n *Namespace) GetSlowSQLFingerprints() map[string]string + func (n *Namespace) GetUserProperty(user string) int + func (n *Namespace) IsAllowWrite(user string) bool + func (n *Namespace) IsAllowedDB(dbname string) bool + func (n *Namespace) IsClientIPAllowed(clientIP net.IP) bool + func (n *Namespace) IsRWSplit(user string) bool + func (n *Namespace) IsSQLAllowed(reqCtx *util.RequestContext, sql string) bool + func (n *Namespace) IsStatisticUser(user string) bool + func (n *Namespace) SetBackendErrorSQLFingerprint(md5, fingerprint string) + func (n *Namespace) SetBackendSlowSQLFingerprint(md5, fingerprint string) + func (n *Namespace) SetCachedPlan(db, sql string, p plan.Plan) + func (n *Namespace) SetErrorSQLFingerprint(md5, fingerprint string) + func (n *Namespace) SetSlowSQLFingerprint(md5, fingerprint string) + type NamespaceManager struct + func CreateNamespaceManager(namespaceConfigs map[string]*models.Namespace) *NamespaceManager + func NewNamespaceManager() *NamespaceManager + func ShallowCopyNamespaceManager(nsMgr *NamespaceManager) *NamespaceManager + func (n *NamespaceManager) ConfigFingerprint() string + func (n *NamespaceManager) DeleteNamespace(ns string) + func (n *NamespaceManager) GetNamespace(namespace string) *Namespace + func (n *NamespaceManager) GetNamespaces() map[string]*Namespace + func (n *NamespaceManager) RebuildNamespace(config *models.Namespace) error + type Response struct + Data interface{} + RespType int + Status uint16 + func CreateEOFResponse(status uint16) Response + func CreateErrorResponse(status uint16, err error) Response + func CreateFieldListResponse(status uint16, fl []*mysql.Field) Response + func CreateNoopResponse() Response + func CreateOKResponse(status uint16) Response + func CreatePrepareResponse(status uint16, stmt *Stmt) Response + func CreateResultResponse(status uint16, result *mysql.Result) Response + type SQLFingerprint struct + ErrorSQL map[string]string + SlowSQL map[string]string + type Server struct + func NewServer(cfg *models.Proxy, manager *Manager) (*Server, error) + func (s *Server) Close() error + func (s *Server) DeleteNamespace(name string) error + func (s *Server) Listener() net.Listener + func (s *Server) ReloadNamespaceCommit(name string) error + func (s *Server) ReloadNamespacePrepare(name string, client models.Client) error + func (s *Server) Run() error + type Session struct + func (cc *Session) Close() + func (cc *Session) Handshake() error + func (cc *Session) IsAllowConnect() bool + func (cc *Session) IsClosed() bool + func (cc *Session) Run() + type SessionExecutor struct + func (se *SessionExecutor) ExecuteCommand(cmd byte, data []byte) Response + func (se *SessionExecutor) ExecuteSQL(reqCtx *util.RequestContext, slice, db, sql string) (*mysql.Result, error) + func (se *SessionExecutor) ExecuteSQLs(reqCtx *util.RequestContext, sqls map[string]map[string][]string) ([]*mysql.Result, error) + func (se *SessionExecutor) GetCharset() string + func (se *SessionExecutor) GetCollationID() mysql.CollationID + func (se *SessionExecutor) GetDatabase() string + func (se *SessionExecutor) GetLastInsertID() uint64 + func (se *SessionExecutor) GetNamespace() *Namespace + func (se *SessionExecutor) GetStatus() uint16 + func (se *SessionExecutor) GetVariables() *mysql.SessionVariables + func (se *SessionExecutor) Parse(sql string) (ast.StmtNode, error) + func (se *SessionExecutor) SetCharset(charset string) + func (se *SessionExecutor) SetCollationID(id mysql.CollationID) + func (se *SessionExecutor) SetDatabase(db string) + func (se *SessionExecutor) SetLastInsertID(id uint64) + func (se *SessionExecutor) SetNamespaceDefaultCollationID() + func (se *SessionExecutor) SetStatus(status uint16) + func (se SessionExecutor) SetNamespaceDefaultCharset() + type StatisticManager struct + func CreateStatisticManager(cfg *models.Proxy, manager *Manager) (*StatisticManager, error) + func NewStatisticManager() *StatisticManager + func (s *StatisticManager) AddReadFlowCount(namespace string, byteCount int) + func (s *StatisticManager) AddWriteFlowCount(namespace string, byteCount int) + func (s *StatisticManager) Close() + func (s *StatisticManager) DescSessionCount(namespace string) + func (s *StatisticManager) GetHandlers() map[string]http.Handler + func (s *StatisticManager) IncrSessionCount(namespace string) + func (s *StatisticManager) Init(cfg *models.Proxy) error + func (s *StatisticManager) RecordSQLForbidden(fingerprint, namespace string) + type Stmt struct + func (s *Stmt) GetRewriteSQL() (string, error) + func (s *Stmt) ResetParams() + type UserManager struct + func CloneUserManager(user *UserManager) *UserManager + func CreateUserManager(namespaceConfigs map[string]*models.Namespace) (*UserManager, error) + func NewUserManager() *UserManager + func (u *UserManager) CheckPassword(user string, salt, auth []byte) (bool, string) + func (u *UserManager) CheckUser(user string) bool + func (u *UserManager) ClearNamespaceUsers(namespace string) + func (u *UserManager) GetNamespaceByUser(userName, password string) string + func (u *UserManager) RebuildNamespaceUsers(namespace *models.Namespace) + type UserProperty struct + OtherProperty int + RWFlag int + RWSplit int