Permalink
Browse files

initial draft

  • Loading branch information...
evanmcc committed Jan 26, 2013
1 parent e0589b2 commit 4df882f03fdd067f345f40a13d873fdf6eead692
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_2i).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_bitcask).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_cassandra).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_cassandra_cql).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -123,4 +125,4 @@ list_to_hexstr([H|T]) ->
to_hex(H) ++ list_to_hexstr(T).
bin_to_hexstr(Bin) ->
- lists:concat(["abcdef0123",list_to_hexstr(binary_to_list(Bin))]).
+ lists:concat(["abcdef0123",list_to_hexstr(binary_to_list(Bin))]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_dets).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_hibari).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_http_raw).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_innostore).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_null).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_riakc_java).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_riakc_pb).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4,
mapred_valgen/2,
@@ -127,6 +129,16 @@ run(get, KeyGen, _ValueGen, State) ->
{error, Reason} ->
{error, Reason, State}
end;
+run(get_provided, Key, _ValueGen, State) ->
+ case riakc_pb_socket:get(State#state.pid, State#state.bucket, Key,
+ [{r, State#state.r}]) of
+ {ok, _} ->
+ {ok, State};
+ {error, notfound} ->
+ {ok, State};
+ {error, Reason} ->
+ {error, Reason, State}
+ end;
run(get_existing, KeyGen, _ValueGen, State) ->
Key = KeyGen(),
case riakc_pb_socket:get(State#state.pid, State#state.bucket, Key,
@@ -148,6 +160,16 @@ run(put, KeyGen, ValueGen, State) ->
{error, Reason} ->
{error, Reason, State}
end;
+run(put_provided, Key, Value, State) ->
+ Robj0 = riakc_obj:new(State#state.bucket, Key),
+ Robj = riakc_obj:update_value(Robj0, Value),
+ case riakc_pb_socket:put(State#state.pid, Robj, [{w, State#state.w},
+ {dw, State#state.dw}]) of
+ ok ->
+ {ok, State};
+ {error, Reason} ->
+ {error, Reason, State}
+ end;
run(update, KeyGen, ValueGen, State) ->
Key = KeyGen(),
case riakc_pb_socket:get(State#state.pid, State#state.bucket,
@@ -172,6 +194,31 @@ run(update, KeyGen, ValueGen, State) ->
{error, Reason, State}
end
end;
+run(update_provided, Key, Value, State) ->
+ case riakc_pb_socket:get(State#state.pid, State#state.bucket,
+ Key, [{r, State#state.r}]) of
+ {ok, Robj} ->
+ Robj2 = riakc_obj:update_value(Robj, Value),
+ case riakc_pb_socket:put(State#state.pid,
+ Robj2, [{w, State#state.w},
+ {dw, State#state.dw}]) of
+ ok ->
+ {ok, State};
+ {error, Reason} ->
+ {error, Reason, State}
+ end;
+ {error, notfound} ->
+ Robj0 = riakc_obj:new(State#state.bucket, Key),
+ Robj = riakc_obj:update_value(Robj0, Value),
+ case riakc_pb_socket:put(State#state.pid,
+ Robj, [{w, State#state.w},
+ {dw, State#state.dw}]) of
+ ok ->
+ {ok, State};
+ {error, Reason} ->
+ {error, Reason, State}
+ end
+ end;
run(update_existing, KeyGen, ValueGen, State) ->
Key = KeyGen(),
case riakc_pb_socket:get(State#state.pid, State#state.bucket,
@@ -21,6 +21,8 @@
%% -------------------------------------------------------------------
-module(basho_bench_driver_riakclient).
+-compile({parse_transform, basho_bench_provide}).
+
-export([new/1,
run/4]).
@@ -30,6 +30,9 @@
%% API
%% ====================================================================
+new({fixed_bin, var_size}, _Id) ->
+ Source = init_source(),
+ fun(Size) -> data_block(Source, Size) end;
new({fixed_bin, Size}, _Id) ->
Source = init_source(),
fun() -> data_block(Source, Size) end;
Oops, something went wrong.

0 comments on commit 4df882f

Please sign in to comment.