naming_client

package
v0.0.0-...-c202456 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNamingProxyDelegate

func NewNamingProxyDelegate(ctx context.Context, clientCfg constant.ClientConfig, serverCfgs []constant.ServerConfig,
	httpAgent http_agent.IHttpAgent, serviceInfoHolder *naming_cache.ServiceInfoHolder) (naming_proxy.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 vo.RegisterInstanceParam) (bool, error)

	// BatchRegisterInstance use to batch register instance
	// ClusterName  optional,default:DEFAULT
	// ServiceName require
	// GroupName optional,default:DEFAULT_GROUP
	// Instances require,batch register instance list (serviceName, groupName in instances do not need to be set)
	BatchRegisterInstance(param vo.BatchRegisterInstanceParam) (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 vo.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 vo.UpdateInstanceParam) (bool, error)

	// GetService use to get service
	// ServiceName require
	// Clusters optional,default:DEFAULT
	// GroupName optional,default:DEFAULT_GROUP
	GetService(param vo.GetServiceParam) (model.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 vo.SelectAllInstancesParam) ([]model.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 vo.SelectInstancesParam) ([]model.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 vo.SelectOneHealthInstanceParam) (*model.Instance, error)

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

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

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

	//CloseClient close the GRPC client
	CloseClient()
}

INamingClient interface for naming client

type NamingClient

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

NamingClient ...

func NewNamingClient

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

NewNamingClient ...

func (*NamingClient) BatchRegisterInstance

func (sc *NamingClient) BatchRegisterInstance(param vo.BatchRegisterInstanceParam) (bool, error)

func (*NamingClient) CloseClient

func (sc *NamingClient) CloseClient()

CloseClient ...

func (*NamingClient) DeregisterInstance

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

DeregisterInstance ...

func (*NamingClient) GetAllServicesInfo

func (sc *NamingClient) GetAllServicesInfo(param vo.GetAllServiceInfoParam) (model.ServiceList, error)

GetAllServicesInfo Get all instance by Namespace and Group with page

func (*NamingClient) GetService

func (sc *NamingClient) GetService(param vo.GetServiceParam) (service model.Service, err error)

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

func (*NamingClient) RegisterInstance

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

RegisterInstance ...

func (*NamingClient) SelectAllInstances

func (sc *NamingClient) SelectAllInstances(param vo.SelectAllInstancesParam) ([]model.Instance, error)

SelectAllInstances Get all instance by DataId 和 Group

func (*NamingClient) SelectInstances

func (sc *NamingClient) SelectInstances(param vo.SelectInstancesParam) ([]model.Instance, error)

SelectInstances Get all instance by DataId, Group and Health

func (*NamingClient) SelectOneHealthyInstance

func (sc *NamingClient) SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (*model.Instance, error)

SelectOneHealthyInstance Get one healthy instance by DataId and Group

func (*NamingClient) Subscribe

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

Subscribe ...

func (*NamingClient) Unsubscribe

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

Unsubscribe ...

func (*NamingClient) UpdateInstance

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

UpdateInstance ...

type NamingProxyDelegate

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

NamingProxyDelegate ...

func (*NamingProxyDelegate) BatchRegisterInstance

func (proxy *NamingProxyDelegate) BatchRegisterInstance(serviceName string, groupName string, instances []model.Instance) (bool, error)

func (*NamingProxyDelegate) CloseClient

func (proxy *NamingProxyDelegate) CloseClient()

func (*NamingProxyDelegate) DeregisterInstance

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

func (*NamingProxyDelegate) GetServiceList

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

func (*NamingProxyDelegate) QueryInstancesOfService

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

func (*NamingProxyDelegate) RegisterInstance

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

func (*NamingProxyDelegate) ServerHealthy

func (proxy *NamingProxyDelegate) ServerHealthy() bool

func (*NamingProxyDelegate) Subscribe

func (proxy *NamingProxyDelegate) Subscribe(serviceName, groupName string, clusters string) (model.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(ctx context.Context, serviceInfoHolder *naming_cache.ServiceInfoHolder, updateThreadNum int,
	namingProxy naming_proxy.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