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
{"inputs":"bucket", | |
"query":[ | |
{"map":{"language":"javascript", "name":"Riak.mapValuesJson"}}, | |
{"reduce":{"language":"javascript", "source":"function(values){ return values.slice(0,20); }"}} | |
] | |
} |
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
{"inputs":[["users","seancribbs"]], |
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' | |
client = Riak::Client.new | |
bucket = client['people'] | |
sean = bucket.new('sean') | |
sean.data = {"name" => "Sean Cribbs"} | |
puts "Storing Justin." |
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
$ curl --raw http://localhost:8098/riak/goog?keys=stream | |
13a | |
{"props":{"name":"goog","n_val":3,"allow_mult":false,"last_write_wins":false,"precommit":[],"postcommit":[],"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"old_vclock":86400,"young_vclock":20,"big_vclock":50,"small_vclock":10}} | |
3cc | |
{"keys":["2010-03-29","2010-02-12","2010-02-09","2009-12-30","2009-12-03","2009-11-19","2009-10-23","2009-09-04","2009-08-17","2009-07-20","2009-06-17","2009-06-15","2009-04-07","2009-03-04","2009-03-03","2009-02-11","2009-01-09","2008-12-19","2008-11-26","2008-10-01","2008-07-16","2008-07-07","2008-06-20","2008-04-29","2008-03-27","2008-03-10","2008-02-04","2008-01-24","2008-01-07","2007-12-24","2007-12-12","2007-12-10","2007-11-27","2007-11-14","2007-11-13","2007-10-29","2007-10-17","2007-09-21","2007-09-04","2007-08-03","2007-07-13","2007-04-10","2007-02-05","2007-01-31","2006-11-30","2006-11-29","2006-11-15","2006-10-26","2006-10-25 |
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
PGError: ERROR: column "Riak" does not exist LINE 1: ...eta_tag_id = meta_tags.id AND (meta_tags.name IN ("Riak")) G... ^ : SELECT pages.* FROM pages, meta_tags, taggings WHERE pages.id = taggings.taggable_id AND taggings.taggable_type = 'Page' AND taggings.meta_tag_id = meta_tags.id AND (meta_tags.name IN ("Riak")) GROUP BY pages.id, pages.title, pages.slug, pages.breadcrumb, pages.class_name, pages.status_id, pages.parent_id, pages.layout_id, pages.created_at, pages.updated_at, pages.published_at, pages.created_by_id, pages.updated_by_id, pages.virtual, pages.lock_version, pages.description, pages.keywords HAVING COUNT(taggings.meta_tag_id) = 1 |
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
-module(test_helper). | |
-export([riak_test/1]). | |
riak_test(Fun) -> | |
start_riak(), | |
{ok, Riak} = riak:local_client(), | |
Ret = (catch Fun(Riak)), | |
stop_riak(), | |
case Ret of |
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
%% Based on Okasaki 6.2.2 | |
-module(binomial_heap). | |
-export([insert/2, insert/3, merge/2, delete/1, to_list/1, take/2,esize/1]). | |
-record(node,{rank,key,value,children=[]}). | |
% Inserts a new pair into the heap (or creates a new heap) | |
insert(Key,Value) -> | |
insert(Key,Value,[]). | |
insert(Key,Value,Forest) -> |
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
Ripple.config = YAML.load_file(::File.expand_path("../../config/ripple.yml", __FILE__))[ENV['RACK_ENV']] |
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
# Add this line to your config/application.rb to enable | |
# initialization of Ripple, after the other framework railties | |
require 'ripple/railtie' | |
# To use the Riak cache store, place this line inside the | |
# Application class | |
config.cache_store = :riak_store |
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
diff --git a/bin/mapreduce b/bin/mapreduce | |
index c661dda..ee7321a 100755 | |
--- a/bin/mapreduce | |
+++ b/bin/mapreduce | |
@@ -25,9 +25,9 @@ map_func_word_count_per_tweet = <<-JAVASCRIPT | |
try { | |
tweet = Riak.mapValuesJson(value)[0]; | |
word_count = tweet["text"] ? tweet["text"].split(" ").length : 0; | |
- return [ { word_count: word_count } ]; | |
+ return [ word_count ]; |