Plasma GitLab Archive
Projects Blog Knowledge

Module type Netplex_cenv.LEVER

module type LEVER = sig .. end

type s 
argument type
type r 
result type
type t = 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.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml