Ejemplo n.º 1
0
 public bool Equals(AvailableNodes rhs)
 {
     if (object.ReferenceEquals(rhs, null) || GetType() != rhs.GetType())
     {
         return(false);
     }
     return(object.ReferenceEquals(this, rhs) || nodes.SequenceEqual(rhs.nodes));
 }
Ejemplo n.º 2
0
        private static void UpdateWinhostsFile(string rsName)
        {
            var currentNodes = GetAvailableNodes(rsName);

            if (!currentNodes.Equals(availableNodes))
            {
                Trace.TraceInformation("Node information changed from {0} to {1}",
                                       (availableNodes == null) ? null : availableNodes.ToString(),
                                       currentNodes);
                availableNodes = currentNodes;
                WriteWinhostsFile();
            }
        }
Ejemplo n.º 3
0
        private static AvailableNodes GetAvailableNodes(string rsName)
        {
            var nodes = new AvailableNodes();

            foreach (var instance in RoleEnvironment.Roles[Constants.MongoDBWorkerRoleName].Instances)
            {
                nodes.Add(new NodeAlias()
                {
                    Alias     = ConnectionUtilities.GetNodeAlias(rsName, ConnectionUtilities.ParseNodeInstanceId(instance.Id)),
                    IpAddress = instance.InstanceEndpoints[Constants.MongodPortSetting].IPEndpoint.Address.ToString()
                });
            }
            return(nodes);
        }