Module Evm_node_lib_dev.Evm_directory

Directories depending on backends

module EndpointMap : Tezos_base.TzPervasives.Map.S with type key = Cohttp.Code.meth * string
type t = private
  1. | Resto of resto_dir
    (*

    A Resto directory

    *)
  2. | Dream of Dream.route Tezos_base.TzPervasives.trace
    (*

    A list of Dream routes

    *)

The type of RPC directory for EVM node depending on the chosen RPC server backend.

An empty directory depending on the RPC server backend.

val init_from_resto_directory : unit Tezos_rpc.Directory.t -> t

A directory initialised with a resto directory. Will produce a Resto value, so not compatible with Dream.

Registering services

Generic functions

val register : t -> ([< Resto.meth ], unit, 'params, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('params -> 'query -> 'input -> 'output Tezos_base.TzPervasives.tzresult Lwt.t) -> t

Register a new service with it's handler.

val opt_register : t -> ([< Resto.meth ], unit, 'params, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('params -> 'query -> 'input -> 'output option Tezos_base.TzPervasives.tzresult Lwt.t) -> t

Register a new service with it's handler. The server answers with 404 Not_Found if the handler returns None.

val lwt_register : t -> ([< Resto.meth ], unit, 'params, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('params -> 'query -> 'input -> 'output Lwt.t) -> t

Register a new service with it's handler.

val streamed_register : t -> ([< Resto.meth ], unit, 'params, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('params -> 'query -> 'input -> ('output Lwt_stream.t * (unit -> unit)) Lwt.t) -> t

Register a new streamed service. The handler should produce output elements in a stream.

val register_metrics : string -> t -> t

Register a new endpoint for collecting metrics.

val jsonrpc_websocket_register : ?monitor:Evm_node_config.Configuration.monitor_websocket_heartbeat -> max_message_length:int -> t -> string -> Rpc_encodings.websocket_handler -> t

Register a new websocket service. The handler should return an initial JSONRPC response and optionally produce output elements in a stream for subscription services. Requests above max_message_length will be rejected and the connection closed (only for Resto directories). If monitor is provided, the websocket connection is monitored with the given parameters (only for Resto directories).

val register_describe : t -> t

Registers a /describe service for a Resto directory. No effect for a Dream directory.

Curried functions with respect to service parameters

val register0 : t -> ([< Resto.meth ], unit, unit, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('query -> 'input -> 'output Tezos_base.TzPervasives.tzresult Lwt.t) -> t
val register1 : t -> ([< Resto.meth ], unit, unit * 'a, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'query -> 'input -> 'output Tezos_base.TzPervasives.tzresult Lwt.t) -> t
val register2 : t -> ([< Resto.meth ], unit, (unit * 'a) * 'b, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'b -> 'query -> 'input -> 'output Tezos_base.TzPervasives.tzresult Lwt.t) -> t
val opt_register0 : t -> ([< Resto.meth ], unit, unit, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('query -> 'input -> 'output option Tezos_base.TzPervasives.tzresult Lwt.t) -> t
val opt_register1 : t -> ([< Resto.meth ], unit, unit * 'a, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'query -> 'input -> 'output option Tezos_base.TzPervasives.tzresult Lwt.t) -> t
val opt_register2 : t -> ([< Resto.meth ], unit, (unit * 'a) * 'b, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'b -> 'query -> 'input -> 'output option Tezos_base.TzPervasives.tzresult Lwt.t) -> t
val lwt_register0 : t -> ([< Resto.meth ], unit, unit, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('query -> 'input -> 'output Lwt.t) -> t
val lwt_register1 : t -> ([< Resto.meth ], unit, unit * 'a, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'query -> 'input -> 'output Lwt.t) -> t
val lwt_register2 : t -> ([< Resto.meth ], unit, (unit * 'a) * 'b, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'b -> 'query -> 'input -> 'output Lwt.t) -> t
val streamed_register0 : t -> ([< Resto.meth ], unit, unit, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('query -> 'input -> ('output Lwt_stream.t * (unit -> unit)) Lwt.t) -> t
val streamed_register1 : t -> ([< Resto.meth ], unit, unit * 'a, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'query -> 'input -> ('output Lwt_stream.t * (unit -> unit)) Lwt.t) -> t
val streamed_register2 : t -> ([< Resto.meth ], unit, (unit * 'a) * 'b, 'query, 'input, 'output) Tezos_rpc.Service.t -> ('a -> 'b -> 'query -> 'input -> ('output Lwt_stream.t * (unit -> unit)) Lwt.t) -> t