module Main:sig
..end
typejson =
Json.t
typekind =
[ `EXEC | `GET | `SET ]
val string_of_kind : kind -> string
val pp_kind : Format.formatter -> kind -> unit
val register : kind -> string -> (json -> json) -> unit
val find : string -> (kind * (json -> json)) option
val exec : string -> json -> json
type
signal
val signal : string -> signal
type'a
request =[ `Kill of 'a
| `Poll
| `Request of 'a * string * json
| `Shutdown
| `SigOff of string
| `SigOn of string ]
type'a
response =[ `Data of 'a * json
| `Error of 'a * string
| `Killed of 'a
| `Rejected of 'a
| `Signal of string ]
type 'a
message = {
|
requests : |
|
callback : |
type 'a
server
val create : pretty:(Format.formatter -> 'a -> unit) ->
?equal:('a -> 'a -> bool) ->
fetch:(unit -> 'a message option) -> unit -> 'a server
~logs:false
is specified.
Default equality is the standard `(=)` one.
val run : 'a server -> unit
val start : 'a server -> unit
The function returns immediately after installing a daemon that accepts GET
requests received by the server on calls to Db.yield()
.
val stop : 'a server -> unit
val kill : unit -> 'a
val emit : signal -> unit
val on_signal : signal -> (bool -> unit) -> unit
The callback is invoked with true
on SIGON
command
and false
on SIGOFF
.
val on : (bool -> unit) -> unit