Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Returns a hash or single value from the column_family:key:super_column:column
- # path you requested.
- def get(column_family, key, super_column = nil, column = nil, limit = 100)
- column_family += ":#{super_column}" if super_column
- column_family += ":#{column}" if column
- # You have got to be kidding
- if is_super(column_family)
- if column
- @client.get_column(@table, key, column_family).value
- elsif super_column
- columns_to_hash(@client.get_superColumn(@table, key, column_family).columns)
- else
- columns_to_hash(@client.get_slice_super(@table, key, "#{column_family}:", -1, limit))
- end
- else
- if super_column
- @client.get_column(@table, key, column_family).value
- elsif is_sorted_by_time(column_family)
- columns_to_hash(@client.get_columns_since(@table, key, column_family, 0))
- else
- columns_to_hash(@client.get_slice(@table, key, "#{column_family}:", -1, limit))
- end
- end
- rescue NotFoundException
- is_super(column_family) && !column ? {} : nil
- end
Add Comment
Please, Sign In to add comment