Documentation ¶
Overview ¶
Package remote created on 2017/6/22.
Index ¶
- Constants
- func InstallConfigClientPlugin(name string, f func(options Options) (Client, error))
- func NewConfigCenterSource(cc Client, refreshMode, refreshInterval int) source.ConfigSource
- type Client
- type Options
- type Source
- func (rs *Source) AddDimensionInfo(labels map[string]string) error
- func (rs *Source) Cleanup() error
- func (rs *Source) Delete(key string) error
- func (rs *Source) GetConfigurationByKey(key string) (interface{}, error)
- func (rs *Source) GetConfigurations() (map[string]interface{}, error)
- func (rs *Source) GetPriority() int
- func (*Source) GetSourceName() string
- func (rs *Source) Set(key string, value interface{}) error
- func (rs *Source) SetPriority(priority int)
- func (rs *Source) Watch(callback source.EventHandler) error
Constants ¶
const ( LabelService = "serviceName" LabelVersion = "version" LabelEnvironment = "environment" LabelApp = "app" )
const
const ( //Name variable of type string Name = "ConfigCenterSource" ModeInterval = 1 )
const
Variables ¶
This section is empty.
Functions ¶
func InstallConfigClientPlugin ¶ added in v1.0.0
InstallConfigClientPlugin install a config client plugin
func NewConfigCenterSource ¶
func NewConfigCenterSource(cc Client, refreshMode, refreshInterval int) source.ConfigSource
NewConfigCenterSource initializes all components of configuration center
Types ¶
type Client ¶ added in v1.0.0
type Client interface { //PullConfigs pull all configs from remote PullConfigs(labels ...map[string]string) (map[string]interface{}, error) //PullConfig pull one config from remote PullConfig(key, contentType string, labels map[string]string) (interface{}, error) // PushConfigs push config to cc PushConfigs(data map[string]interface{}, labels map[string]string) (map[string]interface{}, error) // DeleteConfigsByKeys delete config for cc by keys DeleteConfigsByKeys(keys []string, labels map[string]string) (map[string]interface{}, error) //Watch get kv change results, you can compare them with local kv cache and refresh local cache Watch(f func(map[string]interface{}), errHandler func(err error), labels map[string]string) error Options() Options }
Client is the interface of config server client, it has basic func to interact with config server
var DefaultClient Client
DefaultClient is config server's client
type Options ¶ added in v1.0.0
type Options struct { ServerURI string Endpoint string TLSConfig *tls.Config TenantName string EnableSSL bool APIVersion string AutoDiscovery bool RefreshPort string Labels map[string]string }
Options is client option
type Source ¶
type Source struct { sync.RWMutex RefreshMode int RefreshInterval time.Duration // contains filtered or unexported fields }
Source handles configs from config center
func (*Source) AddDimensionInfo ¶
AddDimensionInfo adds dimension info for a configuration
func (*Source) GetConfigurationByKey ¶
GetConfigurationByKey gets required configuration for a particular key
func (*Source) GetConfigurations ¶
GetConfigurations pull config from remote and start refresh configs interval write a new map and return, internal map can not be operated outside struct
func (*Source) GetPriority ¶
GetPriority returns priority of a configuration
func (*Source) GetSourceName ¶
GetSourceName returns name of the configuration
func (*Source) SetPriority ¶
SetPriority custom priority
Directories ¶
Path | Synopsis |
---|---|
Package configcenter created on 2017/6/20.
|
Package configcenter created on 2017/6/20. |