Skip to content

Commit

Permalink
Fix Dialyzer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoegele committed Sep 20, 2016
1 parent fdcce67 commit 4067bc4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/riak_core_table_owner.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@

%% Unfortunately the `ets' module does not define a type for options, but we
%% can at least insist on a list.
-type ets_options() :: [].
-type ets_options() :: list().
-type ets_table() :: ets:tab().
-type create_table_result() :: {ok, ets_table()} | {error, Reason::term()}.

%%%===================================================================
%%% API
Expand All @@ -70,7 +72,7 @@ start_link() ->
%% Since the table will be owned by the `riak_core_table_owner' process, it
%% should be created with the `public' option so that other processes can read
%% and write data in the table.
-spec create_table(Name::atom(), Options::ets_options()) -> ets:tid().
-spec create_table(Name::atom(), Options::ets_options()) -> create_table_result().
create_table(Name, Options) ->
gen_server:call(?MODULE, {create_table, Name, Options}).

Expand All @@ -79,7 +81,7 @@ create_table(Name, Options) ->
%% Since the table will be owned by the `riak_core_table_owner' process, it
%% should be created with the `public' option so that other processes can read
%% and write data in the table.
-spec maybe_create_table(Name::atom(), Options::ets_options()) -> ets:tid().
-spec maybe_create_table(Name::atom(), Options::ets_options()) -> create_table_result().
maybe_create_table(Name, Options) ->
gen_server:call(?MODULE, {maybe_create_table, Name, Options}).

Expand Down
9 changes: 7 additions & 2 deletions src/riak_core_throttle.erl
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@
%% @doc Initialize the throttling subsystem. Should be called just once during
%% startup, although calling multiple times will not have any negative
%% consequences.
-spec init() -> ok.
init() ->
{ok, ?ETS_TABLE_NAME} = riak_core_table_owner:maybe_create_table(?ETS_TABLE_NAME,
?ETS_TABLE_OPTIONS).
case riak_core_table_owner:maybe_create_table(?ETS_TABLE_NAME, ?ETS_TABLE_OPTIONS) of
{ok, ?ETS_TABLE_NAME} ->
ok;
{error, Reason} ->
throw({"Failed to create ETS table for riak_core_throttle", Reason})
end.

%% @doc Sets the throttle for the activity identified by `AppName' and `Key' to
%% the specified `Time'.
Expand Down

0 comments on commit 4067bc4

Please sign in to comment.