Skip to content

Commit

Permalink
Prefer three % for module docs and remove author comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Dec 19, 2023
1 parent 51752ff commit 305d113
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 57 deletions.
82 changes: 42 additions & 40 deletions src/wpool.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,48 @@
% KIND, either express or implied. See the License for the
% specific language governing permissions and limitations
% under the License.
%% @author Fernando Benavides <elbrujohalcon@inaka.net>
%% @doc Worker pool main interface.
%%
%% Use functions provided by this module to manage your pools of workers.
%%
%% <h2>Starting the application</h2>
%% <b>Worker Pool</b> is an Erlang application that can be started using the functions in the
%% `application' module. For convenience, `wpool:start/0' and `wpool:stop/0' are also provided.
%%
%% <h2>Starting a Pool</h2>
%%
%% To start a new worker pool, you can either
%% <ul>
%% <li>Use `wpool:child_spec/2' if you want to add the pool under a supervision tree
%% initialisation;</li>
%% <li>Use `wpool:start_pool/1' or `wpool:start_pool/2' if you want to supervise it yourself;</li>
%% <li>Use `wpool:start_sup_pool/1' or `wpool:start_sup_pool/2' if you want the pool to live under
%% wpool's supervision tree.</li>
%% </ul>
%%
%% <h2>Stopping a Pool</h2>
%% To stop a pool, just use `wpool:stop_pool/1' or `wpool:stop_sup_pool/1' according to how you
%% started the pool.
%%
%% <h2>Using the Workers</h2>
%%
%% Since the workers are `gen_server's, messages can be `call'ed or `cast'ed to them. To do that you
%% can use `wpool:call' and `wpool:cast' as you would use the equivalent functions on `gen_server'.
%%
%% <h3>Choosing a Strategy</h3>
%%
%% Beyond the regular parameters for `gen_server', wpool also provides an extra optional parameter
%% <b>Strategy</b> The strategy used to pick up the worker to perform the task. If not provided,
%% the result of `wpool:default_strategy/0' is used.
%%
%% The available strategies are defined in the `t:wpool:strategy/0' type.
%%
%% <h2>Watching a Pool</h2>
%% Wpool provides a way to get live statistics about a pool. To do that, you can use
%% `wpool:stats/1'.
%%% @doc Worker pool main interface.
%%%
%%% Use functions provided by this module to manage your pools of workers.
%%%
%%% <h2>Starting the application</h2>
%%% <b>Worker Pool</b> is an Erlang application that can be started using the functions in the
%%% `application' module. For convenience, `wpool:start/0' and `wpool:stop/0' are also provided.
%%%
%%% <h2>Starting a Pool</h2>
%%%
%%% To start a new worker pool, you can either
%%% <ul>
%%% <li>Use `wpool:child_spec/2' if you want to add the pool under a supervision tree
%%% initialisation;</li>
%%% <li>Use `wpool:start_pool/1' or `wpool:start_pool/2' if you want to supervise it
%%% yourself;</li>
%%% <li>Use `wpool:start_sup_pool/1' or `wpool:start_sup_pool/2' if you want the pool to live
%%% under
%%% wpool's supervision tree.</li>
%%% </ul>
%%%
%%% <h2>Stopping a Pool</h2>
%%% To stop a pool, just use `wpool:stop_pool/1' or `wpool:stop_sup_pool/1' according to how you
%%% started the pool.
%%%
%%% <h2>Using the Workers</h2>
%%%
%%% Since the workers are `gen_server's, messages can be `call'ed or `cast'ed to them. To do that
%%% you can use `wpool:call' and `wpool:cast' as you would use the equivalent functions on
%%% `gen_server'.
%%%
%%% <h3>Choosing a Strategy</h3>
%%%
%%% Beyond the regular parameters for `gen_server', wpool also provides an extra optional parameter
%%% <b>Strategy</b> The strategy used to pick up the worker to perform the task. If not provided,
%%% the result of `wpool:default_strategy/0' is used.
%%%
%%% The available strategies are defined in the `t:wpool:strategy/0' type.
%%%
%%% <h2>Watching a Pool</h2>
%%% Wpool provides a way to get live statistics about a pool. To do that, you can use
%%% `wpool:stats/1'.
-module(wpool).

-behaviour(application).
Expand Down
18 changes: 8 additions & 10 deletions src/wpool_pool.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
% KIND, either express or implied. See the License for the
% specific language governing permissions and limitations
% under the License.
%% @author Fernando Benavides <elbrujohalcon@inaka.net>
%% @doc Top supervisor for a `worker_pool'.
%%
%% This supervisor supervises `wpool_process_sup' (which is the worker's supervisor) together with
%% auxiliary servers that help keep the whole pool running and in order.
%%
%%
%% The strategy of this supervisor must be `one_for_all' but the intensity and period may be changed
%% from their defaults by the `t:wpool:pool_sup_intensity()' and `t:wpool:pool_sup_intensity()'
%% options respectively.
%%% @doc Top supervisor for a `worker_pool'.
%%%
%%% This supervisor supervises `wpool_process_sup' (which is the worker's supervisor) together with
%%% auxiliary servers that help keep the whole pool running and in order.
%%%
%%% The strategy of this supervisor must be `one_for_all' but the intensity and period may be
%%% changed from their defaults by the `t:wpool:pool_sup_intensity()' and
%%% `t:wpool:pool_sup_intensity()' options respectively.
-module(wpool_pool).

-behaviour(supervisor).
Expand Down
1 change: 0 additions & 1 deletion src/wpool_process.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
% specific language governing permissions and limitations
% under the License.
%%% @private
%%% @author Fernando Benavides <elbrujohalcon@inaka.net>
%%% @doc Decorator over `gen_server' that lets `wpool_pool'
%%% control certain aspects of the execution
-module(wpool_process).
Expand Down
2 changes: 1 addition & 1 deletion src/wpool_process_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
% KIND, either express or implied. See the License for the
% specific language governing permissions and limitations
% under the License.
%% @doc This is the supervisor that supervises the `gen_server' workers specifically.
%%% @doc This is the supervisor that supervises the `gen_server' workers specifically.
-module(wpool_process_sup).

-behaviour(supervisor).
Expand Down
1 change: 0 additions & 1 deletion src/wpool_utils.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
% KIND, either express or implied. See the License for the
% specific language governing permissions and limitations
% under the License.
%%% @author Felipe Ripoll <ferigis@gmail.com>
%%% @doc Common functions for wpool_process and other modules.
-module(wpool_utils).

Expand Down
7 changes: 3 additions & 4 deletions src/wpool_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
% KIND, either express or implied. See the License for the
% specific language governing permissions and limitations
% under the License.
%% @author Fernando Benavides <elbrujohalcon@inaka.net>
%% @doc Default instance for `wpool_process'
%%
%% It is a module that implements a very simple RPC-like interface.
%%% @doc Default instance for `wpool_process'
%%%
%%% It is a module that implements a very simple RPC-like interface.
-module(wpool_worker).

-behaviour(gen_server).
Expand Down

0 comments on commit 305d113

Please sign in to comment.