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)

init

(init _ args)

terminate

(terminate _ reason state)

reply

(reply to response)

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-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.