Documentation
¶
Index ¶
- Constants
- Variables
- func CloseMock(p *Proxy)
- func CodeToErr(code int) error
- func ComposeTS(physical, logical int64) uint64
- func ExtractPhysical(ts uint64) int64
- func LimitListener(l net.Listener, n int) net.Listener
- func PutInsertTask(task *InsertTask)
- func PutSelectTask(task *SelectTask)
- func UpdateConfig(addr string) error
- type And
- type BenchMarkConfig
- type BlacklistSqls
- type ClientConn
- func (c *ClientConn) AddDatabase(nodeName string, role string, addr string) error
- func (c *ClientConn) Close() error
- func (c *ClientConn) DeleteDatabase(nodeName string, role string, addr string) error
- func (c *ClientConn) DownDatabase(nodeName string, role string, addr string) error
- func (c *ClientConn) Handshake() error
- func (c *ClientConn) IsAllowConnect() bool
- func (c *ClientConn) Run()
- func (c *ClientConn) UpDatabase(nodeName string, role string, addr string) error
- type ClusterConfig
- type Column
- type Command
- type Config
- type Counter
- type CreateDatabase
- type CreateTable
- type DataBase
- type ExecuteDB
- type Field
- type Field_
- type Filter
- type Filter_
- type InsertResult
- type InsertRowValue
- type InsertTask
- type KvParisSlice
- type Limit
- type Limit_
- type LogConfig
- type Match
- type MatchType
- type MetricConfig
- type Or
- type Order
- type PerformConfig
- type Proxy
- func (p *Proxy) Close()
- func (p *Proxy) EncodeRow(t *Table, colMap map[string]int, rowValue InsertRowValue) (*kvrpcpb.KeyValue, error)
- func (p *Proxy) HandleAdmin(db string, cmd string, args []string) (*mysql.Result, error)
- func (p *Proxy) HandleDelete(db string, stmt *sqlparser.Delete, args []interface{}) (*mysql.Result, error)
- func (p *Proxy) HandleDescribe(db string, stmt *sqlparser.Describe) (*mysql.Result, error)
- func (p *Proxy) HandleInsert(db string, stmt *sqlparser.Insert, args []interface{}) (*mysql.Result, error)
- func (p *Proxy) HandleSelect(db string, stmt *sqlparser.Select, args []interface{}) (*mysql.Result, error)
- func (p *Proxy) HandleTruncate(db string, stmt *sqlparser.Truncate) (*mysql.Result, error)
- func (p *Proxy) Lock(dbName, tableName string, lockName string, userCondition []byte, uuid string, ...) (*kvrpcpb.LockResponse, error)
- func (p *Proxy) LockScan(dbName, tableName string, startKey, endKey string, number uint32) (*kvrpcpb.LockScanResponse, error)
- func (p *Proxy) LockUpdate(dbName, tableName string, lockName string, uuid string, condition []byte) (*kvrpcpb.LockResponse, error)
- func (p *Proxy) RawDelete(dbName, tableName string, key []byte) error
- func (p *Proxy) RawGet(dbName, tableName string, key []byte) ([]byte, error)
- func (p *Proxy) RawPut(dbName, tableName string, key, value []byte) error
- func (p *Proxy) Submit(t Task) error
- func (p *Proxy) Unlock(dbName, tableName string, lockName, uuid, userName string) (*kvrpcpb.LockResponse, error)
- func (p *Proxy) UnlockForce(dbName, tableName string, lockName, userName string) (*kvrpcpb.LockResponse, error)
- func (p *Proxy) UpdateCondition(dbName, tableName string, lockName string, userCondition []byte) (*kvrpcpb.LockResponse, error)
- type Query
- type Reply
- type Response
- type ResultRow
- type Router
- type Row
- type SQLValue
- type Scope
- type SelColumn
- type SelectResult
- type SelectTask
- type Server
- func (s *Server) ChangeProxy(v string) error
- func (s *Server) Close()
- func (service *Server) DoHeartbeat(ctx context.Context, req *lockrpcpb.LockHeartbeatRequest) (*lockrpcpb.DLockResponse, error)
- func (service *Server) ForceUnLock(ctx context.Context, req *lockrpcpb.ForceUnLockRequest) (*lockrpcpb.DLockResponse, error)
- func (s *Server) GetCfg() *Config
- func (service *Server) Lock(ctx context.Context, req *lockrpcpb.LockRequest) (*lockrpcpb.DLockResponse, error)
- func (s *Server) Run() error
- func (s *Server) Status() string
- func (service *Server) UnLock(ctx context.Context, req *lockrpcpb.UnLockRequest) (*lockrpcpb.DLockResponse, error)
- func (service *Server) UpdateCondition(ctx context.Context, req *lockrpcpb.UpdateConditionRequest) (*lockrpcpb.DLockResponse, error)
- type Session
- type SharkStoreApi
- func (api *SharkStoreApi) Delete(s *Server, dbName string, tableName string, fields []string, ...) *Reply
- func (api *SharkStoreApi) Insert(s *Server, dbName string, tableName string, fields []string, ...) *Reply
- func (api *SharkStoreApi) MultSelect(s *Server, dbName string, tableName string, fields []string, ...) *Reply
- func (api *SharkStoreApi) Select(s *Server, dbName string, tableName string, fields []string, ...) *Reply
- type SortRoutes
- type Stmt
- type StmtParser
- type Table
- func (t *Table) AddColumn(c *metapb.Column)
- func (t *Table) AllIndexs() []uint64
- func (t *Table) AllRoutes() []*dskv.KeyLocation
- func (t *Table) DbName() string
- func (t *Table) DeleteColumn(columnName string)
- func (t *Table) FindColumn(columnName string) *metapb.Column
- func (t *Table) FindColumnById(columnId uint64) *metapb.Column
- func (t *Table) GetAllColumns() []*metapb.Column
- func (t *Table) ID() uint64
- func (t *Table) Name() string
- func (t *Table) PKS() []string
- func (t *Table) PkDupCheck() bool
- type Task
Constants ¶
View Source
const ( DefaultHttpPort = 8080 DefaultLockRpcPort = 8090 DefaultSqlPort = 6060 DefaultServerName = "gateway" DefaultInsertSlowLog = 20 * time.Millisecond DefaultSelectSlowLog = 100 * time.Millisecond DefaultDeleteSlowLog = 20 * time.Millisecond DefaultMaxWorkNum = 100 DefaultMaxTaskQueueLen = 10000 DefaultGrpcPoolSize = 3 DefaultGrpcInitWinSize = 64 * 1024 DefaultMaxSlowLogLen = 10 DefaultMaxRawCount = 10000 )
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 ( LOCK_OK = iota LOCK_EXIST_ERROR LOCK_NOT_EXIST_ERROR LOCK_NOT_OWNER_ERROR LOCK_FORCE_UNLOCK_ERROR LOCK_STORE_ERROR LOCK_EPOCH_ERROR LOCK_NAMESPACE_NO_EXIST LOCK_NETWORK_ERROR LOCK_NO_SUPPORT_FORCE_UNLOCK )
View Source
const ( Offline = iota Online Unknown )
View Source
const DefaultConfig = `` /* 1031-byte string literal not displayed */
Variables ¶
View Source
var ( ErrInternalError = errors.New("internal error") ErrNotExistDatabase = errors.New("database not exist") ErrNotExistTable = errors.New("table not exist") ErrNotExistNode = errors.New("node not exist") ErrNotExistRange = errors.New("range not exist") ErrNotExistPeer = errors.New("range peer not exist") ErrInvalidColumn = errors.New("invalid column") ErrNoRoute = errors.New("no route") ErrExceedMaxLimit = errors.New("exceeding the maximum limit") ErrEmptyRow = errors.New("empty row") ErrHttpCmdUnknown = errors.New("invalid command") ErrHttpCmdParse = errors.New("parse error") ErrHttpCmdRun = errors.New("run error") ErrHttpCmdEmpty = errors.New("command empty") ErrAffectRows = errors.New("affect rows is not equal") ErrCreateDatabase = errors.New(" create database err") ErrCreateTable = errors.New("create table err") )
View Source
var ( Lock_exist_error string = "lock exist" Lock_not_exist_error string = "lock not exist" Lock_not_owner_error string = "not lock owner" Lock_force_unlock_error string = "force unlock ing" Lock_store_error string = "raft store error" Lock_epoch_error string = "range epoch error" Lock_namespace_no_exist string = "namespace not exist" Lock_network_error string = "network exception" Lock_no_suport_force_unlock string = "no support force unlock" )
View Source
var DEFAULT_CAPABILITY uint32 = mysql.CLIENT_LONG_PASSWORD | mysql.CLIENT_LONG_FLAG | mysql.CLIENT_CONNECT_WITH_DB | mysql.CLIENT_PROTOCOL_41 | mysql.CLIENT_TRANSACTIONS | mysql.CLIENT_SECURE_CONNECTION
View Source
var Lock_error_name = map[int64]string{ LOCK_EXIST_ERROR: Lock_exist_error, LOCK_NOT_EXIST_ERROR: Lock_not_exist_error, LOCK_NOT_OWNER_ERROR: Lock_not_owner_error, LOCK_FORCE_UNLOCK_ERROR: Lock_force_unlock_error, LOCK_STORE_ERROR: Lock_store_error, LOCK_EPOCH_ERROR: Lock_epoch_error, LOCK_NAMESPACE_NO_EXIST: Lock_namespace_no_exist, LOCK_NETWORK_ERROR: Lock_network_error, LOCK_NO_SUPPORT_FORCE_UNLOCK: Lock_no_suport_force_unlock, }
View Source
var MockDs *mock_ds.DsRpcServer
View Source
var MockMs *mock_ms.Cluster
Functions ¶
func ExtractPhysical ¶
ExtractPhysical returns a ts's physical part.
func LimitListener ¶
LimitListener returns a Listener that accepts at most n simultaneous connections from the provided Listener.
func PutInsertTask ¶
func PutInsertTask(task *InsertTask)
func PutSelectTask ¶
func PutSelectTask(task *SelectTask)
func UpdateConfig ¶ added in v0.6.3
Types ¶
type BenchMarkConfig ¶
type BenchMarkConfig struct { Type int `toml:"type,omitempty" json:"type"` DataLen int `toml:"data-len,omitempty" json:"data-len"` SendNum int `toml:"send-num,omitempty" json:"send-num"` Threads int `toml:"threads,omitempty" json:"threads"` DB string `toml:"db,omitempty" json:"db"` Table string `toml:"table,omitempty" json:"table"` Batch int `toml:"batch,omitempty" json:"batch"` Scope int `toml:"scope,omitempty" json:"scope"` }
type BlacklistSqls ¶
type BlacklistSqls struct {
// contains filtered or unexported fields
}
type ClientConn ¶
client <-> proxy
func (*ClientConn) AddDatabase ¶
func (c *ClientConn) AddDatabase(nodeName string, role string, addr string) error
func (*ClientConn) Close ¶
func (c *ClientConn) Close() error
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) Handshake ¶
func (c *ClientConn) Handshake() error
func (*ClientConn) IsAllowConnect ¶
func (c *ClientConn) IsAllowConnect() bool
func (*ClientConn) Run ¶
func (c *ClientConn) Run()
func (*ClientConn) UpDatabase ¶
func (c *ClientConn) UpDatabase(nodeName string, role string, addr string) error
type ClusterConfig ¶
type Config ¶
type Config struct { HttpPort int `toml:"http-port,omitempty" json:"http-port"` LockRpcPort int `toml:"lock-port,omitempty" json:"lock-port"` SqlPort int `toml:"mysql-port,omitempty" json:"mysql-port"` MaxClients int `toml:"max-clients,omitempty" json:"max-clients"` MaxLimit uint64 `toml:"max-record-limit,omitempty" json:"max-record-limit"` User string `toml:"user,omitempty" json:"user"` Password string `toml:"password,omitempty" json:"password"` Charset string `toml:"charset,omitempty" json:"charset"` Performance PerformConfig `toml:"performance,omitempty" json:"performance"` Cluster ClusterConfig `toml:"cluster,omitempty" json:"cluster"` Log LogConfig `toml:"log,omitempty" json:"log"` Metric MetricConfig `toml:"metric,omitempty" json:"metric"` BenchConfig BenchMarkConfig `toml:"benchmark,omitempty" json:"benchmark"` }
func (*Config) LoadConfig ¶
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) 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 CreateDatabase ¶
type CreateTable ¶
type DataBase ¶
func NewDataBase ¶
type InsertResult ¶
type InsertResult struct {
// contains filtered or unexported fields
}
func (*InsertResult) GetAffected ¶
func (r *InsertResult) GetAffected() uint64
func (*InsertResult) GetDuplicateKey ¶
func (r *InsertResult) GetDuplicateKey() []byte
type InsertRowValue ¶
type InsertRowValue []SQLValue
type InsertTask ¶
type InsertTask struct {
// contains filtered or unexported fields
}
func GetInsertTask ¶
func GetInsertTask() *InsertTask
func (*InsertTask) Do ¶
func (it *InsertTask) Do()
func (*InsertTask) Reset ¶
func (it *InsertTask) Reset()
func (*InsertTask) Wait ¶
func (it *InsertTask) Wait() error
type KvParisSlice ¶
func (KvParisSlice) Len ¶
func (p KvParisSlice) Len() int
func (KvParisSlice) Swap ¶
func (p KvParisSlice) Swap(i int, j int)
type MetricConfig ¶
type PerformConfig ¶
type PerformConfig struct { MaxWorkNum uint64 `toml:"max-work-num,omitempty" json:"max-work-num"` MaxTaskQueueLen uint64 `toml:"max-task-queue-len,omitempty" json:"max-task-queue-len"` GrpcPoolSize int `toml:"grpc-pool-size,omitempty" json:"grpc-pool-size"` GrpcInitWinSize int `toml:"grpc-win-size,omitempty" json:"grpc-win-size"` InsertSlowLog util.Duration `toml:"slow-insert,omitempty" json:"slow-insert"` SelectSlowLog util.Duration `toml:"slow-select,omitempty" json:"slow-select"` DeleteSlowLog util.Duration `toml:"slow-delete,omitempty" json:"slow-delete"` SlowLogMaxLen uint64 `toml:"slow-log-max-len,omitempty" json:"slow-log-max-len"` }
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) EncodeRow ¶
func (p *Proxy) EncodeRow(t *Table, colMap map[string]int, rowValue InsertRowValue) (*kvrpcpb.KeyValue, error)
EncodeRow 编码一行
func (*Proxy) HandleAdmin ¶
func (*Proxy) HandleDelete ¶
func (p *Proxy) HandleDelete(db string, stmt *sqlparser.Delete, args []interface{}) (*mysql.Result, error)
HandleDelete handle delete
func (*Proxy) HandleDescribe ¶
HandleDescribe decribe table
func (*Proxy) HandleInsert ¶
func (*Proxy) HandleSelect ¶
func (*Proxy) HandleTruncate ¶
HandleTruncate truncate table
func (*Proxy) LockUpdate ¶
func (*Proxy) RawGet ¶
get in range split, first get from dst range, if no value, we need get from src range again
func (*Proxy) UnlockForce ¶
func (*Proxy) UpdateCondition ¶
type SelColumn ¶
type SelColumn struct {
// contains filtered or unexported fields
}
SelColumn select fields
type SelectResult ¶
type SelectResult struct {
// contains filtered or unexported fields
}
type SelectTask ¶
type SelectTask struct {
// contains filtered or unexported fields
}
func GetSelectTask ¶
func GetSelectTask() *SelectTask
func (*SelectTask) Do ¶
func (it *SelectTask) Do()
func (*SelectTask) Reset ¶
func (it *SelectTask) Reset()
func (*SelectTask) Wait ¶
func (it *SelectTask) Wait() error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ChangeProxy ¶
func (*Server) DoHeartbeat ¶
func (*Server) ForceUnLock ¶
type SharkStoreApi ¶
type SharkStoreApi struct { }
func (*SharkStoreApi) MultSelect ¶ added in v0.7.2
type SortRoutes ¶
func (SortRoutes) Len ¶
func (s SortRoutes) Len() int
func (SortRoutes) Less ¶
func (s SortRoutes) Less(i, j int) bool
func (SortRoutes) Swap ¶
func (s SortRoutes) Swap(i, j int)
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) ResetParams ¶
func (s *Stmt) ResetParams()
type StmtParser ¶
type StmtParser struct { }
Source Files
¶
- config.go
- conn.go
- conn_admin.go
- conn_preshard.go
- conn_query.go
- conn_resultset.go
- conn_select.go
- conn_set.go
- conn_stmt.go
- conn_tx.go
- conn_use.go
- counter.go
- database_cache.go
- errors.go
- http_handle.go
- limitListener.go
- lock_handle.go
- lock_rpc_server.go
- pool.go
- proxy.go
- proxy_admin.go
- proxy_concurrent.go
- proxy_delete.go
- proxy_insert.go
- proxy_lock.go
- proxy_raw.go
- proxy_select.go
- proxy_select_aggre.go
- proxy_select_result.go
- proxy_test_helper.go
- proxy_util.go
- rest.go
- router.go
- schema.go
- server.go
- session.go
- sharkstore_api.go
- stmt_parser.go
- table_cache.go
- timestamp.go
Click to show internal directories.
Click to hide internal directories.