cassandra 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.11.2
2
+ - Update thrift_client gem to deal with failover bug.
3
+
1
4
  v0.11.1
2
5
  - Add counter support for Cassandra 0.8. (Thanks Swrve team!)
3
6
  - Add additional rake tasks to start and stop cassandra in the background.
data/README.md CHANGED
@@ -1,10 +1,7 @@
1
1
  # cassandra
2
2
  A Ruby client for the Cassandra distributed database.
3
3
 
4
- * [Getting Started](#getting-started)
5
- * [License](#license)
6
- * [Cassandra Version](#cassandra-version)
7
- * [Read/Write API Method Reference](#read-write-api-method-reference)
4
+ Supports 1.8.7, 1.9.2, and rubinius on Cassandra 0.6.13, 0.7.5, 0.8.0.
8
5
 
9
6
  ## Getting Started
10
7
 
@@ -31,10 +28,12 @@ The default version is the currently stable release of cassandra. (0.7
31
28
  at this time, but 0.8 is looming in the near future.)
32
29
 
33
30
  To use the default version simply use a normal require:
31
+
34
32
  require 'cassandra'
35
33
 
36
34
  To use a specific version (0.7 in this example) you would use a
37
35
  slightly differently formatted require:
36
+
38
37
  require 'cassandra/0.7'
39
38
 
40
39
  #### Environment Variable Method
@@ -42,12 +41,14 @@ These mechanisms work well when you are using the cassandra gem in your
42
41
  own projects or irb, but if you would rather not hard code your app to a
43
42
  specific version you can always specify an environment variable with the
44
43
  version you are using:
44
+
45
45
  export CASSANDRA_VERSION=0.7
46
46
 
47
47
  Then you would use the default require as listed above:
48
+
48
49
  require 'cassandra'
49
50
 
50
- ## Read/Write API Method Reference
51
+ ## Read/Write API Method Reference
51
52
 
52
53
  ### insert
53
54
 
@@ -90,6 +91,7 @@ This method is used to delete (actually marking them as deleted with a
90
91
  tombstone) columns or super columns.
91
92
 
92
93
  Example:
94
+
93
95
  @client.insert(:Statuses, key, {'body' => 'v', 'subject' => 'v'})
94
96
 
95
97
  @client.remove(:Statuses, key, 'body') # removes the 'body' column
@@ -107,6 +109,7 @@ Count the columns for the provided parameters.
107
109
  * :consistency - Uses the default read consistency if none specified.
108
110
 
109
111
  Example:
112
+
110
113
  @client.insert(:Statuses, key, {'body' => 'v1', 'user' => 'v2'})
111
114
  @client.count_columns(:Statuses, key) # returns 2
112
115
 
@@ -129,6 +132,7 @@ path you request.
129
132
  * :consistency - Uses the default read consistency if none specified.
130
133
 
131
134
  Example:
135
+
132
136
  @client.insert(:Users, key, {'body' => 'v', 'user' => 'v'})
133
137
  @client.get(:Users, key)) # returns {'body' => 'v', 'user' => 'v'}
134
138
 
@@ -255,7 +259,7 @@ Return an Array containing all of the keys within a given range.
255
259
  This method just calls Cassandra#get\_range and returns the
256
260
  row keys for the records returned.
257
261
 
258
- See [Cassandra#get\_range](#get-range) for options.
262
+ See Cassandra#get\_range for options.
259
263
 
260
264
  ### get\_range\_keys
261
265
 
@@ -264,7 +268,7 @@ Return an Array containing all of the keys within a given range.
264
268
  This method just calls Cassandra#get\_range and returns the
265
269
  row keys for the records returned.
266
270
 
267
- See [Cassandra#get\_range](#get-range) for options.
271
+ See Cassandra#get\_range for options.
268
272
 
269
273
  ### each\_key
270
274
  Iterate through each key within the given range parameters. This function can be
@@ -272,7 +276,7 @@ used to iterate over each key in the given column family.
272
276
 
273
277
  This method just calls Cassandra#get\_range and yields each row key.
274
278
 
275
- See [Cassandra#get\_range](#get-range) for options.
279
+ See Cassandra#get\_range for options.
276
280
 
277
281
  Example:
278
282
  10.times do |i|
@@ -291,7 +295,7 @@ Iterate through each row within the given column\_family.
291
295
  This method just calls Cassandra#get\_range and yields the key and
292
296
  columns.
293
297
 
294
- See [Cassandra#get\_range](#get-range) for options.
298
+ See Cassandra#get\_range for options.
295
299
 
296
300
  ### get\_index\_slices
297
301
  This method is used to query a secondary index with a set of
@@ -312,6 +316,7 @@ format as below.
312
316
  * :consistency
313
317
 
314
318
  Example:
319
+
315
320
  @client.create_index('Twitter', 'Statuses', 'x', 'LongType')
316
321
 
317
322
  @client.insert(:Statuses, 'row1', { 'x' => [0,10].pack("NN") })
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ unless ENV['FROM_BIN_CASSANDRA_HELPER']
9
9
  p.project = "fauna"
10
10
  p.summary = "A Ruby client for the Cassandra distributed database."
11
11
  p.rubygems_version = ">= 0.8"
12
- p.dependencies = ['thrift_client >=0.6.0', 'json', 'rake', 'simple_uuid >=0.1.0']
12
+ p.dependencies = ['thrift_client >=0.6.3', 'json', 'rake', 'simple_uuid >=0.1.0']
13
13
  p.ignore_pattern = /^(data|vendor\/cassandra|cassandra|vendor\/thrift|.*\.rbc)/
14
14
  p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
15
15
  p.retain_gemspec = true
@@ -19,7 +19,7 @@ end
19
19
  CassandraBinaries = {
20
20
  '0.6' => 'http://www.apache.org/dist/cassandra/0.6.13/apache-cassandra-0.6.13-bin.tar.gz',
21
21
  '0.7' => 'http://www.apache.org/dist/cassandra/0.7.5/apache-cassandra-0.7.5-bin.tar.gz',
22
- '0.8' => 'http://www.apache.org/dist/cassandra/0.8.0/apache-cassandra-0.8.0-rc1-bin.tar.gz'
22
+ '0.8' => 'http://www.apache.org/dist/cassandra/0.8.0/apache-cassandra-0.8.0-bin.tar.gz'
23
23
  }
24
24
 
25
25
  CASSANDRA_HOME = ENV['CASSANDRA_HOME'] || "#{ENV['HOME']}/cassandra"
data/cassandra.gemspec CHANGED
@@ -2,40 +2,40 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cassandra}
5
- s.version = "0.11.1"
5
+ s.version = "0.11.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Evan Weaver, Ryan King"]
9
- s.date = %q{2011-06-01}
8
+ s.authors = [%q{Evan Weaver, Ryan King}]
9
+ s.date = %q{2011-06-30}
10
10
  s.description = %q{A Ruby client for the Cassandra distributed database.}
11
11
  s.email = %q{}
12
- s.executables = ["cassandra_helper"]
13
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md", "bin/cassandra_helper", "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/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/column_family.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.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"]
14
- s.files = ["CHANGELOG", "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", "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/array.rb", "lib/cassandra/cassandra.rb", "lib/cassandra/column_family.rb", "lib/cassandra/columns.rb", "lib/cassandra/comparable.rb", "lib/cassandra/constants.rb", "lib/cassandra/debug.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/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", "cassandra.gemspec"]
12
+ s.executables = [%q{cassandra_helper}]
13
+ s.extra_rdoc_files = [%q{CHANGELOG}, %q{LICENSE}, %q{README.md}, %q{bin/cassandra_helper}, %q{lib/cassandra.rb}, %q{lib/cassandra/0.6.rb}, %q{lib/cassandra/0.6/cassandra.rb}, %q{lib/cassandra/0.6/columns.rb}, %q{lib/cassandra/0.6/protocol.rb}, %q{lib/cassandra/0.7.rb}, %q{lib/cassandra/0.7/cassandra.rb}, %q{lib/cassandra/0.7/columns.rb}, %q{lib/cassandra/0.7/protocol.rb}, %q{lib/cassandra/0.8.rb}, %q{lib/cassandra/0.8/cassandra.rb}, %q{lib/cassandra/0.8/columns.rb}, %q{lib/cassandra/0.8/protocol.rb}, %q{lib/cassandra/array.rb}, %q{lib/cassandra/cassandra.rb}, %q{lib/cassandra/column_family.rb}, %q{lib/cassandra/columns.rb}, %q{lib/cassandra/comparable.rb}, %q{lib/cassandra/constants.rb}, %q{lib/cassandra/debug.rb}, %q{lib/cassandra/helpers.rb}, %q{lib/cassandra/keyspace.rb}, %q{lib/cassandra/long.rb}, %q{lib/cassandra/mock.rb}, %q{lib/cassandra/ordered_hash.rb}, %q{lib/cassandra/protocol.rb}, %q{lib/cassandra/time.rb}]
14
+ s.files = [%q{CHANGELOG}, %q{LICENSE}, %q{Manifest}, %q{README.md}, %q{Rakefile}, %q{bin/cassandra_helper}, %q{conf/0.6/cassandra.in.sh}, %q{conf/0.6/log4j.properties}, %q{conf/0.6/schema.json}, %q{conf/0.6/storage-conf.xml}, %q{conf/0.7/cassandra.in.sh}, %q{conf/0.7/cassandra.yaml}, %q{conf/0.7/log4j-server.properties}, %q{conf/0.7/schema.json}, %q{conf/0.7/schema.txt}, %q{conf/0.8/cassandra.in.sh}, %q{conf/0.8/cassandra.yaml}, %q{conf/0.8/log4j-server.properties}, %q{conf/0.8/schema.json}, %q{conf/0.8/schema.txt}, %q{lib/cassandra.rb}, %q{lib/cassandra/0.6.rb}, %q{lib/cassandra/0.6/cassandra.rb}, %q{lib/cassandra/0.6/columns.rb}, %q{lib/cassandra/0.6/protocol.rb}, %q{lib/cassandra/0.7.rb}, %q{lib/cassandra/0.7/cassandra.rb}, %q{lib/cassandra/0.7/columns.rb}, %q{lib/cassandra/0.7/protocol.rb}, %q{lib/cassandra/0.8.rb}, %q{lib/cassandra/0.8/cassandra.rb}, %q{lib/cassandra/0.8/columns.rb}, %q{lib/cassandra/0.8/protocol.rb}, %q{lib/cassandra/array.rb}, %q{lib/cassandra/cassandra.rb}, %q{lib/cassandra/column_family.rb}, %q{lib/cassandra/columns.rb}, %q{lib/cassandra/comparable.rb}, %q{lib/cassandra/constants.rb}, %q{lib/cassandra/debug.rb}, %q{lib/cassandra/helpers.rb}, %q{lib/cassandra/keyspace.rb}, %q{lib/cassandra/long.rb}, %q{lib/cassandra/mock.rb}, %q{lib/cassandra/ordered_hash.rb}, %q{lib/cassandra/protocol.rb}, %q{lib/cassandra/time.rb}, %q{test/cassandra_client_test.rb}, %q{test/cassandra_mock_test.rb}, %q{test/cassandra_test.rb}, %q{test/comparable_types_test.rb}, %q{test/eventmachine_test.rb}, %q{test/ordered_hash_test.rb}, %q{test/test_helper.rb}, %q{vendor/0.6/gen-rb/cassandra.rb}, %q{vendor/0.6/gen-rb/cassandra_constants.rb}, %q{vendor/0.6/gen-rb/cassandra_types.rb}, %q{vendor/0.7/gen-rb/cassandra.rb}, %q{vendor/0.7/gen-rb/cassandra_constants.rb}, %q{vendor/0.7/gen-rb/cassandra_types.rb}, %q{vendor/0.8/gen-rb/cassandra.rb}, %q{vendor/0.8/gen-rb/cassandra_constants.rb}, %q{vendor/0.8/gen-rb/cassandra_types.rb}, %q{cassandra.gemspec}]
15
15
  s.homepage = %q{http://fauna.github.com/fauna/cassandra/}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cassandra", "--main", "README.md"]
17
- s.require_paths = ["lib"]
16
+ s.rdoc_options = [%q{--line-numbers}, %q{--inline-source}, %q{--title}, %q{Cassandra}, %q{--main}, %q{README.md}]
17
+ s.require_paths = [%q{lib}]
18
18
  s.rubyforge_project = %q{fauna}
19
- s.rubygems_version = %q{1.7.2}
19
+ s.rubygems_version = %q{1.8.5}
20
20
  s.summary = %q{A Ruby client for the Cassandra distributed database.}
21
- 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"]
21
+ s.test_files = [%q{test/cassandra_client_test.rb}, %q{test/cassandra_mock_test.rb}, %q{test/cassandra_test.rb}, %q{test/comparable_types_test.rb}, %q{test/eventmachine_test.rb}, %q{test/ordered_hash_test.rb}, %q{test/test_helper.rb}]
22
22
 
23
23
  if s.respond_to? :specification_version then
24
24
  s.specification_version = 3
25
25
 
26
26
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<thrift_client>, [">= 0.6.0"])
27
+ s.add_runtime_dependency(%q<thrift_client>, [">= 0.6.3"])
28
28
  s.add_runtime_dependency(%q<json>, [">= 0"])
29
29
  s.add_runtime_dependency(%q<rake>, [">= 0"])
30
30
  s.add_runtime_dependency(%q<simple_uuid>, [">= 0.1.0"])
31
31
  else
32
- s.add_dependency(%q<thrift_client>, [">= 0.6.0"])
32
+ s.add_dependency(%q<thrift_client>, [">= 0.6.3"])
33
33
  s.add_dependency(%q<json>, [">= 0"])
34
34
  s.add_dependency(%q<rake>, [">= 0"])
35
35
  s.add_dependency(%q<simple_uuid>, [">= 0.1.0"])
36
36
  end
37
37
  else
38
- s.add_dependency(%q<thrift_client>, [">= 0.6.0"])
38
+ s.add_dependency(%q<thrift_client>, [">= 0.6.3"])
39
39
  s.add_dependency(%q<json>, [">= 0"])
40
40
  s.add_dependency(%q<rake>, [">= 0"])
41
41
  s.add_dependency(%q<simple_uuid>, [">= 0.1.0"])
data/lib/cassandra.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- gem 'thrift_client', '~> 0.6.0'
2
+ gem 'thrift_client', '~> 0.6.3'
3
3
  require 'thrift_client'
4
4
  gem 'simple_uuid' , '~> 0.1.0'
5
5
  require 'simple_uuid'
@@ -36,7 +36,7 @@ class Cassandra
36
36
  end
37
37
 
38
38
  def multi_key_slices_to_hash(column_family, array, return_empty_rows = false)
39
- ret = {}
39
+ ret = OrderedHash.new
40
40
  array.each do |value|
41
41
  next if return_empty_rows == false && value.columns.length == 0
42
42
  ret[value.key] = columns_to_hash(column_family, value.columns)
@@ -215,7 +215,7 @@ class Cassandra
215
215
  end
216
216
 
217
217
  def count_range(column_family, options = {})
218
- get_range(column_family, options).select{|k,v| v.length > 0}.keys.compact.length
218
+ Hash[get_range(column_family, options).select{|k,v| v.length > 0}].keys.compact.length
219
219
  end
220
220
 
221
221
  def each_key(column_family, options = {})
@@ -132,7 +132,7 @@ class Cassandra
132
132
 
133
133
  class OrderedHash < OrderedHashInt #:nodoc:
134
134
  def initialize(*args, &block)
135
- @timestamps = Hash.new
135
+ @timestamps = OrderedHashInt.new
136
136
  super
137
137
  end
138
138
 
@@ -176,9 +176,10 @@ class CassandraTest < Test::Unit::TestCase
176
176
  end
177
177
 
178
178
  def test_get_several_super_keys
179
- columns = {
180
- 'mentions_timelines' => {@uuids[2] => 'v2'},
181
- 'user_timelines' => {@uuids[1] => 'v1'}}
179
+ columns = OrderedHash[
180
+ 'mentions_timelines', {@uuids[2] => 'v2'},
181
+ 'user_timelines', {@uuids[1] => 'v1'}
182
+ ]
182
183
 
183
184
  @twitter.insert(:StatusRelationships, key, columns)
184
185
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassandra
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 1
10
- version: 0.11.1
9
+ - 2
10
+ version: 0.11.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Evan Weaver, Ryan King
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-01 00:00:00 Z
18
+ date: 2011-06-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thrift_client
@@ -25,12 +25,12 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- hash: 7
28
+ hash: 1
29
29
  segments:
30
30
  - 0
31
31
  - 6
32
- - 0
33
- version: 0.6.0
32
+ - 3
33
+ version: 0.6.3
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  requirements: []
216
216
 
217
217
  rubyforge_project: fauna
218
- rubygems_version: 1.7.2
218
+ rubygems_version: 1.8.5
219
219
  signing_key:
220
220
  specification_version: 3
221
221
  summary: A Ruby client for the Cassandra distributed database.