nacos

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config_CancelListenConfig

func Config_CancelListenConfig(params vo.ConfigParam) (err error)

func Config_DeleteConfig

func Config_DeleteConfig(param vo.ConfigParam) (bool, error)

func Config_GetConfig

func Config_GetConfig(param vo.ConfigParam) (string, error)

func Config_ListenConfig

func Config_ListenConfig(params vo.ConfigParam) (err error)

func Config_PublishAggr

func Config_PublishAggr(param vo.ConfigParam) (published bool, err error)

func Config_PublishConfig

func Config_PublishConfig(param vo.ConfigParam) (bool, error)

func Config_SearchConfig

func Config_SearchConfig(param vo.SearchConfigParam) (*model.ConfigPage, error)

func Naming_DeregisterInstance

func Naming_DeregisterInstance(service vo.DeregisterInstanceParam) (success bool, err error)

/注销服务

func Naming_GetAllServicesInfo

func Naming_GetAllServicesInfo(param vo.GetAllServiceInfoParam) (serviceInfos model.ServiceList, err error)

func Naming_GetService

func Naming_GetService(param vo.GetServiceParam) (services model.Service, err error)

/获取服务

func Naming_RegisterInstance

func Naming_RegisterInstance(service vo.RegisterInstanceParam) (success bool, err error)

/注册服务

func Naming_SelectAllInstances

func Naming_SelectAllInstances(param vo.SelectAllInstancesParam) (instances []model.Instance, err error)

/获取全部服务实例

func Naming_SelectInstances

func Naming_SelectInstances(param vo.SelectInstancesParam) (instances []model.Instance, err error)

func Naming_SelectOneHealthyInstance

func Naming_SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (instance *model.Instance, err error)

func Naming_Subscribe

func Naming_Subscribe(param *vo.SubscribeParam) (err error)

func Naming_Unsubscribe

func Naming_Unsubscribe(param *vo.SubscribeParam) (err error)

func OnInit

func OnInit(config map[string]interface{}, option ...Option) (err error)

Types

type ISys

type ISys interface {
	Naming_RegisterInstance(service vo.RegisterInstanceParam) (success bool, err error)
	Naming_DeregisterInstance(service vo.DeregisterInstanceParam) (success bool, err error)
	Naming_GetService(param vo.GetServiceParam) (services model.Service, err error)
	Naming_SelectAllInstances(param vo.SelectAllInstancesParam) (instances []model.Instance, err error)
	Naming_SelectInstances(param vo.SelectInstancesParam) (instances []model.Instance, err error)
	Naming_SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (instance *model.Instance, err error)
	Naming_Subscribe(param *vo.SubscribeParam) (err error)
	Naming_Unsubscribe(param *vo.SubscribeParam) (err error)
	Naming_GetAllServicesInfo(param vo.GetAllServiceInfoParam) (serviceInfos model.ServiceList, err error)
	Config_GetConfig(param vo.ConfigParam) (string, error)
	Config_PublishConfig(param vo.ConfigParam) (bool, error)
	Config_DeleteConfig(param vo.ConfigParam) (bool, error)
	Config_ListenConfig(params vo.ConfigParam) (err error)
	Config_CancelListenConfig(params vo.ConfigParam) (err error)
	Config_SearchConfig(param vo.SearchConfigParam) (*model.ConfigPage, error)
	Config_PublishAggr(param vo.ConfigParam) (published bool, err error)
}

func NewSys

func NewSys(option ...Option) (sys ISys, err error)

type Nacos

type Nacos struct {
	// contains filtered or unexported fields
}

func (*Nacos) Config_CancelListenConfig

func (this *Nacos) Config_CancelListenConfig(params vo.ConfigParam) (err error)

func (*Nacos) Config_DeleteConfig

func (this *Nacos) Config_DeleteConfig(param vo.ConfigParam) (bool, error)

func (*Nacos) Config_GetConfig

func (this *Nacos) Config_GetConfig(param vo.ConfigParam) (string, error)

func (*Nacos) Config_ListenConfig

func (this *Nacos) Config_ListenConfig(params vo.ConfigParam) (err error)

func (*Nacos) Config_PublishAggr

func (this *Nacos) Config_PublishAggr(param vo.ConfigParam) (published bool, err error)

func (*Nacos) Config_PublishConfig

func (this *Nacos) Config_PublishConfig(param vo.ConfigParam) (bool, error)

func (*Nacos) Config_SearchConfig

func (this *Nacos) Config_SearchConfig(param vo.SearchConfigParam) (*model.ConfigPage, error)

func (*Nacos) Naming_DeregisterInstance

func (this *Nacos) Naming_DeregisterInstance(service vo.DeregisterInstanceParam) (success bool, err error)

/注销服务

func (*Nacos) Naming_GetAllServicesInfo

func (this *Nacos) Naming_GetAllServicesInfo(param vo.GetAllServiceInfoParam) (serviceInfos model.ServiceList, err error)

func (*Nacos) Naming_GetService

func (this *Nacos) Naming_GetService(param vo.GetServiceParam) (services model.Service, err error)

/获取服务

func (*Nacos) Naming_RegisterInstance

func (this *Nacos) Naming_RegisterInstance(service vo.RegisterInstanceParam) (success bool, err error)

/注册服务

func (*Nacos) Naming_SelectAllInstances

func (this *Nacos) Naming_SelectAllInstances(param vo.SelectAllInstancesParam) (instances []model.Instance, err error)

/ SelectAllInstance可以返回全部实例列表,包括healthy=false,enable=false,weight<=0

func (*Nacos) Naming_SelectInstances

func (this *Nacos) Naming_SelectInstances(param vo.SelectInstancesParam) (instances []model.Instance, err error)

/选中实例列表

func (*Nacos) Naming_SelectOneHealthyInstance

func (this *Nacos) Naming_SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (instance *model.Instance, err error)

/ SelectOneHealthyInstance将会按加权随机轮询的负载均衡策略返回一个健康的实例 实例必须满足的条件:health=true,enable=true and weight>0

func (*Nacos) Naming_Subscribe

func (this *Nacos) Naming_Subscribe(param *vo.SubscribeParam) (err error)

/ Subscribe key=serviceName+groupName+cluster 注意:我们可以在相同的key添加多个SubscribeCallback.

func (*Nacos) Naming_Unsubscribe

func (this *Nacos) Naming_Unsubscribe(param *vo.SubscribeParam) (err error)

type NacosClientType

type NacosClientType uint8
const (
	NamingClient NacosClientType = iota
	ConfigClient
	All
)

type Option

type Option func(*Options)

func SetNacosAddr

func SetNacosAddr(v string) Option

func SetNacosClientType

func SetNacosClientType(v NacosClientType) Option

func SetNamespaceId

func SetNamespaceId(v string) Option

func SetPort

func SetPort(v uint64) Option

func SetTimeoutMs

func SetTimeoutMs(v uint64) Option

type Options

type Options struct {
	NacosClientType NacosClientType
	NamespaceId     string
	NacosAddr       string
	Port            uint64
	TimeoutMs       uint64
}

Jump to

Keyboard shortcuts

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