public static bool RandomShardServerHTTPAction(Client client, Quorum quorum, string action)
{
var configState = Utils.GetFullConfigState(client);
var shardServers = configState.shardServers;
var configQuorum = configState.quorums.First(cq => cq.quorumID == (long)quorum.QuorumID);
var random = new Random();
// select shard server
var victimNodeID = configQuorum.activeNodes[random.Next(configQuorum.activeNodes.Count)];
foreach (var shardServer in shardServers)
{
if (shardServer.nodeID == victimNodeID)
{
var httpURI = ConfigStateHelpers.GetShardServerURL(shardServer);
var response = Utils.HTTP.GET(Utils.HTTP.BuildUri(httpURI, action));
if (response == null)
return false;
return true;
}
}
return false;
}