Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. # Returns a hash or single value from the column_family:key:super_column:column
  2. # path you requested.
  3. def get(column_family, key, super_column = nil, column = nil, limit = 100)
  4. column_family += ":#{super_column}" if super_column
  5. column_family += ":#{column}" if column
  6.  
  7. # You have got to be kidding
  8. if is_super(column_family)
  9. if column
  10. @client.get_column(@table, key, column_family).value
  11. elsif super_column
  12. columns_to_hash(@client.get_superColumn(@table, key, column_family).columns)
  13. else
  14. columns_to_hash(@client.get_slice_super(@table, key, "#{column_family}:", -1, limit))
  15. end
  16. else
  17. if super_column
  18. @client.get_column(@table, key, column_family).value
  19. elsif is_sorted_by_time(column_family)
  20. columns_to_hash(@client.get_columns_since(@table, key, column_family, 0))
  21. else
  22. columns_to_hash(@client.get_slice(@table, key, "#{column_family}:", -1, limit))
  23. end
  24. end
  25. rescue NotFoundException
  26. is_super(column_family) && !column ? {} : nil
  27. end
Add Comment
Please, Sign In to add comment