Documentation
¶
Index ¶
- Constants
- func GetBool(ctx context.Context, key string) (bool, bool)
- func GetBoolWithNamespace(ctx context.Context, namespace, key string) (bool, bool)
- func GetInt(ctx context.Context, key string) (int, bool)
- func GetIntWithNamespace(ctx context.Context, namespace, key string) (int, bool)
- func GetString(ctx context.Context, key string) (string, bool)
- func GetStringWithNamespace(ctx context.Context, namespace, key string) (string, bool)
- func Init(ctx context.Context, serviceName string, namespaceNames []string) error
- func RegisterObserver(ctx context.Context, observer ConfigObserver) (recall func())
- func StartWatchUpdate(ctx context.Context)
- func Stop(ctx context.Context) error
- func SubscribeNamespaces(ctx context.Context, namespaceNames []string) error
- func Unmarshal(ctx context.Context, v interface{}) error
- func UnmarshalKey(ctx context.Context, key string, v interface{}) error
- func UnmarshalKeyWithNamespace(ctx context.Context, namespace, key string, v interface{}) error
- func UnmarshalWithNamespace(ctx context.Context, namespace string, v interface{}) error
- type Change
- type ChangeEvent
- type ChangeEventSource
- type ChangeType
- type ConfigCenter
- type ConfigCenterType
- type ConfigObserver
Constants ¶
View Source
const ( DefaultApolloMiddlewareService = "middleware" DefaultApolloMQNamespace = "infra.mq" DefaultApolloCacheNamespace = "infra.cache" )
Variables ¶
This section is empty.
Functions ¶
func GetBoolWithNamespace ¶
func GetIntWithNamespace ¶
func GetStringWithNamespace ¶
func RegisterObserver ¶
func RegisterObserver(ctx context.Context, observer ConfigObserver) (recall func())
func StartWatchUpdate ¶
func SubscribeNamespaces ¶
Types ¶
type Change ¶
type Change struct { OldValue string NewValue string ChangeType ChangeType }
type ChangeEvent ¶
type ChangeEvent struct { Source ChangeEventSource // Namespace means // Namespace in Apollo // Path in Etcd Namespace string Changes map[string]*Change }
type ChangeType ¶
type ChangeType int
const ( ADD ChangeType = iota MODIFY DELETE )
func (ChangeType) String ¶
func (c ChangeType) String() string
type ConfigCenter ¶
type ConfigCenter interface { Init(ctx context.Context, serviceName string, namespaceNames []string) error Stop(ctx context.Context) error SubscribeNamespaces(ctx context.Context, namespaceNames []string) error GetString(ctx context.Context, key string) (string, bool) GetStringWithNamespace(ctx context.Context, namespace, key string) (string, bool) GetBool(ctx context.Context, key string) (bool, bool) GetBoolWithNamespace(ctx context.Context, namespace, key string) (bool, bool) GetInt(ctx context.Context, key string) (int, bool) GetIntWithNamespace(ctx context.Context, namespace, key string) (int, bool) GetAllKeys(ctx context.Context) []string GetAllKeysWithNamespace(ctx context.Context, namespace string) []string Unmarshal(ctx context.Context, v interface{}) error UnmarshalWithNamespace(ctx context.Context, namespace string, v interface{}) error UnmarshalKey(ctx context.Context, key string, v interface{}) error UnmarshalKeyWithNamespace(ctx context.Context, namespace string, key string, v interface{}) error StartWatchUpdate(ctx context.Context) RegisterObserver(ctx context.Context, observer ConfigObserver) (recall func()) }
func NewConfigCenter ¶
func NewConfigCenter(t ConfigCenterType) (ConfigCenter, error)
type ConfigCenterType ¶
type ConfigCenterType int
const (
ApolloConfigCenter ConfigCenterType = iota
)
func (ConfigCenterType) String ¶
func (c ConfigCenterType) String() string
type ConfigObserver ¶
type ConfigObserver interface {
HandleChangeEvent(event *ChangeEvent)
}
Click to show internal directories.
Click to hide internal directories.