Scalien.ConfigStateHelpers.GetShardServerURL C# (CSharp) Method

GetShardServerURL() public static method

public static GetShardServerURL ( ConfigState shardServer ) : string
shardServer ConfigState
return string
        public static string GetShardServerURL(ConfigState.ShardServer shardServer)
        {
            return "http://" + GetEndpointWithPort(shardServer.endpoint, shardServer.httpPort) + "/";
        }

Usage Example

Exemplo n.º 1
0
        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);
        }
All Usage Examples Of Scalien.ConfigStateHelpers::GetShardServerURL