naming_client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNamingProxyDelegate

func NewNamingProxyDelegate(clientCfg constant2.ClientConfig, serverCfgs []constant2.ServerConfig,
	httpAgent http_agent2.IHttpAgent, serviceInfoHolder *naming_cache2.ServiceInfoHolder) (naming_proxy2.INamingProxy, error)

Types

type Chooser

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

type INamingClient

type INamingClient interface {

	// RegisterInstance use to register instance
	// Ip  require
	// Port  require
	// Weight  require,it must be lager than 0
	// Enable  require,the instance can be access or not
	// Healthy  require,the instance is health or not
	// Metadata  optional
	// ClusterName  optional,default:DEFAULT
	// ServiceName require
	// GroupName optional,default:DEFAULT_GROUP
	// Ephemeral optional
	RegisterInstance(param vo2.RegisterInstanceParam) (bool, error)

	// DeregisterInstance use to deregister instance
	// Ip required
	// Port required
	// Tenant optional
	// Cluster optional,default:DEFAULT
	// ServiceName  require
	// GroupName  optional,default:DEFAULT_GROUP
	// Ephemeral optional
	DeregisterInstance(param vo2.DeregisterInstanceParam) (bool, error)

	// UpdateInstance use to update instance
	// Ip  require
	// Port  require
	// Weight  require,it must be lager than 0
	// Enable  require,the instance can be access or not
	// Healthy  require,the instance is health or not
	// Metadata  optional
	// ClusterName  optional,default:DEFAULT
	// ServiceName require
	// GroupName optional,default:DEFAULT_GROUP
	// Ephemeral optional
	UpdateInstance(param vo2.UpdateInstanceParam) (bool, error)

	// GetService use to get service
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	GetService(param vo2.GetServiceParam) (model2.Service, error)

	// SelectAllInstances return all instances,include healthy=false,enable=false,weight<=0
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	SelectAllInstances(param vo2.SelectAllInstancesParam) ([]model2.Instance, error)

	// SelectInstances only return the instances of healthy=${HealthyOnly},enable=true and weight>0
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	// HealthyOnly optional
	SelectInstances(param vo2.SelectInstancesParam) ([]model2.Instance, error)

	// SelectOneHealthyInstance return one instance by WRR strategy for load balance
	// And the instance should be health=true,enable=true and weight>0
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	SelectOneHealthyInstance(param vo2.SelectOneHealthInstanceParam) (*model2.Instance, error)

	// Subscribe use to subscribe service change event
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	// SubscribeCallback require
	Subscribe(param *vo2.SubscribeParam) error

	// Unsubscribe use to unsubscribe service change event
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	// SubscribeCallback require
	Unsubscribe(param *vo2.SubscribeParam) error

	// GetAllServicesInfo use to get all service info by page
	GetAllServicesInfo(param vo2.GetAllServiceInfoParam) (model2.ServiceList, error)

	//CloseClient close the GRPC client
	CloseClient()
}

INamingClient interface for naming client

type NamingClient

type NamingClient struct {
	nacos_client2.INacosClient
	// contains filtered or unexported fields
}

NamingClient ...

func NewNamingClient

func NewNamingClient(nc nacos_client2.INacosClient) (*NamingClient, error)

NewNamingClient ...

func (*NamingClient) CloseClient

func (sc *NamingClient) CloseClient()

CloseClient ...

func (*NamingClient) DeregisterInstance

func (sc *NamingClient) DeregisterInstance(param vo2.DeregisterInstanceParam) (bool, error)

DeregisterInstance ...

func (*NamingClient) GetAllServicesInfo

func (sc *NamingClient) GetAllServicesInfo(param vo2.GetAllServiceInfoParam) (model2.ServiceList, error)

GetAllServicesInfo Get all instance by Namespace and Group with page

func (*NamingClient) GetService

func (sc *NamingClient) GetService(param vo2.GetServiceParam) (service model2.Service, err error)

GetService Get service info by Group and DataId, clusters was optional

func (*NamingClient) RegisterInstance

func (sc *NamingClient) RegisterInstance(param vo2.RegisterInstanceParam) (bool, error)

RegisterInstance ...

func (*NamingClient) SelectAllInstances

func (sc *NamingClient) SelectAllInstances(param vo2.SelectAllInstancesParam) ([]model2.Instance, error)

SelectAllInstances Get all instance by DataId 和 Group

func (*NamingClient) SelectInstances

func (sc *NamingClient) SelectInstances(param vo2.SelectInstancesParam) ([]model2.Instance, error)

SelectInstances Get all instance by DataId, Group and Health

func (*NamingClient) SelectOneHealthyInstance

func (sc *NamingClient) SelectOneHealthyInstance(param vo2.SelectOneHealthInstanceParam) (*model2.Instance, error)

SelectOneHealthyInstance Get one healthy instance by DataId and Group

func (*NamingClient) Subscribe

func (sc *NamingClient) Subscribe(param *vo2.SubscribeParam) error

Subscribe ...

func (*NamingClient) Unsubscribe

func (sc *NamingClient) Unsubscribe(param *vo2.SubscribeParam) (err error)

Unsubscribe ...

func (*NamingClient) UpdateInstance

func (sc *NamingClient) UpdateInstance(param vo2.UpdateInstanceParam) (bool, error)

UpdateInstance ...

type NamingProxyDelegate

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

NamingProxyDelegate ...

func (*NamingProxyDelegate) CloseClient

func (proxy *NamingProxyDelegate) CloseClient()

func (*NamingProxyDelegate) DeregisterInstance

func (proxy *NamingProxyDelegate) DeregisterInstance(serviceName string, groupName string, instance model2.Instance) (bool, error)

func (*NamingProxyDelegate) GetServiceList

func (proxy *NamingProxyDelegate) GetServiceList(pageNo uint32, pageSize uint32, groupName string, selector *model2.ExpressionSelector) (model2.ServiceList, error)

func (*NamingProxyDelegate) QueryInstancesOfService

func (proxy *NamingProxyDelegate) QueryInstancesOfService(serviceName, groupName, clusters string, udpPort int, healthyOnly bool) (*model2.Service, error)

func (*NamingProxyDelegate) RegisterInstance

func (proxy *NamingProxyDelegate) RegisterInstance(serviceName string, groupName string, instance model2.Instance) (bool, error)

func (*NamingProxyDelegate) ServerHealthy

func (proxy *NamingProxyDelegate) ServerHealthy() bool

func (*NamingProxyDelegate) Subscribe

func (proxy *NamingProxyDelegate) Subscribe(serviceName, groupName string, clusters string) (model2.Service, error)

func (*NamingProxyDelegate) Unsubscribe

func (proxy *NamingProxyDelegate) Unsubscribe(serviceName, groupName, clusters string) error

type ServiceInfoUpdater

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

func NewServiceInfoUpdater

func NewServiceInfoUpdater(serviceInfoHolder *naming_cache2.ServiceInfoHolder, updateThreadNum int,
	namingProxy naming_proxy2.INamingProxy) *ServiceInfoUpdater

Directories

Path Synopsis
Package naming_proxy is a generated GoMock package.
Package naming_proxy is a generated GoMock package.

Jump to

Keyboard shortcuts

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