예제 #1
0
        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;
        }
예제 #2
0
        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
                        );
            }
        }
예제 #3
0
 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 });
 }
예제 #4
0
 public KeyedCassandraClientFactory(IKeyedObjectPool <Endpoint, ICassandraClient> pool, Config config)
 {
     KeyedCassandraClientFactory.monitor = new CassandraClientMonitor();
     this.pool = pool;
     if (config != null)
     {
         this.timeout = config.Timeout;
     }
 }
예제 #5
0
        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 });
        }
예제 #6
0
 public void Dispose()
 {
     if (Client != null)
     {
         Client.MarkAsClosed();
         Client = null;
     }
     if (Pool != null)
     {
         Pool.Close();
         Pool = null;
     }
 }
예제 #7
0
 public void Dispose()
 {
     if (Client != null)
     {
         Client.MarkAsClosed();
         Client = null;
     }
     if (Pool != null)
     {
         Pool.Close();
         Pool = null;
     }
     CassandraRunner.Stop();
     CassandraRunner.CleanData();
 }
예제 #8
0
 public void Dispose()
 {
     if (Client != null)
     {
         Client.MarkAsClosed();
         Client = null;
     }
     if (Pool != null)
     {
         Pool.Close();
         Pool = null;
     }
     CassandraRunner.Stop();
     CassandraRunner.CleanData();
 }
예제 #9
0
        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
            });
        }
예제 #10
0
 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);
 }
예제 #11
0
 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
                ));
 }
예제 #12
0
        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
                );
        }
예제 #13
0
        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;
        }
예제 #14
0
        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();
        }
예제 #15
0
        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();
        }
예제 #16
0
 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;
 }
예제 #17
0
 internal CassandraClient(Apache.Cassandra.Cassandra.Iface thriftClient, KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool <Endpoint, ICassandraClient> pool)
     : this(keyspaceFactory, endpoint, pool)
 {
     cassandra = thriftClient;
 }
예제 #18
0
 internal CassandraClient(Apache.Cassandra.Cassandra.Iface thriftClient, KeyspaceFactory keyspaceFactory, Endpoint endpoint, IKeyedObjectPool<Endpoint, ICassandraClient> pool)
     : this(keyspaceFactory, endpoint, pool)
 {
     cassandra = thriftClient;
 }