client

package
v0.0.0-...-096c525 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: PostgreSQL Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDB = "default"
View Source
const DefaultDS = "default"
View Source
const DefaultUsr = "default"

Variables

View Source
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 (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 MockShard

type MockShard struct {
	shard.Shard
	// contains filtered or unexported fields
}

func (MockShard) Instance

func (s MockShard) Instance() conn.DBInstance

type NoopClient

type NoopClient struct {
	client.Client
	// contains filtered or unexported fields
}

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) Auth

func (cl *PsqlClient) Auth(rt *route.Route) 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

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) ReplyRFQ

func (cl *PsqlClient) ReplyRFQ(txstatus txstatus.TXStatus) 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
}

Jump to

Keyboard shortcuts

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