示例#1
0
        internal static RoutingTableManager NewRoutingTableManager(
            IRoutingTable routingTable,
            IClusterConnectionPoolManager poolManager, IInitialServerAddressProvider addressProvider = null)
        {
            if (addressProvider == null)
            {
                addressProvider = new InitialServerAddressProvider(InitialUri, new PassThroughServerAddressResolver());
            }

            return(new RoutingTableManager(addressProvider, new Dictionary <string, string>(), routingTable, poolManager,
                                           null));
        }
示例#2
0
 public RoutingTableManager(
     IInitialServerAddressProvider initialServerAddressProvider,
     IDictionary <string, string> routingContext,
     IRoutingTable routingTable,
     IClusterConnectionPoolManager poolManager,
     IDriverLogger logger)
 {
     _initialServerAddressProvider = initialServerAddressProvider;
     _routingContext = routingContext;
     _routingTable   = routingTable;
     _poolManager    = poolManager;
     _logger         = logger;
 }
示例#3
0
 public RoutingTableManager(
     IInitialServerAddressProvider initialServerAddressProvider,
     IDiscovery discovery,
     IRoutingTable routingTable,
     IClusterConnectionPoolManager poolManager,
     IDriverLogger logger)
 {
     _initialServerAddressProvider = initialServerAddressProvider;
     _discovery    = discovery;
     _routingTable = routingTable;
     _poolManager  = poolManager;
     _logger       = logger;
 }
示例#4
0
        public LoadBalancer(
            IPooledConnectionFactory connectionFactory,
            RoutingSettings routingSettings,
            ConnectionPoolSettings poolSettings,
            ILogger logger)
        {
            _logger = logger;

            _clusterConnectionPool =
                new ClusterConnectionPool(Enumerable.Empty <Uri>(), connectionFactory, poolSettings, logger);
            _routingTableManager          = new RoutingTableManager(routingSettings, this, logger);
            _loadBalancingStrategy        = CreateLoadBalancingStrategy(_clusterConnectionPool, _logger);
            _initialServerAddressProvider = routingSettings.InitialServerAddressProvider;
        }
示例#5
0
        internal static RoutingTableManager NewRoutingTableManager(
            IRoutingTable routingTable,
            IClusterConnectionPoolManager poolManager, IDiscovery discovery = null,
            IInitialServerAddressProvider addressProvider = null,
            IDriverLogger logger = null)
        {
            if (addressProvider == null)
            {
                addressProvider = new InitialServerAddressProvider(InitialUri, new PassThroughServerAddressResolver());
            }

            if (discovery == null)
            {
                discovery = Mock.Of <IDiscovery>();
            }

            return(new RoutingTableManager(addressProvider, discovery, routingTable, poolManager, logger));
        }
        public RoutingTableManager(
            IInitialServerAddressProvider initialServerAddressProvider,
            IDiscovery discovery,
            IClusterConnectionPoolManager poolManager,
            ILogger logger,
            TimeSpan routingTablePurgeDelay,
            params IRoutingTable[] routingTables)
        {
            _initialServerAddressProvider = initialServerAddressProvider;
            _discovery              = discovery;
            _poolManager            = poolManager;
            _logger                 = logger;
            _routingTablePurgeDelay = routingTablePurgeDelay;

            foreach (var routingTable in routingTables)
            {
                _routingTables.TryAdd(routingTable.Database, routingTable);
            }
        }