Documentation ¶
Index ¶
- Variables
- func GetNacosSdkConfig(config *NacosConfig) ([]constant.ServerConfig, *constant.ClientConfig, error)
- type ExternalConfig
- type Kafka
- type KeysPath
- type Log
- type Mongodb
- type NacosClient
- func (client *NacosClient) CancelListenConfig(dataId, group string) error
- func (client *NacosClient) DeleteConfig(dataId, group string) (bool, error)
- func (client *NacosClient) Deregister(svcIp string, svcPort uint64, svcName string) (bool, error)
- func (client *NacosClient) DeregisterInstance() (bool, error)
- func (client *NacosClient) GetConfig(dataId, group string) (string, error)
- func (client *NacosClient) ListenConfig(dataId, group string, changeCb func(namespace, group, dataId, data string)) error
- func (client *NacosClient) PublishConfig(dataId, group, content string) (bool, error)
- func (client *NacosClient) RegisterInstance(config *NacosRegisterConfig) (bool, error)
- func (client *NacosClient) SelectAllInstances(svcName, groupName string) ([]model.Instance, error)
- func (client *NacosClient) SelectInstances(svcName, groupName string) ([]model.Instance, error)
- func (client *NacosClient) SelectOneHealthyInstance(svcName, groupName string) (*model.Instance, error)
- func (client *NacosClient) Subscribe(svcName, groupName string, cb func(services []model.Instance, err error)) error
- func (client *NacosClient) Unsubscribe(svcName, groupName string, cb func(services []model.Instance, err error)) error
- func (client *NacosClient) UpdateMetaData(metadata map[string]string) (bool, error)
- type NacosConf
- type NacosConfig
- type NacosRegisterConfig
- type NacosServicName
- type Redis
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Config = ExternalConfig{}
)
Functions ¶
func GetNacosSdkConfig ¶
func GetNacosSdkConfig(config *NacosConfig) ([]constant.ServerConfig, *constant.ClientConfig, error)
Types ¶
type ExternalConfig ¶
type ExternalConfig struct { ListenOn string `yaml:"listenOn"` Redis *Redis `yaml:"redis"` Mongodb *Mongodb `yaml:"mongodb"` Kafka *Kafka `yaml:"kafka"` NacosConf *NacosConf `yaml:"nacosConf"` NacosServicName *NacosServicName `yaml:"nacosServicName"` KeysPath *KeysPath `yaml:"keysPath"` Log *Log `yaml:"log"` }
func InitConfig ¶
func InitConfig(data []byte) (*ExternalConfig, error)
type NacosClient ¶
type NacosClient struct {
// contains filtered or unexported fields
}
func InitNacos ¶
func InitNacos(config *NacosConfig) (*NacosClient, error)
func (*NacosClient) CancelListenConfig ¶
func (client *NacosClient) CancelListenConfig(dataId, group string) error
func (*NacosClient) DeleteConfig ¶
func (client *NacosClient) DeleteConfig(dataId, group string) (bool, error)
func (*NacosClient) Deregister ¶
func (*NacosClient) DeregisterInstance ¶
func (client *NacosClient) DeregisterInstance() (bool, error)
func (*NacosClient) GetConfig ¶
func (client *NacosClient) GetConfig(dataId, group string) (string, error)
func (*NacosClient) ListenConfig ¶
func (client *NacosClient) ListenConfig(dataId, group string, changeCb func(namespace, group, dataId, data string)) error
func (*NacosClient) PublishConfig ¶
func (client *NacosClient) PublishConfig(dataId, group, content string) (bool, error)
func (*NacosClient) RegisterInstance ¶
func (client *NacosClient) RegisterInstance(config *NacosRegisterConfig) (bool, error)
func (*NacosClient) SelectAllInstances ¶
func (client *NacosClient) SelectAllInstances(svcName, groupName string) ([]model.Instance, error)
func (*NacosClient) SelectInstances ¶
func (client *NacosClient) SelectInstances(svcName, groupName string) ([]model.Instance, error)
func (*NacosClient) SelectOneHealthyInstance ¶
func (client *NacosClient) SelectOneHealthyInstance(svcName, groupName string) (*model.Instance, error)
func (*NacosClient) Unsubscribe ¶
func (*NacosClient) UpdateMetaData ¶
func (client *NacosClient) UpdateMetaData(metadata map[string]string) (bool, error)
type NacosConfig ¶
type NacosConfig struct { Host string // 地址 例:"http://127.0.0.1:8848;127.0.0.1:8849;127.0.0.1:8850" NameSpaceId string // 命名空间 // 以下基本使用默认值,调用DefaultNacosConfig NotLoadCacheAtStart bool TimeoutMs uint64 // 超时时间 毫秒 CacheDir string // 缓存地址 LogDir string // 日志地址 LogLevel string // 日志等级 }
func DefaultNacosConfig ¶
func DefaultNacosConfig() *NacosConfig
type NacosRegisterConfig ¶
type NacosRegisterConfig struct { SvcIp string // 注册服务的ip SvcPort uint64 // 注册服务的端口 SvcName string // 注册服务名称 GroupName string // 服务组名 Metadata map[string]string // 数据 // 以下基本使用默认值,调用DefaultNacosRegisterConfig Healthy bool // 健康检查 Enable bool // 服务启用 Ephemeral bool }
func DefaultNacosRegisterConfig ¶
func DefaultNacosRegisterConfig() *NacosRegisterConfig
type NacosServicName ¶
Click to show internal directories.
Click to hide internal directories.