Module: CassandraArchive::ClassMethods

Defined in:
lib/cassandra_archive.rb

Instance Method Summary collapse

Instance Method Details

#archived(options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cassandra_archive.rb', line 41

def archived(options = {})
  if time = options.delete(:after)
    options[:start] = Helper.timestamp(time).to_s
  end

  records = ::CASSANDRA_CLIENT.get('DeletedRecords', table_name, options)

  # encode attributes to utf8
  records.each_entry do |entry|
    entry.last.keys.each do |key|
      entry.last[key].force_encoding('UTF-8')
    end
  end

  if block_given?
    records.each {|key, value| yield key, value}
  end

  records
end