Module Tezt_mavryk.Proxy_server

type t

A proxy server instance

type argument =
  1. | Data_dir
    (*

    Whether to pass --data-dir, to read the node's data-dir from disk, instead of using a RPC. This case doesn't need a parameter, because it is computed automatically from the Node.t value in init. Think of this argument as a Boolean flag (not an argument) whether to pass --data-dir to mavkit-proxy-server.

    *)
  2. | Symbolic_block_caching_time of int
    (*

    Time interval (in seconds) during which data for a symbolic block identifier (like HEAD) is kept. A symbolic identifier is a block identifier that it not a hash and which hence cannot be safely used as a key in any form of cache.

    *)

Command-line arguments of mavkit-proxy-server.

Not all arguments are available here, because it was not needed so far.

val rpc_port : t -> int

Get the RPC port of a proxy server. It's the port to do requests to.

val rpc_host : string

Get the RPC host of a proxy server. It's the host to do requests to. Its value is "127.0.0.1".

val rpc_scheme : string

Get the RPC scheme of a proxy server. Its value is "http".

val runner : t -> Tezt_wrapper.Runner.t option

Get the runner associated to a proxy server.

Return None if the proxy server runs on the local machine.

val spawn : ?rpc_port:int -> ?args:string list -> Node.t -> Tezt_wrapper.Process.t

spawn ?rpc_port node spawns a new proxy server that serves the given port and delegates its queries to node.

This function is meant to be used by callers that need finer control than what init allows.

val init : ?runner:Tezt_wrapper.Runner.t -> ?name:string -> ?rpc_port:int -> ?event_level:Daemon.Level.default_level -> ?event_sections_levels:(string * Daemon.Level.level) list -> ?args:argument list -> Node.t -> t Lwt.t

init ?runner ?name ?rpc_port ?event_level ?args node creates and starts a proxy server that serves the given port and delegates its queries to node.

event_level specifies the verbosity of the file descriptor sink.

event_sections_levels specifies the verbosity for events in sections whose prefix is in the list. See Node.run for description.

type event = {
  1. name : string;
  2. value : Tezt_wrapper.JSON.t;
  3. timestamp : float;
}

Raw events.

val on_event : t -> (event -> unit) -> unit

Add a callback to be called whenever the proxy_server emits an event.

This callback is never removed.

You can have multiple on_event handlers, although the order in which they trigger is unspecified.

val wait_for : ?where:string -> t -> string -> (Tezt_wrapper.JSON.t -> 'a option) -> 'a Lwt.t

See Daemon.Make.wait_for.

val as_rpc_endpoint : t -> Endpoint.t

Expose the RPC server address of this proxy server as a foreign endpoint.