Documentation
¶
Index ¶
- Variables
- func ReadVersion(metadir string) int64
- func UpdateVersion(metadir string) error
- func WriteConfig(path string, conf interface{}) error
- type AuditConfig
- type BackendConfig
- type BackendsConfig
- type BinlogConfig
- type Config
- type LogConfig
- type PartitionConfig
- type ProxyConfig
- type RouterConfig
- type SchemaConfig
- type TableConfig
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( // MockSchemaConfig config. MockSchemaConfig = &SchemaConfig{ DB: "sbtest", Tables: MockTablesConfig, } // MockTablesConfig config. MockTablesConfig = []*TableConfig{ &TableConfig{ Name: "A", ShardKey: "id", Partitions: MockPartitionAConfig, }, &TableConfig{ Name: "B", ShardKey: "id", Partitions: MockPartitionBConfig, }, } // MockPartitionAConfig config. MockPartitionAConfig = []*PartitionConfig{ &PartitionConfig{ Table: "A1", Segment: "0-2", Backend: "backend1", }, &PartitionConfig{ Table: "A2", Segment: "2-4", Backend: "backend1", }, &PartitionConfig{ Table: "A3", Segment: "4-8", Backend: "backend2", }, &PartitionConfig{ Table: "A4", Segment: "8-16", Backend: "backend2", }, } // MockPartitionBConfig config. MockPartitionBConfig = []*PartitionConfig{ &PartitionConfig{ Table: "B1", Segment: "0-4", Backend: "backend2", }, &PartitionConfig{ Table: "B2", Segment: "4-8", Backend: "backend1", }, &PartitionConfig{ Table: "B3", Segment: "8-16", Backend: "backend2", }, } // MockBackends config. MockBackends = []*BackendConfig{ &BackendConfig{ Name: "backend1", Address: "127.0.0.1:3304", User: "root", Password: "", MaxConnections: 1024, }, } // MockBackup config. MockBackup = &BackendConfig{ Name: "backupnode", Address: "127.0.0.1:3304", User: "root", Password: "", MaxConnections: 1024, } // MockProxyConfig config. MockProxyConfig = &ProxyConfig{ Endpoint: ":5566", MaxConnections: 1024, MetaDir: "/tmp/radonmeta", PeerAddress: ":8080", BackupDefaultEngine: "TokuDB", } // MockLogConfig config. MockLogConfig = &LogConfig{ Level: "DEBUG", } )
Functions ¶
func ReadVersion ¶
ReadVersion used to read the config version from the file.
func UpdateVersion ¶
UpdateVersion used to update the config version of the file.
Types ¶
type AuditConfig ¶
type AuditConfig struct { Mode string `json:"mode"` LogDir string `json:"audit-dir"` MaxSize int `json:"max-size"` ExpireHours int `json:"expire-hours"` }
AuditConfig tuple.
func DefaultAuditConfig ¶
func DefaultAuditConfig() *AuditConfig
DefaultAuditConfig returns default audit config.
func (*AuditConfig) UnmarshalJSON ¶
func (c *AuditConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON interface on AuditConfig.
type BackendConfig ¶
type BackendConfig struct { Name string `json:"name"` Address string `json:"address"` User string `json:"user"` Password string `json:"password"` DBName string `json:"database"` Charset string `json:"charset"` MaxConnections int `json:"max-connections"` }
BackendConfig tuple.
type BackendsConfig ¶
type BackendsConfig struct { Backup *BackendConfig `json:"backup"` Backends []*BackendConfig `json:"backends"` }
BackendsConfig tuple.
func ReadBackendsConfig ¶
func ReadBackendsConfig(data string) (*BackendsConfig, error)
ReadBackendsConfig used to read the backend config from the data.
type BinlogConfig ¶
type BinlogConfig struct { LogDir string `json:"binlog-dir"` MaxSize int `json:"max-size"` RelayWorkers int `json:"relay-workers"` RelayWaitMs int `json:"relay-wait-ms"` EnableBinlog bool `json:"enable-binlog"` EnableRelay bool `json:"enable-relay"` // type=0, turn off the parallel. // type=1, same events type can parallel(default). // type=2, all events type can parallel. ParallelType int `json:"parallel-type"` }
BinlogConfig tuple.
func DefaultBinlogConfig ¶
func DefaultBinlogConfig() *BinlogConfig
DefaultBinlogConfig returns default binlog config.
func (*BinlogConfig) UnmarshalJSON ¶
func (c *BinlogConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON interface on BinlogConfig.
type Config ¶
type Config struct { Proxy *ProxyConfig `json:"proxy"` Audit *AuditConfig `json:"audit"` Router *RouterConfig `json:"router"` Binlog *BinlogConfig `json:"binlog"` Log *LogConfig `json:"log"` }
Config tuple.
type LogConfig ¶
type LogConfig struct {
Level string `json:"level"`
}
LogConfig tuple.
type PartitionConfig ¶
type PartitionConfig struct { Table string `json:"table"` Segment string `json:"segment"` Backend string `json:"backend"` }
PartitionConfig tuple.
type ProxyConfig ¶
type ProxyConfig struct { IPS []string `json:"allowip,omitempty"` MetaDir string `json:"meta-dir"` Endpoint string `json:"endpoint"` TwopcEnable bool `json:"twopc-enable"` MaxConnections int `json:"max-connections"` MaxResultSize int `json:"max-result-size"` DDLTimeout int `json:"ddl-timeout"` QueryTimeout int `json:"query-timeout"` PeerAddress string `json:"peer-address,omitempty"` BackupDefaultEngine string `json:"backup-default-engine"` }
ProxyConfig tuple.
func DefaultProxyConfig ¶
func DefaultProxyConfig() *ProxyConfig
DefaultProxyConfig returns default proxy config.
func (*ProxyConfig) UnmarshalJSON ¶
func (c *ProxyConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON interface on ProxyConfig.
type RouterConfig ¶
RouterConfig tuple.
func DefaultRouterConfig ¶
func DefaultRouterConfig() *RouterConfig
DefaultRouterConfig returns the default router config.
func (*RouterConfig) UnmarshalJSON ¶
func (c *RouterConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON interface on RouterConfig.
type SchemaConfig ¶
type SchemaConfig struct { DB string `json:"database"` Tables []*TableConfig `json:"tables"` }
SchemaConfig tuple.
type TableConfig ¶
type TableConfig struct { Name string `json:"name"` ShardType string `json:"shardtype"` ShardKey string `json:"shardkey"` Partitions []*PartitionConfig `json:"partitions"` }
TableConfig tuple.
func ReadTableConfig ¶
func ReadTableConfig(data string) (*TableConfig, error)
ReadTableConfig used to read the table config from the data.