예제 #1
0
        public static List <ConfigState.Shard> GetTableShards(ConfigState.Table table, List <ConfigState.Shard> allShards)
        {
            var shards = new List <ConfigState.Shard>();

            foreach (var shard in allShards)
            {
                if (shard.tableID == table.tableID)
                {
                    shards.Add(shard);
                }
            }

            return(shards);
        }
예제 #2
0
        public static List <ConfigState.ShardServer> GetShardServersByTable(ConfigState.Table table, ConfigState configState)
        {
            var shardServers = new List <ConfigState.ShardServer>();

            foreach (var quorum in configState.quorums)
            {
                if (quorum.shards.Intersect(table.shards).Sum() > 0)
                {
                    var quorumServers = GetQuorumActiveShardServers(configState, quorum);
                    foreach (var quorumServer in quorumServers)
                    {
                        if (!shardServers.Contains(quorumServer))
                        {
                            shardServers.Add(quorumServer);
                        }
                    }
                }
            }

            return(shardServers);
        }