nacos

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllServicesInfo

func GetAllServicesInfo(params GetAllServerInfoParams) (model.ServiceList, error)

GetAllServicesInfo 获取注册中信的服务

func GetConfig

func GetConfig(params GetConfigParams, config any) error

GetConfig 获取配置

func GetConfigClient

func GetConfigClient(config ConnectConfig) (config_client.IConfigClient, error)

GetConfigClient 配置连接配置

func GetInstance

func GetInstance(params GetInstanceParams) ([]model.Instance, error)

GetInstance 获取注册中信的服务实例

func GetNamingClient

func GetNamingClient(config ConnectConfig) (naming_client.INamingClient, error)

GetNamingClient 服务连接配置

func GetService

func GetService(params GetServerParams) (model.Service, error)

GetService 获取注册中信的服务

func ListenConfig

func ListenConfig(params ListenConfigParams) error

ListenConfig 监听配置文件变化

func RegisterServer

func RegisterServer(params RegisterServerParams) (bool, error)

RegisterServer 注册服务

func SubscribeServer

func SubscribeServer(params SubscribeServerParams) error

SubscribeServer 服务订阅

Types

type ConnectConfig

type ConnectConfig struct {
	Host        string `json:"host,omitempty"`
	Port        uint64 `json:"port,omitempty"`
	NamespaceId string `json:"namespace_id,omitempty"`
	LogDir      string `json:"log_dir,omitempty"`
	CacheDir    string `json:"cache_dir,omitempty"`
	LogLevel    string `json:"log_level,omitempty"`
	AppName     string `json:"app_name"`
}

type GetAllServerInfoParams

type GetAllServerInfoParams struct {
	Client    naming_client.INamingClient `json:"client,omitempty"`
	NameSpace string                      `json:"name_space,omitempty"` // required
	PageNo    uint32                      `param:"pageNo"`              // optional,default:1
	PageSize  uint32                      `param:"pageSize"`            // optional,default:10
	GroupName string                      `json:"group_name,omitempty"` // optional,default:DEFAULT_GROUP
}

type GetConfigParams

type GetConfigParams struct {
	Client config_client.IConfigClient `json:"client,omitempty"`
	DataId string                      `json:"data_id,omitempty"`
	Group  string                      `json:"group,omitempty"`
}

type GetInstanceParams

type GetInstanceParams struct {
	Client      naming_client.INamingClient `json:"client,omitempty"`
	ServiceName string                      `json:"service_name,omitempty"` // required
	Cluster     []string                    `json:"cluster_name,omitempty"` // optional,default:DEFAULT
	GroupName   string                      `json:"group_name,omitempty"`   // optional,default:DEFAULT_GROUP
}

type GetServerParams

type GetServerParams struct {
	Client      naming_client.INamingClient `json:"client,omitempty"`
	ServiceName string                      `json:"service_name,omitempty"` // required
	Cluster     []string                    `json:"cluster_name,omitempty"` // optional,default:DEFAULT
	GroupName   string                      `json:"group_name,omitempty"`   // optional,default:DEFAULT_GROUP
}

type ListenConfigParams

type ListenConfigParams struct {
	Client config_client.IConfigClient `json:"client,omitempty"`
	DataId string                      `json:"data_id,omitempty"`
	Group  string                      `json:"group,omitempty"`
	// AppName  string                      `json:"app_name,omitempty"`
	OnChange OnChange `json:"on_change,omitempty"`
}

type OnChange

type OnChange func(namespace, group, dataId, data string)

type RegisterServerParams

type RegisterServerParams struct {
	Client      naming_client.INamingClient `json:"client,omitempty"`
	Port        uint64                      `json:"port,omitempty"`         // required
	ServiceName string                      `json:"service_name,omitempty"` // required
	ClusterName string                      `json:"cluster_name,omitempty"` // optional,default:DEFAULT
	GroupName   string                      `json:"group_name,omitempty"`   // optional,default:DEFAULT_GROUP
	Metadata    map[string]string           `json:"metadata,omitempty"`     // optional
}

RegisterServerParams 服务注册参数

type SubscribeServerParams

type SubscribeServerParams struct {
	Client            naming_client.INamingClient                `json:"client,omitempty"`
	ServiceName       string                                     `param:"serviceName"` // required
	Clusters          []string                                   `param:"clusters"`    // optional,default:DEFAULT
	GroupName         string                                     `param:"groupName"`   // optional,default:DEFAULT_GROUP
	SubscribeCallback func(services []model.Instance, err error) // required
}

Jump to

Keyboard shortcuts

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