Documentation
¶
Index ¶
- Constants
- Variables
- func ClearAllRdsHostListProviderCaches()
- func ClearCaches()
- func ClearResetSessionStateOnCloseFunc()
- func ClearTransferSessionStateOnCloseFunc()
- func GetHostWeightMapFromString(hostWeightMapString string) (map[string]int, error)
- func GetResetSessionStateOnCloseFunc() func(sessionState SessionState, conn driver.Conn) bool
- func GetTransferSessionStateOnCloseFunc() func(sessionState SessionState, conn driver.Conn) bool
- func MonitoringRdsHostListProviderClearCaches()
- func ResetCustomConnectionProvider()
- func SetCustomConnectionProvider(connProvider ConnectionProvider)
- func SetResetSessionStateOnCloseFunc(function func(sessionState SessionState, conn driver.Conn) bool)
- func SetTransferSessionStateOnCloseFunc(function func(sessionState SessionState, conn driver.Conn) bool)
- type AuroraLimitlessDialect
- type AuroraMySQLDatabaseDialect
- func (m *AuroraMySQLDatabaseDialect) GetDialectUpdateCandidates() []string
- func (m *AuroraMySQLDatabaseDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (m *AuroraMySQLDatabaseDialect) GetHostName(conn driver.Conn) string
- func (m *AuroraMySQLDatabaseDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
- func (m *AuroraMySQLDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
- func (m *AuroraMySQLDatabaseDialect) IsDialect(conn driver.Conn) bool
- type AuroraPgDatabaseDialect
- func (m *AuroraPgDatabaseDialect) GetDialectUpdateCandidates() []string
- func (m *AuroraPgDatabaseDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (m *AuroraPgDatabaseDialect) GetHostName(conn driver.Conn) string
- func (m *AuroraPgDatabaseDialect) GetLimitlessRouterEndpointQuery() string
- func (m *AuroraPgDatabaseDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
- func (m *AuroraPgDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
- func (m *AuroraPgDatabaseDialect) IsDialect(conn driver.Conn) bool
- type BlockingHostListProvider
- type CanReleaseResources
- type ClusterTopologyMonitor
- type ClusterTopologyMonitorImpl
- func (c *ClusterTopologyMonitorImpl) Close()
- func (c *ClusterTopologyMonitorImpl) ForceRefreshUsingConn(conn driver.Conn, timeoutMs int) ([]*host_info_util.HostInfo, error)
- func (c *ClusterTopologyMonitorImpl) ForceRefreshVerifyWriter(shouldVerify bool, timeoutMs int) ([]*host_info_util.HostInfo, error)
- func (c *ClusterTopologyMonitorImpl) Run(wg *sync.WaitGroup)
- func (c *ClusterTopologyMonitorImpl) SetClusterId(clusterId string)
- func (c *ClusterTopologyMonitorImpl) Start(wg *sync.WaitGroup)
- type ConnectFunc
- type ConnectionContainer
- type ConnectionPlugin
- type ConnectionPluginFactory
- type ConnectionProvider
- type ConnectionProviderManager
- func (connProviderManager *ConnectionProviderManager) AcceptsStrategy(strategy string) bool
- func (connProviderManager *ConnectionProviderManager) GetConnectionProvider(hostInfo host_info_util.HostInfo, props map[string]string) ConnectionProvider
- func (connProviderManager *ConnectionProviderManager) GetDefaultProvider() ConnectionProvider
- func (connProviderManager *ConnectionProviderManager) GetHostInfoByStrategy(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, ...) (*host_info_util.HostInfo, error)
- func (connProviderManager *ConnectionProviderManager) GetHostSelectorStrategy(strategy string) (HostSelector, error)
- type DatabaseDialect
- type DatabaseEngine
- type DialectCode
- type DialectManager
- type DialectProvider
- type DriverConnectionProvider
- func (d DriverConnectionProvider) AcceptsStrategy(strategy string) bool
- func (d DriverConnectionProvider) AcceptsUrl(hostInfo host_info_util.HostInfo, props map[string]string) bool
- func (d DriverConnectionProvider) Connect(hostInfo *host_info_util.HostInfo, props map[string]string, ...) (driver.Conn, error)
- func (d DriverConnectionProvider) GetHostInfoByStrategy(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, ...) (*host_info_util.HostInfo, error)
- func (d DriverConnectionProvider) GetHostSelectorStrategy(strategy string) (HostSelector, error)
- type DriverDialect
- type DsnHostListProvider
- func (c *DsnHostListProvider) CreateHost(hostName string, hostRole host_info_util.HostRole, lag float64, cpu float64, ...) *host_info_util.HostInfo
- func (c *DsnHostListProvider) ForceRefresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
- func (c *DsnHostListProvider) GetClusterId() (clusterId string, err error)
- func (c *DsnHostListProvider) GetHostRole(conn driver.Conn) host_info_util.HostRole
- func (c *DsnHostListProvider) IdentifyConnection(conn driver.Conn) (*host_info_util.HostInfo, error)
- func (c *DsnHostListProvider) IsStaticHostListProvider() bool
- func (c *DsnHostListProvider) Refresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
- type ExecuteFunc
- type HighestWeightHostSelector
- type HostChangeOptions
- type HostListProvider
- type HostListProviderService
- type HostMonitoringRoutine
- type HostSelector
- type MonitoringRdsHostListProvider
- type MySQLDatabaseDialect
- func (m *MySQLDatabaseDialect) DoesStatementSetAutoCommit(statement string) (bool, bool)
- func (m *MySQLDatabaseDialect) DoesStatementSetCatalog(statement string) (string, bool)
- func (m *MySQLDatabaseDialect) DoesStatementSetReadOnly(statement string) (bool, bool)
- func (m *MySQLDatabaseDialect) DoesStatementSetSchema(statement string) (string, bool)
- func (m *MySQLDatabaseDialect) DoesStatementSetTransactionIsolation(statement string) (TransactionIsolationLevel, bool)
- func (m *MySQLDatabaseDialect) GetDefaultPort() int
- func (m *MySQLDatabaseDialect) GetDialectUpdateCandidates() []string
- func (m *MySQLDatabaseDialect) GetHostAliasQuery() string
- func (m *MySQLDatabaseDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (m *MySQLDatabaseDialect) GetServerVersionQuery() string
- func (m *MySQLDatabaseDialect) GetSetAutoCommitQuery(autoCommit bool) (string, error)
- func (m *MySQLDatabaseDialect) GetSetCatalogQuery(catalog string) (string, error)
- func (m *MySQLDatabaseDialect) GetSetReadOnlyQuery(readOnly bool) (string, error)
- func (m *MySQLDatabaseDialect) GetSetSchemaQuery(schema string) (string, error)
- func (m *MySQLDatabaseDialect) GetSetTransactionIsolationQuery(level TransactionIsolationLevel) (string, error)
- func (m *MySQLDatabaseDialect) IsDialect(conn driver.Conn) bool
- type MySQLTopologyAwareDatabaseDialect
- func (m *MySQLTopologyAwareDatabaseDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (m *MySQLTopologyAwareDatabaseDialect) GetHostName(conn driver.Conn) string
- func (m *MySQLTopologyAwareDatabaseDialect) GetHostRole(conn driver.Conn) host_info_util.HostRole
- func (m *MySQLTopologyAwareDatabaseDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
- func (m *MySQLTopologyAwareDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
- type NumberRange
- type OldConnectionSuggestedAction
- type PgDatabaseDialect
- func (p *PgDatabaseDialect) DoesStatementSetAutoCommit(statement string) (bool, bool)
- func (p *PgDatabaseDialect) DoesStatementSetCatalog(statement string) (string, bool)
- func (p *PgDatabaseDialect) DoesStatementSetReadOnly(statement string) (bool, bool)
- func (p *PgDatabaseDialect) DoesStatementSetSchema(statement string) (string, bool)
- func (p *PgDatabaseDialect) DoesStatementSetTransactionIsolation(statement string) (TransactionIsolationLevel, bool)
- func (p *PgDatabaseDialect) GetDefaultPort() int
- func (p *PgDatabaseDialect) GetDialectUpdateCandidates() []string
- func (p *PgDatabaseDialect) GetHostAliasQuery() string
- func (p *PgDatabaseDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (p *PgDatabaseDialect) GetServerVersionQuery() string
- func (p *PgDatabaseDialect) GetSetAutoCommitQuery(autoCommit bool) (string, error)
- func (p *PgDatabaseDialect) GetSetCatalogQuery(catalog string) (string, error)
- func (p *PgDatabaseDialect) GetSetReadOnlyQuery(readOnly bool) (string, error)
- func (p *PgDatabaseDialect) GetSetSchemaQuery(schema string) (string, error)
- func (p *PgDatabaseDialect) GetSetTransactionIsolationQuery(level TransactionIsolationLevel) (string, error)
- func (p *PgDatabaseDialect) IsDialect(conn driver.Conn) bool
- type PgTopologyAwareDatabaseDialect
- func (m *PgTopologyAwareDatabaseDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (m *PgTopologyAwareDatabaseDialect) GetHostName(conn driver.Conn) string
- func (m *PgTopologyAwareDatabaseDialect) GetHostRole(conn driver.Conn) host_info_util.HostRole
- func (m *PgTopologyAwareDatabaseDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
- func (m *PgTopologyAwareDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
- type PluginConnectFunc
- type PluginExecFunc
- type PluginManager
- type PluginManagerProvider
- type PluginService
- type PluginServiceProvider
- type RandomHostSelector
- type RdsHostListProvider
- func (r *RdsHostListProvider) CreateHost(host string, hostRole host_info_util.HostRole, lag float64, cpu float64, ...) *host_info_util.HostInfo
- func (r *RdsHostListProvider) ForceRefresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
- func (r *RdsHostListProvider) GetClusterId() (string, error)
- func (r *RdsHostListProvider) GetHostRole(conn driver.Conn) host_info_util.HostRole
- func (r *RdsHostListProvider) IdentifyConnection(conn driver.Conn) (*host_info_util.HostInfo, error)
- func (r *RdsHostListProvider) IsStaticHostListProvider() bool
- func (r *RdsHostListProvider) Refresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
- type RdsMultiAzDbClusterMySQLDialect
- func (r *RdsMultiAzDbClusterMySQLDialect) GetDialectUpdateCandidates() []string
- func (r *RdsMultiAzDbClusterMySQLDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (r *RdsMultiAzDbClusterMySQLDialect) GetHostName(conn driver.Conn) string
- func (r *RdsMultiAzDbClusterMySQLDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
- func (r *RdsMultiAzDbClusterMySQLDialect) GetWriterHostName(conn driver.Conn) (string, error)
- func (r *RdsMultiAzDbClusterMySQLDialect) IsDialect(conn driver.Conn) bool
- type RdsMultiAzDbClusterPgDialect
- func (r *RdsMultiAzDbClusterPgDialect) GetDialectUpdateCandidates() []string
- func (r *RdsMultiAzDbClusterPgDialect) GetHostListProvider(props map[string]string, initialDsn string, ...) HostListProvider
- func (r *RdsMultiAzDbClusterPgDialect) GetHostName(conn driver.Conn) string
- func (r *RdsMultiAzDbClusterPgDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
- func (r *RdsMultiAzDbClusterPgDialect) GetWriterHostName(conn driver.Conn) (string, error)
- func (r *RdsMultiAzDbClusterPgDialect) IsDialect(conn driver.Conn) bool
- type RdsMySQLDatabaseDialect
- type RdsPgDatabaseDialect
- type SessionState
- type SessionStateField
- func (ssf *SessionStateField[T]) CanRestorePristine() bool
- func (ssf *SessionStateField[T]) GetPristineValue() *T
- func (ssf *SessionStateField[T]) GetValue() *T
- func (ssf *SessionStateField[T]) Reset()
- func (ssf *SessionStateField[T]) ResetPristineValue()
- func (ssf *SessionStateField[T]) ResetValue()
- func (ssf *SessionStateField[T]) SetPristineValue(value T)
- func (ssf *SessionStateField[T]) SetValue(value T)
- type SessionStateService
- type SessionStateServiceImpl
- func (sss *SessionStateServiceImpl) ApplyCurrentSessionState(newConn driver.Conn) error
- func (sss *SessionStateServiceImpl) ApplyPristineSessionState(conn driver.Conn) error
- func (sss *SessionStateServiceImpl) Begin() error
- func (sss *SessionStateServiceImpl) Complete()
- func (sss *SessionStateServiceImpl) GetAutoCommit() *bool
- func (sss *SessionStateServiceImpl) GetCatalog() *string
- func (sss *SessionStateServiceImpl) GetReadOnly() *bool
- func (sss *SessionStateServiceImpl) GetSchema() *string
- func (sss *SessionStateServiceImpl) GetTransactionIsolation() *TransactionIsolationLevel
- func (sss *SessionStateServiceImpl) Reset()
- func (sss *SessionStateServiceImpl) SetAutoCommit(val bool)
- func (sss *SessionStateServiceImpl) SetCatalog(val string)
- func (sss *SessionStateServiceImpl) SetReadOnly(val bool)
- func (sss *SessionStateServiceImpl) SetSchema(val string)
- func (sss *SessionStateServiceImpl) SetTransactionIsolation(val TransactionIsolationLevel)
- func (sss *SessionStateServiceImpl) SetupPristineAutoCommit()
- func (sss *SessionStateServiceImpl) SetupPristineAutoCommitWithVal(val bool)
- func (sss *SessionStateServiceImpl) SetupPristineCatalog()
- func (sss *SessionStateServiceImpl) SetupPristineCatalogWithVal(val string)
- func (sss *SessionStateServiceImpl) SetupPristineReadOnly()
- func (sss *SessionStateServiceImpl) SetupPristineReadOnlyWithVal(val bool)
- func (sss *SessionStateServiceImpl) SetupPristineSchema()
- func (sss *SessionStateServiceImpl) SetupPristineSchemaWithVal(val string)
- func (sss *SessionStateServiceImpl) SetupPristineTransactionIsolation()
- func (sss *SessionStateServiceImpl) SetupPristineTransactionIsolationWithVal(val TransactionIsolationLevel)
- type TopologyAwareDialect
- type TransactionIsolationLevel
- type WeightedHostSelector
- type WeightedRandomHostSelector
- func (r *WeightedRandomHostSelector) ClearHostWeights()
- func (r *WeightedRandomHostSelector) GetHost(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, ...) (*host_info_util.HostInfo, error)
- func (r *WeightedRandomHostSelector) SetHostWeights(hostWeightMap map[string]int)
- func (r *WeightedRandomHostSelector) SetRandomNumberFunc(f func(int) int)
Constants ¶
View Source
const ( AURORA_MYSQL_DIALECT string = "aurora-mysql" RDS_MYSQL_DIALECT string = "rds-mysql" MYSQL_DIALECT string = "mysql" RDS_MYSQL_MULTI_AZ_CLUSTER_DIALECT string = "rds-multi-az-mysql-cluster" AURORA_PG_DIALECT string = "aurora-pg" RDS_PG_DIALECT string = "rds-pg" PG_DIALECT string = "pg" RDS_PG_MULTI_AZ_CLUSTER_DIALECT string = "rds-multi-az-pg-cluster" )
View Source
const ( AWS_PGX_DRIVER_CODE string = "awssql-pgx" AWS_MYSQL_DRIVER_CODE string = "awssql-mysql" )
View Source
const ( SELECTOR_HIGHEST_WEIGHT = "highestWeight" SELECTOR_RANDOM = "random" SELECTOR_WEIGHTED_RANDOM = "weightedRandom" )
Variables ¶
View Source
var ( // Example host weight pair patterns: "host0:3,host1:02,host2:1", "host.com:50000". HOST_WEIGHT_PAIR_PATTERN = regexp.MustCompile("(?i)^((?P<host>[^:/?#]*):(?P<weight>0*[1-9][0-9]*))") HOST_PATTERN_GROUP = "host" HOST_WEIGHT_PATTERN_GROUP = "weight" )
View Source
var DEFAULT_TOPOLOGY_QUERY_TIMEOUT_MS = 5000
View Source
var ENDPOINT_CACHE_EXPIRATION = time.Hour * 24
View Source
var FallbackTopologyRefreshTimeoutMs = 1100
View Source
var KnownDialectsByCode = map[string]DatabaseDialect{ MYSQL_DIALECT: &MySQLDatabaseDialect{}, PG_DIALECT: &PgDatabaseDialect{}, RDS_MYSQL_DIALECT: &RdsMySQLDatabaseDialect{}, RDS_PG_DIALECT: &RdsPgDatabaseDialect{}, AURORA_MYSQL_DIALECT: &AuroraMySQLDatabaseDialect{}, AURORA_PG_DIALECT: &AuroraPgDatabaseDialect{}, RDS_MYSQL_MULTI_AZ_CLUSTER_DIALECT: &RdsMultiAzDbClusterMySQLDialect{}, RDS_PG_MULTI_AZ_CLUSTER_DIALECT: &RdsMultiAzDbClusterPgDialect{}, }
View Source
var MONITOR_EXPIRATION_NANOS = time.Minute
View Source
var TOPOLOGY_CACHE_EXPIRATION_NANO = time.Minute * 5
View Source
var TopologyCache = utils.NewCache[[]*host_info_util.HostInfo]()
Functions ¶
func ClearAllRdsHostListProviderCaches ¶
func ClearAllRdsHostListProviderCaches()
func ClearCaches ¶
func ClearCaches()
This cleans up all long standing caches. To be called at the end of program, not each time a Conn is closed.
func ClearResetSessionStateOnCloseFunc ¶
func ClearResetSessionStateOnCloseFunc()
func ClearTransferSessionStateOnCloseFunc ¶
func ClearTransferSessionStateOnCloseFunc()
func GetResetSessionStateOnCloseFunc ¶
func GetResetSessionStateOnCloseFunc() func(sessionState SessionState, conn driver.Conn) bool
func GetTransferSessionStateOnCloseFunc ¶
func GetTransferSessionStateOnCloseFunc() func(sessionState SessionState, conn driver.Conn) bool
func MonitoringRdsHostListProviderClearCaches ¶
func MonitoringRdsHostListProviderClearCaches()
func ResetCustomConnectionProvider ¶
func ResetCustomConnectionProvider()
func SetCustomConnectionProvider ¶
func SetCustomConnectionProvider(connProvider ConnectionProvider)
func SetResetSessionStateOnCloseFunc ¶
func SetResetSessionStateOnCloseFunc(function func(sessionState SessionState, conn driver.Conn) bool)
func SetTransferSessionStateOnCloseFunc ¶
func SetTransferSessionStateOnCloseFunc(function func(sessionState SessionState, conn driver.Conn) bool)
Types ¶
type AuroraLimitlessDialect ¶
type AuroraLimitlessDialect interface {
GetLimitlessRouterEndpointQuery() string
DatabaseDialect
}
type AuroraMySQLDatabaseDialect ¶
type AuroraMySQLDatabaseDialect struct {
MySQLTopologyAwareDatabaseDialect
}
func (*AuroraMySQLDatabaseDialect) GetDialectUpdateCandidates ¶
func (m *AuroraMySQLDatabaseDialect) GetDialectUpdateCandidates() []string
func (*AuroraMySQLDatabaseDialect) GetHostListProvider ¶
func (m *AuroraMySQLDatabaseDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*AuroraMySQLDatabaseDialect) GetHostName ¶
func (m *AuroraMySQLDatabaseDialect) GetHostName(conn driver.Conn) string
func (*AuroraMySQLDatabaseDialect) GetTopology ¶
func (m *AuroraMySQLDatabaseDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
func (*AuroraMySQLDatabaseDialect) GetWriterHostName ¶
func (m *AuroraMySQLDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
type AuroraPgDatabaseDialect ¶
type AuroraPgDatabaseDialect struct {
PgTopologyAwareDatabaseDialect
}
func (*AuroraPgDatabaseDialect) GetDialectUpdateCandidates ¶
func (m *AuroraPgDatabaseDialect) GetDialectUpdateCandidates() []string
func (*AuroraPgDatabaseDialect) GetHostListProvider ¶
func (m *AuroraPgDatabaseDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*AuroraPgDatabaseDialect) GetHostName ¶
func (m *AuroraPgDatabaseDialect) GetHostName(conn driver.Conn) string
func (*AuroraPgDatabaseDialect) GetLimitlessRouterEndpointQuery ¶
func (m *AuroraPgDatabaseDialect) GetLimitlessRouterEndpointQuery() string
func (*AuroraPgDatabaseDialect) GetTopology ¶
func (m *AuroraPgDatabaseDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
func (*AuroraPgDatabaseDialect) GetWriterHostName ¶
func (m *AuroraPgDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
type BlockingHostListProvider ¶
type BlockingHostListProvider interface {
HostListProvider
ForceRefreshHostListWithTimeout(shouldVerifyWriter bool, timeoutMs int) ([]*host_info_util.HostInfo, error)
}
type CanReleaseResources ¶
type CanReleaseResources interface {
ReleaseResources()
}
type ClusterTopologyMonitor ¶
type ClusterTopologyMonitorImpl ¶
type ClusterTopologyMonitorImpl struct {
// contains filtered or unexported fields
}
func NewClusterTopologyMonitorImpl ¶
func NewClusterTopologyMonitorImpl( hostListProvider *MonitoringRdsHostListProvider, dialect TopologyAwareDialect, clusterId string, highRefreshRateNano time.Duration, refreshRateNano time.Duration, topologyCacheExpirationNano time.Duration, props map[string]string, initialHostInfo *host_info_util.HostInfo, clusterInstanceTemplate *host_info_util.HostInfo, pluginService PluginService) *ClusterTopologyMonitorImpl
func (*ClusterTopologyMonitorImpl) Close ¶
func (c *ClusterTopologyMonitorImpl) Close()
func (*ClusterTopologyMonitorImpl) ForceRefreshUsingConn ¶
func (c *ClusterTopologyMonitorImpl) ForceRefreshUsingConn(conn driver.Conn, timeoutMs int) ([]*host_info_util.HostInfo, error)
func (*ClusterTopologyMonitorImpl) ForceRefreshVerifyWriter ¶
func (c *ClusterTopologyMonitorImpl) ForceRefreshVerifyWriter(shouldVerify bool, timeoutMs int) ([]*host_info_util.HostInfo, error)
func (*ClusterTopologyMonitorImpl) Run ¶
func (c *ClusterTopologyMonitorImpl) Run(wg *sync.WaitGroup)
func (*ClusterTopologyMonitorImpl) SetClusterId ¶
func (c *ClusterTopologyMonitorImpl) SetClusterId(clusterId string)
func (*ClusterTopologyMonitorImpl) Start ¶
func (c *ClusterTopologyMonitorImpl) Start(wg *sync.WaitGroup)
type ConnectionContainer ¶
type ConnectionPlugin ¶
type ConnectionPlugin interface {
GetSubscribedMethods() []string
Execute(
connInvokedOn driver.Conn,
methodName string,
executeFunc ExecuteFunc,
methodArgs ...any) (wrappedReturnValue any, wrappedReturnValue2 any, wrappedOk bool, wrappedErr error)
Connect(hostInfo *host_info_util.HostInfo, props map[string]string, isInitialConnection bool, connectFunc ConnectFunc) (driver.Conn, error)
ForceConnect(hostInfo *host_info_util.HostInfo, props map[string]string, isInitialConnection bool, connectFunc ConnectFunc) (driver.Conn, error)
AcceptsStrategy(strategy string) bool
GetHostInfoByStrategy(role host_info_util.HostRole, strategy string, hosts []*host_info_util.HostInfo) (*host_info_util.HostInfo, error)
GetHostSelectorStrategy(strategy string) (HostSelector, error)
NotifyConnectionChanged(changes map[HostChangeOptions]bool) OldConnectionSuggestedAction
NotifyHostListChanged(changes map[string]map[HostChangeOptions]bool)
InitHostProvider(initialUrl string, props map[string]string, hostListProviderService HostListProviderService, initHostProviderFunc func() error) error
}
type ConnectionPluginFactory ¶
type ConnectionPluginFactory interface {
GetInstance(pluginService PluginService, props map[string]string) (ConnectionPlugin, error)
ClearCaches()
}
type ConnectionProvider ¶
type ConnectionProvider interface {
AcceptsUrl(hostInfo host_info_util.HostInfo, props map[string]string) bool
AcceptsStrategy(strategy string) bool
GetHostInfoByStrategy(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, strategy string, props map[string]string) (*host_info_util.HostInfo, error)
GetHostSelectorStrategy(strategy string) (HostSelector, error)
Connect(hostInfo *host_info_util.HostInfo, props map[string]string, pluginService PluginService) (driver.Conn, error)
}
type ConnectionProviderManager ¶
type ConnectionProviderManager struct {
DefaultProvider ConnectionProvider
EffectiveProvider ConnectionProvider
}
func (*ConnectionProviderManager) AcceptsStrategy ¶
func (connProviderManager *ConnectionProviderManager) AcceptsStrategy(strategy string) bool
func (*ConnectionProviderManager) GetConnectionProvider ¶
func (connProviderManager *ConnectionProviderManager) GetConnectionProvider( hostInfo host_info_util.HostInfo, props map[string]string) ConnectionProvider
func (*ConnectionProviderManager) GetDefaultProvider ¶
func (connProviderManager *ConnectionProviderManager) GetDefaultProvider() ConnectionProvider
func (*ConnectionProviderManager) GetHostInfoByStrategy ¶
func (connProviderManager *ConnectionProviderManager) GetHostInfoByStrategy( hosts []*host_info_util.HostInfo, role host_info_util.HostRole, strategy string, props map[string]string) (*host_info_util.HostInfo, error)
func (*ConnectionProviderManager) GetHostSelectorStrategy ¶
func (connProviderManager *ConnectionProviderManager) GetHostSelectorStrategy(strategy string) (HostSelector, error)
type DatabaseDialect ¶
type DatabaseDialect interface {
GetDefaultPort() int
GetHostAliasQuery() string
GetServerVersionQuery() string
GetDialectUpdateCandidates() []string
IsDialect(conn driver.Conn) bool
GetHostListProvider(props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
DoesStatementSetAutoCommit(statement string) (bool, bool)
DoesStatementSetReadOnly(statement string) (bool, bool)
DoesStatementSetCatalog(statement string) (string, bool)
DoesStatementSetSchema(statement string) (string, bool)
DoesStatementSetTransactionIsolation(statement string) (TransactionIsolationLevel, bool)
GetSetAutoCommitQuery(autoCommit bool) (string, error)
GetSetReadOnlyQuery(readOnly bool) (string, error)
GetSetCatalogQuery(catalog string) (string, error)
GetSetSchemaQuery(schema string) (string, error)
GetSetTransactionIsolationQuery(level TransactionIsolationLevel) (string, error)
}
type DatabaseEngine ¶
type DatabaseEngine string
const ( MYSQL DatabaseEngine = "mysql" PG DatabaseEngine = "pg" )
type DialectCode ¶
type DialectCode string
type DialectManager ¶
type DialectManager struct {
FindRegisteredDriver func(dialectCode string) bool
// contains filtered or unexported fields
}
func (*DialectManager) GetDialect ¶
func (d *DialectManager) GetDialect(dsn string, props map[string]string) (DatabaseDialect, error)
func (*DialectManager) GetDialectForUpdate ¶
func (d *DialectManager) GetDialectForUpdate(conn driver.Conn, originalHost string, newHost string) DatabaseDialect
type DialectProvider ¶
type DialectProvider interface {
GetDialect(dsn string, props map[string]string) (DatabaseDialect, error)
GetDialectForUpdate(conn driver.Conn, originalHost string, newHost string) DatabaseDialect
}
type DriverConnectionProvider ¶
type DriverConnectionProvider struct {
// contains filtered or unexported fields
}
func NewDriverConnectionProvider ¶
func NewDriverConnectionProvider(targetDriver driver.Driver) *DriverConnectionProvider
func (DriverConnectionProvider) AcceptsStrategy ¶
func (d DriverConnectionProvider) AcceptsStrategy(strategy string) bool
func (DriverConnectionProvider) AcceptsUrl ¶
func (d DriverConnectionProvider) AcceptsUrl(hostInfo host_info_util.HostInfo, props map[string]string) bool
func (DriverConnectionProvider) Connect ¶
func (d DriverConnectionProvider) Connect(hostInfo *host_info_util.HostInfo, props map[string]string, pluginService PluginService) (driver.Conn, error)
func (DriverConnectionProvider) GetHostInfoByStrategy ¶
func (d DriverConnectionProvider) GetHostInfoByStrategy( hosts []*host_info_util.HostInfo, role host_info_util.HostRole, strategy string, props map[string]string) (*host_info_util.HostInfo, error)
func (DriverConnectionProvider) GetHostSelectorStrategy ¶
func (d DriverConnectionProvider) GetHostSelectorStrategy(strategy string) (HostSelector, error)
type DriverDialect ¶
type DriverDialect interface {
IsDialect(driver driver.Driver) bool
GetAllowedOnConnectionMethodNames() []string
PrepareDsn(properties map[string]string, info *host_info_util.HostInfo) string
IsNetworkError(err error) bool
IsLoginError(err error) bool
IsClosed(conn driver.Conn) bool
IsDriverRegistered(drivers map[string]driver.Driver) bool
RegisterDriver()
}
type DsnHostListProvider ¶
type DsnHostListProvider struct {
// contains filtered or unexported fields
}
func NewDsnHostListProvider ¶
func NewDsnHostListProvider(props map[string]string, dsn string, hostListProviderService HostListProviderService) *DsnHostListProvider
func (*DsnHostListProvider) CreateHost ¶
func (c *DsnHostListProvider) CreateHost(hostName string, hostRole host_info_util.HostRole, lag float64, cpu float64, lastUpdateTime time.Time) *host_info_util.HostInfo
func (*DsnHostListProvider) ForceRefresh ¶
func (c *DsnHostListProvider) ForceRefresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
func (*DsnHostListProvider) GetClusterId ¶
func (c *DsnHostListProvider) GetClusterId() (clusterId string, err error)
func (*DsnHostListProvider) GetHostRole ¶
func (c *DsnHostListProvider) GetHostRole(conn driver.Conn) host_info_util.HostRole
func (*DsnHostListProvider) IdentifyConnection ¶
func (c *DsnHostListProvider) IdentifyConnection(conn driver.Conn) (*host_info_util.HostInfo, error)
func (*DsnHostListProvider) IsStaticHostListProvider ¶
func (c *DsnHostListProvider) IsStaticHostListProvider() bool
func (*DsnHostListProvider) Refresh ¶
func (c *DsnHostListProvider) Refresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
type HighestWeightHostSelector ¶
type HighestWeightHostSelector struct{}
func (*HighestWeightHostSelector) GetHost ¶
func (h *HighestWeightHostSelector) GetHost( hosts []*host_info_util.HostInfo, role host_info_util.HostRole, props map[string]string) (*host_info_util.HostInfo, error)
type HostChangeOptions ¶
type HostChangeOptions int
const ( HOSTNAME HostChangeOptions = 0 PROMOTED_TO_WRITER HostChangeOptions = 1 PROMOTED_TO_READER HostChangeOptions = 2 WENT_UP HostChangeOptions = 3 WENT_DOWN HostChangeOptions = 4 CONNECTION_OBJECT_CHANGED HostChangeOptions = 5 INITIAL_CONNECTION HostChangeOptions = 6 HOST_ADDED HostChangeOptions = 7 HOST_CHANGED HostChangeOptions = 8 HOST_DELETED HostChangeOptions = 9 )
type HostListProvider ¶
type HostListProvider interface {
Refresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
ForceRefresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
GetHostRole(conn driver.Conn) host_info_util.HostRole
IdentifyConnection(conn driver.Conn) (*host_info_util.HostInfo, error)
GetClusterId() (string, error)
IsStaticHostListProvider() bool
CreateHost(hostName string, role host_info_util.HostRole, lag float64, cpu float64, lastUpdateTime time.Time) *host_info_util.HostInfo
}
type HostListProviderService ¶
type HostListProviderService interface {
IsStaticHostListProvider() bool
CreateHostListProvider(props map[string]string, dsn string) HostListProvider
GetHostListProvider() HostListProvider
SetHostListProvider(hostListProvider HostListProvider)
SetInitialConnectionHostInfo(info *host_info_util.HostInfo)
GetDialect() DatabaseDialect
GetCurrentConnection() driver.Conn
}
type HostMonitoringRoutine ¶
type HostMonitoringRoutine struct {
// contains filtered or unexported fields
}
func (*HostMonitoringRoutine) Init ¶
func (h *HostMonitoringRoutine) Init()
type HostSelector ¶
type HostSelector interface {
GetHost(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, props map[string]string) (*host_info_util.HostInfo, error)
}
type MonitoringRdsHostListProvider ¶
type MonitoringRdsHostListProvider struct {
*RdsHostListProvider
// contains filtered or unexported fields
}
func NewMonitoringRdsHostListProvider ¶
func NewMonitoringRdsHostListProvider( hostListProviderService HostListProviderService, databaseDialect TopologyAwareDialect, properties map[string]string, originalDsn string, pluginService PluginService) *MonitoringRdsHostListProvider
func (*MonitoringRdsHostListProvider) ForceRefreshHostListWithTimeout ¶
func (m *MonitoringRdsHostListProvider) ForceRefreshHostListWithTimeout(shouldVerifyWriter bool, timeoutMs int) ([]*host_info_util.HostInfo, error)
type MySQLDatabaseDialect ¶
type MySQLDatabaseDialect struct {
}
func (*MySQLDatabaseDialect) DoesStatementSetAutoCommit ¶
func (m *MySQLDatabaseDialect) DoesStatementSetAutoCommit(statement string) (bool, bool)
func (*MySQLDatabaseDialect) DoesStatementSetCatalog ¶
func (m *MySQLDatabaseDialect) DoesStatementSetCatalog(statement string) (string, bool)
func (*MySQLDatabaseDialect) DoesStatementSetReadOnly ¶
func (m *MySQLDatabaseDialect) DoesStatementSetReadOnly(statement string) (bool, bool)
func (*MySQLDatabaseDialect) DoesStatementSetSchema ¶
func (m *MySQLDatabaseDialect) DoesStatementSetSchema(statement string) (string, bool)
func (*MySQLDatabaseDialect) DoesStatementSetTransactionIsolation ¶
func (m *MySQLDatabaseDialect) DoesStatementSetTransactionIsolation(statement string) (TransactionIsolationLevel, bool)
func (*MySQLDatabaseDialect) GetDefaultPort ¶
func (m *MySQLDatabaseDialect) GetDefaultPort() int
func (*MySQLDatabaseDialect) GetDialectUpdateCandidates ¶
func (m *MySQLDatabaseDialect) GetDialectUpdateCandidates() []string
func (*MySQLDatabaseDialect) GetHostAliasQuery ¶
func (m *MySQLDatabaseDialect) GetHostAliasQuery() string
func (*MySQLDatabaseDialect) GetHostListProvider ¶
func (m *MySQLDatabaseDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*MySQLDatabaseDialect) GetServerVersionQuery ¶
func (m *MySQLDatabaseDialect) GetServerVersionQuery() string
func (*MySQLDatabaseDialect) GetSetAutoCommitQuery ¶
func (m *MySQLDatabaseDialect) GetSetAutoCommitQuery(autoCommit bool) (string, error)
func (*MySQLDatabaseDialect) GetSetCatalogQuery ¶
func (m *MySQLDatabaseDialect) GetSetCatalogQuery(catalog string) (string, error)
func (*MySQLDatabaseDialect) GetSetReadOnlyQuery ¶
func (m *MySQLDatabaseDialect) GetSetReadOnlyQuery(readOnly bool) (string, error)
func (*MySQLDatabaseDialect) GetSetSchemaQuery ¶
func (m *MySQLDatabaseDialect) GetSetSchemaQuery(schema string) (string, error)
func (*MySQLDatabaseDialect) GetSetTransactionIsolationQuery ¶
func (m *MySQLDatabaseDialect) GetSetTransactionIsolationQuery(level TransactionIsolationLevel) (string, error)
type MySQLTopologyAwareDatabaseDialect ¶
type MySQLTopologyAwareDatabaseDialect struct {
MySQLDatabaseDialect
}
func (*MySQLTopologyAwareDatabaseDialect) GetHostListProvider ¶
func (m *MySQLTopologyAwareDatabaseDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*MySQLTopologyAwareDatabaseDialect) GetHostName ¶
func (m *MySQLTopologyAwareDatabaseDialect) GetHostName(conn driver.Conn) string
func (*MySQLTopologyAwareDatabaseDialect) GetHostRole ¶
func (m *MySQLTopologyAwareDatabaseDialect) GetHostRole(conn driver.Conn) host_info_util.HostRole
func (*MySQLTopologyAwareDatabaseDialect) GetTopology ¶
func (m *MySQLTopologyAwareDatabaseDialect) GetTopology( conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
func (*MySQLTopologyAwareDatabaseDialect) GetWriterHostName ¶
func (m *MySQLTopologyAwareDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
type NumberRange ¶
func (NumberRange) IsInNumberRange ¶
func (nr NumberRange) IsInNumberRange(n int) bool
type OldConnectionSuggestedAction ¶
type OldConnectionSuggestedAction string
const ( NO_OPINION OldConnectionSuggestedAction = "no_opinion" DISPOSE OldConnectionSuggestedAction = "dispose" PRESERVE OldConnectionSuggestedAction = "preserve" )
type PgDatabaseDialect ¶
type PgDatabaseDialect struct {
}
func (*PgDatabaseDialect) DoesStatementSetAutoCommit ¶
func (p *PgDatabaseDialect) DoesStatementSetAutoCommit(statement string) (bool, bool)
func (*PgDatabaseDialect) DoesStatementSetCatalog ¶
func (p *PgDatabaseDialect) DoesStatementSetCatalog(statement string) (string, bool)
func (*PgDatabaseDialect) DoesStatementSetReadOnly ¶
func (p *PgDatabaseDialect) DoesStatementSetReadOnly(statement string) (bool, bool)
func (*PgDatabaseDialect) DoesStatementSetSchema ¶
func (p *PgDatabaseDialect) DoesStatementSetSchema(statement string) (string, bool)
func (*PgDatabaseDialect) DoesStatementSetTransactionIsolation ¶
func (p *PgDatabaseDialect) DoesStatementSetTransactionIsolation(statement string) (TransactionIsolationLevel, bool)
func (*PgDatabaseDialect) GetDefaultPort ¶
func (p *PgDatabaseDialect) GetDefaultPort() int
func (*PgDatabaseDialect) GetDialectUpdateCandidates ¶
func (p *PgDatabaseDialect) GetDialectUpdateCandidates() []string
func (*PgDatabaseDialect) GetHostAliasQuery ¶
func (p *PgDatabaseDialect) GetHostAliasQuery() string
func (*PgDatabaseDialect) GetHostListProvider ¶
func (p *PgDatabaseDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*PgDatabaseDialect) GetServerVersionQuery ¶
func (p *PgDatabaseDialect) GetServerVersionQuery() string
func (*PgDatabaseDialect) GetSetAutoCommitQuery ¶
func (p *PgDatabaseDialect) GetSetAutoCommitQuery(autoCommit bool) (string, error)
func (*PgDatabaseDialect) GetSetCatalogQuery ¶
func (p *PgDatabaseDialect) GetSetCatalogQuery(catalog string) (string, error)
func (*PgDatabaseDialect) GetSetReadOnlyQuery ¶
func (p *PgDatabaseDialect) GetSetReadOnlyQuery(readOnly bool) (string, error)
func (*PgDatabaseDialect) GetSetSchemaQuery ¶
func (p *PgDatabaseDialect) GetSetSchemaQuery(schema string) (string, error)
func (*PgDatabaseDialect) GetSetTransactionIsolationQuery ¶
func (p *PgDatabaseDialect) GetSetTransactionIsolationQuery(level TransactionIsolationLevel) (string, error)
type PgTopologyAwareDatabaseDialect ¶
type PgTopologyAwareDatabaseDialect struct {
PgDatabaseDialect
}
func (*PgTopologyAwareDatabaseDialect) GetHostListProvider ¶
func (m *PgTopologyAwareDatabaseDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*PgTopologyAwareDatabaseDialect) GetHostName ¶
func (m *PgTopologyAwareDatabaseDialect) GetHostName(conn driver.Conn) string
func (*PgTopologyAwareDatabaseDialect) GetHostRole ¶
func (m *PgTopologyAwareDatabaseDialect) GetHostRole(conn driver.Conn) host_info_util.HostRole
func (*PgTopologyAwareDatabaseDialect) GetTopology ¶
func (m *PgTopologyAwareDatabaseDialect) GetTopology( conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
func (*PgTopologyAwareDatabaseDialect) GetWriterHostName ¶
func (m *PgTopologyAwareDatabaseDialect) GetWriterHostName(conn driver.Conn) (string, error)
type PluginConnectFunc ¶
type PluginExecFunc ¶
type PluginManager ¶
type PluginManager interface {
Init(pluginService PluginService, plugins []ConnectionPlugin) error
InitHostProvider(initialUrl string, props map[string]string, hostListProviderService HostListProviderService) error
Connect(hostInfo *host_info_util.HostInfo, props map[string]string, isInitialConnection bool, pluginToSkip ConnectionPlugin) (driver.Conn, error)
ForceConnect(hostInfo *host_info_util.HostInfo, props map[string]string, isInitialConnection bool) (driver.Conn, error)
Execute(connInvokedOn driver.Conn, name string, methodFunc ExecuteFunc, methodArgs ...any) (
wrappedReturnValue any,
wrappedReturnValue2 any,
wrappedOk bool,
wrappedErr error)
AcceptsStrategy(strategy string) bool
NotifyHostListChanged(changes map[string]map[HostChangeOptions]bool)
NotifyConnectionChanged(
changes map[HostChangeOptions]bool, skipNotificationForThisPlugin ConnectionPlugin) map[OldConnectionSuggestedAction]bool
NotifySubscribedPlugins(methodName string, pluginFunc PluginExecFunc, skipNotificationForThisPlugin ConnectionPlugin) error
GetHostInfoByStrategy(role host_info_util.HostRole, strategy string, hosts []*host_info_util.HostInfo) (*host_info_util.HostInfo, error)
GetHostSelectorStrategy(strategy string) (hostSelector HostSelector, err error)
GetDefaultConnectionProvider() ConnectionProvider
GetEffectiveConnectionProvider() ConnectionProvider
GetConnectionProviderManager() ConnectionProviderManager
GetTelemetryContext() context.Context
GetTelemetryFactory() telemetry.TelemetryFactory
SetTelemetryContext(ctx context.Context)
ReleaseResources()
}
type PluginManagerProvider ¶
type PluginManagerProvider func( targetDriver driver.Driver, props map[string]string, connProviderManager ConnectionProviderManager, telemetryFactory telemetry.TelemetryFactory) PluginManager
type PluginService ¶
type PluginService interface {
GetCurrentConnection() driver.Conn
GetCurrentConnectionRef() *driver.Conn
SetCurrentConnection(conn driver.Conn, hostInfo *host_info_util.HostInfo, skipNotificationForThisPlugin ConnectionPlugin) error
GetInitialConnectionHostInfo() *host_info_util.HostInfo
GetCurrentHostInfo() (*host_info_util.HostInfo, error)
GetHosts() []*host_info_util.HostInfo
AcceptsStrategy(strategy string) bool
GetHostInfoByStrategy(role host_info_util.HostRole, strategy string, hosts []*host_info_util.HostInfo) (*host_info_util.HostInfo, error)
GetHostSelectorStrategy(strategy string) (hostSelector HostSelector, err error)
GetHostRole(driver.Conn) host_info_util.HostRole
SetAvailability(hostAliases map[string]bool, availability host_info_util.HostAvailability)
IsInTransaction() bool
SetInTransaction(inTransaction bool)
GetCurrentTx() driver.Tx
SetCurrentTx(driver.Tx)
CreateHostListProvider(props map[string]string, dsn string) HostListProvider
SetHostListProvider(hostListProvider HostListProvider)
SetInitialConnectionHostInfo(info *host_info_util.HostInfo)
IsStaticHostListProvider() bool
GetHostListProvider() HostListProvider
RefreshHostList(conn driver.Conn) error
ForceRefreshHostList(conn driver.Conn) error
ForceRefreshHostListWithTimeout(shouldVerifyWriter bool, timeoutMs int) (bool, error)
GetUpdatedHostListWithTimeout(shouldVerifyWriter bool, timeoutMs int) ([]*host_info_util.HostInfo, error)
Connect(hostInfo *host_info_util.HostInfo, props map[string]string, pluginToSkip ConnectionPlugin) (driver.Conn, error)
ForceConnect(hostInfo *host_info_util.HostInfo, props map[string]string) (driver.Conn, error)
GetDialect() DatabaseDialect
SetDialect(dialect DatabaseDialect)
UpdateDialect(conn driver.Conn)
GetTargetDriverDialect() DriverDialect
IdentifyConnection(conn driver.Conn) (*host_info_util.HostInfo, error)
FillAliases(conn driver.Conn, hostInfo *host_info_util.HostInfo)
GetConnectionProvider() ConnectionProvider
GetProperties() map[string]string
IsNetworkError(err error) bool
IsLoginError(err error) bool
GetTelemetryContext() context.Context
GetTelemetryFactory() telemetry.TelemetryFactory
SetTelemetryContext(ctx context.Context)
UpdateState(sql string, methodArgs ...any)
}
type PluginServiceProvider ¶
type PluginServiceProvider func( pluginManager PluginManager, driverDialect DriverDialect, props map[string]string, dsn string) (PluginService, error)
type RandomHostSelector ¶
type RandomHostSelector struct{}
func (*RandomHostSelector) GetHost ¶
func (r *RandomHostSelector) GetHost(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, props map[string]string) (*host_info_util.HostInfo, error)
type RdsHostListProvider ¶
type RdsHostListProvider struct {
IsPrimaryClusterId bool
// contains filtered or unexported fields
}
func NewRdsHostListProvider ¶
func NewRdsHostListProvider( hostListProviderService HostListProviderService, databaseDialect TopologyAwareDialect, properties map[string]string, originalDsn string, queryForTopologyFunc func(conn driver.Conn) ([]*host_info_util.HostInfo, error), clusterIdChangedFunc func(oldClusterId string)) *RdsHostListProvider
func (*RdsHostListProvider) CreateHost ¶
func (r *RdsHostListProvider) CreateHost(host string, hostRole host_info_util.HostRole, lag float64, cpu float64, lastUpdateTime time.Time) *host_info_util.HostInfo
func (*RdsHostListProvider) ForceRefresh ¶
func (r *RdsHostListProvider) ForceRefresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
func (*RdsHostListProvider) GetClusterId ¶
func (r *RdsHostListProvider) GetClusterId() (string, error)
func (*RdsHostListProvider) GetHostRole ¶
func (r *RdsHostListProvider) GetHostRole(conn driver.Conn) host_info_util.HostRole
func (*RdsHostListProvider) IdentifyConnection ¶
func (r *RdsHostListProvider) IdentifyConnection(conn driver.Conn) (*host_info_util.HostInfo, error)
func (*RdsHostListProvider) IsStaticHostListProvider ¶
func (r *RdsHostListProvider) IsStaticHostListProvider() bool
func (*RdsHostListProvider) Refresh ¶
func (r *RdsHostListProvider) Refresh(conn driver.Conn) ([]*host_info_util.HostInfo, error)
type RdsMultiAzDbClusterMySQLDialect ¶
type RdsMultiAzDbClusterMySQLDialect struct {
MySQLTopologyAwareDatabaseDialect
}
func (*RdsMultiAzDbClusterMySQLDialect) GetDialectUpdateCandidates ¶
func (r *RdsMultiAzDbClusterMySQLDialect) GetDialectUpdateCandidates() []string
func (*RdsMultiAzDbClusterMySQLDialect) GetHostListProvider ¶
func (r *RdsMultiAzDbClusterMySQLDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*RdsMultiAzDbClusterMySQLDialect) GetHostName ¶
func (r *RdsMultiAzDbClusterMySQLDialect) GetHostName(conn driver.Conn) string
func (*RdsMultiAzDbClusterMySQLDialect) GetTopology ¶
func (r *RdsMultiAzDbClusterMySQLDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
func (*RdsMultiAzDbClusterMySQLDialect) GetWriterHostName ¶
func (r *RdsMultiAzDbClusterMySQLDialect) GetWriterHostName(conn driver.Conn) (string, error)
type RdsMultiAzDbClusterPgDialect ¶
type RdsMultiAzDbClusterPgDialect struct {
PgTopologyAwareDatabaseDialect
}
func (*RdsMultiAzDbClusterPgDialect) GetDialectUpdateCandidates ¶
func (r *RdsMultiAzDbClusterPgDialect) GetDialectUpdateCandidates() []string
func (*RdsMultiAzDbClusterPgDialect) GetHostListProvider ¶
func (r *RdsMultiAzDbClusterPgDialect) GetHostListProvider( props map[string]string, initialDsn string, hostListProviderService HostListProviderService, pluginService PluginService) HostListProvider
func (*RdsMultiAzDbClusterPgDialect) GetHostName ¶
func (r *RdsMultiAzDbClusterPgDialect) GetHostName(conn driver.Conn) string
func (*RdsMultiAzDbClusterPgDialect) GetTopology ¶
func (r *RdsMultiAzDbClusterPgDialect) GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
func (*RdsMultiAzDbClusterPgDialect) GetWriterHostName ¶
func (r *RdsMultiAzDbClusterPgDialect) GetWriterHostName(conn driver.Conn) (string, error)
type RdsMySQLDatabaseDialect ¶
type RdsMySQLDatabaseDialect struct {
MySQLDatabaseDialect
}
func (*RdsMySQLDatabaseDialect) GetDialectUpdateCandidates ¶
func (m *RdsMySQLDatabaseDialect) GetDialectUpdateCandidates() []string
type RdsPgDatabaseDialect ¶
type RdsPgDatabaseDialect struct {
PgDatabaseDialect
}
func (*RdsPgDatabaseDialect) GetDialectUpdateCandidates ¶
func (m *RdsPgDatabaseDialect) GetDialectUpdateCandidates() []string
type SessionState ¶
type SessionState struct {
AutoCommit SessionStateField[bool]
ReadOnly SessionStateField[bool]
Catalog SessionStateField[string]
Schema SessionStateField[string]
TransactionIsolation SessionStateField[TransactionIsolationLevel]
}
func (*SessionState) Copy ¶
func (ssf *SessionState) Copy() *SessionState
func (*SessionState) ToString ¶
func (ssf *SessionState) ToString() string
type SessionStateField ¶
type SessionStateField[T comparable] struct { // contains filtered or unexported fields }
func (*SessionStateField[T]) CanRestorePristine ¶
func (ssf *SessionStateField[T]) CanRestorePristine() bool
func (*SessionStateField[T]) GetPristineValue ¶
func (ssf *SessionStateField[T]) GetPristineValue() *T
func (*SessionStateField[T]) GetValue ¶
func (ssf *SessionStateField[T]) GetValue() *T
func (*SessionStateField[T]) Reset ¶
func (ssf *SessionStateField[T]) Reset()
func (*SessionStateField[T]) ResetPristineValue ¶
func (ssf *SessionStateField[T]) ResetPristineValue()
func (*SessionStateField[T]) ResetValue ¶
func (ssf *SessionStateField[T]) ResetValue()
func (*SessionStateField[T]) SetPristineValue ¶
func (ssf *SessionStateField[T]) SetPristineValue(value T)
func (*SessionStateField[T]) SetValue ¶
func (ssf *SessionStateField[T]) SetValue(value T)
type SessionStateService ¶
type SessionStateService interface {
GetAutoCommit() *bool
SetAutoCommit(bool)
SetupPristineAutoCommit()
SetupPristineAutoCommitWithVal(bool)
GetReadOnly() *bool
SetReadOnly(bool)
SetupPristineReadOnly()
SetupPristineReadOnlyWithVal(bool)
GetCatalog() *string
SetCatalog(string)
SetupPristineCatalog()
SetupPristineCatalogWithVal(string)
GetSchema() *string
SetSchema(string)
SetupPristineSchema()
SetupPristineSchemaWithVal(string)
GetTransactionIsolation() *TransactionIsolationLevel
SetTransactionIsolation(level TransactionIsolationLevel)
SetupPristineTransactionIsolation()
SetupPristineTransactionIsolationWithVal(TransactionIsolationLevel)
Begin() error
Complete()
Reset()
ApplyCurrentSessionState(conn driver.Conn) error
ApplyPristineSessionState(conn driver.Conn) error
}
type SessionStateServiceImpl ¶
type SessionStateServiceImpl struct {
SessionState *SessionState
// contains filtered or unexported fields
}
func NewSessionStateServiceImpl ¶
func NewSessionStateServiceImpl(pluginService PluginService, props map[string]string) *SessionStateServiceImpl
func (*SessionStateServiceImpl) ApplyCurrentSessionState ¶
func (sss *SessionStateServiceImpl) ApplyCurrentSessionState(newConn driver.Conn) error
func (*SessionStateServiceImpl) ApplyPristineSessionState ¶
func (sss *SessionStateServiceImpl) ApplyPristineSessionState(conn driver.Conn) error
func (*SessionStateServiceImpl) Begin ¶
func (sss *SessionStateServiceImpl) Begin() error
func (*SessionStateServiceImpl) Complete ¶
func (sss *SessionStateServiceImpl) Complete()
func (*SessionStateServiceImpl) GetAutoCommit ¶
func (sss *SessionStateServiceImpl) GetAutoCommit() *bool
func (*SessionStateServiceImpl) GetCatalog ¶
func (sss *SessionStateServiceImpl) GetCatalog() *string
func (*SessionStateServiceImpl) GetReadOnly ¶
func (sss *SessionStateServiceImpl) GetReadOnly() *bool
func (*SessionStateServiceImpl) GetSchema ¶
func (sss *SessionStateServiceImpl) GetSchema() *string
func (*SessionStateServiceImpl) GetTransactionIsolation ¶
func (sss *SessionStateServiceImpl) GetTransactionIsolation() *TransactionIsolationLevel
func (*SessionStateServiceImpl) Reset ¶
func (sss *SessionStateServiceImpl) Reset()
func (*SessionStateServiceImpl) SetAutoCommit ¶
func (sss *SessionStateServiceImpl) SetAutoCommit(val bool)
func (*SessionStateServiceImpl) SetCatalog ¶
func (sss *SessionStateServiceImpl) SetCatalog(val string)
func (*SessionStateServiceImpl) SetReadOnly ¶
func (sss *SessionStateServiceImpl) SetReadOnly(val bool)
func (*SessionStateServiceImpl) SetSchema ¶
func (sss *SessionStateServiceImpl) SetSchema(val string)
func (*SessionStateServiceImpl) SetTransactionIsolation ¶
func (sss *SessionStateServiceImpl) SetTransactionIsolation(val TransactionIsolationLevel)
func (*SessionStateServiceImpl) SetupPristineAutoCommit ¶
func (sss *SessionStateServiceImpl) SetupPristineAutoCommit()
func (*SessionStateServiceImpl) SetupPristineAutoCommitWithVal ¶
func (sss *SessionStateServiceImpl) SetupPristineAutoCommitWithVal(val bool)
func (*SessionStateServiceImpl) SetupPristineCatalog ¶
func (sss *SessionStateServiceImpl) SetupPristineCatalog()
func (*SessionStateServiceImpl) SetupPristineCatalogWithVal ¶
func (sss *SessionStateServiceImpl) SetupPristineCatalogWithVal(val string)
func (*SessionStateServiceImpl) SetupPristineReadOnly ¶
func (sss *SessionStateServiceImpl) SetupPristineReadOnly()
func (*SessionStateServiceImpl) SetupPristineReadOnlyWithVal ¶
func (sss *SessionStateServiceImpl) SetupPristineReadOnlyWithVal(val bool)
func (*SessionStateServiceImpl) SetupPristineSchema ¶
func (sss *SessionStateServiceImpl) SetupPristineSchema()
func (*SessionStateServiceImpl) SetupPristineSchemaWithVal ¶
func (sss *SessionStateServiceImpl) SetupPristineSchemaWithVal(val string)
func (*SessionStateServiceImpl) SetupPristineTransactionIsolation ¶
func (sss *SessionStateServiceImpl) SetupPristineTransactionIsolation()
func (*SessionStateServiceImpl) SetupPristineTransactionIsolationWithVal ¶
func (sss *SessionStateServiceImpl) SetupPristineTransactionIsolationWithVal(val TransactionIsolationLevel)
type TopologyAwareDialect ¶
type TopologyAwareDialect interface {
GetTopology(conn driver.Conn, provider HostListProvider) ([]*host_info_util.HostInfo, error)
GetHostRole(conn driver.Conn) host_info_util.HostRole
GetHostName(conn driver.Conn) string
GetWriterHostName(conn driver.Conn) (string, error)
DatabaseDialect
}
type TransactionIsolationLevel ¶
type TransactionIsolationLevel int
const ( TRANSACTION_READ_UNCOMMITTED TransactionIsolationLevel = 0 TRANSACTION_READ_COMMITTED TransactionIsolationLevel = 1 TRANSACTION_REPEATABLE_READ TransactionIsolationLevel = 2 TRANSACTION_SERIALIZABLE TransactionIsolationLevel = 3 )
type WeightedHostSelector ¶
type WeightedHostSelector interface {
SetHostWeights(hostWeightMap map[string]int)
ClearHostWeights()
HostSelector
}
type WeightedRandomHostSelector ¶
type WeightedRandomHostSelector struct {
// contains filtered or unexported fields
}
func (*WeightedRandomHostSelector) ClearHostWeights ¶
func (r *WeightedRandomHostSelector) ClearHostWeights()
func (*WeightedRandomHostSelector) GetHost ¶
func (r *WeightedRandomHostSelector) GetHost(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, props map[string]string) (*host_info_util.HostInfo, error)
func (*WeightedRandomHostSelector) SetHostWeights ¶
func (r *WeightedRandomHostSelector) SetHostWeights(hostWeightMap map[string]int)
func (*WeightedRandomHostSelector) SetRandomNumberFunc ¶
func (r *WeightedRandomHostSelector) SetRandomNumberFunc(f func(int) int)
Source Files
¶
- blocking_host_list_provider.go
- cluster_topology_monitor.go
- connection_plugin.go
- connection_plugin_factory.go
- connection_provider.go
- connection_provider_manager.go
- database_dialect.go
- dialect_manager.go
- driver_connection_provider.go
- driver_dialect.go
- dsn_host_list_provider.go
- fixed_value_types.go
- highest_weight_host_selector.go
- host_list_provider.go
- host_selector.go
- monitoring_rds_host_list_provider.go
- mysql_database_dialects.go
- pg_database_dialects.go
- plugin_helpers.go
- random_host_selector.go
- rds_host_list_provider.go
- session_state.go
- session_state_service.go
- session_state_transfer_handling.go
- weighted_random_host_selector.go
Click to show internal directories.
Click to hide internal directories.