storage

package
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddChangeListener

func AddChangeListener(listener ChangeListener)

AddChangeListener 增加变更监控

func CreateNamespaceConfig

func CreateNamespaceConfig(namespace string)

CreateNamespaceConfig 根据namespace初始化agollo内润配置

func GetApolloConfigCache

func GetApolloConfigCache() *sync.Map

GetApolloConfigCache 获取默认namespace的apollo配置

func GetChangeListeners

func GetChangeListeners() *list.List

GetChangeListeners 获取配置修改监听器列表

func GetDefaultNamespace

func GetDefaultNamespace() string

GetDefaultNamespace 获取默认命名空间

func InitConfigCache

func InitConfigCache()

InitConfigCache 获取程序配置初始化agollo内润配置

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 GetConfig

func GetConfig(namespace string) *Config

GetConfig 根据namespace获取apollo配置

func (*Config) GetBoolValue

func (c *Config) GetBoolValue(key string, defaultValue bool) bool

GetBoolValue 获取配置值(bool),获取不到则取默认值

func (*Config) GetCache

func (c *Config) GetCache() agcache.CacheInterface

GetCache 获取cache

func (*Config) GetContent

func (c *Config) GetContent(format ConfigFileFormat) string

GetContent 获取配置文件内容

func (*Config) GetFloatValue

func (c *Config) GetFloatValue(key string, defaultValue float64) float64

GetFloatValue 获取配置值(float),获取不到则取默认值

func (*Config) GetIntValue

func (c *Config) GetIntValue(key string, defaultValue int) int

GetIntValue 获取配置值(int),获取不到则取默认值

func (*Config) GetIsInit

func (c *Config) GetIsInit() bool

GetIsInit 获取标志

func (*Config) GetStringValue

func (c *Config) GetStringValue(key string, defaultValue string) string

GetStringValue 获取配置值(string),获取不到则取默认值

func (*Config) GetValue

func (c *Config) GetValue(key string) string

GetValue 获取配置值(string)

func (*Config) GetWaitInit

func (c *Config) GetWaitInit() *sync.WaitGroup

GetWaitInit 获取标志

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL