Example #1
0
 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());
 }
Example #2
0
        public ShardValueDetail(string nodeName, ShardConfiguration configuration, string[] pathChunks)
        {
            NodeName       = nodeName;
            NodeType       = PathType.Shard;
            IsContainer    = true;
            IsValid        = true;
            Configuration  = configuration;
            PathChunks     = pathChunks;
            ChilderanTable = new PrintableTable();
            ChilderanName  = new List <string>();
            ClusterInfo       clusterInfo = ConfigurationConnection.ClusterInfo;
            ShardInfo         shardInfo   = clusterInfo.GetShard(nodeName);
            List <ServerInfo> running     = new List <ServerInfo>();

            if (shardInfo != null)
            {
                if (shardInfo.RunningNodes != null)
                {
                    running = shardInfo.RunningNodes.Values.ToList();
                }
            }
            ChilderanTable.AddHeader("Node IP Address", "Running Status", "Primary Status", "Priority");

            foreach (ServerNode node in configuration.Servers.Nodes.Values)
            {
                ServerInfo serverInfo = null;
                string     isPrimery  = ProviderUtil.NOT_PRIMARY;
                string     isRunning  = ProviderUtil.NOT_RUNNING;
                if (running != null)
                {
                    serverInfo = running.Find(x => x.Address.ip.Equals(node.Name));
                }

                if (serverInfo != null)
                {
                    if (running.Contains(serverInfo))
                    {
                        isRunning = ProviderUtil.RUNNING;
                    }
                    if (shardInfo.Primary != null && serverInfo.Equals(shardInfo.Primary))
                    {
                        isPrimery = ProviderUtil.PRIMARY;
                    }
                }
                ChilderanTable.AddRow(node.Name, isRunning, isPrimery, node.Priority.ToString());
                ChilderanName.Add(node.Name);
            }
        }
Example #3
0
 internal DatabasesDetail(string nodeName, DatabaseConfigurations configuration, string[] pathChunks)
 {
     NodeName       = nodeName;
     NodeType       = PathType.Databases;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Database name", "Provider");
     ChilderanName = new List <string>();
     foreach (var db in configuration.Configurations.Values)
     {
         ChilderanName.Add(db.Name);
         ChilderanTable.AddRow(db.Name, db.Storage.StorageProvider.StorageProviderType.ToString());
     }
 }
Example #4
0
        public ShardsDetail(string nodeName, DeploymentConfiguration configuration, string[] pathChunks)
        {
            NodeName       = nodeName;
            NodeType       = PathType.Shards;
            IsContainer    = true;
            IsValid        = true;
            Configuration  = configuration;
            ChilderanTable = new PrintableTable();
            PathChunks     = pathChunks;
            ChilderanName  = new List <string>();
            ChilderanTable.AddHeader("Shard Name", "Node(s)", "Status", "Shard Port");
            ClusterInfo clusterInfo = ConfigurationConnection.ClusterInfo;

            foreach (ShardConfiguration shard in configuration.Shards.Values)
            {
                List <string> status    = new List <string>();
                ShardInfo     shardInfo = clusterInfo.GetShard(shard.Name);
                if (shardInfo != null)
                {
                    foreach (String node in shard.Servers.Nodes.Keys)
                    {
                        string statusString = "";
                        if (shardInfo.RunningNodes.Values.ToList().Exists(k => k.Address.IpAddress.ToString().Equals(node)))
                        {
                            statusString = ProviderUtil.STARTED;

                            if (shardInfo.Primary != null)
                            {
                                if (shardInfo.Primary.Address.IpAddress.ToString().Equals(node))
                                {
                                    statusString += ProviderUtil.PRIMARY_STATUS;
                                }
                            }
                        }
                        else
                        {
                            statusString = ProviderUtil.STOPPED;
                        }
                        status.Add(statusString);
                    }
                }

                ChilderanTable.AddMultiLineRow(new string[] { shard.Name }, shard.Servers.Nodes.Keys.ToArray(), status.ToArray(), new string[] { shard.Port.ToString() });
                ChilderanName.Add(shard.Name);
            }
        }
Example #5
0
 internal CollectionsDetail(string databaseName, string nodeName, CollectionConfigurations configuration, string[] pathChunks)
 {
     _databaseName  = databaseName;
     NodeName       = nodeName;
     NodeType       = PathType.Collections;
     IsContainer    = true;
     IsValid        = true;
     ChilderanTable = new PrintableTable();
     Configuration  = configuration;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Name", "Type", "Detail");
     ChilderanName = new List <string>();
     foreach (CollectionConfiguration cConfig in configuration.Configuration.Values)
     {
         ChilderanTable.AddRow(cConfig.CollectionName, "Non Sharded", cConfig.Shard);
     }
     PathChunks = pathChunks;
 }
Example #6
0
 internal NoSDbDetail(string[] pathChunks, PSDriveInfo drive)
 {
     if (ConfigurationConnection.ClusterConfiguration != null)
     {
         PathChunks = pathChunks;
         Drive      = (NosDBPSDriveInfo)drive;
         ClusterConfiguration configuration = ConfigurationConnection.ClusterConfiguration;
         new ConfigClusterInfo(ConfigurationConnection.ConfigCluster);
         Configuration  = configuration;
         IsContainer    = true;
         IsValid        = true;
         NodeType       = PathType.NoSDB;
         ChilderanName  = new List <string>();
         ChilderanTable = new PrintableTable();
         ChilderanTable.AddHeader("Database Cluster");
         ChilderanTable.AddRow(ConfigurationConnection.ClusterConfiguration.DisplayName);
         ChilderanName.Add(ConfigurationConnection.ClusterConfiguration.DisplayName);
     }
 }
Example #7
0
 internal IndexValueDetail(string nodeName,
                           IndexConfiguration configuration, string[] pathChunks, string databaseName)
 {
     _databaseName  = databaseName;
     NodeName       = nodeName;
     NodeType       = PathType.Index;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanName  = new List <string>();
     ChilderanTable.AddHeader("Attribute Name", "Order");
     if (configuration.Attributes != null)
     {
         ChilderanTable.AddRow(configuration.Attributes.Name, configuration.Attributes.Order);
         ChilderanName.Add(configuration.Attributes.Name);
     }
 }
Example #8
0
 internal IndicesValueDetail(string nodeName,
                             Indices configuration, string[] pathChunks, string databaseName)
 {
     NodeName       = nodeName;
     NodeType       = PathType.Indexes;
     IsContainer    = true;
     IsValid        = true;
     Configuration  = configuration;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Indices");
     ChilderanName = new List <string>();
     if (configuration.IndexConfigurations != null)
     {
         foreach (IndexConfiguration index in configuration.IndexConfigurations.Values)
         {
             ChilderanName.Add(index.IndexName);
             ChilderanTable.AddRow(index.IndexName);
         }
     }
 }
Example #9
0
 public ConfigurationNodesDetail(string nodeName, bool isContainer, bool isValid,
                                 ConfigClusterInfo configCluster, string[] pathChunks)
 {
     NodeName       = nodeName;
     NodeType       = PathType.ConfigurationNodes;
     IsContainer    = isContainer;
     IsValid        = isValid;
     Configuration  = configCluster;
     PathChunks     = pathChunks;
     ChilderanTable = new PrintableTable();
     ChilderanTable.AddHeader("Node IP Address", "Status");
     ChilderanName = new List <string>();
     foreach (ServerDetail server in ((ConfigClusterInfo)this.Configuration).Servers)
     {
         ChilderanName.Add(server.IPAddress);
         string statusString = ConfigurationConnection.Current.ConfigServerIP.Equals(server.IPAddress)
             ? ProviderUtil.ACTIVE
             : "";
         ChilderanTable.AddRow(server.IPAddress, statusString);
     }
 }