Documentation ¶
Index ¶
- Constants
- Variables
- type ApolloConfigParser
- func (a *ApolloConfigParser) Get(key string) interface{}
- func (a *ApolloConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool)
- func (a *ApolloConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo
- func (a *ApolloConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool)
- func (a *ApolloConfigParser) GetRedisConfigs() []RedisConfigInfo
- func (a *ApolloConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool)
- func (a *ApolloConfigParser) GetRpcConfigs() []RpcNetConfigInfo
- func (e *ApolloConfigParser) Reload() error
- func (a *ApolloConfigParser) Unmarshal(obj interface{}) error
- type Config
- type ConfigCenterInfo
- type ConfigInfo
- type ConfigParser
- func NewApolloConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
- func NewConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
- func NewEtcdConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
- func NewFileConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
- type DatabaseAccount
- type DatabaseConfigInfo
- type EtcdConfigParser
- func (e *EtcdConfigParser) Get(key string) interface{}
- func (e *EtcdConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool)
- func (e *EtcdConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo
- func (e *EtcdConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool)
- func (e *EtcdConfigParser) GetRedisConfigs() []RedisConfigInfo
- func (e *EtcdConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool)
- func (e *EtcdConfigParser) GetRpcConfigs() []RpcNetConfigInfo
- func (e *EtcdConfigParser) Reload() error
- func (e *EtcdConfigParser) Unmarshal(obj interface{}) error
- type FileConfigParser
- func (f *FileConfigParser) Get(key string) interface{}
- func (f *FileConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool)
- func (f *FileConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo
- func (f *FileConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool)
- func (f *FileConfigParser) GetRedisConfigs() []RedisConfigInfo
- func (f *FileConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool)
- func (f *FileConfigParser) GetRpcConfigs() []RpcNetConfigInfo
- func (f *FileConfigParser) GetServiceDiscoveryConfig() (ServiceDiscovery, bool)
- func (f *FileConfigParser) Reload() error
- func (f *FileConfigParser) Unmarshal(obj interface{}) error
- type LogConfigInfo
- type RedisConfigInfo
- type RpcNetConfigInfo
- type ServerConfig
- type ServerConfigInfo
- type ServerConfigManager
- type ServerConfigParser
- type ServiceDiscovery
Constants ¶
View Source
const ( TomlConfigParserType = "toml" YamlConfigParserType = "yaml" YmlConfigParserType = "yml" )
View Source
const ( TomlServerConfigParserType = "toml" YamlServerConfigParserType = "yaml" YmlServerConfigParserType = "yml" )
Variables ¶
View Source
var ( ErrConfigParserType = errors.New("config typ nil") ErrConfigParserPath = errors.New("config path nil") )
View Source
var (
ErrConfigParserTyp = errors.New("config parser error")
)
View Source
var (
ErrFileTypeNil = errors.New("file type nil")
)
Functions ¶
This section is empty.
Types ¶
type ApolloConfigParser ¶
type ApolloConfigParser struct{}
func (*ApolloConfigParser) Get ¶
func (a *ApolloConfigParser) Get(key string) interface{}
func (*ApolloConfigParser) GetDataBaseConfig ¶
func (a *ApolloConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool)
func (*ApolloConfigParser) GetDataBaseConfigs ¶
func (a *ApolloConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo
func (*ApolloConfigParser) GetRedisConfig ¶
func (a *ApolloConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool)
func (*ApolloConfigParser) GetRedisConfigs ¶
func (a *ApolloConfigParser) GetRedisConfigs() []RedisConfigInfo
func (*ApolloConfigParser) GetRpcConfig ¶
func (a *ApolloConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool)
func (*ApolloConfigParser) GetRpcConfigs ¶
func (a *ApolloConfigParser) GetRpcConfigs() []RpcNetConfigInfo
func (*ApolloConfigParser) Reload ¶
func (e *ApolloConfigParser) Reload() error
func (*ApolloConfigParser) Unmarshal ¶
func (a *ApolloConfigParser) Unmarshal(obj interface{}) error
type Config ¶
type Config struct { ServiceDiscovery ServiceDiscovery `mapstructure:"service_discovery"` DatabaseConfigs []DatabaseConfigInfo `mapstructure:"database"` RedisConfigs []RedisConfigInfo `mapstructure:"redis"` RpcNetConfigs []RpcNetConfigInfo `mapstructure:"rpc_server_client"` }
type ConfigCenterInfo ¶
type ConfigInfo ¶
type ConfigParser ¶
type ConfigParser interface { Get(key string) interface{} GetServiceDiscoveryConfig() (ServiceDiscovery, bool) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool) GetRedisConfig(key string) (RedisConfigInfo, bool) GetRpcConfig(key string) (RpcNetConfigInfo, bool) GetDataBaseConfigs() []DatabaseConfigInfo GetRedisConfigs() []RedisConfigInfo GetRpcConfigs() []RpcNetConfigInfo Unmarshal(obj interface{}) error Reload() error }
func NewApolloConfigParser ¶
func NewApolloConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
func NewConfigParser ¶
func NewConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
func NewEtcdConfigParser ¶
func NewEtcdConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
func NewFileConfigParser ¶
func NewFileConfigParser(configCenter ConfigCenterInfo) (ConfigParser, error)
type DatabaseAccount ¶
type DatabaseConfigInfo ¶
type DatabaseConfigInfo struct { Name string `mapstructure:"name"` Master DatabaseAccount `mapstructure:"master"` Slaves []DatabaseAccount `mapstructure:"slaves"` Database string `mapstructure:"database"` Charset string `mapstructure:"charset"` ParseTime string `mapstructure:"parseTime"` Loc string `mapstructure:"loc"` ReadTimeout string `mapstructure:"readTimeout"` MaxIdleConns int `mapstructure:"maxIdleConns"` MaxOpenConns int `mapstructure:"maxOpenConns"` ConnMaxIdleTime int `mapstructure:"connMaxIdletime"` ConnMaxLifetime int `mapstructure:"connMaxLifetime"` DiscoverFlag bool `mapstructure:"discover_flag"` LogModel bool `mapstructure:"log_model"` }
type EtcdConfigParser ¶
type EtcdConfigParser struct{}
func (*EtcdConfigParser) Get ¶
func (e *EtcdConfigParser) Get(key string) interface{}
func (*EtcdConfigParser) GetDataBaseConfig ¶
func (e *EtcdConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool)
func (*EtcdConfigParser) GetDataBaseConfigs ¶
func (e *EtcdConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo
func (*EtcdConfigParser) GetRedisConfig ¶
func (e *EtcdConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool)
func (*EtcdConfigParser) GetRedisConfigs ¶
func (e *EtcdConfigParser) GetRedisConfigs() []RedisConfigInfo
func (*EtcdConfigParser) GetRpcConfig ¶
func (e *EtcdConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool)
func (*EtcdConfigParser) GetRpcConfigs ¶
func (e *EtcdConfigParser) GetRpcConfigs() []RpcNetConfigInfo
func (*EtcdConfigParser) Reload ¶
func (e *EtcdConfigParser) Reload() error
func (*EtcdConfigParser) Unmarshal ¶
func (e *EtcdConfigParser) Unmarshal(obj interface{}) error
type FileConfigParser ¶
type FileConfigParser struct {
// contains filtered or unexported fields
}
func (*FileConfigParser) Get ¶
func (f *FileConfigParser) Get(key string) interface{}
func (*FileConfigParser) GetDataBaseConfig ¶
func (f *FileConfigParser) GetDataBaseConfig(key string) (DatabaseConfigInfo, bool)
func (*FileConfigParser) GetDataBaseConfigs ¶
func (f *FileConfigParser) GetDataBaseConfigs() []DatabaseConfigInfo
func (*FileConfigParser) GetRedisConfig ¶
func (f *FileConfigParser) GetRedisConfig(key string) (RedisConfigInfo, bool)
func (*FileConfigParser) GetRedisConfigs ¶
func (f *FileConfigParser) GetRedisConfigs() []RedisConfigInfo
func (*FileConfigParser) GetRpcConfig ¶
func (f *FileConfigParser) GetRpcConfig(key string) (RpcNetConfigInfo, bool)
func (*FileConfigParser) GetRpcConfigs ¶
func (f *FileConfigParser) GetRpcConfigs() []RpcNetConfigInfo
func (*FileConfigParser) GetServiceDiscoveryConfig ¶
func (f *FileConfigParser) GetServiceDiscoveryConfig() (ServiceDiscovery, bool)
func (*FileConfigParser) Reload ¶
func (f *FileConfigParser) Reload() error
func (*FileConfigParser) Unmarshal ¶
func (f *FileConfigParser) Unmarshal(obj interface{}) error
type LogConfigInfo ¶
type LogConfigInfo struct { LogTyp string `mapstructure:"log_type"` Dir string `mapstructure:"dir"` LogLevel string `mapstructure:"log_level"` Prefix string `mapstructure:"prefix"` AutoClearHours int `mapstructure:"auto_clear_hours"` Depth int `mapstructure:"depth"` Format string `mapstructure:"format"` }
type RedisConfigInfo ¶
type RedisConfigInfo struct { Name string `mapstructure:"name"` Addr string `mapstructure:"addr"` Password string `mapstructure:"password"` MaxIdle int `mapstructure:"max_idle"` IdleTimeout int64 `mapstructure:"max_idletimeout"` MaxActive int `mapstructure:"max_active"` ReadTimeout int64 `mapstructure:"read_timeout"` WriteTimeout int64 `mapstructure:"write_timeout"` SlowTime int64 `mapstructure:"slow_time"` ConnectTimeout int64 `mapstructure:"connect_time"` Wait bool `mapstructure:"wait"` Database int `mapstructure:"databases"` }
type RpcNetConfigInfo ¶
type RpcNetConfigInfo struct { // Service Discovery Name. ServiceName string `mapstructure:"service_name"` // Protocol type, HTTP, HTTPS and grpc are currently supported. Proto string `mapstructure:"proto"` // Service discovery type,eg: etcd, zk, apollo, list. // If we choose list,We will get the remote call service address from the "Addr" configuration. EndpointsFrom string `mapstructure:"endpoints_from"` // Address list. See "endpointsfrom" for details. // The "Addr" can also be competent for the task of service discovery. Addr []string `mapstructure:"addr"` // Weights Wight []int `mapstructure:"wight"` // Load balancing type. // eg: consistency_hash, p2c, random, range. Balancetype string `mapstructure:"balancetype"` // rpc dial time out.(Millisecond default 0.) DialTimeout int `mapstructure:"dial_timeout"` // rpc total time out.(Millisecond default 0.) TimeOut int `mapstructure:"timeout"` // back off retry times. RetryTimes int `mapstructure:"retry_times"` // every addr max conns num. MaxConnsPerAddr int `mapstructure:"max_conns_per_addr"` // every addr max idle conns num. MaxIdleConnsPerAddr int `mapstructure:"max_idleconns_per_addr"` // all addr max idle conns num. MaxIdleConns int `mapstructure:"max_idleconns"` // idle timeout. (second default 10.) IdleConnTimeout int `mapstructure:"idleconn_timeout"` // ReadBufferSize (bytes). ReadBufferSize int `mapstructure:"readbuffer_size"` // WriteBufferSize (bytes). WriteBufferSize int `mapstructure:"writebuffer_size"` }
remote call
type ServerConfig ¶
type ServerConfig struct { ServerConfig ServerConfigInfo `mapstructure:"server"` LogConfig LogConfigInfo `mapstructure:"log"` ConfigCenter ConfigCenterInfo `mapstructure:"config_center"` }
type ServerConfigInfo ¶
type ServerConfigManager ¶
type ServerConfigManager struct { ServerConfig ServerConfig // contains filtered or unexported fields }
func (*ServerConfigManager) Get ¶
func (scm *ServerConfigManager) Get(key string) interface{}
func (*ServerConfigManager) GetConfigCenterInfo ¶
func (scm *ServerConfigManager) GetConfigCenterInfo() ConfigCenterInfo
func (*ServerConfigManager) GetLogConfigInfo ¶
func (scm *ServerConfigManager) GetLogConfigInfo() LogConfigInfo
func (*ServerConfigManager) GetServerConfigInfo ¶
func (scm *ServerConfigManager) GetServerConfigInfo() ServerConfigInfo
type ServerConfigParser ¶
type ServerConfigParser interface { GetServerConfigInfo() ServerConfigInfo GetLogConfigInfo() LogConfigInfo GetConfigCenterInfo() ConfigCenterInfo Get(key string) interface{} }
func NewServerConfigManager ¶
func NewServerConfigManager(conf ConfigInfo) (ServerConfigParser, error)
func NewServerConfigParser ¶
func NewServerConfigParser(conf ConfigInfo) (ServerConfigParser, error)
type ServiceDiscovery ¶
Click to show internal directories.
Click to hide internal directories.