/// <summary>
 ///  Creates a new <c>Policies</c> object using the provided policies.
 /// </summary>
 /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param>
 /// <param name="reconnectionPolicy"> the reconnection policy to use. </param>
 /// <param name="retryPolicy"> the retry policy to use.</param>
 public Policies(ILoadBalancingPolicy loadBalancingPolicy,
                 IReconnectionPolicy reconnectionPolicy,
                 IRetryPolicy retryPolicy)
     : this(loadBalancingPolicy, reconnectionPolicy, retryPolicy, NoSpeculativeExecutionPolicy.Instance)
 {
     //Part of the public API can not be removed
 }
示例#2
0
 /// <summary>
 ///  Creates a new <code>Policies</code> object using the provided policies.
 /// </summary>
 /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param>
 /// <param name="reconnectionPolicy"> the reconnection policy to use. </param>
 /// <param name="retryPolicy"> the retry policy to use.</param>
 public Policies(ILoadBalancingPolicy loadBalancingPolicy,
                 IReconnectionPolicy reconnectionPolicy,
                 IRetryPolicy retryPolicy)
 {
     this._loadBalancingPolicy = loadBalancingPolicy;
     this._reconnectionPolicy = reconnectionPolicy;
     this._retryPolicy = retryPolicy;
 }
示例#3
0
 /// <summary>
 ///  Creates a new <c>Policies</c> object using the provided policies.
 /// </summary>
 /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param>
 /// <param name="reconnectionPolicy"> the reconnection policy to use. </param>
 /// <param name="retryPolicy"> the retry policy to use.</param>
 public Policies(ILoadBalancingPolicy loadBalancingPolicy,
                 IReconnectionPolicy reconnectionPolicy,
                 IRetryPolicy retryPolicy)
 {
     _loadBalancingPolicy = loadBalancingPolicy;
     _reconnectionPolicy  = reconnectionPolicy;
     _retryPolicy         = retryPolicy;
 }
 /// <summary>
 /// Creates a new <c>Policies</c> object using the provided policies.
 /// </summary>
 /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param>
 /// <param name="reconnectionPolicy"> the reconnection policy to use. </param>
 /// <param name="retryPolicy"> the retry policy to use.</param>
 public Policies(ILoadBalancingPolicy loadBalancingPolicy,
                 IReconnectionPolicy reconnectionPolicy,
                 IRetryPolicy retryPolicy)
     : this(loadBalancingPolicy, reconnectionPolicy, retryPolicy, DefaultSpeculativeExecutionPolicy,
            DefaultTimestampGenerator)
 {
     //Part of the public API can not be removed
 }
 internal ControlConnection(byte initialProtocolVersion, Configuration config, Metadata metadata)
 {
     _metadata = metadata;
     _reconnectionPolicy = config.Policies.ReconnectionPolicy;
     _reconnectionSchedule = _reconnectionPolicy.NewSchedule();
     _reconnectionTimer = new Timer(_ => Reconnect(), null, Timeout.Infinite, Timeout.Infinite);
     _config = config;
     ProtocolVersion = initialProtocolVersion;
 }
示例#6
0
 internal ControlConnection(ProtocolVersion initialProtocolVersion, Configuration config, Metadata metadata)
 {
     _metadata             = metadata;
     _reconnectionPolicy   = config.Policies.ReconnectionPolicy;
     _reconnectionSchedule = _reconnectionPolicy.NewSchedule();
     _reconnectionTimer    = new Timer(_ => Reconnect(), null, Timeout.Infinite, Timeout.Infinite);
     _config     = config;
     _serializer = new Serializer(initialProtocolVersion, config.TypeSerializers);
 }
