(ns GenServer "Elixir GenServer module — generic server (OTP behaviour). In CljElixir: (GenServer/start-link MyModule init-arg opts), etc. GenServer is the core abstraction for stateful processes on the BEAM. Callbacks to implement in your module: init/1, handle-call/3, handle-cast/2, handle-info/2, terminate/2") (defn start "Starts a GenServer without linking. Returns {:ok pid} or {:error reason}. (GenServer/start MyModule init-arg []) (GenServer/start MyModule init-arg :name :my-server)" ([module init-arg]) ([module init-arg opts])) (defn start-link "Starts a GenServer linked to the current process. Returns {:ok pid}. (GenServer/start-link MyModule init-arg []) (GenServer/start-link MyModule init-arg :name :my-server)" ([module init-arg]) ([module init-arg opts])) (defn call "Makes a synchronous call to the server. Blocks until reply. Default timeout 5000ms. (GenServer/call pid :get-state) ;=> server's reply (GenServer/call pid {:set \"value\"} 10000) ;=> with 10s timeout" ([server request]) ([server request timeout])) (defn cast "Sends an asynchronous request to the server. Returns :ok immediately. (GenServer/cast pid {:update \"value\"}) ;=> :ok" [server request]) (defn reply "Replies to a client from within handle-call (for delayed replies). (GenServer/reply from {:ok result}) ;=> :ok" [client reply]) (defn stop "Stops the GenServer. (GenServer/stop pid) ;=> :ok (GenServer/stop pid :normal) ;=> with reason (GenServer/stop pid :normal :infinity) ;=> with timeout" ([server]) ([server reason]) ([server reason timeout])) (defn whereis "Returns the PID of a named GenServer, or nil. (GenServer/whereis :my-server) ;=> #PID<0.123.0>" [name]) (defn multi-call "Calls all locally registered servers on all connected nodes." ([name request]) ([nodes name request]) ([nodes name request timeout])) (defn abcast "Casts to all locally registered servers on all connected nodes." ([name request]) ([nodes name request]))