Ejemplo n.º 1
0
        public HostInfo GetHostInfo(uint hostId)
        {
            var hostInfo = new HostInfo();
            //该host包含的所有service的id
            //该host所有service的address
            //该host所有service的名称
            var aName = GetName(hostId);

            this.mHNAME2ANAME.TryGetValue(aName, out var aList);
            List <string> svcNameList = new List <string>();

            if (aList != null)
            {
                svcNameList = aList.Distinct().Where(m => m.EndsWith("Service")).ToList();
            }

            hostInfo.HostId          = hostId;
            hostInfo.HostName        = Global.IdManager.GetHostName(hostId);
            hostInfo.HostAddr        = Global.IdManager.GetHostAddr(hostId);//, false);
            hostInfo.ServiceId2Name  = svcNameList.ToDictionary(m => GetId(m), m => m);
            hostInfo.ServiceId2TName = svcNameList.ToDictionary(m => GetId(m), m => m);

            return(hostInfo);
        }
Ejemplo n.º 2
0
        public HostInfo GetHostInfo(uint hostId)
        {
            var hostInfo = new HostInfo();

            //该host包含的所有service的id
            //该host所有service的address
            //该host所有service的名称

            this.mHID2AID.TryGetValue(hostId, out var actorList);
            List <uint> serviceIdList = new List <uint>();

            if (actorList != null)
            {
                serviceIdList = actorList.Distinct().Where(m => this.GetActorName(m).EndsWith("Service")).ToList();
            }

            hostInfo.HostId          = hostId;
            hostInfo.HostName        = Global.IdManager.GetHostName(hostId);
            hostInfo.HostAddr        = Global.IdManager.GetHostAddr(hostId);//, false);
            hostInfo.ServiceId2Name  = serviceIdList.ToDictionary(m => m, m => this.GetActorName(m));
            hostInfo.ServiceId2TName = serviceIdList.ToDictionary(m => m, m => this.GetActorTypename(m));

            return(hostInfo);
        }
Ejemplo n.º 3
0
        public void OnAddHostId(HostInfo hostInfo, Action <bool> callback, RpcContext ctx)
        {
            var result = Global.IdManager.RegisterHostInfo(hostInfo);

            callback(result);
        }