behaviour_info(callbacks) ->
[
{api_version,0},
This file contains hidden or 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
| #!/usr/bin/env python | |
| import httplib | |
| import json | |
| from datetime import datetime, date, time | |
| from time import sleep | |
| import os.path | |
| from multiprocessing import Process | |
This file contains hidden or 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
| import scala.concurrent.duration._ | |
| import scala.concurrent.ExecutionContext | |
| import scala.concurrent.Future | |
| import akka.pattern.after | |
| import akka.actor.Scheduler | |
| /** | |
| * Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown, | |
| * in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through | |
| * the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure. |
This file contains hidden or 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
| echo "Data load start time: $(date +%s)" | |
| for i in {1..100} | |
| do | |
| curl -XPOST http://localhost:10018/riak/some_bucket -d "$RANDOM" -H "X-Riak-Index-Timestamp_int: $(date +%s)" -H "Content-Type: text/plain" | |
| sleep 0.5 | |
| done | |
| echo "Data load end time: $(date +%s)" | |
| echo "Running MapReduce" | |
| curl -XPOST http://localhost:10018/mapred -H "Content-Type: application/json" -d ' |
- Starting: https://github.com/basho/riak_kv/blob/1.4.2/src/riak_kv_wm_object.erl#L619
- We create a new
riak_objectand populate the various fields with the headers, metadata supplied by the client. - Big suprise, we eventually call
riak_client:put: https://github.com/basho/riak_kv/blob/1.4.2/src/riak_client.erl#L143 - If/when the client returns any errors these are handled in
handle_common_errorsand it is nice to return human readable errors to client :)
This file contains hidden or 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
| %% Get the state for the local node | |
| %% The get_my_ring function really returns the ring | |
| %% plus other state information about the cluster. | |
| {ok, State} = riak_core_ring_manager:get_my_ring(). | |
| %% Get number of partitions | |
| riak_core_ring:num_partitions(State). | |
| %% Get the names of custom buckets | |
| riak_core_ring:get_buckets(State). |
This file contains hidden or 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
| %% Get the state for the local node | |
| %% The get_my_ring function really returns the ring | |
| %% plus other state information about the cluster. | |
| {ok, State} = riak_core_ring_manager:get_my_ring(). | |
| %% Get number of partitions | |
| riak_core_ring:num_partitions(State). | |
| %% Get the names of custom buckets | |
| riak_core_ring:get_buckets(State). |