Created
July 17, 2012 16:46
-
-
Save randysecrist/3130528 to your computer and use it in GitHub Desktop.
simple 2i test that should print true 5 times in leveldb, but only 4 times with memory backend.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'riak' | |
c = Riak::Client.new(:nodes => [{:host => 'localhost', :http_port => 8091}]) | |
b = c.bucket('foo') | |
ro1 = b.get_or_new('one') | |
ro1.raw_data = "Hello, world!" | |
ro1.content_type = "text/html" | |
ro1.indexes['date_bin'] << '2012-07-13' | |
ro1.store | |
ro2 = b.get_or_new('two') | |
ro2.raw_data = "Ola Mundo!" | |
ro2.content_type = "text/html" | |
ro2.indexes['date_bin'] << '2012-07-12' | |
ro2.store | |
ro3 = b.get_or_new('three') | |
ro3.raw_data = "Guten Tag!" | |
ro3.content_type = "text/html" | |
ro3.indexes['date_bin'] << '2012-07-11' | |
ro3.store | |
result = b.get_index('date_bin', '2012-07-11'..'2012-07-13') | |
puts 3 == result.length | |
result = b.get_index('date_bin', '2012-07-11'..'2012-07-12') | |
puts 2 == result.length | |
result = b.get_index('date_bin', '2012-07-11'..'2012-07-11') | |
puts 1 == result.length | |
result = b.get_index('date_bin', '2012-07-09'..'2012-07-10') | |
puts 0 == result.length | |
result = b.get_index("$key", 'two'..'two') | |
puts 1 == result.length |
We should add this to the riak_test for 2i. I'll look into that today, hopefully.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in riak 1.2rc1, toggle between {storage_backend, riak_kv_eleveldb_backend}, and {storage_backend, riak_kv_memory_backend}