Documentation ¶
Index ¶
- Constants
- Variables
- type FakeClient
- type MockDBInstance
- type MockShard
- type NoopClient
- type PsqlClient
- func (cl *PsqlClient) AllowMultishard() bool
- func (cl *PsqlClient) AssignRoute(r *route.Route) error
- func (cl *PsqlClient) AssignRule(rule *config.FrontendRule) error
- func (cl *PsqlClient) AssignServerConn(srv server.Server) error
- func (cl *PsqlClient) Auth(rt *route.Route) error
- func (cl *PsqlClient) AutoDistribution() string
- func (cl *PsqlClient) BindParamFormatCodes() []int16
- func (cl *PsqlClient) BindParams() [][]byte
- func (cl *PsqlClient) Cancel() error
- func (cl *PsqlClient) CancelMsg() *pgproto3.CancelRequest
- func (cl *PsqlClient) Close() error
- func (cl *PsqlClient) CommitActiveSet()
- func (cl *PsqlClient) ConstructClientParams() *pgproto3.Query
- func (cl *PsqlClient) DB() string
- func (cl *PsqlClient) DefaultReply() error
- func (cl *PsqlClient) DefaultRouteBehaviour() string
- func (cl *PsqlClient) Distribution() string
- func (cl *PsqlClient) DistributionKey() string
- func (cl *PsqlClient) ExecuteOn() string
- func (cl *PsqlClient) GetCancelKey() uint32
- func (cl *PsqlClient) GetCancelPid() uint32
- func (cl *PsqlClient) GetTsa() tsa.TSA
- func (cl *PsqlClient) ID() uint
- func (cl *PsqlClient) Init(tlsconfig *tls.Config) error
- func (cl *PsqlClient) MaintainParams() bool
- func (cl *PsqlClient) Params() map[string]string
- func (cl *PsqlClient) PasswordCT() (string, error)
- func (cl *PsqlClient) PasswordMD5(salt [4]byte) (string, error)
- func (cl *PsqlClient) PreparedStatementDefinitionByName(name string) *prepstatement.PreparedStatementDefinition
- func (cl *PsqlClient) PreparedStatementQueryByName(name string) string
- func (cl *PsqlClient) PreparedStatementQueryHashByName(name string) uint64
- func (cl *PsqlClient) RLock()
- func (cl *PsqlClient) RUnlock()
- func (cl *PsqlClient) Receive() (pgproto3.FrontendMessage, error)
- func (*PsqlClient) ReceiveCtx(ctx context.Context) (pgproto3.FrontendMessage, error)
- func (cl *PsqlClient) Reply(msg string) error
- func (cl *PsqlClient) ReplyBindComplete() error
- func (cl *PsqlClient) ReplyCommandComplete(commandTag string) error
- func (cl *PsqlClient) ReplyDebugNotice(msg string) error
- func (cl *PsqlClient) ReplyDebugNoticef(fmtString string, args ...interface{}) error
- func (cl *PsqlClient) ReplyErr(e error) error
- func (cl *PsqlClient) ReplyErrMsg(msg string, code string) error
- func (cl *PsqlClient) ReplyErrMsgByCode(code string) error
- func (cl *PsqlClient) ReplyNotice(message string) error
- func (cl *PsqlClient) ReplyParseComplete() error
- func (cl *PsqlClient) ReplyRFQ(txstatus txstatus.TXStatus) error
- func (cl *PsqlClient) ReplyWarningMsg(errmsg string) error
- func (cl *PsqlClient) ReplyWarningf(fmtString string, args ...interface{}) error
- func (cl *PsqlClient) Reset() error
- func (cl *PsqlClient) ResetAll()
- func (cl *PsqlClient) ResetParam(name string)
- func (cl *PsqlClient) ResetTsa()
- func (cl *PsqlClient) Rollback()
- func (cl *PsqlClient) RollbackToSP(name string)
- func (cl *PsqlClient) Route() *route.Route
- func (cl *PsqlClient) RouteHint() routehint.RouteHint
- func (cl *PsqlClient) Rule() *config.FrontendRule
- func (cl *PsqlClient) Savepoint(name string)
- func (cl *PsqlClient) Send(msg pgproto3.BackendMessage) error
- func (cl *PsqlClient) SendCtx(ctx context.Context, msg pgproto3.BackendMessage) error
- func (cl *PsqlClient) Server() server.Server
- func (cl *PsqlClient) ServerAcquireUse()
- func (cl *PsqlClient) ServerReleaseUse()
- func (cl *PsqlClient) SetAllowMultishard(val bool)
- func (cl *PsqlClient) SetAuthType(t uint32) error
- func (cl *PsqlClient) SetAutoDistribution(val string)
- func (cl *PsqlClient) SetBindParams(p [][]byte)
- func (cl *PsqlClient) SetDefaultRouteBehaviour(b string)
- func (cl *PsqlClient) SetDistribution(val string)
- func (cl *PsqlClient) SetDistributionKey(val string)
- func (cl *PsqlClient) SetExecuteOn(val string)
- func (cl *PsqlClient) SetMaintainParams(val bool)
- func (cl *PsqlClient) SetParam(name, value string)
- func (cl *PsqlClient) SetParamFormatCodes(paramCodes []int16)
- func (cl *PsqlClient) SetRouteHint(rh routehint.RouteHint)
- func (cl *PsqlClient) SetShardingKey(k string)
- func (cl *PsqlClient) SetShowNoticeMsg(val bool)
- func (cl *PsqlClient) SetTsa(s string)
- func (cl *PsqlClient) ShardingKey() string
- func (cl *PsqlClient) Shards() []shard.Shard
- func (cl *PsqlClient) ShowNoticeMsg() bool
- func (cl *PsqlClient) Shutdown() error
- func (cl *PsqlClient) StartTx()
- func (cl *PsqlClient) StartupMessage() *pgproto3.StartupMessage
- func (cl *PsqlClient) StorePreparedStatement(d *prepstatement.PreparedStatementDefinition)
- func (cl *PsqlClient) Unroute() error
- func (cl *PsqlClient) Usr() string
- type RouterClient
Constants ¶
const DefaultDB = "default"
const DefaultDS = "default"
const DefaultUsr = "default"
Variables ¶
var NotRouted = fmt.Errorf("client not routed")
Functions ¶
This section is empty.
Types ¶
type FakeClient ¶
type FakeClient struct {
RouterClient
}
func NewFakeClient ¶
func NewFakeClient() *FakeClient
func (FakeClient) DB ¶
func (f FakeClient) DB() string
func (FakeClient) ID ¶
func (f FakeClient) ID() uint
func (FakeClient) Receive ¶
func (f FakeClient) Receive() (pgproto3.FrontendMessage, error)
func (FakeClient) Send ¶
func (f FakeClient) Send(msg pgproto3.BackendMessage) error
func (FakeClient) Usr ¶
func (f FakeClient) Usr() string
type MockDBInstance ¶
type MockDBInstance struct { conn.DBInstance // contains filtered or unexported fields }
func (MockDBInstance) Hostname ¶
func (dbi MockDBInstance) Hostname() string
type NoopClient ¶
func NewNoopClient ¶
func NewNoopClient(clientInfo *routerproto.ClientInfo, rAddr string) NoopClient
func (NoopClient) DB ¶
func (c NoopClient) DB() string
func (NoopClient) ID ¶
func (c NoopClient) ID() uint
func (NoopClient) RAddr ¶
func (c NoopClient) RAddr() string
func (NoopClient) Shards ¶
func (c NoopClient) Shards() []shard.Shard
func (NoopClient) Usr ¶
func (c NoopClient) Usr() string
type PsqlClient ¶
type PsqlClient struct { client.Client ReplyClientId bool // contains filtered or unexported fields }
func NewPsqlClient ¶
func NewPsqlClient(pgconn conn.RawConn, pt port.RouterPortType, defaultRouteBehaviour string, showNoticeMessages bool, intanseDefaultTsa string) *PsqlClient
func (*PsqlClient) AllowMultishard ¶
func (cl *PsqlClient) AllowMultishard() bool
AllowMultishard implements RouterClient.
func (*PsqlClient) AssignRoute ¶
func (cl *PsqlClient) AssignRoute(r *route.Route) error
func (*PsqlClient) AssignRule ¶
func (cl *PsqlClient) AssignRule(rule *config.FrontendRule) error
func (*PsqlClient) AssignServerConn ¶
func (cl *PsqlClient) AssignServerConn(srv server.Server) error
func (*PsqlClient) AutoDistribution ¶
func (cl *PsqlClient) AutoDistribution() string
AutoDistribution implements RouterClient.
func (*PsqlClient) BindParamFormatCodes ¶
func (cl *PsqlClient) BindParamFormatCodes() []int16
BindParamFormatCodes implements RouterClient.
func (*PsqlClient) BindParams ¶
func (cl *PsqlClient) BindParams() [][]byte
BindParams implements RouterClient.
func (*PsqlClient) Cancel ¶
func (cl *PsqlClient) Cancel() error
This method can be called concurrently with Unroute()
func (*PsqlClient) CancelMsg ¶
func (cl *PsqlClient) CancelMsg() *pgproto3.CancelRequest
func (*PsqlClient) Close ¶
func (cl *PsqlClient) Close() error
func (*PsqlClient) CommitActiveSet ¶
func (cl *PsqlClient) CommitActiveSet()
func (*PsqlClient) ConstructClientParams ¶
func (cl *PsqlClient) ConstructClientParams() *pgproto3.Query
func (*PsqlClient) DB ¶
func (cl *PsqlClient) DB() string
func (*PsqlClient) DefaultReply ¶
func (cl *PsqlClient) DefaultReply() error
func (*PsqlClient) DefaultRouteBehaviour ¶
func (cl *PsqlClient) DefaultRouteBehaviour() string
DefaultRouteBehaviour implements RouterClient.
func (*PsqlClient) Distribution ¶
func (cl *PsqlClient) Distribution() string
Distribution implements RouterClient.
func (*PsqlClient) DistributionKey ¶
func (cl *PsqlClient) DistributionKey() string
DistributionKey implements RouterClient.
func (*PsqlClient) ExecuteOn ¶
func (cl *PsqlClient) ExecuteOn() string
ExecuteOn implements RouterClient.
func (*PsqlClient) GetCancelKey ¶
func (cl *PsqlClient) GetCancelKey() uint32
func (*PsqlClient) GetCancelPid ¶
func (cl *PsqlClient) GetCancelPid() uint32
func (*PsqlClient) GetTsa ¶
func (cl *PsqlClient) GetTsa() tsa.TSA
func (*PsqlClient) ID ¶
func (cl *PsqlClient) ID() uint
func (*PsqlClient) Init ¶
func (cl *PsqlClient) Init(tlsconfig *tls.Config) error
startup + ssl/cancel
func (*PsqlClient) MaintainParams ¶
func (cl *PsqlClient) MaintainParams() bool
MaintainParams implements RouterClient.
func (*PsqlClient) Params ¶
func (cl *PsqlClient) Params() map[string]string
func (*PsqlClient) PasswordCT ¶
func (cl *PsqlClient) PasswordCT() (string, error)
func (*PsqlClient) PasswordMD5 ¶
func (cl *PsqlClient) PasswordMD5(salt [4]byte) (string, error)
func (*PsqlClient) PreparedStatementDefinitionByName ¶
func (cl *PsqlClient) PreparedStatementDefinitionByName(name string) *prepstatement.PreparedStatementDefinition
func (*PsqlClient) PreparedStatementQueryByName ¶
func (cl *PsqlClient) PreparedStatementQueryByName(name string) string
func (*PsqlClient) PreparedStatementQueryHashByName ¶
func (cl *PsqlClient) PreparedStatementQueryHashByName(name string) uint64
func (*PsqlClient) RLock ¶
func (cl *PsqlClient) RLock()
func (*PsqlClient) RUnlock ¶
func (cl *PsqlClient) RUnlock()
func (*PsqlClient) Receive ¶
func (cl *PsqlClient) Receive() (pgproto3.FrontendMessage, error)
func (*PsqlClient) ReceiveCtx ¶
func (*PsqlClient) ReceiveCtx(ctx context.Context) (pgproto3.FrontendMessage, error)
TODO : implement, unit tests ReceiveCtx implements RouterClient.
func (*PsqlClient) Reply ¶
func (cl *PsqlClient) Reply(msg string) error
func (*PsqlClient) ReplyBindComplete ¶
func (cl *PsqlClient) ReplyBindComplete() error
func (*PsqlClient) ReplyCommandComplete ¶
func (cl *PsqlClient) ReplyCommandComplete(commandTag string) error
func (*PsqlClient) ReplyDebugNotice ¶
func (cl *PsqlClient) ReplyDebugNotice(msg string) error
func (*PsqlClient) ReplyDebugNoticef ¶
func (cl *PsqlClient) ReplyDebugNoticef(fmtString string, args ...interface{}) error
func (*PsqlClient) ReplyErr ¶
func (cl *PsqlClient) ReplyErr(e error) error
func (*PsqlClient) ReplyErrMsg ¶
func (cl *PsqlClient) ReplyErrMsg(msg string, code string) error
func (*PsqlClient) ReplyErrMsgByCode ¶
func (cl *PsqlClient) ReplyErrMsgByCode(code string) error
func (*PsqlClient) ReplyNotice ¶
func (cl *PsqlClient) ReplyNotice(message string) error
func (*PsqlClient) ReplyParseComplete ¶
func (cl *PsqlClient) ReplyParseComplete() error
func (*PsqlClient) ReplyWarningMsg ¶
func (cl *PsqlClient) ReplyWarningMsg(errmsg string) error
func (*PsqlClient) ReplyWarningf ¶
func (cl *PsqlClient) ReplyWarningf(fmtString string, args ...interface{}) error
func (*PsqlClient) Reset ¶
func (cl *PsqlClient) Reset() error
func (*PsqlClient) ResetAll ¶
func (cl *PsqlClient) ResetAll()
func (*PsqlClient) ResetParam ¶
func (cl *PsqlClient) ResetParam(name string)
func (*PsqlClient) ResetTsa ¶
func (cl *PsqlClient) ResetTsa()
func (*PsqlClient) Rollback ¶
func (cl *PsqlClient) Rollback()
func (*PsqlClient) RollbackToSP ¶
func (cl *PsqlClient) RollbackToSP(name string)
func (*PsqlClient) Route ¶
func (cl *PsqlClient) Route() *route.Route
func (*PsqlClient) RouteHint ¶
func (cl *PsqlClient) RouteHint() routehint.RouteHint
RouteHint implements RouterClient.
func (*PsqlClient) Rule ¶
func (cl *PsqlClient) Rule() *config.FrontendRule
func (*PsqlClient) Savepoint ¶
func (cl *PsqlClient) Savepoint(name string)
func (*PsqlClient) Send ¶
func (cl *PsqlClient) Send(msg pgproto3.BackendMessage) error
func (*PsqlClient) SendCtx ¶
func (cl *PsqlClient) SendCtx(ctx context.Context, msg pgproto3.BackendMessage) error
func (*PsqlClient) Server ¶
func (cl *PsqlClient) Server() server.Server
func (*PsqlClient) ServerAcquireUse ¶
func (cl *PsqlClient) ServerAcquireUse()
This method can be called concurrently with Unroute()
func (*PsqlClient) ServerReleaseUse ¶
func (cl *PsqlClient) ServerReleaseUse()
func (*PsqlClient) SetAllowMultishard ¶
func (cl *PsqlClient) SetAllowMultishard(val bool)
SetAllowMultishard implements RouterClient.
func (*PsqlClient) SetAuthType ¶
func (cl *PsqlClient) SetAuthType(t uint32) error
func (*PsqlClient) SetAutoDistribution ¶
func (cl *PsqlClient) SetAutoDistribution(val string)
SetAutoDistribution implements RouterClient.
func (*PsqlClient) SetBindParams ¶
func (cl *PsqlClient) SetBindParams(p [][]byte)
SetBindParams implements RouterClient.
func (*PsqlClient) SetDefaultRouteBehaviour ¶
func (cl *PsqlClient) SetDefaultRouteBehaviour(b string)
SetDefaultRouteBehaviour implements RouterClient.
func (*PsqlClient) SetDistribution ¶
func (cl *PsqlClient) SetDistribution(val string)
SetDistribution implements RouterClient.
func (*PsqlClient) SetDistributionKey ¶
func (cl *PsqlClient) SetDistributionKey(val string)
SetDistributionKey implements RouterClient.
func (*PsqlClient) SetExecuteOn ¶
func (cl *PsqlClient) SetExecuteOn(val string)
SetExecuteOn implements RouterClient.
func (*PsqlClient) SetMaintainParams ¶
func (cl *PsqlClient) SetMaintainParams(val bool)
SetMaintainParams implements RouterClient.
func (*PsqlClient) SetParam ¶
func (cl *PsqlClient) SetParam(name, value string)
func (*PsqlClient) SetParamFormatCodes ¶
func (cl *PsqlClient) SetParamFormatCodes(paramCodes []int16)
SetParamFormatCodes implements RouterClient.
func (*PsqlClient) SetRouteHint ¶
func (cl *PsqlClient) SetRouteHint(rh routehint.RouteHint)
SetRouteHint implements RouterClient.
func (*PsqlClient) SetShardingKey ¶
func (cl *PsqlClient) SetShardingKey(k string)
SetShardingKey implements RouterClient.
func (*PsqlClient) SetShowNoticeMsg ¶
func (cl *PsqlClient) SetShowNoticeMsg(val bool)
SetShowNoticeMsg implements client.Client.
func (*PsqlClient) SetTsa ¶
func (cl *PsqlClient) SetTsa(s string)
func (*PsqlClient) ShardingKey ¶
func (cl *PsqlClient) ShardingKey() string
ShardingKey implements RouterClient.
func (*PsqlClient) Shards ¶
func (cl *PsqlClient) Shards() []shard.Shard
func (*PsqlClient) ShowNoticeMsg ¶
func (cl *PsqlClient) ShowNoticeMsg() bool
ShowNoticeMsg implements RouterClient.
func (*PsqlClient) Shutdown ¶
func (cl *PsqlClient) Shutdown() error
func (*PsqlClient) StartTx ¶
func (cl *PsqlClient) StartTx()
func (*PsqlClient) StartupMessage ¶
func (cl *PsqlClient) StartupMessage() *pgproto3.StartupMessage
func (*PsqlClient) StorePreparedStatement ¶
func (cl *PsqlClient) StorePreparedStatement(d *prepstatement.PreparedStatementDefinition)
func (*PsqlClient) Unroute ¶
func (cl *PsqlClient) Unroute() error
This method can be called concurrently with Cancel()
func (*PsqlClient) Usr ¶
func (cl *PsqlClient) Usr() string
type RouterClient ¶
type RouterClient interface { client.Client prepstatement.PreparedStatementMapper RLock() RUnlock() /* only call this function while holding lock */ Server() server.Server ServerAcquireUse() ServerReleaseUse() Unroute() error Auth(rt *route.Route) error AssignRule(rule *config.FrontendRule) error AssignServerConn(srv server.Server) error AssignRoute(r *route.Route) error Route() *route.Route Rule() *config.FrontendRule GetTsa() tsa.TSA SetTsa(string) CancelMsg() *pgproto3.CancelRequest ReplyParseComplete() error ReplyBindComplete() error ReplyCommandComplete(commandTag string) error GetCancelPid() uint32 GetCancelKey() uint32 }