Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
drewkerrigan committed Dec 6, 2013
1 parent 447e85c commit df1dedc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
6 changes: 3 additions & 3 deletions examples/http.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
{targets, [
{base_uri_t, {"localhost", 4567, "/"}},
{with_key_t, {"localhost", 4567, {"/~s", [key_generator]}}},
{with_another_key_t, {"localhost", 4567, {"another/~s", [string_g]}}},
{smallbin_t, {"localhost", 4567, {"smallbin/~s", [key_generator]}}},
{upload_t, {"localhost", 4567, {"upload/~s", [key_generator]}}}
{with_another_key_t, {"localhost", 4567, {"/another/~s", [string_g]}}},
{smallbin_t, {"localhost", 4567, {"/smallbin/~s", [key_generator]}}},
{upload_t, {"localhost", 4567, {"/upload/~s", [key_generator]}}}
]}.

%%% Operations: {{get|delete, Target}, Weight}
Expand Down
23 changes: 9 additions & 14 deletions src/basho_bench_driver_http.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@
%% API
%% ====================================================================


build_generators([{Name, {key_generator, KeyGenSpec}}|Rest], Generators, Id) ->
KeyGen = basho_bench_keygen:new(KeyGenSpec, Id),
build_generators(Rest, [{Name, KeyGen}|Generators], Id);
build_generators([{Name, {value_generator, ValGenSpec}}|Rest], Generators, Id) ->
ValGen = basho_bench_valgen:new(ValGenSpec, Id),
build_generators(Rest, [{Name, ValGen}|Generators], Id);
build_generators([], Generators, _) ->
Generators.

new(Id) ->
?DEBUG("ID: ~p\n", [Id]),

Expand Down Expand Up @@ -147,9 +137,16 @@ run({delete, Target, HeaderName}, KeyGen, ValueGen, State) ->
%% Internal functions
%% ====================================================================

evaluate_generator(Name, Generators, KeyGen, ValueGen) ->
io:format("build_formatted_value_yeah2~n Name: ~p~n Generators: ~p~n Keygen: ~p~n ValueGen: ~p~n", [Name, Generators, KeyGen, ValueGen]),
build_generators([{Name, {key_generator, KeyGenSpec}}|Rest], Generators, Id) ->
KeyGen = basho_bench_keygen:new(KeyGenSpec, Id),
build_generators(Rest, [{Name, KeyGen}|Generators], Id);
build_generators([{Name, {value_generator, ValGenSpec}}|Rest], Generators, Id) ->
ValGen = basho_bench_valgen:new(ValGenSpec, Id),
build_generators(Rest, [{Name, ValGen}|Generators], Id);
build_generators([], Generators, _) ->
Generators.

evaluate_generator(Name, Generators, KeyGen, ValueGen) ->
case Name of
key_generator -> KeyGen();
value_generator -> ValueGen();
Expand All @@ -160,7 +157,6 @@ evaluate_generator(Name, Generators, KeyGen, ValueGen) ->
end.

build_formatted_value(String, GeneratorNames, Generators, KeyGen, ValueGen) ->
io:format("build_formatted_value_yeah1~n String: ~p~n GeneratorNames: ~p~n Generators: ~p~n KeyGen: ~p~n ValueGen: ~p~n", [String, GeneratorNames, Generators, KeyGen, ValueGen]),
Values = lists:map(fun (Name) -> evaluate_generator(Name, Generators, KeyGen, ValueGen) end, GeneratorNames),
io_lib:format(String, Values).

Expand All @@ -170,7 +166,6 @@ build_url({Host, Port, {FormattedPath, GeneratorNames}}, Generators, KeyGen, Val
build_url({Host, Port, Path}, _, _, _) ->
#url{host=Host, port=Port, path=Path};
build_url(Target, KeyGen, ValueGen, State) ->
io:format("build_url~n Target: ~p~n State: ~p~n", [Target, State]),
build_url(proplists:get_value(Target, State#state.targets), State#state.generators, KeyGen, ValueGen).

build_value(ValueName, KeyGen, ValueGen, State) ->
Expand Down

0 comments on commit df1dedc

Please sign in to comment.