2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
module Directory :
|
|
|
|
(module type of struct include RestoDirectory.MakeDirectory(RPC.Data) end)
|
2017-11-27 09:13:12 +04:00
|
|
|
include (module type of struct include RestoDirectory end)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
(** Typed RPC services: server implementation. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
type cors = {
|
|
|
|
allowed_headers : string list ;
|
|
|
|
allowed_origins : string list ;
|
|
|
|
}
|
|
|
|
|
|
|
|
type media_type = {
|
|
|
|
name: string ;
|
|
|
|
construct: 'a. 'a Data_encoding.t -> 'a -> string ;
|
|
|
|
destruct: 'a. 'a Data_encoding.t -> string -> ('a, string) result ;
|
|
|
|
}
|
|
|
|
|
|
|
|
val json : media_type
|
|
|
|
val octet_stream : media_type
|
|
|
|
|
|
|
|
(** A handle on the server worker. *)
|
|
|
|
type server
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
(** Promise a running RPC server.*)
|
|
|
|
val launch :
|
|
|
|
?host:string ->
|
|
|
|
?cors:cors ->
|
|
|
|
media_types:media_type list ->
|
|
|
|
Conduit_lwt_unix.server ->
|
|
|
|
unit Directory.t ->
|
|
|
|
server Lwt.t
|
2016-12-11 19:34:58 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
(** Kill an RPC server. *)
|
|
|
|
val shutdown : server -> unit Lwt.t
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2017-11-27 09:13:12 +04:00
|
|
|
|
|
|
|
(** Compatibility layer, to be removed ASAP. *)
|
|
|
|
|
|
|
|
type 'a directory = 'a Directory.t
|
2017-11-27 09:13:12 +04:00
|
|
|
val empty: 'a directory
|
2016-09-08 21:13:10 +04:00
|
|
|
val register:
|
|
|
|
'prefix directory ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('prefix, 'params, 'input, 'output) RPC.service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('params -> 'input -> [< ('output, unit) RestoDirectory.Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
'prefix directory
|
|
|
|
|
|
|
|
val register0:
|
|
|
|
unit directory ->
|
2017-11-27 09:13:12 +04:00
|
|
|
(unit, unit, 'i, 'o) RPC.service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('i -> [< ('o, unit) Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
unit directory
|
|
|
|
|
|
|
|
val register1:
|
|
|
|
'prefix directory ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('prefix, unit * 'a, 'i, 'o) RPC.service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('a -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
'prefix directory
|
|
|
|
|
|
|
|
val register2:
|
|
|
|
'prefix directory ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('prefix, (unit * 'a) * 'b, 'i, 'o) RPC.service ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('a -> 'b -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
|
2016-09-08 21:13:10 +04:00
|
|
|
'prefix directory
|
|
|
|
|
|
|
|
val register_dynamic_directory1:
|
|
|
|
?descr:string ->
|
|
|
|
'prefix directory ->
|
2017-11-27 09:13:12 +04:00
|
|
|
('prefix, unit * 'a) RPC.Path.path ->
|
2016-09-08 21:13:10 +04:00
|
|
|
('a -> (unit * 'a) directory Lwt.t) ->
|
|
|
|
'prefix directory
|
|
|
|
|