Created
September 20, 2011 17:54
Revisions
-
mgwilliams revised this gist
Sep 20, 2011 . 1 changed file with 26 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,27 @@ @defer.inlineCallbacks def setUp(self): self.cmanager = ManagedCassandraClientFactory(keyspace='system') self.client = CassandraClient(self.cmanager) for i in xrange(CONNS): reactor.connectTCP(HOST, PORT, self.cmanager) yield self.cmanager.deferred self.my_keyspace = KsDef( name=KEYSPACE, strategy_class='org.apache.cassandra.locator.SimpleStrategy', replication_factor=1, cf_defs=[ CfDef( keyspace=KEYSPACE, name=CF, column_type='Standard' ), ] ) try: yield self.client.system_drop_keyspace(self.my_keyspace.name) except: pass yield self.client.system_add_keyspace(self.my_keyspace) yield self.client.set_keyspace(KEYSPACE) -
mgwilliams created this gist
Sep 20, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ from twisted.application.internet import TCPClient from telephus.protocol import ManagedCassandraClientFactory from telephus.client import CassandraClient class Service(TCPClient): def __init__(self, keyspace=None, host="localhost", port=9160, delegate=None): f = ManagedCassandraClientFactory(keyspace) delegate.set_client(CassandraClient(f)) TCPClient.__init__(self, host, port, f)