Behaviours: supervisor.
Authors: Fernando Benavides (elbrujohalcon@inaka.net).
wpool() = #wpool{}
best_worker/1 | Picks the worker with the smaller queue of messages. |
call_available_worker/3 | Picks the first available worker and sends the call to it. |
cast_to_available_worker/2 | Casts a message to the first available worker. |
create_table/0 | Creates the ets table that will hold the information about active pools. |
find_wpool/1 | Use this function to get the Worker pool record in a custom worker. |
hash_worker/2 | Picks a worker base on a hash result. |
next_available_worker/1 | Picks the first available worker, if any. |
next_worker/1 | Picks the next worker in a round robin fashion. |
random_worker/1 | Picks a random worker. |
send_all_event_to_available_worker/2 | Sends an event to the first available worker. |
send_event_to_available_worker/2 | Sends an event to the first available worker. |
start_link/2 | Starts a supervisor with several wpool_process es as its children. |
stats/1 | Retrieves a snapshot of the pool stats. |
sync_send_all_event_to_available_worker/3 | Picks the first available worker and sends the event to it. |
sync_send_event_to_available_worker/3 | Picks the first available worker and sends the event to it. |
worker_names/1 | Returns the names of the workers in the pool. |
wpool_get/2 | Get values from the worker pool record. |
wpool_set/2 | Set values from the worker pool record. |
wpool_size/1 | the number of workers in the pool. |
best_worker(Sup::wpool:name()) -> atom()
throws no_workers
Picks the worker with the smaller queue of messages.
call_available_worker(Sup::wpool:name(), Call::any(), Timeout::timeout()) -> any()
throws no_workers | timeout
Picks the first available worker and sends the call to it. The timeout provided includes the time it takes to get a worker and for it to process the call.
cast_to_available_worker(Sup::wpool:name(), Cast::term()) -> ok
Casts a message to the first available worker. Since we can wait forever for a wpool:cast to be delivered but we don't want the caller to be blocked, this function just forwards the cast when it gets the worker
create_table() -> ok
Creates the ets table that will hold the information about active pools
find_wpool(Name::atom()) -> undefined | wpool()
Use this function to get the Worker pool record in a custom worker.
hash_worker(Sup::wpool:name(), HashKey::term()) -> atom()
throws no_workers
Picks a worker base on a hash result.
phash2(Term, Range)returns hash = integer, 0 <= hash < Range so
1must be added
next_available_worker(Sup::wpool:name()) -> atom()
throws no_workers | no_available_workers
Picks the first available worker, if any
next_worker(Sup::wpool:name()) -> atom()
throws no_workers
Picks the next worker in a round robin fashion
random_worker(Sup::wpool:name()) -> atom()
throws no_workers
Picks a random worker
send_all_event_to_available_worker(Sup::wpool:name(), Event::term()) -> ok
Sends an event to the first available worker. Since we can wait forever for a wpool:send_event to be delivered but we don't want the caller to be blocked, this function just forwards the event when it gets the worker
send_event_to_available_worker(Sup::wpool:name(), Event::term()) -> ok
Sends an event to the first available worker. Since we can wait forever for a wpool:send_event to be delivered but we don't want the caller to be blocked, this function just forwards the event when it gets the worker
start_link(Name::wpool:name(), Options::[wpool:option()]) -> {ok, pid()} | {error, {already_started, pid()} | term()}
Starts a supervisor with several wpool_process
es as its children
stats(Sup::wpool:name()) -> wpool:stats()
throws no_workers
Retrieves a snapshot of the pool stats
sync_send_all_event_to_available_worker(Sup::wpool:name(), Event::any(), Timeout::timeout()) -> any()
throws no_workers | timeout
Picks the first available worker and sends the event to it. The timeout provided includes the time it takes to get a worker and for it to process the call.
sync_send_event_to_available_worker(Sup::wpool:name(), Event::any(), Timeout::timeout()) -> any()
throws no_workers | timeout
Picks the first available worker and sends the event to it. The timeout provided includes the time it takes to get a worker and for it to process the call.
worker_names(Pool_Name::wpool:name()) -> [atom()]
Returns the names of the workers in the pool
wpool_get(List::atom(), WPool::wpool()) -> any()
Get values from the worker pool record. Useful when using a custom strategy function.
Set values from the worker pool record. Useful when using a custom strategy function.
wpool_size(Name::atom()) -> non_neg_integer() | undefined
the number of workers in the pool
Generated by EDoc, Apr 28 2016, 11:36:37.