cassandra 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.8.1 Adding the ability to compose ThriftClient classes.
2
+
1
3
  v0.8.0 Compatibility with Cassandra 0.6 betas (no longer compatible with 0.5); assorted bugfixes.
2
4
 
3
5
  v0.7.6 Bugfixes.
data/cassandra.gemspec CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cassandra}
5
- s.version = "0.8.0"
5
+ s.version = "0.8.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Evan Weaver, Ryan King"]
9
9
  s.cert_chain = ["/Users/ryan/.gemkeys/gem-public_cert.pem"]
10
- s.date = %q{2010-03-23}
10
+ s.date = %q{2010-03-30}
11
11
  s.default_executable = %q{cassandra_helper}
12
12
  s.description = %q{A Ruby client for the Cassandra distributed database.}
13
13
  s.email = %q{}
14
14
  s.executables = ["cassandra_helper"]
15
15
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "bin/cassandra_helper", "lib/cassandra.rb", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/helpers.rb", "lib/cassandra/long.rb", "lib/cassandra/mock.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/time.rb"]
16
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "bin/cassandra_helper", "conf/cassandra.in.sh", "conf/log4j.properties", "conf/storage-conf.xml", "lib/cassandra.rb", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/helpers.rb", "lib/cassandra/long.rb", "lib/cassandra/mock.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/time.rb", "test/cassandra_client_test.rb", "test/cassandra_mock_test.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb", "vendor/gen-rb/cassandra.rb", "vendor/gen-rb/cassandra_constants.rb", "vendor/gen-rb/cassandra_types.rb", "cassandra.gemspec"]
16
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "bin/cassandra_helper", "conf/cassandra.in.sh", "conf/log4j.properties", "conf/storage-conf.xml", "lib/cassandra.rb", "lib/cassandra/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/helpers.rb", "lib/cassandra/long.rb", "lib/cassandra/mock.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/time.rb", "test/cassandra_client_test.rb", "test/cassandra_mock_test.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb", "vendor/gen-rb/cassandra.rb", "vendor/gen-rb/cassandra_constants.rb", "vendor/gen-rb/cassandra_types.rb", "cassandra.gemspec", "test/eventmachine_test.rb"]
17
17
  s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/cassandra/}
18
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cassandra", "--main", "README.rdoc"]
19
19
  s.require_paths = ["lib"]
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.rubygems_version = %q{1.3.5}
22
22
  s.signing_key = %q{/Users/ryan/.gemkeys/gem-private_key.pem}
23
23
  s.summary = %q{A Ruby client for the Cassandra distributed database.}
24
- s.test_files = ["test/cassandra_client_test.rb", "test/cassandra_mock_test.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb"]
24
+ s.test_files = ["test/cassandra_client_test.rb", "test/cassandra_mock_test.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/eventmachine_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb"]
25
25
 
26
26
  if s.respond_to? :specification_version then
27
27
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -24,6 +24,8 @@ For write methods, valid option parameters are:
24
24
  <tt>:timestamp </tt>:: The transaction timestamp. Defaults to the current time in milliseconds. This is used for conflict resolution by the server; you normally never need to change it.
25
25
  <tt>:consistency</tt>:: See above.
26
26
 
27
+ For the initial client instantiation, you may also pass in <tt>:thrift_client<tt> with a ThriftClient subclass attached. On connection, that class will be used instead of the default ThriftClient class, allowing you to add additional behavior to the connection (e.g. query logging).
28
+
27
29
  =end rdoc
28
30
 
29
31
  class Cassandra
@@ -53,10 +55,11 @@ class Cassandra
53
55
  }.freeze
54
56
 
55
57
  THRIFT_DEFAULTS = {
56
- :transport_wrapper => Thrift::BufferedTransport
58
+ :transport_wrapper => Thrift::BufferedTransport,
59
+ :thrift_client_class => ThriftClient
57
60
  }.freeze
58
61
 
59
- attr_reader :keyspace, :servers, :schema, :thrift_client_options
62
+ attr_reader :keyspace, :servers, :schema, :thrift_client_options, :thrift_client_class
60
63
 
61
64
  # Create a new Cassandra instance and open the connection.
62
65
  def initialize(keyspace, servers = "127.0.0.1:9160", thrift_client_options = {})
@@ -64,7 +67,7 @@ class Cassandra
64
67
  @column_name_class = {}
65
68
  @sub_column_name_class = {}
66
69
  @thrift_client_options = THRIFT_DEFAULTS.merge(thrift_client_options)
67
-
70
+ @thrift_client_class = @thrift_client_options[:thrift_client_class]
68
71
  @keyspace = keyspace
69
72
  @servers = Array(servers)
70
73
  end
@@ -286,7 +289,7 @@ class Cassandra
286
289
  end
287
290
 
288
291
  def new_client
289
- ThriftClient.new(CassandraThrift::Cassandra::Client, @servers, @thrift_client_options)
292
+ thrift_client_class.new(CassandraThrift::Cassandra::Client, @servers, @thrift_client_options)
290
293
  end
291
294
 
292
295
  def all_nodes
@@ -0,0 +1,42 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
+
3
+ if RUBY_VERSION < '1.9'
4
+ puts "Skipping EventMachine test"
5
+ else
6
+
7
+ require 'thrift_client/event_machine'
8
+
9
+ class EventmachineTest < Test::Unit::TestCase
10
+
11
+ def test_twitter
12
+ @twitter = Cassandra.new('Twitter', "127.0.0.1:9160", :retries => 2, :exception_classes => [], :transport => Thrift::EventMachineTransport, :transport_wrapper => nil)
13
+ @twitter.clear_keyspace!
14
+ end
15
+
16
+ private
17
+
18
+ def em_test(name)
19
+ EM.run do
20
+ Fiber.new do
21
+ begin
22
+ send("raw_#{name}".to_sym)
23
+ ensure
24
+ EM.stop
25
+ end
26
+ end.resume
27
+ end
28
+ end
29
+
30
+ def self.wrap_tests
31
+ self.public_instance_methods.select { |m| m =~ /^test_/ }.each do |meth|
32
+ alias_method :"raw_#{meth}", meth
33
+ define_method(meth) do
34
+ em_test(meth)
35
+ end
36
+ end
37
+ end
38
+
39
+ wrap_tests
40
+
41
+ end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver, Ryan King
@@ -30,7 +30,7 @@ cert_chain:
30
30
  zyKMYVRO0z/58g==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2010-03-23 00:00:00 -07:00
33
+ date: 2010-03-30 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -168,5 +168,6 @@ test_files:
168
168
  - test/cassandra_mock_test.rb
169
169
  - test/cassandra_test.rb
170
170
  - test/comparable_types_test.rb
171
+ - test/eventmachine_test.rb
171
172
  - test/ordered_hash_test.rb
172
173
  - test/test_helper.rb
metadata.gz.sig CHANGED
Binary file