Documentation ¶
Index ¶
- Constants
- func AddChangeListener(listener ChangeListener)
- func GetApolloConfigCache() agcache.CacheInterface
- func GetBoolValue(key string, defaultValue bool) bool
- func GetConfigCache(namespace string) agcache.CacheInterface
- func GetCurrentApolloConfig() map[string]*ApolloConnConfig
- func GetFloatValue(key string, defaultValue float64) float64
- func GetIntValue(key string, defaultValue int) int
- func GetStringValue(key string, defaultValue string) string
- func InitCustomConfig(loadAppConfig func() (*AppConfig, error))
- func SetCache(cacheFactory *agcache.DefaultCacheFactory)
- func SetLogger(loggerInterface LoggerInterface)
- func Start() error
- func StartRefreshConfig(component AbsComponent)
- func StartWithCache(cacheFactory *agcache.DefaultCacheFactory) error
- func StartWithLogger(loggerInterface LoggerInterface) error
- type AbsComponent
- type ApolloConfig
- type ApolloConnConfig
- type AppConfig
- type CallBack
- type ChangeEvent
- type ChangeListener
- type Config
- func (this *Config) GetBoolValue(key string, defaultValue bool) bool
- func (c *Config) GetContent(format ConfigFileFormat) string
- func (this *Config) GetFloatValue(key string, defaultValue float64) float64
- func (this *Config) GetIntValue(key string, defaultValue int) int
- func (this *Config) GetStringValue(key string, defaultValue string) string
- type ConfigChange
- type ConfigChangeType
- type ConfigFileFormat
- type ConnectConfig
- type ContentParser
- type DefaultLogger
- func (this *DefaultLogger) Debug(v ...interface{})
- func (this *DefaultLogger) Debugf(format string, params ...interface{})
- func (this *DefaultLogger) Error(v ...interface{}) error
- func (this *DefaultLogger) Errorf(format string, params ...interface{}) error
- func (this *DefaultLogger) Info(v ...interface{})
- func (this *DefaultLogger) Infof(format string, params ...interface{})
- func (this *DefaultLogger) Warn(v ...interface{}) error
- func (this *DefaultLogger) Warnf(format string, params ...interface{}) error
- type DefaultParser
- type LoggerInterface
- type NotifyConfigComponent
- type PropertiesParser
Constants ¶
View Source
const ( APP_CONFIG_FILE_NAME = "app.properties" ENV_CONFIG_FILE_PATH = "AGOLLO_CONF" )
Variables ¶
This section is empty.
Functions ¶
func GetApolloConfigCache ¶
func GetApolloConfigCache() agcache.CacheInterface
GetApolloConfigCache 获取默认namespace的apollo配置
func GetBoolValue ¶
func GetConfigCache ¶
func GetConfigCache(namespace string) agcache.CacheInterface
GetConfigCache 根据namespace获取apollo配置的缓存
func GetCurrentApolloConfig ¶
func GetCurrentApolloConfig() map[string]*ApolloConnConfig
GetCurrentApolloConfig 获取Apollo链接配置
func GetFloatValue ¶
func GetIntValue ¶
func GetStringValue ¶
func InitCustomConfig ¶
InitCustomConfig init config by custom
func StartRefreshConfig ¶
func StartRefreshConfig(component AbsComponent)
func StartWithCache ¶
func StartWithCache(cacheFactory *agcache.DefaultCacheFactory) error
StartWithCache 通过自定义cache启动agollo
func StartWithLogger ¶
func StartWithLogger(loggerInterface LoggerInterface) error
StartWithLogger 通过自定义logger启动agollo
Types ¶
type AbsComponent ¶
type AbsComponent interface {
Start()
}
type ApolloConfig ¶
type ApolloConfig struct { ApolloConnConfig Configurations map[string]string `json:"configurations"` }
type ApolloConnConfig ¶
type AppConfig ¶
type AppConfig struct { AppId string `json:"appId"` Cluster string `json:"cluster"` NamespaceName string `json:"namespaceName"` Ip string `json:"ip"` NextTryConnTime int64 `json:"-"` BackupConfigPath string `json:"backupConfigPath"` }
func GetAppConfig ¶
type ChangeEvent ¶
type ChangeEvent struct { Namespace string Changes map[string]*ConfigChange }
config change event
type ChangeListener ¶
type ChangeListener interface { //OnChange 增加变更监控 OnChange(event *ChangeEvent) }
ChangeListener 监听器
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config apollo配置项
func GetConfigAndInit ¶
GetConfigAndInit 根据namespace获取apollo配置
func (*Config) GetBoolValue ¶
GetBoolValue 获取配置值(bool),获取不到则取默认值
func (*Config) GetContent ¶
func (c *Config) GetContent(format ConfigFileFormat) string
GetContent 获取配置文件内容
func (*Config) GetFloatValue ¶
GetFloatValue 获取配置值(float),获取不到则取默认值
func (*Config) GetIntValue ¶
GetIntValue 获取配置值(int),获取不到则取默认值
type ConfigChange ¶
type ConfigChange struct { OldValue string NewValue string ChangeType ConfigChangeType }
type ConfigChangeType ¶
type ConfigChangeType int
config change type
const ( ADDED ConfigChangeType = iota MODIFIED DELETED )
type ConfigFileFormat ¶
type ConfigFileFormat string
ConfigFileFormat 配置文件类型
const ( //Properties Properties ConfigFileFormat = "properties" //XML XML ConfigFileFormat = "xml" //JSON JSON ConfigFileFormat = "json" //YML YML ConfigFileFormat = "yml" //YAML YAML ConfigFileFormat = "yaml" )
type ConnectConfig ¶
type ContentParser ¶
type ContentParser interface {
// contains filtered or unexported methods
}
ContentParser 内容转换
type DefaultLogger ¶
type DefaultLogger struct { }
func (*DefaultLogger) Debug ¶
func (this *DefaultLogger) Debug(v ...interface{})
func (*DefaultLogger) Debugf ¶
func (this *DefaultLogger) Debugf(format string, params ...interface{})
func (*DefaultLogger) Error ¶
func (this *DefaultLogger) Error(v ...interface{}) error
func (*DefaultLogger) Errorf ¶
func (this *DefaultLogger) Errorf(format string, params ...interface{}) error
func (*DefaultLogger) Info ¶
func (this *DefaultLogger) Info(v ...interface{})
func (*DefaultLogger) Infof ¶
func (this *DefaultLogger) Infof(format string, params ...interface{})
func (*DefaultLogger) Warn ¶
func (this *DefaultLogger) Warn(v ...interface{}) error
func (*DefaultLogger) Warnf ¶
func (this *DefaultLogger) Warnf(format string, params ...interface{}) error
type LoggerInterface ¶
type LoggerInterface interface { Debugf(format string, params ...interface{}) Infof(format string, params ...interface{}) Warnf(format string, params ...interface{}) error Errorf(format string, params ...interface{}) error Debug(v ...interface{}) Info(v ...interface{}) Warn(v ...interface{}) error Error(v ...interface{}) error }
type NotifyConfigComponent ¶
type NotifyConfigComponent struct { }
func (*NotifyConfigComponent) Start ¶
func (this *NotifyConfigComponent) Start()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.