Documentation ¶
Index ¶
- type Client
- type DconfigClient
- func (uf *DconfigClient) AddHandlers(handlerMap map[string]Handler)
- func (uf *DconfigClient) AddVerifiers(verifierMap map[string]Verifier)
- func (uf *DconfigClient) GetClient() interface{}
- func (uf *DconfigClient) GetOrDefault(fieldName string, defaultValue interface{}) interface{}
- func (uf *DconfigClient) Refresh()
- func (uf *DconfigClient) StartBackGroundRefresh()
- type GetterInt
- type GetterString
- type Handler
- type SetterInt
- type SetterString
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // AddHandlers register all the handler for the dynamic config values AddHandlers(handlerMap map[string]Handler) // AddVerifiers register all the handler for the dynamic config values AddVerifiers(verifierMap map[string]Verifier) // Refresh the dynamic config client Refresh() // StartBackGroundRefresh start the back fround refresh for dynamic config StartBackGroundRefresh() GetOrDefault(fieldName string, defaultValue interface{}) interface{} }
Client is the interface used to manager dynamic config
func NewDconfigClient ¶
func NewDconfigClient(scfg configure.CommonServiceConfig, serviceName string) Client
NewDconfigClient return the dconfig client for the service
type DconfigClient ¶
type DconfigClient struct {
// contains filtered or unexported fields
}
DconfigClient is the struct which implements the ClientInt interface
func (*DconfigClient) AddHandlers ¶
func (uf *DconfigClient) AddHandlers(handlerMap map[string]Handler)
AddHandlers register all the handler for the dynamic config values
func (*DconfigClient) AddVerifiers ¶
func (uf *DconfigClient) AddVerifiers(verifierMap map[string]Verifier)
AddVerifiers register all the handler for the dynamic config values
func (*DconfigClient) GetClient ¶
func (uf *DconfigClient) GetClient() interface{}
GetClient return the config client
func (*DconfigClient) GetOrDefault ¶
func (uf *DconfigClient) GetOrDefault(fieldName string, defaultValue interface{}) interface{}
GetOrDefault implements the corresponding method
func (*DconfigClient) Refresh ¶
func (uf *DconfigClient) Refresh()
Refresh refresh the dynamic config client
func (*DconfigClient) StartBackGroundRefresh ¶
func (uf *DconfigClient) StartBackGroundRefresh()
StartBackGroundRefresh start the automatical refresh for dynamic config
type GetterInt ¶
type GetterInt func() int
GetterInt is the function interface for handler dconfig value
type GetterString ¶
type GetterString func() string
GetterString is the function interface for handler dconfig value
type Handler ¶
type Handler func(newConfig interface{})
Handler is user supplied handler functions, which will be called back when the dynamic config updates.
func GenerateIntHandler ¶
GenerateIntHandler return a dconfig Handler for the dconfigKey
func GenerateStringHandler ¶
func GenerateStringHandler(dconfigKey string, setter SetterString, getter GetterString) Handler
GenerateStringHandler return a dconfig Handler for the dconfigKey
type SetterInt ¶
type SetterInt func(value int32)
SetterInt is the setter function to generate the handler function
type SetterString ¶
type SetterString func(value string)
SetterString is the setter function to generate the handler function
type Verifier ¶
type Verifier func(oldValue interface{}, newValue interface{}) bool
Verifier interface user supplied verifier functions to verify the value when updates
func GenerateIntMaxMinVerifier ¶
GenerateIntMaxMinVerifier return a dconfig Verifier for the dconfigKey