Documentation
¶
Index ¶
- func AddChangeListener(listener ChangeListener)
- func CreateNamespaceConfig(namespace string)
- func GetApolloConfigCache() *sync.Map
- func GetChangeListeners() *list.List
- func GetDefaultNamespace() string
- func InitConfigCache()
- func RemoveChangeListener(listener ChangeListener)
- func UpdateApolloConfig(apolloConfig *env.ApolloConfig, isBackupConfig bool)
- func UpdateApolloConfigCache(configurations map[string]string, expireTime int, namespace string) map[string]*ConfigChange
- type ChangeEvent
- type ChangeListener
- type Config
- func (c *Config) GetBoolValue(key string, defaultValue bool) bool
- func (c *Config) GetCache() agcache.CacheInterface
- func (c *Config) GetContent(format ConfigFileFormat) string
- func (c *Config) GetFloatValue(key string, defaultValue float64) float64
- func (c *Config) GetIntValue(key string, defaultValue int) int
- func (c *Config) GetIsInit() bool
- func (c *Config) GetStringValue(key string, defaultValue string) string
- func (c *Config) GetValue(key string) string
- func (c *Config) GetWaitInit() *sync.WaitGroup
- type ConfigChange
- type ConfigChangeType
- type ConfigFileFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNamespaceConfig ¶
func CreateNamespaceConfig(namespace string)
CreateNamespaceConfig 根据namespace初始化agollo内润配置
func GetApolloConfigCache ¶
GetApolloConfigCache 获取默认namespace的apollo配置
func RemoveChangeListener ¶
func RemoveChangeListener(listener ChangeListener)
RemoveChangeListener 增加变更监控
func UpdateApolloConfig ¶
func UpdateApolloConfig(apolloConfig *env.ApolloConfig, isBackupConfig bool)
UpdateApolloConfig 根据conf[ig server返回的内容更新内存 并判断是否需要写备份文件
func UpdateApolloConfigCache ¶
func UpdateApolloConfigCache(configurations map[string]string, expireTime int, namespace string) map[string]*ConfigChange
UpdateApolloConfigCache 根据conf[ig server返回的内容更新内存
Types ¶
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 (*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),获取不到则取默认值
func (*Config) GetStringValue ¶
GetStringValue 获取配置值(string),获取不到则取默认值
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 Properties ConfigFileFormat = "properties" //XML XML XML ConfigFileFormat = "xml" //JSON JSON JSON ConfigFileFormat = "json" //YML YML YML ConfigFileFormat = "yml" //YAML YAML YAML ConfigFileFormat = "yaml" )
Click to show internal directories.
Click to hide internal directories.