otplike.gen-server
gen-server behaviour and related functions.
call
(call server message)
(call server message timeout-ms)
cast
(cast server message)
IGenServer
protocol
members
handle-call
(handle-call _ request from state)
handle-cast
(handle-cast _ request state)
handle-info
(handle-info _ request state)
terminate
(terminate _ reason state)
start
(start server)
(start server args)
(start server args options)
(start reg-name server args options)
Starts the server, passing args to server's init function.
Arguments:
server-impl - IGenServer implementation, or map, or namespace.
args - any form that is passed as the argument to init function.
Options:
:timeout - time in milliseconds gen-server is allowed to spend
initializing or it is terminated and the start function returns
[:error :timeout].
:spawn-opt - options used to spawn the gen-server process (see
process/spawn-opt)
Returns:
[:ok pid] if server started successfully,
[:error :no-init] if server implementation doesn't provide init
function,
[:error [:bad-return-value value]] if init returns a bad value,
[:error reason] otherwise.
Throws on illegal arguments.
start-link
(start-link server)
(start-link server args)
(start-link server args options)
(start-link reg-name server args options)
start-link-ns
macro
(start-link-ns)
(start-link-ns args)
(start-link-ns args options)
(start-link-ns reg-name args options)
start-ns
macro
(start-ns)
(start-ns args)
(start-ns args options)
(start-ns reg-name args options)
Starts the server, taking current ns as a implementation source.
See start for more info.