Documentation ¶
Overview ¶
Package apollo ctrip apollo go client
Index ¶
- func GetIntValue(key string, defaultValue int) int
- func GetNameSpaceContent(namespace, defaultValue string) string
- func GetStringValue(key, defaultValue string) string
- func GetStringValueWithNameSpace(namespace, key, defaultValue string) string
- func ListKeys(namespace string) []string
- func SetLogger(userLog Logger)
- func Start() error
- func StartWithConf(conf *Conf) error
- func StartWithConfFile(name string) error
- func Stop() error
- func WatchUpdate() <-chan *ChangeEvent
- type Change
- type ChangeEvent
- type ChangeType
- type Client
- func (c *Client) GetIntValue(key string, defaultValue int) int
- func (c *Client) GetIntValueWithNameSpace(namespace, key string, defaultValue int) int
- func (c *Client) GetNameSpaceContent(namespace, defaultValue string) string
- func (c *Client) GetStringValue(key, defaultValue string) string
- func (c *Client) GetStringValueWithNameSpace(namespace, key, defaultValue string) string
- func (c *Client) ListKeys(namespace string) []string
- func (c *Client) Start() error
- func (c *Client) Stop() error
- func (c *Client) WatchUpdate() <-chan *ChangeEvent
- type Conf
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIntValue ¶ added in v0.2.2
GetIntValue from default namespace
func GetNameSpaceContent ¶
GetNameSpaceContent get contents of namespace
func GetStringValue ¶
GetStringValue from default namespace
func GetStringValueWithNameSpace ¶ added in v0.1.1
GetStringValueWithNameSpace get value from given namespace
func StartWithConfFile ¶
StartWithConfFile run apollo with conf file
Types ¶
type Change ¶
type Change struct { OldValue []byte NewValue []byte ChangeType ChangeType }
Change represent a single key change
type ChangeEvent ¶
ChangeEvent change event
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) GetIntValue ¶ added in v0.2.2
GetIntValue from default namespace
func (*Client) GetIntValueWithNameSpace ¶ added in v0.2.2
GetIntValueWithNameSpace get int value from given namespace
func (*Client) GetNameSpaceContent ¶
GetNameSpaceContent get contents of namespace
func (*Client) GetStringValue ¶
GetStringValue from default namespace
func (*Client) GetStringValueWithNameSpace ¶ added in v0.1.1
GetStringValueWithNameSpace get value from given namespace
func (*Client) WatchUpdate ¶
func (c *Client) WatchUpdate() <-chan *ChangeEvent
WatchUpdate get all updates
type Conf ¶
type Conf struct { AppID string `yaml:"appId"` Cluster string `yaml:"cluster"` Namespaces []string `yaml:"namespaces,flow"` IP string `json:"ip"` }
Conf ...
type Logger ¶ added in v0.3.0
type Logger interface { Warnf(format string, v ...interface{}) Warn(v ...interface{}) Errorf(format string, v ...interface{}) Error(v ...interface{}) Infof(format string, v ...interface{}) Info(v ...interface{}) Debugf(format string, v ...interface{}) Debug(v ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) }
Logger interface