sessionm-cassandra 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/CHANGELOG +135 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE +202 -0
  4. data/Manifest +94 -0
  5. data/README.md +373 -0
  6. data/Rakefile +195 -0
  7. data/bin/cassandra_helper +16 -0
  8. data/conf/0.6/cassandra.in.sh +47 -0
  9. data/conf/0.6/log4j.properties +38 -0
  10. data/conf/0.6/schema.json +57 -0
  11. data/conf/0.6/storage-conf.xml +352 -0
  12. data/conf/0.7/cassandra.in.sh +46 -0
  13. data/conf/0.7/cassandra.yaml +336 -0
  14. data/conf/0.7/log4j-server.properties +41 -0
  15. data/conf/0.7/schema.json +57 -0
  16. data/conf/0.7/schema.txt +45 -0
  17. data/conf/0.8/cassandra.in.sh +41 -0
  18. data/conf/0.8/cassandra.yaml +61 -0
  19. data/conf/0.8/log4j-server.properties +40 -0
  20. data/conf/0.8/schema.json +72 -0
  21. data/conf/0.8/schema.txt +57 -0
  22. data/conf/1.0/cassandra.in.sh +41 -0
  23. data/conf/1.0/cassandra.yaml +415 -0
  24. data/conf/1.0/log4j-server.properties +40 -0
  25. data/conf/1.0/schema.json +72 -0
  26. data/conf/1.0/schema.txt +57 -0
  27. data/conf/1.1/cassandra.in.sh +41 -0
  28. data/conf/1.1/cassandra.yaml +567 -0
  29. data/conf/1.1/log4j-server.properties +44 -0
  30. data/conf/1.1/schema.json +72 -0
  31. data/conf/1.1/schema.txt +57 -0
  32. data/ext/cassandra_native.c +34 -0
  33. data/ext/extconf.rb +9 -0
  34. data/lib/cassandra/0.6/cassandra.rb +113 -0
  35. data/lib/cassandra/0.6/columns.rb +78 -0
  36. data/lib/cassandra/0.6/protocol.rb +91 -0
  37. data/lib/cassandra/0.6.rb +7 -0
  38. data/lib/cassandra/0.7/cassandra.rb +2 -0
  39. data/lib/cassandra/0.7/columns.rb +4 -0
  40. data/lib/cassandra/0.7/protocol.rb +5 -0
  41. data/lib/cassandra/0.7.rb +7 -0
  42. data/lib/cassandra/0.8/cassandra.rb +51 -0
  43. data/lib/cassandra/0.8/columns.rb +28 -0
  44. data/lib/cassandra/0.8/protocol.rb +10 -0
  45. data/lib/cassandra/0.8.rb +7 -0
  46. data/lib/cassandra/1.0/cassandra.rb +1 -0
  47. data/lib/cassandra/1.0/columns.rb +1 -0
  48. data/lib/cassandra/1.0/protocol.rb +1 -0
  49. data/lib/cassandra/1.0.rb +7 -0
  50. data/lib/cassandra/1.1/cassandra.rb +1 -0
  51. data/lib/cassandra/1.1/columns.rb +1 -0
  52. data/lib/cassandra/1.1/protocol.rb +1 -0
  53. data/lib/cassandra/1.1.rb +7 -0
  54. data/lib/cassandra/array.rb +8 -0
  55. data/lib/cassandra/batch.rb +41 -0
  56. data/lib/cassandra/cassandra.rb +1088 -0
  57. data/lib/cassandra/column_family.rb +3 -0
  58. data/lib/cassandra/columns.rb +172 -0
  59. data/lib/cassandra/comparable.rb +28 -0
  60. data/lib/cassandra/composite.rb +140 -0
  61. data/lib/cassandra/constants.rb +11 -0
  62. data/lib/cassandra/debug.rb +9 -0
  63. data/lib/cassandra/dynamic_composite.rb +96 -0
  64. data/lib/cassandra/helpers.rb +41 -0
  65. data/lib/cassandra/keyspace.rb +3 -0
  66. data/lib/cassandra/long.rb +58 -0
  67. data/lib/cassandra/mock.rb +525 -0
  68. data/lib/cassandra/ordered_hash.rb +192 -0
  69. data/lib/cassandra/protocol.rb +137 -0
  70. data/lib/cassandra/time.rb +11 -0
  71. data/lib/cassandra.rb +41 -0
  72. data/sessionm-cassandra.gemspec +47 -0
  73. data/test/cassandra_client_test.rb +20 -0
  74. data/test/cassandra_mock_test.rb +128 -0
  75. data/test/cassandra_test.rb +1353 -0
  76. data/test/comparable_types_test.rb +45 -0
  77. data/test/composite_type_test.rb +64 -0
  78. data/test/eventmachine_test.rb +42 -0
  79. data/test/ordered_hash_test.rb +386 -0
  80. data/test/test_helper.rb +19 -0
  81. data/vendor/0.6/gen-rb/cassandra.rb +1481 -0
  82. data/vendor/0.6/gen-rb/cassandra_constants.rb +12 -0
  83. data/vendor/0.6/gen-rb/cassandra_types.rb +482 -0
  84. data/vendor/0.7/gen-rb/cassandra.rb +1936 -0
  85. data/vendor/0.7/gen-rb/cassandra_constants.rb +12 -0
  86. data/vendor/0.7/gen-rb/cassandra_types.rb +681 -0
  87. data/vendor/0.8/gen-rb/cassandra.rb +2215 -0
  88. data/vendor/0.8/gen-rb/cassandra_constants.rb +12 -0
  89. data/vendor/0.8/gen-rb/cassandra_types.rb +824 -0
  90. data/vendor/1.0/gen-rb/cassandra.rb +2215 -0
  91. data/vendor/1.0/gen-rb/cassandra_constants.rb +12 -0
  92. data/vendor/1.0/gen-rb/cassandra_types.rb +857 -0
  93. data/vendor/1.1/gen-rb/cassandra.rb +2571 -0
  94. data/vendor/1.1/gen-rb/cassandra_constants.rb +12 -0
  95. data/vendor/1.1/gen-rb/cassandra_types.rb +928 -0
  96. metadata +287 -0
