2016-12-01 21:27:53 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-12-01 21:27:53 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
(** Typed RPC services: server implementation. *)
|
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
type cors = {
|
|
|
|
allowed_headers : string list ;
|
|
|
|
allowed_origins : string list ;
|
|
|
|
}
|
2016-12-01 21:27:53 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
type media_type = {
|
|
|
|
name: string ;
|
|
|
|
construct: 'a. 'a Data_encoding.t -> 'a -> string ;
|
|
|
|
destruct: 'a. 'a Data_encoding.t -> string -> ('a, string) result ;
|
|
|
|
}
|
2016-12-01 21:27:53 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
val json : media_type
|
|
|
|
val octet_stream : media_type
|
2016-12-06 16:58:21 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
(** A handle on the server worker. *)
|
|
|
|
type server
|
|
|
|
|
|
|
|
(** Promise a running RPC server.*)
|
2016-12-13 04:52:55 +04:00
|
|
|
val launch :
|
|
|
|
?host:string ->
|
2017-11-27 09:13:12 +04:00
|
|
|
?cors:cors ->
|
|
|
|
media_types:media_type list ->
|
2016-12-13 04:52:55 +04:00
|
|
|
Conduit_lwt_unix.server ->
|
2017-11-27 09:13:12 +04:00
|
|
|
unit RPC.Directory.t ->
|
2016-12-06 16:58:21 +04:00
|
|
|
server Lwt.t
|
2016-12-01 21:27:53 +04:00
|
|
|
|
2016-12-14 19:40:42 +04:00
|
|
|
(** Kill an RPC server. *)
|
2016-12-01 21:27:53 +04:00
|
|
|
val shutdown : server -> unit Lwt.t
|