wpool_process (worker_pool v7.0.0)

View Source

Decorator over gen_server that lets wpool_pool control certain aspects of the execution.

Summary

Types

Options for process control. The atoms, like time_checker and event_manager, correspond to registered process names.

Internal state.

API Functions

Equivalent to gen_server:call(Process, Call, Timeout).

Equivalent to gen_server:cast(Process, {cast, Cast}).

Runs a function that takes as a parameter the given process.

Equivalent to gen_server:send_request(Process, Request).

Types

opts()

-nominal opts() ::
             #{time_checker := atom(),
               queue_manager := atom(),
               event_manager := atom(),
               overrun_warning := timeout(),
               _ => _}.

Options for process control. The atoms, like time_checker and event_manager, correspond to registered process names.

state()

-opaque state()

Internal state.

API Functions

call(Process, Call, Timeout)

-spec call(wpool:name() | pid(), term(), timeout()) -> term().

Equivalent to gen_server:call(Process, Call, Timeout).

cast(Process, Cast)

-spec cast(wpool:name() | pid(), term()) -> ok.

Equivalent to gen_server:cast(Process, {cast, Cast}).

run(Process, Run, Timeout)

-spec run(wpool:name() | pid(), wpool:run(Result), timeout()) -> Result.

Runs a function that takes as a parameter the given process.

send_request(Name, Request)

-spec send_request(wpool:name() | pid(), term()) -> gen_server:request_id().

Equivalent to gen_server:send_request(Process, Request).

start_link(Name, Module, InitArgs, Options)

-spec start_link(wpool:name(), module(), term(), wpool:options()) ->
                    {ok, pid()} | ignore | {error, {already_started, pid()} | term()}.

Starts a named process.