module Make_lever:
Creates a LEVER
module from a function type as specified in
FUN_TYPE
Parameters: |
|
type
s
argument type
type
r
result type
typet =
s -> r
val register : Netplex_types.controller ->
(Netplex_types.controller -> t) -> t
let reg_lever = register ctrl raw_lever
:
Registers raw_lever
in the controller ctrl
, so one can call
reg_lever
to activate it. For example:
module LT = struct type s = unit type r = int end
module L = Make_lever(LT)
let get_num_services =
L.register ctrl (fun ctrl () -> List.length ctrl#services)
The registration must be done in controller context, e.g.
in the pre_start_hook
of a container.
From the running container, one can now call:
get_num_services()
to get the current length of the ctrl#services
list.