Documentation
¶
Index ¶
- Constants
- type Array
- func (t *Array) ArrayAt(i int) *embedArray
- func (t *Array) AtomicUpdate(v string)
- func (t *Array) Bools() []*embedBool
- func (t *Array) Changed(evt UpdateEvent)
- func (t *Array) Floats() []*embedFloat
- func (t *Array) Ints() []*embedInt
- func (t *Array) Len() int
- func (t *Array) String() string
- func (t *Array) Strings() []*embedString
- func (t *Array) Uints() []*embedUint
- type Bool
- type Callback
- type CallbackFunc
- type DynamicType
- type Float
- type Int
- type InvalidUnmarshalError
- type Map
- func (t *Map) ArrayVal(key string) *embedArray
- func (t *Map) AtomicUpdate(v string)
- func (t *Map) BoolVal(key string) *embedBool
- func (t *Map) Changed(evt UpdateEvent)
- func (t *Map) FloatVal(key string) *embedFloat
- func (t *Map) HasKey(key string) bool
- func (t *Map) IntVal(key string) *embedInt
- func (t *Map) Keys() *embedArray
- func (t *Map) Len() int
- func (t *Map) MapVal(key string) *embedMap
- func (t *Map) String() string
- func (t *Map) StringVal(key string) *embedString
- func (t *Map) UintVal(key string) *embedUint
- type Node
- type NodeOption
- type Nodes
- type Option
- func WithBasePath(path string) Option
- func WithCallbackManger(mgr Callback) Option
- func WithConfigAutoCreation() Option
- func WithContext(ctx context.Context) Option
- func WithDebugProvider() Option
- func WithEtcdProvider(ctx context.Context, endPoints []string, username, password string) Option
- func WithProvider(provider backend.Provider) Option
- type RemoteConfig
- type StaticType
- type String
- type Uint
- type UpdateEvent
Constants ¶
View Source
const (
ExceedDeepLevel = "grc: only support two level map/array"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
func (*Array) AtomicUpdate ¶
func (*Array) Changed ¶
func (t *Array) Changed(evt UpdateEvent)
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func (*Bool) AtomicUpdate ¶
func (*Bool) Changed ¶
func (t *Bool) Changed(evt UpdateEvent)
type Callback ¶
type Callback interface {
RegChan() chan<- *CallbackFunc
EvtChan() chan<- DynamicType
}
type CallbackFunc ¶
type CallbackFunc struct {
Val DynamicType
Evt UpdateEvent
}
type DynamicType ¶
type DynamicType interface {
// AtomicUpdate updates value.
AtomicUpdate(v string)
// Changed will be invoked if value updated.
Changed(evt UpdateEvent)
}
DynamicType interface.
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
func (*Float) AtomicUpdate ¶
func (*Float) Changed ¶
func (t *Float) Changed(evt UpdateEvent)
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
func (*Int) AtomicUpdate ¶
func (*Int) Changed ¶
func (t *Int) Changed(evt UpdateEvent)
type InvalidUnmarshalError ¶
An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. (The argument to Unmarshal must be a non-nil pointer.)
func (*InvalidUnmarshalError) Error ¶
func (e *InvalidUnmarshalError) Error() string
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func (*Map) AtomicUpdate ¶
func (*Map) Changed ¶
func (t *Map) Changed(evt UpdateEvent)
type Node ¶
type Node struct {
TTL time.Duration `json:"ttl,omitempty"`
UniqueID int64 `json:"unique_id,omitempty"`
Service string `json:"service,omitempty"`
Address string `json:"address,omitempty"`
Weight int `json:"weight,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
// contains filtered or unexported fields
}
type NodeOption ¶
type NodeOption func(*Node)
func WithNodeMetadata ¶
func WithNodeMetadata(md map[string]string) NodeOption
func WithNodeTTL ¶
func WithNodeTTL(ttl time.Duration) NodeOption
func WithNodeWeight ¶
func WithNodeWeight(weight int) NodeOption
func WithOpsConfig ¶
func WithOpsConfig() NodeOption
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option interface sets options such as provider, autoCreation, etc.
func WithBasePath ¶
func WithCallbackManger ¶
func WithConfigAutoCreation ¶
func WithConfigAutoCreation() Option
func WithContext ¶
func WithDebugProvider ¶
func WithDebugProvider() Option
func WithEtcdProvider ¶
func WithProvider ¶
type RemoteConfig ¶
type RemoteConfig struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...Option) (*RemoteConfig, error)
func (*RemoteConfig) GetNodes ¶
func (rc *RemoteConfig) GetNodes(service string) Nodes
func (*RemoteConfig) RegisterConfig ¶
func (rc *RemoteConfig) RegisterConfig(service string, v interface{}) error
func (*RemoteConfig) RegisterNode ¶
func (rc *RemoteConfig) RegisterNode(service, nodeAddr string, opts ...NodeOption) (int64, error)
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (*String) AtomicUpdate ¶
func (*String) Changed ¶
func (t *String) Changed(evt UpdateEvent)
type Uint ¶
type Uint struct {
// contains filtered or unexported fields
}
func (*Uint) AtomicUpdate ¶
func (*Uint) Changed ¶
func (t *Uint) Changed(evt UpdateEvent)
type UpdateEvent ¶
type UpdateEvent func()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.