leo_pod_manager¶
leo_pod_manager can manage worker pools in the pod.
Behaviours: `gen_server <gen_server.html>`__.
References
Description¶
leo_pod_manager can manage worker pools in the pod
Function Index¶
checkin/2 | Check in a worker to the woker pool. |
checkin_async/2 | Check in a worker to the worker pool with asynchronous. |
checkout/1 | Check out a worker from the worker pool. |
close/1 | Retrieve pids of specified PodName. |
code_change/3 | gen_server callback - Module:code_change(OldVsn, State, Extra) -> {ok, NewState} | {error, Reason}. |
handle_call/3 | gen_server callback - Module:handle_call(Request, From, State) -> Result. |
handle_cast/2 | gen_server callback - Module:handle_cast(Request, State) -> Result. |
handle_info/2 | gen_server callback - Module:handle_info(Info, State) -> Result. |
init/1 | gen_server callback - Module:init(Args) -> Result. |
pool_pids/1 | Retrieve pids of specified PodName. |
raw_status/1 | Retrieve a raw status of specified PodName. |
start_link/6 | Initialize a wooker pool. |
status/1 | Retrieve the current status in pretty format as follows: format: { working_process_count, worker_process_count, overflow_count }. |
stop/1 | Stop the worker pool. |
terminate/2 | gen_server callback - Module:terminate(Reason, State). |
Function Details¶
checkin/2¶
checkin(PodName, WorkerPid) -> ok | {error, any()}
- PodName = atom()
- WorkerPid = pid()
Check in a worker to the woker pool
checkin_async/2¶
checkin_async(PodName, WorkerPid) -> ok
- PodName = atom()
- WorkerPid = pid()
Check in a worker to the worker pool with asynchronous
checkout/1¶
checkout(PodName) -> {ok, pid()} | {error, empty}
- PodName = atom()
Check out a worker from the worker pool
code_change/3¶
code_change(OldVsn, State, Extra) -> any()
gen_server callback - Module:code_change(OldVsn, State, Extra) -> {ok, NewState} | {error, Reason}
Description: Convert process state when code is changed
handle_call/3¶
handle_call(X1, From, State) -> any()
gen_server callback - Module:handle_call(Request, From, State) -> Result
handle_cast/2¶
handle_cast(X1, State) -> any()
gen_server callback - Module:handle_cast(Request, State) -> Result
handle_info/2¶
handle_info(Info, State) -> any()
gen_server callback - Module:handle_info(Info, State) -> Result
pool_pids/1¶
pool_pids(PodName) -> {ok, [pid()]} | {error, any()}
- PodName = atom()
Retrieve pids of specified PodName
raw_status/1¶
raw_status(PodName) -> {ok, [tuple()]} | {error, any()}
- PodName = atom()
Retrieve a raw status of specified PodName
start_link/6¶
start_link(PodName, NumOfChildren, MaxOverflow, WorkerMod, WorkerArgs, InitFun) -> {ok, pid()} | ignore | {error, any()}
- PodName = atom()
- NumOfChildren = pos_integer()
- MaxOverflow = non_neg_integer()
- WorkerMod = module()
- WorkerArgs = [any()]
- InitFun = function()
Initialize a wooker pool
status/1¶
status(PodName) -> {ok, {NumOfWorking, NumOfWating, NumOfRoomForOverflow}}
- PodName = atom()
- NumOfWorking = non_neg_integer()
- NumOfWating = non_neg_integer()
- NumOfRoomForOverflow = non_neg_integer()
Retrieve the current status in pretty format as follows: format: { working_process_count, worker_process_count, overflow_count }
terminate/2¶
terminate(Reason, State) -> any()
gen_server callback - Module:terminate(Reason, State)
Description: This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.