class type controller =object..end
The controller is the object in the Netplex master process/thread that manages the containers, logging, and service definitions
method ptype : parallelization_typeThe actually effective parallelization type
method sys_id : thread_sys_idThe thread running the controller
method controller_config : controller_config
method services : (socket_service * socket_controller *
workload_manager)
listThe list of controlled services
method add_service : socket_service -> workload_manager -> unitAdds a new service. Containers for these services will be started soon. It is allowed to add several services with the same name (but it will be hard to distinguish them later).
method add_message_receiver : ctrl_message_receiver -> unitAdds a message receiver. This receiver runs in the context of the
controller and receives all messages sent to it. The name method
must return the name.
method add_plugin : plugin -> unitAdds a plugin. If the plugin object has already been added, this is a no-op.
Plugins must have been added before the first container is started.
This is not checked, however. You are on the safe side when the
plugin is added in the create_processor factory method, or in
the post_add_hook of the processor.
method add_admin : (Rpc_server.t -> unit) -> unitadd_admin setup: Allows to bind another RPC program to the admin
socket. The function setup will be called whenever a connection
to the admin socket is established, and this function can call
Rpc_server.bind to bind another RPC program. By default, only
the Admin interface is available as described in netplex_ctrl.x.
Note that this RPC server runs in the scope of the controller! No additional process or thread is created.
method logger : loggerThe logger
method event_system : Unixqueue.unix_event_systemThe event system used by the controller. It must not be used from a container.
method restart : unit -> unitInitiates a restart of all containers: All threads/processes are terminated and replaced by newly initialized ones.
method shutdown : unit -> unitInitiates a shutdown of all containers. It is no longer possible to add new services. When the shutdown has been completed, the controller will terminate itself. Note that the shutdown is performed asynchronously, i.e. this method returns immediately, and the messaging required to do the shutdown is done in the background.
method send_message : string -> string -> string array -> unitsend_message destination msgname msgargs: Sends a message to
destination. When this method returns, it is only ensured that
the receivers registered in the controller have been notified about
the message (so it can be made sure that any newly forked containers
know about the message). It is not guaranteed that the existing
containers are notified when this method returns. This can (and
usually will) happen at any time in the future.
method send_admin_message : string -> string -> string array -> unitsend_message destination msgname msgargs: Sends an admin message to
destination.
See send_message for the notification guarantees.
method register_lever : (controller -> encap -> encap) ->
intlet id = register_lever f: It is possible to register a function f
in the controller, and run it over the internal RPC interface from
any container. These functions are called levers. See
activate_lever below. See also
Netplex_cenv.Make_lever for a convenient way to create
and use levers.
method activate_lever : int -> encap -> encapRuns the registered lever directly
method containers : container_id listLists the containers
method containers_for : string -> container_id listLists the containers for a certain socket service name
method container_count : string -> intThe number of containers for a certain socket service name
method free_resources : unit -> unitShould be called when the controller is finished, in order to free resources again. E.g. plugins are unplugged, and the master sockets are closed.
method startup_directory : stringThe current directory at startup time