Documentation
¶
Index ¶
- func LoadRegisterConfig()
- func LoadRemoteConfig(actions ...func())
- func NewConfig(ctx context.Context, config Config, actions ...func()) (adapter gcfg.Adapter, err error)
- func NewServiceFromInstance(instance []model.Instance) gsvc.Service
- func NewServicesFromInstances(instances []model.Instance) []gsvc.Service
- type Client
- type Config
- type LocalNacosConfig
- type Registry
- func (reg *Registry) Deregister(ctx context.Context, service gsvc.Service) (err error)
- func (reg *Registry) Register(ctx context.Context, service gsvc.Service) (registered gsvc.Service, err error)
- func (reg *Registry) Search(ctx context.Context, in gsvc.SearchInput) (result []gsvc.Service, err error)
- func (reg *Registry) SetClusterName(clusterName string) *Registry
- func (reg *Registry) SetGroupName(groupName string) *Registry
- func (reg *Registry) Watch(ctx context.Context, key string) (watcher gsvc.Watcher, err error)
- type RegistryConfig
- type RemoteRegistryConfig
- type Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadRegisterConfig ¶
func LoadRegisterConfig()
func LoadRemoteConfig ¶
func LoadRemoteConfig(actions ...func())
func NewConfig ¶
func NewConfig(ctx context.Context, config Config, actions ...func()) (adapter gcfg.Adapter, err error)
NewConfig creates and returns gcfg.Adapter implementing using nacos service.
func NewServiceFromInstance ¶
NewServiceFromInstance new one service from instance
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements gcfg.Adapter implementing using nacos service.
func (*Client) Available ¶
Available checks and returns the backend configuration service is available. The optional parameter `resource` specifies certain configuration resource.
Note that this function does not return error as it just does simply check for backend configuration service.
type Config ¶
type Config struct {
ServerConfigs []constant.ServerConfig `v:"required"` // See constant.ServerConfig
ClientConfig constant.ClientConfig `v:"required"` // See constant.ClientConfig
ConfigParam vo.ConfigParam `v:"required"` // See vo.ConfigParam
Watch bool // Watch watches remote configuration updates, which updates local configuration in memory immediately when remote configuration changes.
}
Config is the configuration object for nacos client.
type LocalNacosConfig ¶
type LocalNacosConfig struct {
Ip string `v:"required#[nacos.config.ip] can not be empty"`
Port uint64 `v:"required#[nacos.config.port] can not be empty"`
NameSpaceId string `v:"required#[nacos.config.name-space-id] can not be empty"`
Group string `v:"required#[nacos.config.group] can not be empty"`
DataId string `v:"required#[nacos.config.data-id] can not be empty"`
Username string `v:"required#[nacos.config.username] can not be empty"`
Password string `v:"required#[nacos.config.password] can not be empty"`
}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is nacos registry.
func NewRegistry ¶
func NewRegistry(address []string, opts ...constant.ClientOption) (reg *Registry)
NewRegistry new a registry with address and opts
func NewWithClient ¶
func NewWithClient(client naming_client.INamingClient) *Registry
NewWithClient new the instance with INamingClient
func NewWithConfig ¶
func NewWithConfig(ctx context.Context, config RegistryConfig) (reg *Registry, err error)
NewConfig creates and returns registry with Config.
func (*Registry) Deregister ¶
Deregister off-lines and removes `service` from the Registry.
func (*Registry) Register ¶
func (reg *Registry) Register(ctx context.Context, service gsvc.Service) (registered gsvc.Service, err error)
Register registers `service` to Registry. Note that it returns a new Service if it changes the input Service with custom one.
func (*Registry) Search ¶
func (reg *Registry) Search(ctx context.Context, in gsvc.SearchInput) (result []gsvc.Service, err error)
Search searches and returns services with specified condition.
func (*Registry) SetClusterName ¶
SetClusterName can set the clusterName. The default is 'DEFAULT'
func (*Registry) SetGroupName ¶
SetGroupName can set the groupName. The default is 'DEFAULT_GROUP'
type RegistryConfig ¶
type RegistryConfig struct {
ServerConfigs []constant.ServerConfig `v:"required"` // See constant.ServerConfig
ClientConfig *constant.ClientConfig `v:"required"` // See constant.ClientConfig
}
RegistryConfig is the configuration object for nacos client.
type RemoteRegistryConfig ¶
type RemoteRegistryConfig struct {
Ip string `v:"required#[nacos.registry.ip] can not be empty"`
Port uint64 `v:"required#[nacos.registry.port] can not be empty"`
NameSpaceId string `v:"required#[nacos.registry.name-space-id] can not be empty"`
Group string `v:"required#[nacos.registry.group] can not be empty"`
Username string `v:"required#[nacos.registry.username] can not be empty"`
Password string `v:"required#[nacos.registry.password] can not be empty"`
ClusterName string `v:"required#[nacos.registry.cluster-name] can not be empty"`
}
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher used to mange service event such as update.
func (*Watcher) Proceed ¶
Proceed proceeds watch in blocking way. It returns all complete services that watched by `key` if any change.
func (*Watcher) SetCloseFunc ¶
SetCloseFunc set the close callback function