Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Center ¶
func (*Center) GetKafkaAddresses ¶ added in v1.0.2
func (*Center) GetZKHosts ¶ added in v1.1.0
type Config ¶ added in v1.2.0
type Config struct {
// contains filtered or unexported fields
}
func (*Config) GetCommon ¶ added in v1.2.0
func (c *Config) GetCommon() *model.CommonConfig
type ConfigType ¶ added in v1.2.0
type ConfigType int
const ( ConfigTypeFile ConfigType = iota ConfigTypeZookeeper ConfigTypeConsul )
type FileConfig ¶ added in v1.0.5
func (*FileConfig) Debug ¶ added in v1.0.6
func (f *FileConfig) Debug() bool
func (*FileConfig) GetZKHosts ¶ added in v1.0.5
func (f *FileConfig) GetZKHosts() []string
type OptionOnlineMode ¶ added in v1.1.0
type OptionOnlineMode struct {
// contains filtered or unexported fields
}
开启在线配置中心
func NewOptionOnlineMode ¶ added in v1.1.0
func NewOptionOnlineMode(remoteDir, zkConfigPath string) (o *OptionOnlineMode)
type OptionZKConfigPath ¶ added in v1.1.0
type OptionZKConfigPath string
type Options ¶ added in v1.2.0
type Options struct { Type ConfigType Hosts []string }
func DefaultOptions ¶ added in v1.2.0
func DefaultOptions() (options *Options)
type PostgreSQLConfig ¶ added in v1.0.2
type PublicConfig ¶ added in v1.1.0
type PublicConfig struct {
Redis RedisConfig
}
func (c *Center) Update() (err error) { err = c.prepareConfig(c.viper, path.Join(c.RemotePath, c.name), c.localPathName()) if c.enablePublicConfig { err = c.prepareConfig(c.publicViper, path.Join(centerPrefix, publicConfigName), c.publicLocalPathName()) c.SetPublicDefault() //同步线上公共配置 err = c.syncPublic() if err != nil { err = fmt.Errorf("[config center]sync public config fail:\n%w", err) log.Error(err) } } return }
type RedisConfig ¶ added in v1.0.2
type RedisConfig struct { Type string MasterName string // A seed list of host:port addresses of cluster nodes. Addrs []string // The maximum number of retries before giving up. Command is retried // on network errors and MOVED/ASK redirects. // Default is 8 retries. MaxRedirects int // Enables read-only commands on slave nodes. ReadOnly bool // Allows routing read-only commands to the closest master or slave node. // It automatically enables ReadOnly. RouteByLatency bool // Allows routing read-only commands to the random master or slave node. // It automatically enables ReadOnly. RouteRandomly bool Password string DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration // PoolSize applies per cluster node and not for the whole cluster. PoolSize int MinIdleConns int MaxConnAge time.Duration PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration }
Click to show internal directories.
Click to hide internal directories.