server

package
v0.0.0-...-e281b8e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2016 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Master = "master"
	Slave  = "slave"

	ServerRegion = "server"
	NodeRegion   = "node"

	//op
	ADMIN_OPT_ADD     = "add"
	ADMIN_OPT_DEL     = "del"
	ADMIN_OPT_UP      = "up"
	ADMIN_OPT_DOWN    = "down"
	ADMIN_OPT_SHOW    = "show"
	ADMIN_OPT_CHANGE  = "change"
	ADMIN_SAVE_CONFIG = "save"

	ADMIN_PROXY         = "proxy"
	ADMIN_NODE          = "node"
	ADMIN_SCHEMA        = "schema"
	ADMIN_LOG_SQL       = "log_sql"
	ADMIN_SLOW_LOG_TIME = "slow_log_time"
	ADMIN_ALLOW_IP      = "allow_ip"
	ADMIN_BLACK_SQL     = "black_sql"

	ADMIN_CONFIG = "config"
	ADMIN_STATUS = "status"
)
View Source
const (
	MasterComment    = "/*master*/"
	SumFunc          = "sum"
	CountFunc        = "count"
	MaxFunc          = "max"
	MinFunc          = "min"
	LastInsertIdFunc = "last_insert_id"
	FUNC_EXIST       = 1
)
View Source
const (
	Offline = iota
	Online
	Unknown
)

Variables

Functions

This section is empty.

Types

type BlacklistSqls

type BlacklistSqls struct {
	// contains filtered or unexported fields
}

BlacklistSqls black list will forbidden by ks

type ClientConn

type ClientConn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

client <-> proxy

func (*ClientConn) AddDatabase

func (c *ClientConn) AddDatabase(nodeName string, role string, addr string) error

func (*ClientConn) Close

func (c *ClientConn) Close() error

Close client conn

func (*ClientConn) DeleteDatabase

func (c *ClientConn) DeleteDatabase(nodeName string, role string, addr string) error

func (*ClientConn) DownDatabase

func (c *ClientConn) DownDatabase(nodeName string, role string, addr string) error

func (*ClientConn) GetExecDB

func (c *ClientConn) GetExecDB(tokens []string, sql string) (*ExecuteDB, error)

if sql need shard return nil, else return the unshard db

func (*ClientConn) GetTransExecDB

func (c *ClientConn) GetTransExecDB(tokens []string, sql string) (*ExecuteDB, error)

func (*ClientConn) Handshake

func (c *ClientConn) Handshake() error

func (*ClientConn) IsAllowConnect

func (c *ClientConn) IsAllowConnect() bool

func (*ClientConn) Run

func (c *ClientConn) Run()

Run clientConn

func (*ClientConn) UpDatabase

func (c *ClientConn) UpDatabase(nodeName string, role string, addr string) error

type Counter

type Counter struct {
	OldClientQPS    int64
	OldErrLogTotal  int64
	OldSlowLogTotal int64

	ClientConns  int64
	ClientQPS    int64
	ErrLogTotal  int64
	SlowLogTotal int64
}

func (*Counter) DecrClientConns

func (counter *Counter) DecrClientConns()

func (*Counter) FlushCounter

func (counter *Counter) FlushCounter()

flush the count per second

func (*Counter) IncrClientConns

func (counter *Counter) IncrClientConns()

func (*Counter) IncrClientQPS

func (counter *Counter) IncrClientQPS()

func (*Counter) IncrErrLogTotal

func (counter *Counter) IncrErrLogTotal()

func (*Counter) IncrSlowLogTotal

func (counter *Counter) IncrSlowLogTotal()

type ExecuteDB

type ExecuteDB struct {
	ExecNode *backend.Node
	IsSlave  bool
}

type ResultRow

type ResultRow struct {
	Value   []interface{}
	RowData mysql.RowData
}

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema defineds sharding rules

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server the main struct for ks

func NewServer

func NewServer(cfg *config.Config) (*Server, error)

func (*Server) AddSlave

func (s *Server) AddSlave(node string, addr string) error

func (*Server) Close

func (s *Server) Close()

func (*Server) DeleteSlave

func (s *Server) DeleteSlave(node string, addr string) error

func (*Server) DownMaster

func (s *Server) DownMaster(node, masterAddr string) error

func (*Server) DownSlave

func (s *Server) DownSlave(node, slaveAddr string) error

func (*Server) GetNode

func (s *Server) GetNode(name string) *backend.Node

func (*Server) GetSchema

func (s *Server) GetSchema() *Schema

func (*Server) Run

func (s *Server) Run() error

func (*Server) Status

func (s *Server) Status() string

func (*Server) UpMaster

func (s *Server) UpMaster(node string, addr string) error

func (*Server) UpSlave

func (s *Server) UpSlave(node string, addr string) error

type Stmt

type Stmt struct {
	// contains filtered or unexported fields
}

func (*Stmt) ResetParams

func (s *Stmt) ResetParams()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL