class type processor_hooks =object..end
Processor hooks can be used to modify the behavior of a processor.
See Netplex_intro.servproc for some documentation about the hooks.
method post_add_hook : socket_service -> controller -> unitA user-supplied function that is called after the service has been added to the controller
method post_rm_hook : socket_service -> controller -> unitA user-supplied function that is called after the service has been removed from the controller
method pre_start_hook : socket_service ->
controller -> container_id -> unitA user-supplied function that is called before the container is created and started. It is called from the process/thread of the controller.
method post_start_hook : container -> unitA user-supplied function that is called after the container is created and started, but before the first service request arrives. It is called from the process/thread of the container.
method pre_finish_hook : container -> unitA user-supplied function that is called just before the container is terminated. It is called from the process/thread of the container.
method post_finish_hook : socket_service ->
controller -> container_id -> unitA user-supplied function that is called after the container is terminated. It is called from the process/thread of the controller.
method workload_hook : container -> bool -> int -> unitA user-supplied function that is called when the workload
changes, i.e. a new connection has been accepted, or an
existing connection could be completely processed.
The bool argument is true if the reason is a new
connection. The int argument is the number of connections.
This function is called from the process/thread of the container.
method receive_message : container -> string -> string array -> unitThis function is called when a broadcast message is received. The first string is the name of the message, and the array are the arguments.
method receive_admin_message : container -> string -> string array -> unitThis function is called when a broadcast admin message is received. The first string is the name of the message, and the array are the arguments.
method config_internal : (string * polysocket_kind_box) listFor internal services, this list configures which message kind is used for which protocol.
method process_internal : when_done:(unit -> unit) ->
container -> polyserver_box -> string -> unitprocess_internal ~when_done cont client protocol: This function
is called instead of process when a connection to an internal
service is made. This method has to accept or reject the connection
with Netsys_polysocket.accept or Netsys_polysocket.refuse,
respectively. The default is to refuse.
Like process, the function must call when_done when the connection
is fully processed.
method system_shutdown : unit -> unitA user-supplied function that is called when a system shutdown notification arrives. This notification is just for information that every container of the system will soon be shut down. The system is still completely up at the time this notification arrives, so if the services of other components are required to go down this is the right point in time to do that (e.g. send important data to a storage component).
method shutdown : unit -> unitA user-supplied function that is called when a shutdown notification
arrives. That means that the container should terminate ASAP.
There is, however, no time limitation. The termination is started
by calling the when_done function passed to the process method.
method global_exception_handler : exn -> boolThis method is called when an uncaught exception would otherwise
terminate the container. It can return true to indicate that
the container continues running.
method container_event_system : unit -> Unixqueue.event_systemThis method is called to get the event systems for containers.
This is normally a Unixqueue.standard_event_system, but
users can override it.
method container_run : Unixqueue.event_system -> unitcontainer_run esys: By default, it just runs esys#run().
This method is called to run the event system of the containers.
Users can override it.