internal CassandraClient(KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool <Endpoint, ICassandraClient> pool) { this.mySerial = serial.Increment(); this.keyspaceFactory = keyspaceFactory; if (endpoint == null) { throw new ArgumentNullException("endpoint"); } if (!port.HasValue) { port = endpoint.Port; } if (port.Value != endpoint.Port) { if (this.pool != null) { this.pool.Clear(); } port = endpoint.Port; } this.Endpoint = endpoint; this.pool = pool; }
public IKeyspace Create( ICassandraClient client, string keyspaceName, IDictionary<string, Dictionary<string, string>> keyspaceDesc, ConsistencyLevel consistencyLevel, FailoverPolicy failoverPolicy, IKeyedObjectPool<Endpoint, ICassandraClient> pool) { switch (client.Version) { case CassandraVersion.v0_6_0_beta_3: throw new NotImplementedException("Version 0.6.0 not implimented yet"); default: case CassandraVersion.v0_5_1: return new _051.Keyspace( client, keyspaceName, keyspaceDesc, consistencyLevel, failoverPolicy, pool, monitor ); } }
public CassandraTestFixture() { Pool = new CassandraClientPoolFactory().Create(); Client = new KeyedCassandraClientFactory(Pool, new KeyedCassandraClientFactory.Config { Timeout = 10 }) .Make(new Endpoint("localhost", 9160)); Keyspace = Client.GetKeyspace("Keyspace1", ConsistencyLevel.ONE, new FailoverPolicy(0) { Strategy = FailoverStrategy.FAIL_FAST }); }
public KeyedCassandraClientFactory(IKeyedObjectPool <Endpoint, ICassandraClient> pool, Config config) { KeyedCassandraClientFactory.monitor = new CassandraClientMonitor(); this.pool = pool; if (config != null) { this.timeout = config.Timeout; } }
public HectorSharpFixture() { CassandraRunner.CleanData(); CassandraRunner.Start(); Pool = new CassandraClientPoolFactory().Create(); Client = new KeyedCassandraClientFactory(Pool, new KeyedCassandraClientFactory.Config { Timeout = 10 }) .Make(new Endpoint("localhost", 9060)); Keyspace = Client.GetKeyspace("Keyspace1", ConsistencyLevel.ONE, new FailoverPolicy(0) { Strategy = FailoverStrategy.FAIL_FAST }); }
public void Dispose() { if (Client != null) { Client.MarkAsClosed(); Client = null; } if (Pool != null) { Pool.Close(); Pool = null; } }
public void Dispose() { if (Client != null) { Client.MarkAsClosed(); Client = null; } if (Pool != null) { Pool.Close(); Pool = null; } CassandraRunner.Stop(); CassandraRunner.CleanData(); }
public IKeyedObjectPool <Endpoint, ICassandraClient> Create(IKeyedPoolableObjectFactory <Endpoint, ICassandraClient> factory) { if (pool == null) { pool = new KeyedObjectPool <Endpoint, ICassandraClient>(null, new KeyedObjectPool <Endpoint, ICassandraClient> .Configuration { MaxSize = 25, MinSize = 4, Timeout = 20 }); pool.SetFactory(factory); } return(pool); }
public IKeyspace Create( ICassandraClient client, string keyspaceName, IDictionary <string, Dictionary <string, string> > keyspaceDesc, ConsistencyLevel consistencyLevel, FailoverPolicy failoverPolicy, IKeyedObjectPool <Endpoint, ICassandraClient> pool) { return(new Keyspace( client, keyspaceName, keyspaceDesc, consistencyLevel, failoverPolicy, pool, monitor )); }
public IKeyspace Create( ICassandraClient client, string keyspaceName, IDictionary<string, Dictionary<string, string>> keyspaceDesc, ConsistencyLevel consistencyLevel, FailoverPolicy failoverPolicy, IKeyedObjectPool<Endpoint, ICassandraClient> pool) { return new Keyspace( client, keyspaceName, keyspaceDesc, consistencyLevel, failoverPolicy, pool, monitor ); }
internal CassandraClient(KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool<Endpoint, ICassandraClient> pool) { this.mySerial = serial.Increment(); this.keyspaceFactory = keyspaceFactory; if (endpoint == null) throw new ArgumentNullException("endpoint"); if (!port.HasValue) port = endpoint.Port; if (port.Value != endpoint.Port) { if (this.pool != null) this.pool.Clear(); port = endpoint.Port; } this.Endpoint = endpoint; this.pool = pool; }
public Keyspace( ICassandraClient client, string keyspaceName, IDictionary<string, Dictionary<string, string>> description, ConsistencyLevel consistencyLevel, FailoverPolicy failoverPolicy, IKeyedObjectPool<Endpoint, ICassandraClient> pool, ICassandraClientMonitor monitor) { if (client == null) throw new ArgumentNullException("client"); this.Client = client; this.ConsistencyLevel = consistencyLevel; this.Description = description; this.Name = keyspaceName; this.cassandra = client.Client as Cassandra.Client; this.FailoverPolicy = failoverPolicy; this.pool = pool; this.monitor = monitor; InitFailover(); }
public Keyspace( ICassandraClient client, string keyspaceName, IDictionary <string, Dictionary <string, string> > description, ConsistencyLevel consistencyLevel, FailoverPolicy failoverPolicy, IKeyedObjectPool <Endpoint, ICassandraClient> pool, ICassandraClientMonitor monitor) { if (client == null) { throw new ArgumentNullException("client"); } this.Client = client; this.ConsistencyLevel = consistencyLevel; this.Description = description; this.Name = keyspaceName; this.cassandra = client.Client as Cassandra.Client; this.FailoverPolicy = failoverPolicy; this.pool = pool; this.monitor = monitor; InitFailover(); }
internal CassandraClient(Apache.Cassandra060b3.Cassandra.Client thriftClient, KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool<Endpoint, ICassandraClient> pool) : this(keyspaceFactory, endpoint, pool) { Version = CassandraVersion.v0_6_0_beta_3; cassandra060 = thriftClient; }
internal CassandraClient(Apache.Cassandra.Cassandra.Iface thriftClient, KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool <Endpoint, ICassandraClient> pool) : this(keyspaceFactory, endpoint, pool) { cassandra = thriftClient; }
internal CassandraClient(Apache.Cassandra.Cassandra.Iface thriftClient, KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool<Endpoint, ICassandraClient> pool) : this(keyspaceFactory, endpoint, pool) { cassandra = thriftClient; }