module Netplex_main:Main program for Netplex serverssig
..end
type
cmdline_config
val args : ?defaults:cmdline_config ->
unit -> (Arg.key * Arg.spec * Arg.doc) list * cmdline_config
let (opt_list, cmdline_cfg) = args()
:
Returns opt_list
for inclusion in the Arg.parse
option list.
The effects made available by the returned cmdline_cfg
value.
defaults
: The default argument valuesval create : ?config_filename:string ->
?pidfile:string option ->
?foreground:bool -> unit -> cmdline_config
val modify : ?config_filename:string ->
?pidfile:string option ->
?foreground:bool ->
cmdline_config -> cmdline_config
val config_filename : cmdline_config -> string
val config_filename_opt : cmdline_config -> string option
None
if it
has not been set on the command-lineval pidfile : cmdline_config -> string option
val foreground : cmdline_config -> bool
val startup : ?late_initializer:(Netplex_types.config_file ->
Netplex_types.controller -> unit) ->
?config_parser:(string -> Netplex_types.config_file) ->
Netplex_types.parallelizer ->
Netplex_types.logger_factory list ->
Netplex_types.workload_manager_factory list ->
Netplex_types.processor_factory list -> cmdline_config -> unit
Netplex_config.Config_error
when an error in the
configuration file is detected.
The late_initializer
is called after the Netplex controller has been
fully initialized, and before the main event loop is entered. You can
perform here further initializations, e.g. starting helper threads.
The config_parser
is by default Netplex_config.read_config_file
.
You can override it by whatever parser you would like to use.
As side-effect, the current logger of the Netlog
module is set
to selected Netplex logger. Note that this setting remains active
even after startup
returns to the caller. Also note that log messages
submitted via Netlog
appear as from component "netplex.other"
if they are sent from outside of a container.
The typical main program for a Netplex
server system looks like:
let my_factories = ...
let start() =
let opts, cmdconf = Netplex_main.args() in
Arg.parse
opts
(fun s -> raise(Arg.Bad ("Unknown arg: " ^ s)))
"usage: protoserver";
let par = Netplex_mp.mp() in (* or Netplex_mt.mt() *)
Netplex_main.startup
par
Netplex_log.logger_factories
Netplex_workload.workload_manager_factories
my_factories
cmdconf
Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
start()
This main program enables:
-conf
, -pid
and -fg
are
understoodmy_factories
are made available
for connection processing