-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefer three % for module docs and remove author comments
- Loading branch information
1 parent
950c85b
commit 0589755
Showing
6 changed files
with
54 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
%% @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). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
%% @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). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ | |
% specific language governing permissions and limitations | ||
% under the License. | ||
%%% @private | ||
%%% @author Fernando Benavides <[email protected]> | ||
%%% @doc Decorator over `gen_server' that lets `wpool_pool' | ||
%%% control certain aspects of the execution | ||
-module(wpool_process). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
%%% @doc Common functions for wpool_process and other modules. | ||
-module(wpool_utils). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
%% @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). | ||
|