Documentation ¶
Index ¶
- func GetAllKeys(namespace string) []string
- func GetBool(key string) (bool, bool)
- func GetBoolWithNamespace(namespace, key string) (bool, bool)
- func GetFloat64(key string) (float64, bool)
- func GetFloat64WithNamespace(namespace, key string) (float64, bool)
- func GetInt(key string) (int, bool)
- func GetIntWithNamespace(namespace, key string) (int, bool)
- func GetNameSpaceContent(namespace string) (string, bool)
- func GetReleaseKey(namespace string) (string, bool)
- func GetString(key string) (string, bool)
- func GetStringWithNamespace(namespace, key string) (string, bool)
- func RegisterObserver(observer ChangeEventObserver) (recall func())
- func SetLogger(logger AgolloLogger)
- func Start() error
- func StartWatchUpdate()
- func StartWithConf(conf *Conf) error
- func StartWithConfFile(name string) error
- func Stop() error
- func SubscribeToNamespaces(namespaces ...string) error
- type Agollo
- func (m *Agollo) GetAllKeys(namespace string) []string
- func (m *Agollo) GetBool(key string) (bool, bool)
- func (m *Agollo) GetBoolWithNamespace(namespace, key string) (bool, bool)
- func (m *Agollo) GetFloat64(key string) (float64, bool)
- func (m *Agollo) GetFloat64WithNamespace(namespace, key string) (float64, bool)
- func (m *Agollo) GetInt(key string) (int, bool)
- func (m *Agollo) GetIntWithNamespace(namespace, key string) (int, bool)
- func (m *Agollo) GetNameSpaceContent(namespace string) (string, bool)
- func (m *Agollo) GetReleaseKey(namespace string) (string, bool)
- func (m *Agollo) GetString(key string) (string, bool)
- func (m *Agollo) GetStringWithNamespace(namespace, key string) (string, bool)
- func (m *Agollo) RegisterObserver(observer ChangeEventObserver) (recall func())
- func (m *Agollo) Start() error
- func (m *Agollo) StartWatchUpdate()
- func (m *Agollo) StartWithConf(conf *Conf) error
- func (m *Agollo) StartWithConfFile(name string) error
- func (m *Agollo) Stop() error
- func (m *Agollo) SubscribeToNamespaces(namespaces ...string) error
- type AgolloLogger
- type Change
- type ChangeEvent
- type ChangeEventObserver
- type ChangeType
- type Client
- func (c *Client) GetAllKeys(namespace string) []string
- func (c *Client) GetBool(key string) (bool, bool)
- func (c *Client) GetBoolWithNamespace(namespace, key string) (bool, bool)
- func (c *Client) GetFloat64(key string) (float64, bool)
- func (c *Client) GetFloat64WithNamespace(namespace, key string) (float64, bool)
- func (c *Client) GetInt(key string) (int, bool)
- func (c *Client) GetIntSlice(key string) ([]int, bool)
- func (c *Client) GetIntSliceWithNamespace(namespace, key string) ([]int, bool)
- func (c *Client) GetIntWithNamespace(namespace, key string) (int, bool)
- func (c *Client) GetNamespaceContent(namespace string) (string, bool)
- func (c *Client) GetNamespaceVal(namespace string, val interface{}) error
- func (c *Client) GetReleaseKey(namespace string) (string, bool)
- func (c *Client) GetString(key string) (string, bool)
- func (c *Client) GetStringSlice(key string) ([]string, bool)
- func (c *Client) GetStringSliceWithNamespace(namespace, key string) ([]string, bool)
- func (c *Client) GetStringWithNamespace(namespace, key string) (string, bool)
- func (c *Client) Start() (err error)
- func (c *Client) Stop() error
- func (c *Client) SubscribeToNamespaces(namespaces ...string) error
- func (c *Client) WatchUpdate() <-chan *ChangeEvent
- type Conf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllKeys ¶
GetAllKeys return all config keys in given namespace
func GetBoolWithNamespace ¶
func GetFloat64 ¶
func GetFloat64WithNamespace ¶
func GetIntWithNamespace ¶
func GetNameSpaceContent ¶
GetNamespaceContent get contents of namespace
func GetReleaseKey ¶
GetReleaseKey return release key for namespace
func GetStringWithNamespace ¶
GetStringWithNamespace get value from given namespace
func RegisterObserver ¶
func RegisterObserver(observer ChangeEventObserver) (recall func())
RegisterObserver registers an observer that will be notified when change event happens
func SetLogger ¶
func SetLogger(logger AgolloLogger)
func StartWatchUpdate ¶
func StartWatchUpdate()
StartWatchUpdate starts an infinite loop reading changeEvent from update channel
and calls HandleChangeEvent method of all observers
func StartWithConfFile ¶
StartWithConfFile run agollo with conf file
func SubscribeToNamespaces ¶
SubscribeToNamespaces fetch namespace config to local and subscribe to updates
Types ¶
type Agollo ¶
type Agollo struct {
Client *Client
}
func (*Agollo) GetAllKeys ¶
func (*Agollo) GetBoolWithNamespace ¶
func (*Agollo) GetFloat64WithNamespace ¶
func (*Agollo) GetIntWithNamespace ¶
func (*Agollo) GetNameSpaceContent ¶
func (*Agollo) GetStringWithNamespace ¶
func (*Agollo) RegisterObserver ¶
func (m *Agollo) RegisterObserver(observer ChangeEventObserver) (recall func())
func (*Agollo) StartWatchUpdate ¶
func (m *Agollo) StartWatchUpdate()
func (*Agollo) StartWithConf ¶
func (*Agollo) StartWithConfFile ¶
func (*Agollo) SubscribeToNamespaces ¶
type AgolloLogger ¶
type AgolloLogger interface {
Printf(format string, v ...interface{})
}
type Change ¶
type Change struct { OldValue interface{} NewValue interface{} ChangeType ChangeType }
Change represent a single key change
type ChangeEvent ¶
ChangeEvent change event
type ChangeEventObserver ¶
type ChangeEventObserver interface {
HandleChangeEvent(event *ChangeEvent)
}
type ChangeType ¶
type ChangeType int
ChangeType for a key
const ( // ADD a new value ADD ChangeType = iota // MODIFY a old value MODIFY // DELETE ... DELETE )
func (ChangeType) String ¶
func (c ChangeType) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for apollo
func (*Client) GetAllKeys ¶
GetAllKeys return all config keys in given namespace
func (*Client) GetBoolWithNamespace ¶
func (*Client) GetFloat64WithNamespace ¶
func (*Client) GetIntSliceWithNamespace ¶ added in v4.1.5
func (*Client) GetIntWithNamespace ¶
func (*Client) GetNamespaceContent ¶
func (*Client) GetNamespaceVal ¶ added in v4.1.5
只有文件类型配置可以 Unmarshal, 类似: properties 这种配置类型是 key , value 结构,没有所谓 content 字段,不适合 Unmarshal
func (*Client) GetReleaseKey ¶
GetReleaseKey return release key for namespace
func (*Client) GetStringSlice ¶ added in v4.1.5
func (*Client) GetStringSliceWithNamespace ¶ added in v4.1.5
func (*Client) GetStringWithNamespace ¶
func (*Client) SubscribeToNamespaces ¶
SubscribeToNamespaces fetch namespace config to local and subscribe to updates
func (*Client) WatchUpdate ¶
func (c *Client) WatchUpdate() <-chan *ChangeEvent
WatchUpdate get all updates