Documentation
¶
Index ¶
- Constants
- func CheckCreateTable(ddl *sqlparser.DDL) error
- func MockConfigMax16() *config.Config
- func MockDefaultConfig() *config.Config
- type DiskCheck
- type IP
- type IPTable
- type Proxy
- func (p *Proxy) Address() string
- func (p *Proxy) Binlog() *binlog.Binlog
- 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) Reaches(quota int) bool
- func (ss *Sessions) Remove(s *driver.Session)
- func (ss *Sessions) Snapshot() []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) Execute(session *driver.Session, database string, query string, ...) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteDDL(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) ExecuteScatter(query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteSingle(query string) (*sqltypes.Result, error)
- func (spanner *Spanner) ExecuteStreamFetch(session *driver.Session, database string, query string, ...) error
- func (spanner *Spanner) ExecuteTwoPC(session *driver.Session, database string, query string, ...) (*sqltypes.Result, 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) 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 CheckCreateTable ¶
CheckCreateTable used to check the CRERATE TABLE statement.
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 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 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) 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.
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, binlog *binlog.Binlog, sessions *Sessions, audit *audit.Audit, throttle *xbase.Throttle) *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, callback func(qr *sqltypes.Result) error) error
ComQuery impl. Supports statements are: 1. DDL 2. DML 3. USE DB
func (*Spanner) Execute ¶
func (spanner *Spanner) Execute(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
Execute used to execute querys to shards.
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) 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) 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) 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) ExecuteTwoPC ¶
func (spanner *Spanner) ExecuteTwoPC(session *driver.Session, database string, query string, node sqlparser.Statement) (*sqltypes.Result, error)
ExecuteTwoPC allows multi-shards transactions with 2pc commit.
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) 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