public override bool TryGetNodeDetail(out NodeDetail nodeDetail) { NodeDetail thisNode = new EndNodeDetail(); List <string> childernNaames = new List <string>(); ShardConfiguration shardConfig = (ShardConfiguration)Configuration; foreach (ServerNode node in shardConfig.Servers.Nodes.Values) { if (node.Name.Equals(PathChunks[0])) { childernNaames.Add(node.Priority.ToString()); string[] childPathChunks = new string[this.PathChunks.Length - 1]; Array.Copy(this.PathChunks, 1, childPathChunks, 0, this.PathChunks.Length - 1); ServerDetail s1 = new ServerDetail() { IPAddress = node.Name, Priority = node.Priority }; thisNode = new ServerValueDetail(PathChunks[0], PathType.Server, s1, childPathChunks); } } if (PathChunks.Length == 1) { nodeDetail = thisNode; return(true); } return(thisNode.TryGetNodeDetail(out nodeDetail)); }
public ServerValueDetail(string nodeName, PathType nodeType, ServerDetail configuration, string[] pathChunks) { NodeName = nodeName; NodeType = nodeType; IsContainer = true; IsValid = true; Configuration = configuration; PathChunks = pathChunks; ChilderanTable = new PrintableTable(); ChilderanTable.AddHeader("Priority"); ChilderanTable.AddRow(((ServerDetail)configuration).Priority.ToString()); }
public ConfigClusterInfo(ConfigServerConfiguration configuration) { if (configuration != null) { if (!string.IsNullOrWhiteSpace(configuration.Name)) { Name = configuration.Name; Port = configuration.Port; List <ServerDetail> serverList = new List <ServerDetail>(); foreach (ServerNode serv in configuration.Servers.Nodes.Values) { ServerDetail serverNodeInfo = new ServerDetail(); serverNodeInfo.IPAddress = serv.Name; serverNodeInfo.Priority = serv.Priority; serverList.Add(serverNodeInfo); } Servers = serverList.ToArray(); } } }