示例#7
0
 internal ControlConnection(byte initialProtocolVersion, Configuration config, Metadata metadata)
 {
     Metadata              = metadata;
     _reconnectionPolicy   = config.Policies.ReconnectionPolicy;
     _reconnectionSchedule = _reconnectionPolicy.NewSchedule();
     _reconnectionTimer    = new Timer(_ => Reconnect(), null, Timeout.Infinite, Timeout.Infinite);
     _config         = config;
     ProtocolVersion = initialProtocolVersion;
 }
 internal Policies(ILoadBalancingPolicy loadBalancingPolicy,
                   IReconnectionPolicy reconnectionPolicy,
                   IRetryPolicy retryPolicy,
                   ISpeculativeExecutionPolicy speculativeExecutionPolicy)
 {
     _loadBalancingPolicy        = loadBalancingPolicy;
     _reconnectionPolicy         = reconnectionPolicy;
     _retryPolicy                = retryPolicy;
     _speculativeExecutionPolicy = speculativeExecutionPolicy;
 }
 internal Policies(ILoadBalancingPolicy loadBalancingPolicy,
                   IReconnectionPolicy reconnectionPolicy,
                   IRetryPolicy retryPolicy,
                   ISpeculativeExecutionPolicy speculativeExecutionPolicy,
                   ITimestampGenerator timestampGenerator)
 {
     _loadBalancingPolicy        = loadBalancingPolicy ?? DefaultLoadBalancingPolicy;
     _reconnectionPolicy         = reconnectionPolicy ?? DefaultReconnectionPolicy;
     _retryPolicy                = retryPolicy ?? DefaultRetryPolicy;
     _speculativeExecutionPolicy = speculativeExecutionPolicy ?? DefaultSpeculativeExecutionPolicy;
     _timestampGenerator         = timestampGenerator ?? DefaultTimestampGenerator;
 }
示例#10
0
 private Policies(
     ILoadBalancingPolicy loadBalancingPolicy,
     IReconnectionPolicy reconnectionPolicy,
     IRetryPolicy retryPolicy,
     ISpeculativeExecutionPolicy speculativeExecutionPolicy,
     ITimestampGenerator timestampGenerator,
     IExtendedRetryPolicy extendedRetryPolicy)
 {
     _loadBalancingPolicy        = loadBalancingPolicy ?? throw new ArgumentNullException(nameof(loadBalancingPolicy));
     _reconnectionPolicy         = reconnectionPolicy ?? throw new ArgumentNullException(nameof(reconnectionPolicy));
     _retryPolicy                = retryPolicy ?? throw new ArgumentNullException(nameof(retryPolicy));
     _speculativeExecutionPolicy = speculativeExecutionPolicy ?? throw new ArgumentNullException(nameof(speculativeExecutionPolicy));
     _timestampGenerator         = timestampGenerator ?? throw new ArgumentNullException(nameof(timestampGenerator));
     _extendedRetryPolicy        = extendedRetryPolicy ?? throw new ArgumentNullException(nameof(extendedRetryPolicy));
 }
示例#11
0
 public void AddIfNotExistsOrBringUpIfDown(IPAddress ep, IReconnectionPolicy rp)
 {
     lock (_hosts)
     {
         if (!_hosts.ContainsKey(ep))
             _hosts.Add(ep, new Host(ep, rp));
         else
             _hosts[ep].BringUpIfDown();
     }
 }
示例#12
0
 public RetryLoadBalancingPolicy(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy)
 {
     _reconnectionPolicy  = reconnectionPolicy;
     _loadBalancingPolicy = loadBalancingPolicy;
 }
示例#13
0
 internal Policies(ILoadBalancingPolicy loadBalancingPolicy,
     IReconnectionPolicy reconnectionPolicy,
     IRetryPolicy retryPolicy,
     ISpeculativeExecutionPolicy speculativeExecutionPolicy)
 {
     _loadBalancingPolicy = loadBalancingPolicy;
     _reconnectionPolicy = reconnectionPolicy;
     _retryPolicy = retryPolicy;
     _speculativeExecutionPolicy = speculativeExecutionPolicy;
 }
示例#14
0
 internal Metadata(IReconnectionPolicy rp)
 {
     this._hosts = new Hosts(rp);
 }
