Documentation
¶
Index ¶
- func RawConfigInstance() config_client.IConfigClient
- func RawNamingInstance() naming_client.INamingClient
- type ConfigChangeData
- type ConfigClient
- func (c *ConfigClient) GetConfig(dataId string, configType ConfigType, value any) error
- func (c *ConfigClient) GetConfigRawContent(dataId string) (string, error)
- func (c *ConfigClient) LoadAndWatchConfig(configFiles []*ConfigFileSetting) error
- func (c *ConfigClient) UnwatchConfig(watchId string) error
- func (c *ConfigClient) WatchConfig(dataId string, watch func(namespace, group, dataId, data string)) (string, error)
- type ConfigFileSetting
- type ConfigType
- type InitConfigSettings
- type Instance
- type InstanceBatch
- type NacosClientConfig
- type NacosServerConfig
- type NacosStarter
- type NamingClient
- func (n *NamingClient) ChooseOneHealthyInstance(serviceName string) (*RegisteredInstance, error)
- func (n *NamingClient) GetAllInstances(serviceName string) ([]RegisteredInstance, error)
- func (n *NamingClient) GetHealthyInstances(serviceName string) ([]RegisteredInstance, error)
- func (n *NamingClient) GetService(serviceName string) (model.Service, error)
- func (n *NamingClient) GetServicePage(pageNo, pageSize uint) (model.ServiceList, error)
- func (n *NamingClient) Register(instance Instance) (string, error)
- func (n *NamingClient) RegisterBatch(serviceName string, instances []InstanceBatch) ([]string, error)
- func (n *NamingClient) Unregister(instanceId string) (bool, error)
- func (n *NamingClient) UnwatchNaming(watchId string) error
- func (n *NamingClient) WatchNaming(serviceName string, watch func(instance []model.Instance, err error)) (string, error)
- type RegisteredInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RawConfigInstance ¶
func RawConfigInstance() config_client.IConfigClient
func RawNamingInstance ¶
func RawNamingInstance() naming_client.INamingClient
Types ¶
type ConfigChangeData ¶ added in v0.1.2
type ConfigChangeData func(namespace, group, dataId, data string)
ConfigChangeData 文件变动监听回调
type ConfigClient ¶ added in v0.1.2
type ConfigClient struct {
// contains filtered or unexported fields
}
func GetConfigClient ¶
func GetConfigClient(group string) (*ConfigClient, error)
func (*ConfigClient) GetConfig ¶ added in v0.1.2
func (c *ConfigClient) GetConfig(dataId string, configType ConfigType, value any) error
GetConfig 获取指定文件内容并反序列化
func (*ConfigClient) GetConfigRawContent ¶ added in v0.1.2
func (c *ConfigClient) GetConfigRawContent(dataId string) (string, error)
GetConfigRawContent 获取指定配置的源文件内容
func (*ConfigClient) LoadAndWatchConfig ¶ added in v0.1.2
func (c *ConfigClient) LoadAndWatchConfig(configFiles []*ConfigFileSetting) error
LoadAndWatchConfig 获取并监听配置变化
func (*ConfigClient) UnwatchConfig ¶ added in v0.1.2
func (c *ConfigClient) UnwatchConfig(watchId string) error
UnwatchConfig 取消监听文件变化
func (*ConfigClient) WatchConfig ¶ added in v0.1.2
func (c *ConfigClient) WatchConfig(dataId string, watch func(namespace, group, dataId, data string)) (string, error)
WatchConfig 监听文件变化
type ConfigFileSetting ¶
type ConfigFileSetting struct { DataId string Type ConfigType Watch bool Value any }
type ConfigType ¶
type ConfigType string
const ( ConfigTypeJson ConfigType = "json" ConfigTypeYaml ConfigType = "yaml" )
type InitConfigSettings ¶
type InitConfigSettings struct { ConfigSetting []*ConfigFileSetting GroupName string }
type InstanceBatch ¶ added in v0.1.2
type NacosClientConfig ¶
type NacosClientConfig struct {
*constant.ClientConfig
}
type NacosServerConfig ¶
type NacosServerConfig struct {
Services []constant.ServerConfig
}
type NacosStarter ¶
type NacosStarter struct { ServerConfig *NacosServerConfig ClientConfig *NacosClientConfig // 禁用配置功能 DisableConfig bool // 禁用服务发现功能 DisableDiscovery bool // 需要立即初始化的配置 // 该设置将在nacos就绪后立即执行,适用于初始化配置其他模块可以立即在后续读取 InitConfigSettings *InitConfigSettings NacosSetting *parent.Setting }
func (*NacosStarter) Setting ¶
func (n *NacosStarter) Setting() *parent.Setting
func (*NacosStarter) Start ¶
func (n *NacosStarter) Start() (interface{}, error)
type NamingClient ¶ added in v0.1.2
type NamingClient struct {
// contains filtered or unexported fields
}
func GetNamingClient ¶
func GetNamingClient(group string) (*NamingClient, error)
func (*NamingClient) ChooseOneHealthyInstance ¶ added in v0.1.2
func (n *NamingClient) ChooseOneHealthyInstance(serviceName string) (*RegisteredInstance, error)
ChooseOneHealthyInstance 选择一个可用的实例
func (*NamingClient) GetAllInstances ¶ added in v0.1.2
func (n *NamingClient) GetAllInstances(serviceName string) ([]RegisteredInstance, error)
GetAllInstances 获取指定服务的所有实例(不论当前是否可用)
func (*NamingClient) GetHealthyInstances ¶ added in v0.1.2
func (n *NamingClient) GetHealthyInstances(serviceName string) ([]RegisteredInstance, error)
GetHealthyInstances 获取指定服务的可用实例
func (*NamingClient) GetService ¶ added in v0.1.2
func (n *NamingClient) GetService(serviceName string) (model.Service, error)
GetService 获取指定服务的概要信息
func (*NamingClient) GetServicePage ¶ added in v0.1.2
func (n *NamingClient) GetServicePage(pageNo, pageSize uint) (model.ServiceList, error)
GetServicePage 获取指定服务的注册信息
func (*NamingClient) Register ¶ added in v0.1.2
func (n *NamingClient) Register(instance Instance) (string, error)
Register 向注册中心注册临时实例 一个NamingClient只能注册一个实例,重复注册将出现替换
func (*NamingClient) RegisterBatch ¶ added in v0.1.2
func (n *NamingClient) RegisterBatch(serviceName string, instances []InstanceBatch) ([]string, error)
func (*NamingClient) Unregister ¶ added in v0.1.2
func (n *NamingClient) Unregister(instanceId string) (bool, error)
Unregister 向注册中心注销实例
func (*NamingClient) UnwatchNaming ¶ added in v0.1.2
func (n *NamingClient) UnwatchNaming(watchId string) error
UnwatchNaming 取消监控服务实例变化
func (*NamingClient) WatchNaming ¶ added in v0.1.2
func (n *NamingClient) WatchNaming(serviceName string, watch func(instance []model.Instance, err error)) (string, error)
WatchNaming 监控服务的实例变化
type RegisteredInstance ¶ added in v0.1.2
Click to show internal directories.
Click to hide internal directories.