Documentation ¶
Index ¶
- type AppConfig
- type Configuration
- type DBPackConfig
- type DataSource
- type DataSourceRef
- type DataSourceRefGroup
- type DataSourceRole
- type DataSourceType
- type DistributedTransaction
- type ExecuteMode
- type Executor
- type Filter
- type Listener
- type LoadBalanceAlgorithm
- type LogicTable
- type Parameters
- type ProtocolType
- type ReadWriteSplittingConfig
- type ShardingConfig
- type ShardingRule
- type SocketAddress
- type TracerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶ added in v0.4.0
type AppConfig map[string]*DBPackConfig
type Configuration ¶
type Configuration struct { ProbePort int `default:"18888" yaml:"probe_port" json:"probe_port"` Tracer *TracerConfig `yaml:"tracer" json:"tracer"` TerminationDrainDuration time.Duration `default:"3s" yaml:"termination_drain_duration" json:"termination_drain_duration"` AppConfig AppConfig `yaml:"app_config" json:"app_config"` }
func (Configuration) DBPackConfig ¶ added in v0.4.0
func (config Configuration) DBPackConfig(appID string) *DBPackConfig
type DBPackConfig ¶ added in v0.4.0
type DBPackConfig struct { AppID string `yaml:"-" json:"-"` DistributedTransaction *DistributedTransaction `yaml:"distributed_transaction" json:"distributed_transaction"` Listeners []*Listener `yaml:"listeners" json:"listeners"` Executors []*Executor `yaml:"executors" json:"executors"` DataSources []*DataSource `yaml:"data_source_cluster" json:"data_source_cluster"` Filters []*Filter `yaml:"filters" json:"filters"` }
func GetDBPackConfig ¶ added in v0.4.0
func GetDBPackConfig(appID string) *DBPackConfig
func (*DBPackConfig) GetEtcdConfig ¶ added in v0.4.0
func (conf *DBPackConfig) GetEtcdConfig() *clientv3.Config
func (*DBPackConfig) Normalize ¶ added in v0.4.0
func (conf *DBPackConfig) Normalize() error
type DataSource ¶
type DataSource struct { Name string `yaml:"name" json:"name"` DSN string `yaml:"dsn" json:"dsn"` MasterName string `yaml:"master_name" json:"master_name"` Capacity int `yaml:"capacity" json:"capacity"` // connection pool capacity MaxCapacity int `yaml:"max_capacity" json:"max_capacity"` // max connection pool capacity IdleTimeout time.Duration `yaml:"idle_timeout" json:"idle_timeout"` // close backend direct connection after idle_timeout,unit: seconds PingInterval time.Duration `yaml:"ping_interval" json:"ping_interval"` PingTimesForChangeStatus int `yaml:"ping_times_for_change_status" json:"ping_times_for_change_status"` Filters []string `yaml:"filters" json:"filters"` }
DataSource ...
type DataSourceRef ¶
type DataSourceRef struct { Name string `yaml:"name" json:"name"` Weight string `yaml:"weight,omitempty" json:"weight,omitempty"` }
func (*DataSourceRef) ParseWeight ¶ added in v0.4.0
func (dataSource *DataSourceRef) ParseWeight() (readWeight int, writeWeight int, err error)
type DataSourceRefGroup ¶
type DataSourceRefGroup struct { Name string `yaml:"name" json:"name"` LBAlgorithm LoadBalanceAlgorithm `yaml:"load_balance_algorithm" json:"load_balance_algorithm"` DataSources []*DataSourceRef `yaml:"data_sources" json:"data_sources"` }
type DataSourceRole ¶
type DataSourceRole int
DataSourceRole ...
const ( Master DataSourceRole = iota Slave Meta )
func (*DataSourceRole) UnmarshalText ¶
func (r *DataSourceRole) UnmarshalText(text []byte) error
type DataSourceType ¶
type DataSourceType int
DataSourceType ...
const ( DBMysql DataSourceType = iota DBPostgresSql )
func (*DataSourceType) UnmarshalText ¶
func (t *DataSourceType) UnmarshalText(text []byte) error
type DistributedTransaction ¶
type DistributedTransaction struct { AppID string `yaml:"appid" json:"appid"` RetryDeadThreshold int64 `yaml:"retry_dead_threshold" json:"retry_dead_threshold"` RollbackRetryTimeoutUnlockEnable bool `yaml:"rollback_retry_timeout_unlock_enable" json:"rollback_retry_timeout_unlock_enable"` EtcdConfig *clientv3.Config `yaml:"etcd_config" json:"etcd_config"` }
type ExecuteMode ¶
type ExecuteMode byte
const ( SDB ExecuteMode = iota RWS SHD )
func (ExecuteMode) String ¶
func (m ExecuteMode) String() string
func (*ExecuteMode) UnmarshalText ¶
func (m *ExecuteMode) UnmarshalText(text []byte) error
type Executor ¶
type Executor struct { AppID string `yaml:"-" json:"-"` Name string `yaml:"name" json:"name"` Mode ExecuteMode `yaml:"mode" json:"mode"` Config Parameters `yaml:"config" json:"config"` Filters []string `yaml:"filters" json:"filters"` }
type Filter ¶
type Filter struct { AppID string `yaml:"-" json:"-"` Name string `yaml:"name" json:"name"` Kind string `yaml:"kind" json:"kind"` Config Parameters `yaml:"conf,omitempty" json:"conf,omitempty"` }
type Listener ¶
type Listener struct { AppID string `yaml:"-" json:"-"` ProtocolType ProtocolType `yaml:"protocol_type" json:"protocol_type"` SocketAddress SocketAddress `yaml:"socket_address" json:"socket_address"` Config Parameters `yaml:"config" json:"config"` Executor string `yaml:"executor" json:"executor"` Filters []string `yaml:"filters" json:"filters"` }
type LoadBalanceAlgorithm ¶ added in v0.4.0
type LoadBalanceAlgorithm int32
const ( Random LoadBalanceAlgorithm = iota RoundRobin RandomWeight )
func (*LoadBalanceAlgorithm) UnmarshalText ¶ added in v0.4.0
func (l *LoadBalanceAlgorithm) UnmarshalText(text []byte) error
type LogicTable ¶
type LogicTable struct { DBName string `yaml:"db_name" json:"db_name"` TableName string `yaml:"table_name" json:"table_name"` AllowFullScan bool `yaml:"allow_full_scan" json:"allow_full_scan"` ShardingRule *ShardingRule `yaml:"sharding_rule" json:"sharding_rule"` Topology map[int]string `yaml:"topology" json:"topology"` }
type Parameters ¶
type Parameters map[string]interface{}
Parameters defines a key-value parameters mapping
type ProtocolType ¶
type ProtocolType int32
ProtocolType protocol type enum
const ( Http ProtocolType = iota Mysql )
func (*ProtocolType) UnmarshalText ¶
func (t *ProtocolType) UnmarshalText(text []byte) error
type ReadWriteSplittingConfig ¶
type ReadWriteSplittingConfig struct { LoadBalanceAlgorithm LoadBalanceAlgorithm `yaml:"load_balance_algorithm" json:"load_balance_algorithm"` DataSources []*DataSourceRef `yaml:"data_sources" json:"data_sources"` }
type ShardingConfig ¶
type ShardingConfig struct { DBGroups []*DataSourceRefGroup `yaml:"db_groups" json:"db_groups"` LogicTables []*LogicTable `yaml:"logic_tables" json:"logic_tables"` TransactionTimeout int32 `yaml:"transaction_timeout" json:"transaction_timeout"` }
type ShardingRule ¶
type ShardingRule struct { Column string `yaml:"column" json:"column"` ShardingAlgorithm string `yaml:"sharding_algorithm" json:"sharding_algorithm"` Config Parameters `yaml:"config,omitempty" json:"config,omitempty"` }
type SocketAddress ¶
type SocketAddress struct { Address string `default:"0.0.0.0" yaml:"address" json:"address"` Port int `default:"8881" yaml:"port" json:"port"` }
SocketAddress specify either a logical or physical address and port, which are used to tell server where to bind/listen, connect to upstream and find management servers
func (SocketAddress) String ¶ added in v0.4.0
func (sa SocketAddress) String() string
type TracerConfig ¶ added in v0.4.0
Click to show internal directories.
Click to hide internal directories.