示例#15
0
 /// <summary>
 ///  Creates a new <c>Policies</c> object using the provided policies.
 /// </summary>
 /// <param name="loadBalancingPolicy"> the load balancing policy to use. </param>
 /// <param name="reconnectionPolicy"> the reconnection policy to use. </param>
 /// <param name="retryPolicy"> the retry policy to use.</param>
 public Policies(ILoadBalancingPolicy loadBalancingPolicy,
                 IReconnectionPolicy reconnectionPolicy,
                 IRetryPolicy retryPolicy)
     : this(loadBalancingPolicy, reconnectionPolicy, retryPolicy, NoSpeculativeExecutionPolicy.Instance)
 {
     //Part of the public API can not be removed
 }
示例#16
0
 public Host AddHost(IPAddress address, IReconnectionPolicy rp)
 {
     _hosts.AddIfNotExistsOrBringUpIfDown(address, rp);
      return _hosts[address];
 }
示例#17
0
 public Host(IPAddress address, IReconnectionPolicy reconnectionPolicy)
 {
     _address              = address;
     _reconnectionPolicy   = reconnectionPolicy;
     _reconnectionSchedule = reconnectionPolicy.NewSchedule();
 }
        private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null)
        {
            var pooling = new PoolingOptions()
                          .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections)
                          .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500)
                          .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections);
            var policies = new Policies(null, rp, null, null, null);
            var config   = new Configuration(
                policies,
                new ProtocolOptions(),
                pooling,
                new SocketOptions(),
                new ClientOptions(),
                NoneAuthProvider.Instance,
                null,
                new QueryOptions(),
                new DefaultAddressTranslator());

            return(config);
        }
示例#19
0
 public Host(IPAddress address, IReconnectionPolicy reconnectionPolicy)
 {
     this._address = address;
     this._reconnectionPolicy = reconnectionPolicy;
     this._reconnectionSchedule = reconnectionPolicy.NewSchedule();
 }
示例#20
0
        private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null)
        {
            var pooling = new PoolingOptions()
                          .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections)
                          .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500)
                          .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections);
            var policies = new Policies(
                Policies.DefaultLoadBalancingPolicy,
                rp ?? Policies.DefaultReconnectionPolicy,
                Policies.DefaultRetryPolicy,
                Policies.DefaultSpeculativeExecutionPolicy);
            var config = new Configuration(
                policies,
                new ProtocolOptions(),
                pooling,
                new SocketOptions(),
                new ClientOptions(),
                NoneAuthProvider.Instance,
                null,
                new QueryOptions(),
                new DefaultAddressTranslator());

            config.BufferPool = new Microsoft.IO.RecyclableMemoryStreamManager();
            config.Timer      = Timer;
            return(config);
        }
示例#21
0
 internal Metadata(IReconnectionPolicy rp)
 {
     Hosts       = new Hosts(rp);
     Hosts.Down += OnHostDown;
 }
示例#22
0
 internal Metadata(IReconnectionPolicy rp)
 {
     this._hosts = new Hosts(rp);
 }
示例#23
0
 public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy)
 {
     Address = address;
     _reconnectionPolicy = reconnectionPolicy;
     _reconnectionSchedule = reconnectionPolicy.NewSchedule();
 }
 public RoundRobinPolicyWithReconnectionRetries(IReconnectionPolicy reconnectionPolicy)
 {
     this._reconnectionPolicy = reconnectionPolicy;
 }
示例#25
0
 /// <summary>
 ///  Configure the reconnection policy to use for the new cluster. <p> If no
 ///  reconnection policy is set through this method,
 ///  <link>Policies.DefaultReconnectionPolicy</link> will be used instead.</p>
 /// </summary>
 /// <param name="policy"> the reconnection policy to use </param>
 /// <returns>this Builder</returns>
 public new DseClusterBuilder WithReconnectionPolicy(IReconnectionPolicy policy)
 {
     base.WithReconnectionPolicy(policy);
     return(this);
 }
 /// <summary>
 ///  Configure the reconnection policy to use for the new cluster. <p> If no
 ///  reconnection policy is set through this method,
 ///  <link>Policies.DefaultReconnectionPolicy</link> will be used instead.</p>
 /// </summary>
 /// <param name="policy"> the reconnection policy to use </param>
 /// <returns>this Builder</returns>
 public new DseClusterBuilder WithReconnectionPolicy(IReconnectionPolicy policy)
 {
     base.WithReconnectionPolicy(policy);
     return this;
 }
