Documentation
¶
Index ¶
- Constants
- func GetBoolValue(key string, defaultValue bool) bool
- 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 ListenChangeEvent() <-chan *ChangeEvent
- func SetCache(cacheInterface CacheInterface)
- func SetLogger(loggerInterface LoggerInterface)
- func Start() error
- func StartRefreshConfig(component AbsComponent)
- func StartWithCache(cacheInterface CacheInterface) error
- func StartWithLogger(loggerInterface LoggerInterface) error
- type AbsComponent
- type ApolloConfig
- type ApolloConnConfig
- type AppConfig
- type CacheInterface
- type CallBack
- type ChangeEvent
- type ConfigChange
- type ConfigChangeType
- type ConnectConfig
- 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 LoggerInterface
- type NotifyConfigComponent
Constants ¶
View Source
const FILE = "apolloConfig.json"
Variables ¶
This section is empty.
Functions ¶
func GetBoolValue ¶
func GetFloatValue ¶
func GetIntValue ¶
func GetStringValue ¶
func InitCustomConfig ¶
init config by custom
func SetCache ¶
func SetCache(cacheInterface CacheInterface)
func SetLogger ¶
func SetLogger(loggerInterface LoggerInterface)
func StartRefreshConfig ¶
func StartRefreshConfig(component AbsComponent)
func StartWithCache ¶
func StartWithCache(cacheInterface CacheInterface) error
func StartWithLogger ¶
func StartWithLogger(loggerInterface LoggerInterface) error
Types ¶
type AbsComponent ¶
type AbsComponent interface {
Start()
}
type ApolloConfig ¶
type ApolloConfig struct { ApolloConnConfig Configurations map[string]string `json:"configurations"` }
type ApolloConnConfig ¶
type ApolloConnConfig struct { AppId string `json:"appId"` Cluster string `json:"cluster"` NamespaceName string `json:"namespaceName"` ReleaseKey string `json:"releaseKey"` sync.RWMutex }
func GetCurrentApolloConfig ¶
func GetCurrentApolloConfig() *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 CacheInterface ¶
type CacheInterface interface { Set(key, value []byte, expireSeconds int) (err error) EntryCount() (entryCount int64) Get(key []byte) (value []byte, err error) Del(key []byte) (affected bool) NewIterator() *freecache.Iterator TTL(key []byte) (timeLeft uint32, err error) Clear() }
func GetApolloConfigCache ¶
func GetApolloConfigCache() CacheInterface
type ChangeEvent ¶
type ChangeEvent struct { Namespace string Changes map[string]*ConfigChange }
config change event
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 ConnectConfig ¶
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()
Click to show internal directories.
Click to hide internal directories.