Skip to content

Commit

Permalink
Merge branch 'release/0.8.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
yosukehara committed May 21, 2015
2 parents 775eacf + 5f55a07 commit 173d346
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 87 deletions.
4 changes: 2 additions & 2 deletions src/savanna_commons.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand All @@ -23,7 +23,7 @@
{application, savanna_commons,
[
{description, "Savanna's common library"},
{vsn, "0.8.9"},
{vsn, "0.8.10"},
{modules, [
savanna_commons
]},
Expand Down
2 changes: 1 addition & 1 deletion src/savanna_commons.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/savanna_commons_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/svc_metric_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/svc_metrics_counter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/svc_metrics_gauge.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/svc_metrics_histogram.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/svc_notify_behaviour.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
2 changes: 1 addition & 1 deletion src/svc_operate_behaviour.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down
43 changes: 25 additions & 18 deletions src/svc_tbl_column.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - Savanna Commons
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down Expand Up @@ -47,23 +47,30 @@
%% @doc Create a table of system-configutation
%%
create_table(Mode, Nodes) ->
mnesia:create_table(
?TBL_COLUMNS,
[{Mode, Nodes},
{type, set},
{record_name, ?SV_COLUMN},
{attributes, record_info(fields, ?SV_COLUMN)},
{user_properties,
[{id, tuple, primary},
{schema_name, binary, false },
{name, binary, false },
{type, atom, false },
{constraint, list, false },
{updated_at, integer, false },
{created_at, integer, false },
{del, boolean, false }
]}
]).
case mnesia:create_table(
?TBL_COLUMNS,
[{Mode, Nodes},
{type, set},
{record_name, ?SV_COLUMN},
{attributes, record_info(fields, ?SV_COLUMN)},
{user_properties,
[{id, tuple, primary},
{schema_name, binary, false },
{name, binary, false },
{type, atom, false },
{constraint, list, false },
{updated_at, integer, false },
{created_at, integer, false },
{del, boolean, false }
]}
]) of
{atomic, ok} ->
ok;
{aborted,{already_exists,_}} ->
ok;
{aborted,Error} ->
{error, Error}
end.

%% @doc Retrieve all records
%%
Expand Down
42 changes: 25 additions & 17 deletions src/svc_tbl_metric_group.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - SavannaDB
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down Expand Up @@ -44,22 +44,30 @@
%% @doc Create a table of system-configutation
%%
create_table(Mode, Nodes) ->
mnesia:create_table(
?TBL_NAME,
[{Mode, Nodes},
{type, set},
{record_name, sv_metric_group},
{attributes, record_info(fields, sv_metric_group)},
{user_properties,
[
{id, tuple, primary},
{schema_name, binary, false },
{name, binary, false },
{window, integer, false },
{callback, atom, false },
{created_at, integer, false }
]}
]).
case mnesia:create_table(
?TBL_NAME,
[{Mode, Nodes},
{type, set},
{record_name, sv_metric_group},
{attributes, record_info(fields, sv_metric_group)},
{user_properties,
[
{id, tuple, primary},
{schema_name, binary, false },
{name, binary, false },
{window, integer, false },
{callback, atom, false },
{created_at, integer, false }
]}
]) of
{atomic, ok} ->
ok;
{aborted,{already_exists,_}} ->
ok;
{aborted,Error} ->
{error, Error}
end.


%% @doc Retrieve all records
%%
Expand Down
34 changes: 21 additions & 13 deletions src/svc_tbl_schema.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%%
%% LeoProject - SavannaDB
%%
%% Copyright (c) 2014 Rakuten, Inc.
%% Copyright (c) 2014-2015 Rakuten, Inc.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
Expand Down Expand Up @@ -45,18 +45,26 @@
%% @doc Create a table of system-configutation
%%
create_table(Mode, Nodes) ->
mnesia:create_table(
?TBL_NAME,
[{Mode, Nodes},
{type, set},
{record_name, ?SV_SCHEMA},
{attributes, record_info(fields, ?SV_SCHEMA)},
{user_properties,
[{name, binary, primary},
{name_string, string, false },
{created_at, pos_integer, false }
]}
]).
case mnesia:create_table(
?TBL_NAME,
[{Mode, Nodes},
{type, set},
{record_name, ?SV_SCHEMA},
{attributes, record_info(fields, ?SV_SCHEMA)},
{user_properties,
[{name, binary, primary},
{name_string, string, false },
{created_at, pos_integer, false }
]}
]) of
{atomic, ok} ->
ok;
{aborted,{already_exists,_}} ->
ok;
{aborted,Error} ->
{error, Error}
end.


%% @doc Retrieve all records
%%
Expand Down
6 changes: 3 additions & 3 deletions test/basho_bench_driver_savanna_commonse.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ new(1) ->
folsom:start(),
mnesia:start(),
{ok,_Pid} = savanna_commons_sup:start_link(),
{atomic,ok} = svc_tbl_schema:create_table(ram_copies, [node()]),
{atomic,ok} = svc_tbl_column:create_table(ram_copies, [node()]),
{atomic,ok} = svc_tbl_metric_group:create_table(ram_copies, [node()]),
ok = svc_tbl_schema:create_table(ram_copies, [node()]),
ok = svc_tbl_column:create_table(ram_copies, [node()]),
ok = svc_tbl_metric_group:create_table(ram_copies, [node()]),

%% create metrics
ok = savanna_commons:create_schema(
Expand Down
12 changes: 6 additions & 6 deletions test/savanna_commons_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ suite_test_() ->
fun () ->
mnesia:start(),
{ok,_Pid} = savanna_commons_sup:start_link(),
{atomic,ok} = svc_tbl_schema:create_table(ram_copies, [node()]),
{atomic,ok} = svc_tbl_column:create_table(ram_copies, [node()]),
{atomic,ok} = svc_tbl_metric_group:create_table(ram_copies, [node()]),
ok = svc_tbl_schema:create_table(ram_copies, [node()]),
ok = svc_tbl_column:create_table(ram_copies, [node()]),
ok = svc_tbl_metric_group:create_table(ram_copies, [node()]),
ok
end,
fun (_) ->
Expand Down Expand Up @@ -96,9 +96,9 @@ counter_metrics_1() ->

mnesia:stop(),
mnesia:start(),
{atomic,ok} = svc_tbl_schema:create_table(ram_copies, [node()]),
{atomic,ok} = svc_tbl_column:create_table(ram_copies, [node()]),
{atomic,ok} = svc_tbl_metric_group:create_table(ram_copies, [node()]),
ok = svc_tbl_schema:create_table(ram_copies, [node()]),
ok = svc_tbl_column:create_table(ram_copies, [node()]),
ok = svc_tbl_metric_group:create_table(ram_copies, [node()]),
ok.

histogram_1() ->
Expand Down
34 changes: 17 additions & 17 deletions test/svc_tbl_column_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ transform() ->
constraint = [],
created_at = leo_date:now()},

{atomic,ok} = mnesia:create_table(
?TBL_COLUMNS,
[{ram_copies, [node()]},
{type, set},
{record_name, sv_column},
{attributes, record_info(fields, sv_column)},
{user_properties,
[{id, tuple, primary},
{schema_name, atom, false },
{name, atom, false },
{type, atom, false },
{constraint, list, false },
{created_at, pos_integer, false }
]}
]),
{atomic, ok} = mnesia:create_table(
?TBL_COLUMNS,
[{ram_copies, [node()]},
{type, set},
{record_name, sv_column},
{attributes, record_info(fields, sv_column)},
{user_properties,
[{id, tuple, primary},
{schema_name, atom, false },
{name, atom, false },
{type, atom, false },
{constraint, list, false },
{created_at, pos_integer, false }
]}
]),
lists:foreach(fun(Col) ->
F = fun()-> mnesia:write(?TBL_COLUMNS, Col, write) end,
leo_mnesia:write(F)
Expand Down Expand Up @@ -151,7 +151,7 @@ sync() ->
del = false
},

{atomic,ok} = svc_tbl_column:create_table(ram_copies, [node()]),
ok = svc_tbl_column:create_table(ram_copies, [node()]),
lists:foreach(fun(Col) ->
F = fun()-> mnesia:write(?TBL_COLUMNS, Col, write) end,
leo_mnesia:write(F)
Expand Down Expand Up @@ -213,7 +213,7 @@ suite() ->
updated_at = Now,
created_at = Now},

{atomic,ok} = svc_tbl_column:create_table(ram_copies, [node()]),
ok = svc_tbl_column:create_table(ram_copies, [node()]),
not_found = svc_tbl_column:all(),
not_found = svc_tbl_column:get(Col_1#?SV_COLUMN.schema_name,
Col_1#?SV_COLUMN.name),
Expand Down
2 changes: 1 addition & 1 deletion test/svc_tbl_metric_group_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ suite() ->
created_at = leo_date:now()},


{atomic,ok} = svc_tbl_metric_group:create_table(ram_copies, [node()]),
ok = svc_tbl_metric_group:create_table(ram_copies, [node()]),
not_found = svc_tbl_metric_group:all(),
not_found = svc_tbl_metric_group:get(MetricGrp_1#sv_metric_group.name),

Expand Down
4 changes: 2 additions & 2 deletions test/svc_tbl_schema_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ suite_test_() ->
sync() ->
mnesia:start(),

{atomic,ok} = svc_tbl_schema:create_table(ram_copies, [node()]),
ok = svc_tbl_schema:create_table(ram_copies, [node()]),
Schema_1 = ?SCHEMA_1,
Schema_2 = ?SCHEMA_2,
Schema_3 = ?SCHEMA_3,
Expand Down Expand Up @@ -86,7 +86,7 @@ sync() ->
suite() ->
mnesia:start(),

{atomic,ok} = svc_tbl_schema:create_table(ram_copies, [node()]),
ok = svc_tbl_schema:create_table(ram_copies, [node()]),
not_found = svc_tbl_schema:all(),
not_found = svc_tbl_schema:get(?SCHEMA_1),
not_found = svc_tbl_schema:get(?SCHEMA_2),
Expand Down

0 comments on commit 173d346

Please sign in to comment.