コード例 #1
0
        private static void HandleLink(CountersReplicationTopology topology, CountersReplicationTopologyNodeBase source, CountersReplicationTopologyNodeBase target)
        {
            topology.Servers.Add(source.ServerUrl);
            topology.Servers.Add(target.ServerUrl);

            CountersReplicationTopologyConnection connection = null;

            if (target is CountersReplicationTopologyDestinationNode)
            {
                var destinationNode = (CountersReplicationTopologyDestinationNode)target;
                // going to destination
                connection             = topology.GetConnection(source.ServerUrl, target.ServerUrl) ?? new CountersReplicationTopologyConnection();
                connection.Source      = source.ServerUrl;
                connection.Destination = target.ServerUrl;
                connection.SourceToDestinationState = destinationNode.State;
                connection.SendServerId             = destinationNode.SendServerId;
                connection.Errors = destinationNode.Errors;
            }
            else if (target is CountersReplicationTopologySourceNode)
            {
                // going to source
                var sourceNode = (CountersReplicationTopologySourceNode)target;
                connection             = topology.GetConnection(target.ServerUrl, source.ServerUrl) ?? new CountersReplicationTopologyConnection();
                connection.Source      = target.ServerUrl;
                connection.Destination = source.ServerUrl;
                connection.DestinationToSourceState = sourceNode.State;
                connection.StoredServerId           = sourceNode.StoredServerId;
                connection.LastEtag = sourceNode.LastEtag;
            }

            topology.Connections.Add(connection);
        }
コード例 #2
0
 private void FindVisitedNodes(CountersReplicationTopologyNodeBase rootNode, HashSet <string> visitedNodes)
 {
     visitedNodes.Add(rootNode.ServerUrl);
     foreach (var source in rootNode.Sources)
     {
         FindVisitedNodes(source, visitedNodes);
     }
     foreach (var destinationNode in rootNode.Destinations)
     {
         FindVisitedNodes(destinationNode, visitedNodes);
     }
 }