cassandra 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.11.4
2
+ - Fix get_range to invoke blocks
3
+ - Fix current distribution urls in Rakfile. Resolves Issue# 97.
4
+
1
5
  v0.11.3
2
6
  - Fix login after reconnect
3
7
 
data/Rakefile CHANGED
@@ -18,8 +18,8 @@ end
18
18
 
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
- '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-bin.tar.gz'
21
+ '0.7' => 'http://www.apache.org/dist/cassandra/0.7.7/apache-cassandra-0.7.7-bin.tar.gz',
22
+ '0.8' => 'http://www.apache.org/dist/cassandra/0.8.1/apache-cassandra-0.8.1-bin.tar.gz'
23
23
  }
24
24
 
25
25
  CASSANDRA_HOME = ENV['CASSANDRA_HOME'] || "#{ENV['HOME']}/cassandra"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cassandra}
5
- s.version = "0.11.3"
5
+ s.version = "0.11.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0.8") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = [%q{Evan Weaver, Ryan King}]
9
- s.date = %q{2011-07-05}
9
+ s.date = %q{2011-07-22}
10
10
  s.description = %q{A Ruby client for the Cassandra distributed database.}
11
11
  s.email = %q{}
12
12
  s.executables = [%q{cassandra_helper}]
@@ -680,11 +680,11 @@ class Cassandra
680
680
  # * :reversed - If set to true the results will be returned in reverse order.
681
681
  # * :consistency - Uses the default read consistency if none specified.
682
682
  #
683
- def get_range(column_family, options = {})
683
+ def get_range(column_family, options = {}, &blk)
684
684
  if block_given? || options[:key_count] || options[:batch_size]
685
- get_range_batch(column_family, options)
685
+ get_range_batch(column_family, options, &blk)
686
686
  else
687
- get_range_single(column_family, options)
687
+ get_range_single(column_family, options, &blk)
688
688
  end
689
689
  end
690
690
 
@@ -191,7 +191,7 @@ class Cassandra
191
191
  end
192
192
  end
193
193
 
194
- def get_range(column_family, options = {})
194
+ def get_range(column_family, options = {}, &blk)
195
195
  column_family, _, _, options = extract_and_validate_params_for_real(column_family, "", [options],
196
196
  READ_DEFAULTS.merge(:start_key => '',
197
197
  :end_key => '',
@@ -207,7 +207,7 @@ class Cassandra
207
207
  options[:start],
208
208
  options[:finish],
209
209
  options[:count],
210
- options[:consistency])
210
+ options[:consistency], &blk)
211
211
  end
212
212
 
213
213
  def get_range_keys(column_family, options = {})
@@ -337,7 +337,7 @@ class Cassandra
337
337
  @schema
338
338
  end
339
339
 
340
- def _get_range(column_family, start_key, finish_key, key_count, columns, start, finish, count, consistency)
340
+ def _get_range(column_family, start_key, finish_key, key_count, columns, start, finish, count, consistency, &blk)
341
341
  ret = OrderedHash.new
342
342
  start = to_compare_with_type(start, column_family)
343
343
  finish = to_compare_with_type(finish, column_family)
@@ -347,9 +347,11 @@ class Cassandra
347
347
  if columns
348
348
  #ret[key] = columns.inject(OrderedHash.new){|hash, column_name| hash[column_name] = cf(column_family)[key][column_name]; hash;}
349
349
  ret[key] = columns_to_hash(column_family, cf(column_family)[key].select{|k,v| columns.include?(k)})
350
+ blk.call(key,ret[key]) unless blk.nil?
350
351
  else
351
352
  #ret[key] = apply_range(cf(column_family)[key], column_family, start, finish, !is_super(column_family))
352
353
  ret[key] = apply_range(columns_to_hash(column_family, cf(column_family)[key]), column_family, start, finish)
354
+ blk.call(key,ret[key]) unless blk.nil?
353
355
  end
354
356
  end
355
357
  end
@@ -259,6 +259,23 @@ class CassandraTest < Test::Unit::TestCase
259
259
  assert_equal(4, @twitter.get_range_keys(:Statuses, :key_count => 4).size)
260
260
  end
261
261
 
262
+ def test_get_range_block
263
+ k = key
264
+ 5.times do |i|
265
+ @twitter.insert(:Statuses, k+i.to_s, {"body-#{i.to_s}" => 'v'})
266
+ end
267
+
268
+ values = (0..4).collect{|n| { :key => "test_get_range_block#{n}", :columns => { "body-#{n}" => "v" }} }.reverse
269
+
270
+ @twitter.get_range(:Statuses, :start_key => k.to_s, :key_count => 5) { |key,columns|
271
+ expected = values.pop
272
+ assert_equal expected[:key], key
273
+ assert_equal expected[:columns], columns
274
+ }
275
+ assert_equal [],values
276
+
277
+ end
278
+
262
279
  def test_each_key
263
280
  k = key
264
281
  keys_yielded = []
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: 53
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 3
10
- version: 0.11.3
9
+ - 4
10
+ version: 0.11.4
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-07-05 00:00:00 Z
18
+ date: 2011-07-22 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thrift_client