Documentation
¶
Index ¶
- Constants
- func MockConfigIdleTxnTimeout1() *config.Config
- func MockConfigMax16() *config.Config
- func MockDefaultConfig() *config.Config
- type DiskCheck
- type IP
- type IPTable
- type Manager
- type Proxy
- func MockProxy(log *xlog.Log) (*fakedb.DB, *Proxy, func())
- func MockProxy1(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func MockProxyPrivilegeN(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func MockProxyPrivilegeNotSuper(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func MockProxyPrivilegeUsers(log *xlog.Log, conf *config.Config) (*fakedb.DB, *Proxy, func())
- func NewProxy(log *xlog.Log, path string, serverVersion string, conf *config.Config) *Proxy
- func (p *Proxy) Address() string
- func (p *Proxy) Config() *config.Config
- func (p *Proxy) FlushConfig() error
- func (p *Proxy) IPTable() *IPTable
- func (p *Proxy) PeerAddress() string
- func (p *Proxy) Router() *router.Router
- func (p *Proxy) Scatter() *backend.Scatter
- func (p *Proxy) Sessions() *Sessions
- func (p *Proxy) SetAllowIP(ips []string)
- func (p *Proxy) SetAuditMode(mode string)
- func (p *Proxy) SetDDLTimeout(timeout int)
- func (p *Proxy) SetLongQueryTime(longQueryTime int)
- func (p *Proxy) SetMaxConnections(connections int)
- func (p *Proxy) SetMaxResultSize(size int)
- func (p *Proxy) SetQueryTimeout(timeout int)
- func (p *Proxy) SetReadOnly(val bool)
- func (p *Proxy) SetStreamBufferSize(streamBufferSize int)
- func (p *Proxy) SetThrottle(val int)
- func (p *Proxy) SetTwoPC(enable bool)
- func (p *Proxy) Spanner() *Spanner
- func (p *Proxy) Start()
- func (p *Proxy) Stop()
- func (p *Proxy) Syncer() *syncer.Syncer
- type SessionInfo
- type Sessions
- func (ss *Sessions) Add(s *driver.Session)
- func (ss *Sessions) Close()
- func (ss *Sessions) Kill(id uint32, reason string)
- func (ss *Sessions) MultiStmtTxnBinding(s *driver.Session, txn backend.Transaction, node sqlparser.Statement, ...)
- func (ss *Sessions) MultiStmtTxnUnBinding(s *driver.Session, isEnd bool)
- func (ss *Sessions) Reaches(quota int) bool
- func (ss *Sessions) Remove(s *driver.Session)
- func (ss *Sessions) Snapshot() []SessionInfo
- func (ss *Sessions) SnapshotTxn() []SessionInfo
- func (ss *Sessions) SnapshotUser(user string) []SessionInfo
- func (ss *Sessions) TxnBinding(s *driver.Session, txn backend.Transaction, node sqlparser.Statement, ...)
- func (ss *Sessions) TxnUnBinding(s *driver.Session)
- type Spanner
- func (spanner *Spanner) AuthCheck(s *driver.Session) error
- func (spanner *Spanner) Close() error
- func (spanner *Spanner) ComInitDB(session *driver.Session, database string) error
- func (spanner *Spanner) ComQuery(session *driver.Session, query string, ...) error
- func (spanner *Spanner) ExecuteBegin(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteCommit(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteDDL(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteDML(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteMultiStmtsInTxn(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteNormal(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteOnThisBackend(backend string, query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteRollback(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteScatter(query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteSingle(query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteSingleStmtTxnTwoPC(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteStreamFetch(session *driver.Session, database string, query string, ...) error
- func (spanner *Spanner) Init() error
- func (spanner *Spanner) IsDDL(node sqlparser.Statement) bool
- func (spanner *Spanner) IsDML(node sqlparser.Statement) bool
- func (spanner *Spanner) IsDMLWrite(node sqlparser.Statement) bool
- func (spanner *Spanner) NewSession(s *driver.Session)
- func (spanner *Spanner) ReadOnly() bool
- func (spanner *Spanner) ServerVersion() string
- func (spanner *Spanner) SessionCheck(s *driver.Session) error
- func (spanner *Spanner) SessionClosed(s *driver.Session)
- func (spanner *Spanner) SessionDec(s *driver.Session)
- func (spanner *Spanner) SessionInc(s *driver.Session)
- func (spanner *Spanner) SetReadOnly(val bool)
Constants ¶
const ( // R enum. R mode = iota // W enum. W )
Variables ¶
This section is empty.
Functions ¶
func MockConfigIdleTxnTimeout1 ¶ added in v1.0.6
MockConfigIdleTxnTimeout1 mocks the config with IdleTxnTimeout=1.
func MockConfigMax16 ¶
MockConfigMax16 mocks the config with MaxConnections=16.
Types ¶
type DiskCheck ¶
type DiskCheck struct {
// contains filtered or unexported fields
}
DiskCheck tuple.
func NewDiskCheck ¶
NewDiskCheck creates the DiskCheck tuple.
func (*DiskCheck) Close ¶
func (dc *DiskCheck) Close()
Close used to close the disk check goroutine.
func (*DiskCheck) HighWater ¶
HighWater returns the highwater mark. If true there is no space left on device.
type IPTable ¶
type IPTable struct {
// contains filtered or unexported fields
}
IPTable tuple.
func NewIPTable ¶
func NewIPTable(log *xlog.Log, conf *config.ProxyConfig) *IPTable
NewIPTable creates a new IPTable.
func (*IPTable) Check ¶
Check used to check a whether the ip is in ip table or not.
type Manager ¶ added in v1.0.6
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶ added in v1.0.6
NewManager creates new Manager.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy tuple.
func MockProxy ¶
MockProxy mocks a proxy.
func MockProxy1 ¶
MockProxy1 mocks the proxy with config.
func MockProxyPrivilegeN ¶ added in v1.0.6
MockProxyPrivilegeN mocks the proxy with Privilege N.
func MockProxyPrivilegeNotSuper ¶ added in v1.0.6
MockProxyPrivilegeNotSuper mocks the proxy Not Super Privilege.
func MockProxyPrivilegeUsers ¶ added in v1.0.6
MockProxyPrivilegeUsers mocks the proxy with multipe users.
func NewProxy ¶
NewProxy creates new proxy.
func (*Proxy) FlushConfig ¶
FlushConfig used to flush the config to disk.
func (*Proxy) PeerAddress ¶
PeerAddress returns the peer address.
func (*Proxy) SetAllowIP ¶
SetAllowIP used to set allow ips.
func (*Proxy) SetAuditMode ¶
SetAuditMode used to set the mode of audit.
func (*Proxy) SetDDLTimeout ¶
SetDDLTimeout used to set the ddl timeout.
func (*Proxy) SetLongQueryTime ¶ added in v1.0.1
SetLongQueryTime Set long Query Time used to set long query time.
func (*Proxy) SetMaxConnections ¶
SetMaxConnections used to set the max connections.
func (*Proxy) SetMaxResultSize ¶
SetMaxResultSize used to set the max result size.
func (*Proxy) SetQueryTimeout ¶
SetQueryTimeout used to set query timeout.
func (*Proxy) SetReadOnly ¶
SetReadOnly used to enable/disable readonly.
func (*Proxy) SetStreamBufferSize ¶ added in v1.0.3
SetStreamBufferSize used to set the streamBufferSize.
func (*Proxy) SetThrottle ¶
SetThrottle used to set the throttle.
func (*Proxy) SetTwoPC ¶
SetTwoPC used to set twopc to enable or disable.
type SessionInfo ¶
type SessionInfo struct {
ID uint32
User string
Host string
DB string
Command string
Time uint32
State string
Info string
RowsSent uint64
RowsExamined uint64
}
SessionInfo tuple.
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
Sessions tuple.
func (*Sessions) Add ¶
Add used to add the session to map when session created.
func (*Sessions) Kill ¶
Kill used to kill a live session. 1. remove from sessions list. 2. close the session from the server side. 3. abort the session's txn.
func (*Sessions) MultiStmtTxnBinding ¶ added in v1.0.4
func (ss *Sessions) MultiStmtTxnBinding(s *driver.Session, txn backend.Transaction, node sqlparser.Statement, query string)
MultiStmtTxnBinding used to bind txn, node, query to the session
func (*Sessions) MultiStmtTxnUnBinding ¶ added in v1.0.4
MultiStmtTxnUnBinding used to set transaction by isEnd
func (*Sessions) Reaches ¶
Reaches used to check whether the sessions count reaches(>=) the quota.
func (*Sessions) Remove ¶
Remove used to remove the session from the map when session exit.
func (*Sessions) Snapshot ¶
func (ss *Sessions) Snapshot() []SessionInfo
Snapshot returns all session info.
func (*Sessions) SnapshotTxn ¶ added in v1.0.6
func (ss *Sessions) SnapshotTxn() []SessionInfo
SnapshotTxn returns all sessions info in transaction.
func (*Sessions) SnapshotUser ¶ added in v1.0.6
func (ss *Sessions) SnapshotUser(user string) []SessionInfo
Snapshot returns all session info about the user.
type Spanner ¶
type Spanner struct {
// contains filtered or unexported fields
}
Spanner tuple.
func NewSpanner ¶
func NewSpanner(log *xlog.Log, conf *config.Config, iptable *IPTable, router *router.Router, scatter *backend.Scatter, sessions *Sessions, audit *audit.Audit, throttle *xbase.Throttle, plugins *plugins.Plugin, serverVersion string) *Spanner
NewSpanner creates a new spanner.
func (*Spanner) AuthCheck ¶
AuthCheck impl.
func (*Spanner) ComInitDB ¶
ComInitDB impl. Here, we will send a fake query 'SELECT 1' to the backend and check the 'USE DB'.
func (*Spanner) ComQuery ¶
func (spanner *Spanner) ComQuery(session *driver.Session, query string, bindVariables map[string]*querypb.BindVariable, callback func(qr *sqltypes.Result) error) error
ComQuery impl. Supports statements are: 1. DDL 2. DML 3. USE DB: MySQL client use 'database' won't pass here, FIXME.
func (*Spanner) ExecuteBegin ¶ added in v1.0.4
func (spanner *Spanner) ExecuteBegin(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteBegin used to execute "start transaction" or "begin".
func (*Spanner) ExecuteCommit ¶ added in v1.0.4
func (spanner *Spanner) ExecuteCommit(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteCommit used to execute multiple-statement transaction: "commit"
func (*Spanner) ExecuteDDL ¶
func (spanner *Spanner) ExecuteDDL(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteDDL used to execute ddl querys to the shards with DDLTimeout limits, used for create/drop index long time operation.
func (*Spanner) ExecuteDML ¶ added in v1.0.4
func (spanner *Spanner) ExecuteDML(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteDML used to execute some DML querys to shards.
func (*Spanner) ExecuteMultiStmtsInTxn ¶ added in v1.0.4
func (spanner *Spanner) ExecuteMultiStmtsInTxn(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteMultiStmtsInTxn used to execute multiple statements in the transaction.
func (*Spanner) ExecuteNormal ¶
func (spanner *Spanner) ExecuteNormal(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteNormal used to execute non-2pc querys to shards with QueryTimeout limits.
func (*Spanner) ExecuteOnThisBackend ¶
func (spanner *Spanner) ExecuteOnThisBackend(backend string, query string) (*sqltypes.Result, error)
ExecuteOnThisBackend used to executye query on the backend whitout planner.
func (*Spanner) ExecuteRollback ¶ added in v1.0.4
func (spanner *Spanner) ExecuteRollback(session *driver.Session, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteRollback used to execute multiple-statement transaction sql:"rollback"
func (*Spanner) ExecuteScatter ¶
ExecuteScatter used to execute query on all shards without planner.
func (*Spanner) ExecuteSingle ¶
ExecuteSingle used to execute query on one shard without planner. The query must contain the database, such as db.table.
func (*Spanner) ExecuteSingleStmtTxnTwoPC ¶ added in v1.0.4
func (spanner *Spanner) ExecuteSingleStmtTxnTwoPC(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteSingleStmtTxnTwoPC used to execute single statement transaction with 2pc commit.
func (*Spanner) ExecuteStreamFetch ¶
func (spanner *Spanner) ExecuteStreamFetch(session *driver.Session, database string, query string, node sqlparser.Statement, callback func(qr *sqltypes.Result) error) error
ExecuteStreamFetch used to execute a stream fetch query.
func (*Spanner) IsDDL ¶
IsDDL returns the DDL query or not.
func (*Spanner) IsDML ¶
IsDML returns the DML query or not.
func (*Spanner) IsDMLWrite ¶
IsDMLWrite returns the DML write or not.
func (*Spanner) ReadOnly ¶
ReadOnly returns the readonly or not.
func (*Spanner) ServerVersion ¶ added in v1.0.6
ServerVersion impl -- returns server version of Radon when greeting.
func (*Spanner) SessionCheck ¶
SessionCheck used to check authentication.
func (*Spanner) SessionClosed ¶
SessionClosed impl.
func (*Spanner) SessionDec ¶ added in v1.0.1
SessionDec decrease client connection metrics.
func (*Spanner) SessionInc ¶ added in v1.0.1
SessionInc increase client connection metrics, it need the user is assigned
Source Files
¶
- audit.go
- auth.go
- checksumtable.go
- connector.go
- ddl.go
- delete.go
- disk.go
- execute.go
- explain.go
- initdb.go
- insert.go
- iptable.go
- kill.go
- manager.go
- mock.go
- multistmt_txn.go
- proxy.go
- query.go
- select.go
- selectsystem.go
- session.go
- sessions.go
- set.go
- show.go
- spanner.go
- update.go
- usedb.go