module Hydro_proxy:Base proxy functionalitysig
..end
Proxies represent remote objects locally. A proxy is bound to
remote objects, and forwards any RPC calls to these. The class
type proxy_t
accesses the core of the proxy functionality,
which is also implemented as class proxy
(below). The generator
hydrogen
creates more specialized proxies that can be much
easier used. However, these proxies always extend the base class
defined here.
Logically, a proxy is bound to one object only. However, it is
possible to configure proxies so they think this object is
available on several servers simultaneously (multiplicity
parameter). There are two ways of taking advantage of this:
multiplicity=`Failover
).multiplicity=`Concurrent
).To be exact, proxies do not keep the connections. This is the task of the pools. It is supported that a proxy shares connections to servers with other proxies, but proxy-private connections are also possible.
It is possible to tell the pools that certain hosts or certain
services are currently unavailable - before proxies try to use
them and run into problems. This is called temporary deactivation.
Use the deactivate_host
and deactivate_port
methods to control
this.
typeextended_proxy_addr =
< facet : string option; id : Hydro_types.identity;
mode : Hydro_types.proxy_mode;
parameters : extended_proxy_parameters; secure : bool >
parameters
can also specify connectors
directlytypeextended_proxy_parameters =
[ `Adapter of string
| `Connectors of
(Hydro_connector.client_connector * Hydro_types.client_params) list
| `Endpoints of Hydro_types.endpoint array
| `Well_known ]
typemultiplicity =
[ `Concurrent of int | `Failover ]
typeshared_or_private =
[ `Private of < > | `Shared ]
typedomain_resolver =
Unixqueue.unix_event_system ->
string -> (Unix.inet_addr option -> unit) -> unit
r
called as r esys name reply
.
As name
the domain name to resolve is passed. The resolver must
finally call reply
with either the resolved address or
with None
, indicating an error in the latter case.
The event system esys
can be used to carry out the resolution
process in an asynchronous way, but this is optional.
Only 1:1 resolution is supported, 1:n resolution not.
class type proxy_conf_t =object
..end
class type proxy_env_t =object
..end
class type proxy_resolver_t =object
..end
class type proxy_t =object
..end
class type pool_t =object
..end
class type managed_client_t =object
..end
val proxy_conf : ?shared_connections:bool ->
?multiplicity:multiplicity ->
?max_reconnections:int ->
?deactivation_period:float ->
?resolution_period:float ->
?context:(string * string) list -> unit -> proxy_conf_t
val modify_proxy_conf : ?shared_connections:bool ->
?multiplicity:multiplicity ->
?max_reconnections:int ->
?deactivation_period:float ->
?resolution_period:float ->
?context:(string * string) list ->
proxy_conf_t -> proxy_conf_t
val proxy_resolver : ?domain_resolver:domain_resolver ->
Hydro_types.client_params -> proxy_resolver_t
The passed client params serve as the base params. Depending on the endpoint, the params are modified:
trans_timeout
of the
client is set to the minimum of the endpoint timeout and the
found trans_timeout
val shuffle : Random.State.t ->
proxy_resolver_t -> proxy_resolver_t
shuffle rnd (proxy_resolver params)
: shuffles the endpoints so that
they are in random orderval proxy : env:proxy_env_t ->
addr:extended_proxy_addr -> unit -> proxy_t
val pool : unit -> pool_t
class proxy_delegation :proxy_t ->
proxy_t
class proxy_env_delegation :proxy_env_t ->
proxy_env_t
class proxy_resolver_delegation :proxy_resolver_t ->
proxy_resolver_t
class pool_delegation :pool_t ->
pool_t