示例#27
0
 /// <summary>
 /// Creates a new instance of <see cref="Host"/>.
 /// </summary>
 // ReSharper disable once UnusedParameter.Local : Part of the public API
 public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy) : this(address, contactPoint : null)
 {
 }
示例#28
0
 public Hosts(IReconnectionPolicy rp)
 {
     this.rp = rp;
 }
        private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null)
        {
            var pooling = new PoolingOptions()
                          .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections)
                          .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500)
                          .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections);
            var policies = new Policies(null, rp, null, null, null);
            var config   = new Configuration(
                policies,
                new ProtocolOptions(),
                pooling,
                new SocketOptions(),
                new ClientOptions(),
                NoneAuthProvider.Instance,
                null,
                new QueryOptions(),
                new DefaultAddressTranslator(),
                Mock.Of <IStartupOptionsFactory>(),
                new SessionFactoryBuilder(),
                new Dictionary <string, IExecutionProfile>(),
                new RequestOptionsMapper(),
                null,
                null,
                null,
                null,
                null);

            return(config);
        }
示例#30
0
 public Hosts(IReconnectionPolicy rp)
 {
     this.rp = rp;
 }
 public RoundRobinPolicyWithReconnectionRetries(IReconnectionPolicy reconnectionPolicy)
 {
     this._reconnectionPolicy = reconnectionPolicy;
 }
示例#32
0
 public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy)
 {
     Address               = address;
     _reconnectionPolicy   = reconnectionPolicy;
     _reconnectionSchedule = reconnectionPolicy.NewSchedule();
 }
 public RetryLoadBalancingPolicy(ILoadBalancingPolicy loadBalancingPolicy, IReconnectionPolicy reconnectionPolicy)
 {
     _reconnectionPolicy = reconnectionPolicy;
     _loadBalancingPolicy = loadBalancingPolicy;
 }
        private static Configuration GetConfig(int coreConnections = 3, int maxConnections = 8, IReconnectionPolicy rp = null)
        {
            var pooling = new PoolingOptions()
                          .SetCoreConnectionsPerHost(HostDistance.Local, coreConnections)
                          .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1500)
                          .SetMaxConnectionsPerHost(HostDistance.Local, maxConnections);
            var policies = new Cassandra.Policies(null, rp, null, null, null);
            var config   = new TestConfigurationBuilder
            {
                Policies       = policies,
                PoolingOptions = pooling
            }.Build();

            return(config);
        }
示例#35
0
 public Hosts(IReconnectionPolicy rp)
 {
     _rp = rp;
 }
示例#36
0
 /// <summary>
 /// Creates a new instance of <see cref="Host"/>.
 /// </summary>
 // ReSharper disable once UnusedParameter.Local : Part of the public API
 public Host(IPEndPoint address, IReconnectionPolicy reconnectionPolicy) : this(address)
 {
 }
示例#37
0
 /// <summary>
 ///  Configure the reconnection policy to use for the new cluster. <p> If no
 ///  reconnection policy is set through this method,
 ///  <link>Policies#DefaultReconnectionPolicy</link> will be used instead.</p>
 /// </summary>
 /// <param name="policy"> the reconnection policy to use </param>
 /// 
 /// <returns>this Builder</returns>
 public Builder WithReconnectionPolicy(IReconnectionPolicy policy)
 {
     this._reconnectionPolicy = policy;
     return this;
 }
示例#38
0
 /// <summary>
 ///  Configure the reconnection policy to use for the new cluster. <p> If no
 ///  reconnection policy is set through this method,
 ///  <link>Policies.DefaultReconnectionPolicy</link> will be used instead.</p>
 /// </summary>
 /// <param name="policy"> the reconnection policy to use </param>
 ///
 /// <returns>this Builder</returns>
 public Builder WithReconnectionPolicy(IReconnectionPolicy policy)
 {
     _reconnectionPolicy = policy;
     return(this);
 }
示例#39
0
 public Hosts(IReconnectionPolicy rp)
 {
     _rp = rp;
 }