@@ -0,0 +1,192 @@
1
+ # OrderedHash is namespaced to prevent conflicts with other implementations
2
+ class Cassandra
3
+ class OrderedHashInt < Hash #:nodoc:
4
+ def initialize(*args, &block)
5
+ super
6
+ @keys = []
7
+ end
8
+
9
+ def self.[](*args)
10
+ ordered_hash = new
11
+
12
+ if (args.length == 1 && args.first.is_a?(Array))
13
+ args.first.each do |key_value_pair|
14
+ next unless (key_value_pair.is_a?(Array))
15
+ ordered_hash[key_value_pair[0]] = key_value_pair[1]
16
+ end
17
+
18
+ return ordered_hash
19
+ end
20
+
21
+ unless (args.size % 2 == 0)
22
+ raise ArgumentError.new("odd number of arguments for Hash")
23
+ end
24
+
25
+ args.each_with_index do |val, ind|
26
+ next if (ind % 2 != 0)
27
+ ordered_hash[val] = args[ind + 1]
28
+ end
29
+
30
+ ordered_hash
31
+ end
32
+
33
+ def initialize_copy(other)
34
+ super
35
+ # make a deep copy of keys
36
+ @keys = other.keys
37
+ end
38
+
39
+ def []=(key, value)
40
+ @keys << key if !has_key?(key)
41
+ super
42
+ end
43
+
44
+ def delete(key)
45
+ if has_key? key
46
+ index = @keys.index(key)
47
+ @keys.delete_at index
48
+ end
49
+ super
50
+ end
51
+
52
+ def delete_if
53
+ super
54
+ sync_keys!
55
+ self
56
+ end
57
+
58
+ def reject!
59
+ super
60
+ sync_keys!
61
+ self
62
+ end
63
+
64
+ def reject(&block)
65
+ dup.reject!(&block)
66
+ end
67
+
68
+ def keys
69
+ @keys.dup
70
+ end
71
+
72
+ def values
73
+ @keys.collect { |key| self[key] }
74
+ end
75
+
76
+ def to_hash
77
+ self
78
+ end
79
+
80
+ def to_a
81
+ @keys.map { |key| [ key, self[key] ] }
82
+ end
83
+
84
+ def each_key
85
+ @keys.each { |key| yield key }
86
+ end
87
+
88
+ def each_value
89
+ @keys.each { |key| yield self[key]}
90
+ end
91
+
92
+ def each
93
+ @keys.each {|key| yield [key, self[key]]}
94
+ end
95
+
96
+ alias_method :each_pair, :each
97
+
98
+ def clear
99
+ super
100
+ @keys.clear
101
+ self
102
+ end
103
+
104
+ def shift
105
+ k = @keys.first
106
+ v = delete(k)
107
+ [k, v]
108
+ end
109
+
110
+ def merge!(other_hash)
111
+ other_hash.each {|k,v| self[k] = v }
112
+ self
113
+ end
114
+
115
+ def merge(other_hash)
116
+ dup.merge!(other_hash)
117
+ end
118
+
119
+ # When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not.
120
+ def replace(other)
121
+ super
122
+ @keys = other.keys
123
+ self
124
+ end
125
+
126
+ def reverse
127
+ OrderedHashInt[self.to_a.reverse]
128
+ end
129
+
130
+ private
131
+
132
+ def sync_keys!
133
+ @keys.delete_if {|k| !has_key?(k)}
134
+ end
135
+ end
136
+
137
+ class OrderedHash < OrderedHashInt #:nodoc:
138
+ def initialize(*args, &block)
139
+ @timestamps = OrderedHashInt.new
140
+ super
141
+ end
142
+
143
+ def initialize_copy(other)
144
+ @timestamps = other.timestamps
145
+ super
146
+ end
147
+
148
+ def []=(key, value, timestamp = nil)
149
+ @timestamps[key] = timestamp
150
+ super(key, value)
151
+ end
152
+
153
+ def delete(key)
154
+ @timestamps.delete(key)
155
+ super
156
+ end
157
+
158
+ def delete_if(&block)
159
+ @timestamps.delete_if(&block)
160
+ super
161
+ end
162
+
163
+ def reject!(&block)
164
+ @timestamps.reject!(&block)
165
+ super
166
+ end
167
+
168
+ def timestamps
169
+ @timestamps.dup
170
+ end
171
+
172
+ def clear
173
+ @timestamps.clear
174
+ super
175
+ end
176
+
177
+ def shift
178
+ k, v = super
179
+ @timestamps.delete(k)
180
+ [k, v]
181
+ end
182
+
183
+ def replace(other)
184
+ @timestamps = other.timestamps
185
+ super
186
+ end
187
+
188
+ def inspect
189
+ "#<OrderedHash #{super}\n#{@timestamps.inspect}>"
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,137 @@
1
+ class Cassandra
2
+ # Inner methods for actually doing the Thrift calls
3
+ module Protocol #:nodoc:
4
+ private
5
+
6
+ def _mutate(mutation_map, consistency_level)
7
+ client.batch_mutate(mutation_map, consistency_level)
8
+ end
9
+
10
+ def _remove(key, column_path, timestamp, consistency_level)
11
+ client.remove(key, column_path, timestamp, consistency_level)
12
+ end
13
+
14
+ def _count_columns(column_family, key, super_column, start, stop, count, consistency)
15
+ client.get_count(key,
16
+ CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => super_column),
17
+ CassandraThrift::SlicePredicate.new(:slice_range =>
18
+ CassandraThrift::SliceRange.new(
19
+ :start => start || '',
20
+ :finish => stop || '',
21
+ :count => count || 100
22
+ )),
23
+ consistency
24
+ )
25
+ end
26
+
27
+ # FIXME: Add support for start, stop, count
28
+ def _get_columns(column_family, key, columns, sub_columns, consistency)
29
+ result = if is_super(column_family)
30
+ if sub_columns
31
+ columns_to_hash(column_family, client.get_slice(key,
32
+ CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => columns),
33
+ CassandraThrift::SlicePredicate.new(:column_names => sub_columns),
34
+ consistency))
35
+ else
36
+ columns_to_hash(column_family, client.get_slice(key,
37
+ CassandraThrift::ColumnParent.new(:column_family => column_family),
38
+ CassandraThrift::SlicePredicate.new(:column_names => columns),
39
+ consistency))
40
+ end
41
+ else
42
+ columns_to_hash(column_family, client.get_slice(key,
43
+ CassandraThrift::ColumnParent.new(:column_family => column_family),
44
+ CassandraThrift::SlicePredicate.new(:column_names => columns),
45
+ consistency))
46
+ end
47
+
48
+ klass = column_name_class(column_family)
49
+ (sub_columns || columns).map { |name| result[klass.new(name)] }
50
+ end
51
+
52
+ def _multi_get_columns(column_family, keys, columns, sub_columns, consistency)
53
+ result = if is_super(column_family) and sub_columns
54
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => sub_columns)
55
+ column_parent = CassandraThrift::ColumnParent.new(
56
+ :column_family => column_family,
57
+ :super_column => columns.kind_of?(Array) ? columns[0] : columns )
58
+ multi_sub_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
59
+ else
60
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => columns)
61
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
62
+ multi_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
63
+ end
64
+
65
+ klass = column_name_class(column_family)
66
+ OrderedHash[result.keys.map { |key| [key, (sub_columns || columns).map { |column| result[key][klass.new(column)] }] }]
67
+ end
68
+
69
+ def _multiget(column_family, keys, column, sub_column, count, start, finish, reversed, consistency)
70
+ # Single values; count and range parameters have no effect
71
+ if is_super(column_family) and sub_column
72
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => [sub_column])
73
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => column)
74
+ column_hash = multi_sub_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
75
+
76
+ klass = sub_column_name_class(column_family)
77
+ keys.inject({}){|hash, key| hash[key] = column_hash[key][klass.new(sub_column)]; hash}
78
+ elsif !is_super(column_family) and column
79
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => [column])
80
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
81
+ column_hash = multi_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
82
+
83
+ klass = column_name_class(column_family)
84
+ keys.inject({}){|hash, key| hash[key] = column_hash[key][klass.new(column)]; hash}
85
+
86
+ # Slices
87
+ else
88
+ predicate = CassandraThrift::SlicePredicate.new(:slice_range =>
89
+ CassandraThrift::SliceRange.new(
90
+ :reversed => reversed,
91
+ :count => count,
92
+ :start => start,
93
+ :finish => finish))
94
+
95
+ if is_super(column_family) and column
96
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => column)
97
+ multi_sub_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
98
+ else
99
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
100
+ multi_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
101
+ end
102
+ end
103
+ end
104
+
105
+ def _get_range(column_family, start_key, finish_key, key_count, columns, start, finish, count, consistency, reversed=false)
106
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
107
+ predicate = if columns
108
+ CassandraThrift::SlicePredicate.new(:column_names => columns)
109
+ else
110
+ CassandraThrift::SlicePredicate.new(:slice_range =>
111
+ CassandraThrift::SliceRange.new(
112
+ :start => start,
113
+ :finish => finish,
114
+ :count => count,
115
+ :reversed => reversed))
116
+ end
117
+ range = CassandraThrift::KeyRange.new(:start_key => start_key, :end_key => finish_key, :count => key_count)
118
+ client.get_range_slices(column_parent, predicate, range, consistency)
119
+ end
120
+
121
+ # TODO: Supercolumn support
122
+ def _get_indexed_slices(column_family, index_clause, column, count, start, finish, reversed, consistency)
123
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
124
+ if column
125
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => [column])
126
+ else
127
+ predicate = CassandraThrift::SlicePredicate.new(:slice_range =>
128
+ CassandraThrift::SliceRange.new(
129
+ :reversed => reversed,
130
+ :count => count,
131
+ :start => start,
132
+ :finish => finish))
133
+ end
134
+ client.get_indexed_slices(column_parent, index_clause, predicate, consistency)
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,11 @@
1
+
2
+ class Time
3
+ def self.stamp
4
+ Time.now.stamp
5
+ end
6
+
7
+ def stamp
8
+ to_i * 1_000_000 + usec
9
+ end
10
+ end
11
+
data/lib/cassandra.rb ADDED
@@ -0,0 +1,41 @@
1
+ require 'rubygems'
2
+ gem 'thrift_client', '>= 0.7.0', '< 0.9'
3
+ require 'thrift_client'
4
+ gem 'simple_uuid' , '~> 0.2.0'
5
+ require 'simple_uuid'
6
+
7
+ require 'json' unless defined?(JSON)
8
+
9
+ here = File.expand_path(File.dirname(__FILE__))
10
+
11
+ class Cassandra ; end
12
+ unless Cassandra.respond_to?(:VERSION)
13
+ require "#{here}/cassandra/0.8"
14
+ end
15
+
16
+ $LOAD_PATH << "#{here}/../vendor/#{Cassandra.VERSION}/gen-rb"
17
+ require "#{here}/../vendor/#{Cassandra.VERSION}/gen-rb/cassandra"
18
+
19
+ $LOAD_PATH << "#{here}"
20
+
21
+ require 'cassandra/helpers'
22
+ require 'cassandra/array'
23
+ require 'cassandra/time'
24
+ require 'cassandra/comparable'
25
+ require 'cassandra/long'
26
+ require 'cassandra/composite'
27
+ require 'cassandra/dynamic_composite'
28
+ require 'cassandra/ordered_hash'
29
+ require 'cassandra/columns'
30
+ require 'cassandra/protocol'
31
+ require 'cassandra/batch'
32
+ require "cassandra/#{Cassandra.VERSION}/columns"
33
+ require "cassandra/#{Cassandra.VERSION}/protocol"
34
+ require "cassandra/cassandra"
35
+ require "cassandra/#{Cassandra.VERSION}/cassandra"
36
+ unless Cassandra.VERSION.eql?("0.6")
37
+ require "cassandra/column_family"
38
+ require "cassandra/keyspace"
39
+ end
40
+ require 'cassandra/constants'
41
+ require 'cassandra/debug' if ENV['DEBUG']
@@ -0,0 +1,47 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "sessionm-cassandra"
5
+ s.version = "1.0.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Evan Weaver, Ryan King", "Kris Lange"]
9
+ s.date = "2012-09-26"
10
+ s.description = "A Ruby client for the Cassandra distributed database."
11
+ s.email = ""
12
+ s.executables = ["cassandra_helper"]
13
+ s.extensions = ["ext/extconf.rb"]
14
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md", "bin/cassandra_helper", "ext/cassandra_native.c", "ext/extconf.rb", "lib/cassandra.rb", "lib/cassandra/0.6.rb", "lib/cassandra/0.6/cassandra.rb", "lib/cassandra/0.6/columns.rb", "lib/cassandra/0.6/protocol.rb", "lib/cassandra/0.7.rb", "lib/cassandra/0.7/cassandra.rb", "lib/cassandra/0.7/columns.rb", "lib/cassandra/0.7/protocol.rb", "lib/cassandra/0.8.rb", "lib/cassandra/0.8/cassandra.rb", "lib/cassandra/0.8/columns.rb", "lib/cassandra/0.8/protocol.rb", "lib/cassandra/1.0.rb", "lib/cassandra/1.0/cassandra.rb", "lib/cassandra/1.0/columns.rb", "lib/cassandra/1.0/protocol.rb", "lib/cassandra/1.1.rb", "lib/cassandra/1.1/cassandra.rb", "lib/cassandra/1.1/columns.rb", "lib/cassandra/1.1/protocol.rb", "lib/cassandra/array.rb", "lib/cassandra/batch.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/column_family.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/composite.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/dynamic_composite.rb", "lib/cassandra/helpers.rb", "lib/cassandra/keyspace.rb", "lib/cassandra/long.rb", "lib/cassandra/mock.rb", "lib/cassandra/ordered_hash.rb", "lib/cassandra/protocol.rb", "lib/cassandra/time.rb"]
15
+ s.files = ["CHANGELOG", "Gemfile", "LICENSE", "Manifest", "README.md", "Rakefile", "bin/cassandra_helper", "conf/0.6/cassandra.in.sh", "conf/0.6/log4j.properties", "conf/0.6/schema.json", "conf/0.6/storage-conf.xml", "conf/0.7/cassandra.in.sh", "conf/0.7/cassandra.yaml", "conf/0.7/log4j-server.properties", "conf/0.7/schema.json", "conf/0.7/schema.txt", "conf/0.8/cassandra.in.sh", "conf/0.8/cassandra.yaml", "conf/0.8/log4j-server.properties", "conf/0.8/schema.json", "conf/0.8/schema.txt", "conf/1.0/cassandra.in.sh", "conf/1.0/cassandra.yaml", "conf/1.0/log4j-server.properties", "conf/1.0/schema.json", "conf/1.0/schema.txt", "conf/1.1/cassandra.in.sh", "conf/1.1/cassandra.yaml", "conf/1.1/log4j-server.properties", "conf/1.1/schema.json", "conf/1.1/schema.txt", "ext/cassandra_native.c", "ext/extconf.rb", "lib/cassandra.rb", "lib/cassandra/0.6.rb", "lib/cassandra/0.6/cassandra.rb", "lib/cassandra/0.6/columns.rb", "lib/cassandra/0.6/protocol.rb", "lib/cassandra/0.7.rb", "lib/cassandra/0.7/cassandra.rb", "lib/cassandra/0.7/columns.rb", "lib/cassandra/0.7/protocol.rb", "lib/cassandra/0.8.rb", "lib/cassandra/0.8/cassandra.rb", "lib/cassandra/0.8/columns.rb", "lib/cassandra/0.8/protocol.rb", "lib/cassandra/1.0.rb", "lib/cassandra/1.0/cassandra.rb", "lib/cassandra/1.0/columns.rb", "lib/cassandra/1.0/protocol.rb", "lib/cassandra/1.1.rb", "lib/cassandra/1.1/cassandra.rb", "lib/cassandra/1.1/columns.rb", "lib/cassandra/1.1/protocol.rb", "lib/cassandra/array.rb", "lib/cassandra/batch.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/column_family.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/composite.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.rb", "lib/cassandra/dynamic_composite.rb", "lib/cassandra/helpers.rb", "lib/cassandra/keyspace.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/composite_type_test.rb", "test/eventmachine_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb", "vendor/0.6/gen-rb/cassandra.rb", "vendor/0.6/gen-rb/cassandra_constants.rb", "vendor/0.6/gen-rb/cassandra_types.rb", "vendor/0.7/gen-rb/cassandra.rb", "vendor/0.7/gen-rb/cassandra_constants.rb", "vendor/0.7/gen-rb/cassandra_types.rb", "vendor/0.8/gen-rb/cassandra.rb", "vendor/0.8/gen-rb/cassandra_constants.rb", "vendor/0.8/gen-rb/cassandra_types.rb", "vendor/1.0/gen-rb/cassandra.rb", "vendor/1.0/gen-rb/cassandra_constants.rb", "vendor/1.0/gen-rb/cassandra_types.rb", "vendor/1.1/gen-rb/cassandra.rb", "vendor/1.1/gen-rb/cassandra_constants.rb", "vendor/1.1/gen-rb/cassandra_types.rb", "sessionm-cassandra.gemspec"]
16
+ s.homepage = "http://github.com/twitter/cassandra"
17
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cassandra", "--main", "README.md"]
18
+ s.require_paths = ["lib", "ext"]
19
+ s.rubyforge_project = "cassandra"
20
+ s.rubygems_version = "1.8.17"
21
+ s.summary = "A Ruby client for the Cassandra distributed database."
22
+ s.test_files = ["test/cassandra_client_test.rb", "test/cassandra_mock_test.rb", "test/cassandra_test.rb", "test/comparable_types_test.rb", "test/composite_type_test.rb", "test/eventmachine_test.rb", "test/ordered_hash_test.rb", "test/test_helper.rb"]
23
+
24
+ if s.respond_to? :specification_version then
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
+ s.add_runtime_dependency(%q<thrift_client>, ["< 0.9", ">= 0.7.0"])
29
+ s.add_runtime_dependency(%q<json>, [">= 0"])
30
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
31
+ s.add_runtime_dependency(%q<simple_uuid>, ["~> 0.2.0"])
32
+ s.add_development_dependency(%q<echoe>, [">= 0"])
33
+ else
34
+ s.add_dependency(%q<thrift_client>, ["< 0.9", ">= 0.7.0"])
35
+ s.add_dependency(%q<json>, [">= 0"])
36
+ s.add_dependency(%q<rake>, [">= 0"])
37
+ s.add_dependency(%q<simple_uuid>, ["~> 0.2.0"])
38
+ s.add_dependency(%q<echoe>, [">= 0"])
39
+ end
40
+ else
41
+ s.add_dependency(%q<thrift_client>, ["< 0.9", ">= 0.7.0"])
42
+ s.add_dependency(%q<json>, [">= 0"])
43
+ s.add_dependency(%q<rake>, [">= 0"])
44
+ s.add_dependency(%q<simple_uuid>, ["~> 0.2.0"])
45
+ s.add_dependency(%q<echoe>, [">= 0"])
46
+ end
47
+ end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
+
3
+ class CassandraClientTest < Test::Unit::TestCase
4
+ include Cassandra::Constants
5
+
6
+ def setup
7
+ @twitter = Cassandra.new('Twitter', "127.0.0.1:9160", :retries => 2, :exception_classes => [])
8
+ end
9
+
10
+ def test_client_method_is_called
11
+ assert_nil @twitter.instance_variable_get(:@client)
12
+ @twitter.insert(:Statuses, key, {'1' => 'v', '2' => 'v', '3' => 'v'})
13
+ assert_not_nil @twitter.instance_variable_get(:@client)
14
+ end
15
+
16
+ def key
17
+ caller.first[/`(.*?)'/, 1]
18
+ end
19
+
20
+ end