Hive.Server

hive · API reference

GenServer-style pure-callback workers.

The GenServer layer: pure-callback servers over Worker.

A server's decision logic is a pure handle : 'r Msg.t -> 'state -> ('state, 'r) reaction that returns the new state, the reply, and actions-as-data; the runtime interprets the actions (design decision D3). handle is unit-testable with no fibers: feed a message and a state, assert on the reaction.

Because OCaml has no higher-kinded type parameters, the layer is a functor over the message GADT: each server module instantiates Make with its own type 'reply t. Casts are unit Msg.t; calls are 'reply Msg.t.

module Info : sig ... end
type reason = 
  | Normal (* Stopped by its own Stop Normal action. *)
  | Shutdown (* Asked to stop by stop or a Stop Shutdown action. *)
  | Crashed of exn (* An exception escaped a callback. *)
val default_call_timeout : float

5 seconds, like OTP.

module type MSG = sig ... end

Message GADT supplied to Make.

module Make (Msg : MSG) : sig ... end