/usr/lib/ocaml/netplex/netplex_kit.mli is in libocamlnet-ocaml-dev 3.7.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | (* $Id: netplex_kit.mli 1652 2011-08-03 21:50:30Z gerd $ *)
(** Netplex toolkit *)
open Netplex_types
(** Same as [processor], but the methods [process] and [supported_ptypes]
* are flagged as [virtual]
*)
class type virtual v_processor =
object
inherit processor_hooks
method virtual process :
when_done:(unit -> unit) ->
container -> Unix.file_descr -> string -> unit
method virtual supported_ptypes : parallelization_type list
end
class empty_processor_hooks : unit -> processor_hooks
(** This is an empty set of processor hooks, i.e. all methods are empty
*)
class processor_hooks_delegation : processor_hooks -> processor_hooks
(** Takes a hooks object, and makes a class of it. Useful for overriding
methods in an object.
*)
class virtual processor_base : processor_hooks -> v_processor
(** A virtual (incomplete) base class for processors. As argument the
* user-supplied hooks are passed in. Use this class as in:
*
* {[
* class my_processor hooks =
* object(self)
* inherit Netplex_kit.processor_base hooks
* method process ~when_done container fd proto_name = ...
* method supported_ptypes = ...
* end
* ]}
*
* In order to run actions from hooks, redefine the hook methods as in:
*
* {[
* class my_processor hooks =
* object(self)
* inherit Netplex_kit.processor_base hooks as super
* method process ~when_done container fd proto_name = ...
* method supported_ptypes = ...
* method post_start_hook container =
* ... (* my action *);
* super # post_start_hook container
* end
* ]}
*)
class protocol_switch_processor : (string * processor) list -> processor
(** The arg is a list of pairs [(proto_name, proto_proc)]. All mentioned
processors are merged into a single processor. When a TCP connection
arrives, it depends on the protocol which processor is actually
activated. (Every socket is bound to a protocol, so this can be derived
from the socket.)
It is up to the user whether the merge makes sense.
*)
class protocol_switch_factory : string ->
(string * processor_factory) list ->
processor_factory
(** [protocol_switch_factory name merge_list]: Merges the factories
in [merge_list] to a single factory. Which factory is selected
depends on the protocol.
For example:
{[
service {
name = "...";
protocol {
name = "A"; ...;
}
protocol {
name = "B"; ...;
}
processor {
type = "merged";
A {
...
}
B {
...
}
}
}
]}
Here, two protocols [A] and [B] are defined, and there is a
subsection in [processor] for each of the protocols configuring
the used service. "merged" is the [name] of the merged factories.
For example, [A] could be an RPC interface, and [B] could be
an HTTP interface providing the same service.
For every protocol in [merge_list] there must be a subsection in
[processor] for the protocol. This subsection configures then
the processor. It is not an error not to create sockets for
a protocol in [merge_list].
*)
val add_helper_service : controller -> string -> processor_hooks -> unit
(** [add_helper_service ctrl name hooks]: Adds a helper service [name] to
the controller
[ctrl]. The helper service does not have any externally
accessible socket, but starts a single regular container that looks
like any other container. Whatever needs to be initialized must be
done in the [pre_start_hook] or the [post_start_hook].
This function must be called in controller context, for example
in the [late_initializer] of {!Netplex_main.startup}, but it can
also be started later.
For an example, look at [examples/netplex/helper_container.ml] in
the distributed source tarball.
For multi-threaded programs, {!Netplex_cenv.run_in_controller_context}
is the required companion function to start helper threads at any
time. Multi-processing programs do not have such an easy way to
add helpers. They should it at program startup time.
{b Known bug.} The the helper component will be in "starting" state as
long as the [post_start_hook] runs.
*)
val create_protocol : ?lstn_backlog:int ->
?lstn_reuseaddr:bool ->
?so_keepalive:bool ->
?tcp_nodelay:bool ->
?configure_slave_socket:(Unix.file_descr ->unit) ->
string ->
extended_address array ->
protocol
(** [create_protocol name addresses]: Creates a [protocol] object
from the passed arguments
*)
val create_socket_service_config :
?startup_timeout:float ->
?change_user_to:(int*int) ->
?gc_when_idle:bool ->
?conn_limit:int ->
string ->
protocol list ->
controller_config ->
socket_service_config
(** [create_socket_service_config name protos ctrl_conf]: Creates a
[socket_service_config] object from the passed arguments
*)
|