Permalink
Browse files

0.7/protocol calls multiget_slice inplace of multiget (removed in 0.7)

  • Loading branch information...
1 parent 6a3b72e commit 617cdf769b6b51aabe3666c69ea0af05100836da Philip (flip) Kromer committed Sep 27, 2010
Showing with 13 additions and 10 deletions.
  1. +13 −10 lib/cassandra/0.7/protocol.rb
@@ -46,21 +46,24 @@ def _get_columns(column_family, key, columns, sub_columns, consistency)
def _multiget(column_family, keys, column, sub_column, count, start, finish, reversed, consistency)
# Single values; count and range parameters have no effect
if is_super(column_family) and sub_column
- column_path = CassandraThrift::ColumnPath.new(:column_family => column_family, :super_column => column, :column => sub_column)
- multi_column_to_hash!(client.multiget(keys, column_path, consistency))
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => [column])
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => column)
+ multi_sub_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
+
elsif !is_super(column_family) and column
- column_path = CassandraThrift::ColumnPath.new(:column_family => column_family, :column => column)
- multi_column_to_hash!(client.multiget(keys, column_path, consistency))
+ predicate = CassandraThrift::SlicePredicate.new(:column_names => [column])
+ column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family)
+ multi_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
# Slices
else
- predicate = CassandraThrift::SlicePredicate.new(:slice_range =>
+ predicate = CassandraThrift::SlicePredicate.new(:slice_range =>
CassandraThrift::SliceRange.new(
- :reversed => reversed,
- :count => count,
- :start => start,
+ :reversed => reversed,
+ :count => count,
+ :start => start,
:finish => finish))
-
+
if is_super(column_family) and column
column_parent = CassandraThrift::ColumnParent.new(:column_family => column_family, :super_column => column)
multi_sub_columns_to_hash!(column_family, client.multiget_slice(keys, column_parent, predicate, consistency))
@@ -77,7 +80,7 @@ def _get_range(column_family, start, finish, count, consistency)
range = CassandraThrift::KeyRange.new(:start_key => start, :end_key => finish, :count => count)
client.get_range_slices(column_parent, predicate, range, 1)
end
-
+
def _get_range_keys(column_family, start, finish, count, consistency)
_get_range(column_family, start, finish, count, consistency).collect{|i| i.key }
end

0 comments on commit 617cdf7

Please sign in to comment.