From 976efe0c04e16559de8a457579ba9edab6302a32 Mon Sep 17 00:00:00 2001 From: boyce <6549168@qq.com> Date: Thu, 18 Dec 2025 13:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=9A=E8=BF=87=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=90=8D=E8=8E=B7=E5=8F=96=E6=9C=8D=E5=8A=A1=E5=92=8C?= =?UTF-8?q?node=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster/parsecfg.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cluster/parsecfg.go b/cluster/parsecfg.go index 1a776e0..7ce0be1 100644 --- a/cluster/parsecfg.go +++ b/cluster/parsecfg.go @@ -507,6 +507,30 @@ func (cls *Cluster) IsConfigService(serviceName string) bool { return ok } +// GetServiceInfoByTemplateService 通过模板服务名,获取map[服务名]map[NodeId]struct{} +func (cls *Cluster) GetServiceInfoByTemplateService(templateServiceName string) map[string]map[string]struct{} { + mapService := map[string]map[string]struct{}{} + cls.locker.RLock() + defer cls.locker.RUnlock() + + mapServiceName := cls.mapTemplateServiceNode[templateServiceName] + for serviceName := range mapServiceName { + mapNodeId, ok := cls.mapServiceNode[serviceName] + if ok == true { + for nodeId := range mapNodeId{ + mapNodeIds:=mapService[serviceName] + if mapNodeIds==nil { + mapNodeIds = map[string]struct{}{} + mapService[serviceName] = mapNodeIds + } + mapNodeIds[nodeId] = struct{}{} + } + } + } + + return mapService +} + func (cls *Cluster) GetNodeIdByTemplateService(templateServiceName string, rpcClientList []*rpc.Client, filterRetire bool) (error, []*rpc.Client) { cls.locker.RLock() defer cls.locker.RUnlock()