config_center

package
v3.2.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 31

Documentation

Overview

Package config_center provides Config Center definition and implementations for listening service governance rules.

Index

Constants

View Source
const (
	DefaultGroup         = "dubbo"
	DefaultConfigTimeout = "10s"
)

Variables

This section is empty.

Functions

func GetRuleKey

func GetRuleKey(url *common.URL) string

GetRuleKey The format is '{interfaceName}:[version]:[group]'

Types

type BaseDynamicConfiguration

type BaseDynamicConfiguration struct{}

BaseDynamicConfiguration will default implementation DynamicConfiguration some method

func (*BaseDynamicConfiguration) RemoveConfig

func (bdc *BaseDynamicConfiguration) RemoveConfig(string, string) error

type ConfigChangeEvent

type ConfigChangeEvent struct {
	Key        string
	Value      interface{}
	ConfigType remoting.EventType
}

ConfigChangeEvent for changing listener's event

func (ConfigChangeEvent) String

func (c ConfigChangeEvent) String() string

type ConfigurationListener

type ConfigurationListener interface {
	// Process the notification event once there's any change happens on the config
	Process(*ConfigChangeEvent)
}

ConfigurationListener for changing listener's event

type Configurator

type Configurator interface {
	GetUrl() *common.URL
	Configure(url *common.URL)
}

Configurator is the interface which wraps GetUrl and Configure method.

type DynamicConfiguration

type DynamicConfiguration interface {
	Parser() parser.ConfigurationParser
	SetParser(parser.ConfigurationParser)
	AddListener(string, ConfigurationListener, ...Option)
	RemoveListener(string, ConfigurationListener, ...Option)
	// GetProperties get properties file
	GetProperties(string, ...Option) (string, error)

	// GetRule get Router rule properties file
	GetRule(string, ...Option) (string, error)

	// GetInternalProperty get value by key in Default properties file(dubbo.properties)
	GetInternalProperty(string, ...Option) (string, error)

	// PublishConfig will publish the config with the (key, group, value) pair
	// for zk: path is /$(group)/config/$(key) -> value
	// for nacos: group, key -> value
	PublishConfig(string, string, string) error

	// RemoveConfig will remove the config white the (key, group) pair
	RemoveConfig(string, string) error

	// GetConfigKeysByGroup will return all keys with the group
	GetConfigKeysByGroup(group string) (*gxset.HashSet, error)
}

DynamicConfiguration is the interface which modifys listener and gets properties file.

type DynamicConfigurationFactory

type DynamicConfigurationFactory interface {
	GetDynamicConfiguration(*common.URL) (DynamicConfiguration, error)
}

DynamicConfigurationFactory gets the DynamicConfiguration

type MockDynamicConfiguration

type MockDynamicConfiguration struct {
	BaseDynamicConfiguration
	// contains filtered or unexported fields
}

MockDynamicConfiguration uses to parse content and defines listener

func (*MockDynamicConfiguration) AddListener

func (c *MockDynamicConfiguration) AddListener(key string, listener ConfigurationListener, _ ...Option)

AddListener adds a listener for MockDynamicConfiguration

func (*MockDynamicConfiguration) GetConfig

func (c *MockDynamicConfiguration) GetConfig(_ string, _ ...Option) (string, error)

GetConfig returns content of MockDynamicConfiguration

func (*MockDynamicConfiguration) GetConfigKeysByGroup

func (c *MockDynamicConfiguration) GetConfigKeysByGroup(group string) (*gxset.HashSet, error)

GetConfigKeysByGroup will return all keys with the group

func (*MockDynamicConfiguration) GetConfigs

func (c *MockDynamicConfiguration) GetConfigs(key string, opts ...Option) (string, error)

GetConfigs For zookeeper, getConfig and getConfigs have the same meaning.

func (*MockDynamicConfiguration) GetInternalProperty

func (c *MockDynamicConfiguration) GetInternalProperty(key string, opts ...Option) (string, error)

GetInternalProperty For zookeeper, getConfig and getConfigs have the same meaning.

func (*MockDynamicConfiguration) GetProperties

func (c *MockDynamicConfiguration) GetProperties(_ string, _ ...Option) (string, error)

GetProperties gets content of MockDynamicConfiguration

func (*MockDynamicConfiguration) GetRule

func (c *MockDynamicConfiguration) GetRule(key string, opts ...Option) (string, error)

GetRule gets properties of MockDynamicConfiguration

func (*MockDynamicConfiguration) MockApplicationConfigEvent

func (c *MockDynamicConfiguration) MockApplicationConfigEvent()

MockApplicationConfigEvent returns ConfiguratorConfig

func (*MockDynamicConfiguration) MockServiceConfigEvent

func (c *MockDynamicConfiguration) MockServiceConfigEvent()

MockServiceConfigEvent returns ConfiguratorConfig

func (*MockDynamicConfiguration) Parser

Parser returns a parser of MockDynamicConfiguration

func (*MockDynamicConfiguration) PublishConfig

func (c *MockDynamicConfiguration) PublishConfig(string, string, string) error

PublishConfig will publish the config with the (key, group, value) pair

func (*MockDynamicConfiguration) RemoveListener

func (c *MockDynamicConfiguration) RemoveListener(_ string, _ ConfigurationListener, _ ...Option)

RemoveListener removes the listener for MockDynamicConfiguration

func (*MockDynamicConfiguration) SetParser

SetParser sets parser of MockDynamicConfiguration

type MockDynamicConfigurationFactory

type MockDynamicConfigurationFactory struct {
	Content             string
	ConfiguratorContent string
}

MockDynamicConfigurationFactory defines content

func (*MockDynamicConfigurationFactory) GetDynamicConfiguration

func (f *MockDynamicConfigurationFactory) GetDynamicConfiguration(_ *common.URL) (DynamicConfiguration, error)

GetDynamicConfiguration returns a DynamicConfiguration

type Option

type Option func(*Options)

func WithAddress

func WithAddress(address string) Option

func WithAppID

func WithAppID(id string) Option

func WithCluster

func WithCluster(cluster string) Option

func WithConfigCenter

func WithConfigCenter(cc string) Option

func WithDataID

func WithDataID(id string) Option

func WithFile

func WithFile() Option

func WithFileExtJson

func WithFileExtJson() Option

func WithFileExtProperties

func WithFileExtProperties() Option

func WithFileExtToml

func WithFileExtToml() Option

func WithFileExtYaml

func WithFileExtYaml() Option

func WithFileExtYml

func WithFileExtYml() Option

func WithGroup

func WithGroup(group string) Option

func WithNacos

func WithNacos() Option

func WithNamespace

func WithNamespace(namespace string) Option

func WithParams

func WithParams(params map[string]string) Option

func WithPassword

func WithPassword(password string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithUsername

func WithUsername(username string) Option

func WithZookeeper

func WithZookeeper() Option

type Options

type Options struct {
	Center *global.CenterConfig
}

func NewOptions

func NewOptions(opts ...Option) *Options

Directories

Path Synopsis
Package file implements config center around file system.
Package file implements config center around file system.
Package nacos implements config center around Nacos.
Package nacos implements config center around Nacos.
Package zookeeper implements config center around zookeeper.
Package zookeeper implements config center around zookeeper.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL