RPC: remove deprecated type RPC.directory

This commit is contained in:
Grégoire Henry 2017-12-07 17:43:21 +01:00 committed by Benjamin Canou
parent bfb6694afb
commit 98755cd2a0
12 changed files with 23 additions and 63 deletions

View File

@ -26,7 +26,7 @@ let rpc_init
Tezos_context.init ~level ~timestamp ~fitness context >>=? fun context -> Tezos_context.init ~level ~timestamp ~fitness context >>=? fun context ->
return { block_hash ; block_header ; operation_hashes ; operations ; context } return { block_hash ; block_header ; operation_hashes ; operations ; context }
let rpc_services = ref (RPC.Directory.empty : Updater.rpc_context RPC.directory) let rpc_services = ref (RPC.Directory.empty : Updater.rpc_context RPC.Directory.t)
let register0_fullctxt s f = let register0_fullctxt s f =
rpc_services := rpc_services :=

View File

@ -49,7 +49,7 @@ let failing_service custom_root =
~error: Data_encoding.empty ~error: Data_encoding.empty
RPC.Path.(custom_root / "failing") RPC.Path.(custom_root / "failing")
let rpc_services : Updater.rpc_context RPC.directory = let rpc_services : Updater.rpc_context RPC.Directory.t =
let dir = RPC.Directory.empty in let dir = RPC.Directory.empty in
let dir = let dir =
RPC.register RPC.register

View File

@ -60,7 +60,7 @@ let int64_to_bytes i =
let operations_hash = let operations_hash =
Operation_list_list_hash.compute [] Operation_list_list_hash.compute []
let rpc_services : Updater.rpc_context RPC.directory = let rpc_services : Updater.rpc_context RPC.Directory.t =
let dir = RPC.Directory.empty in let dir = RPC.Directory.empty in
let dir = let dir =
RPC.register RPC.register

View File

@ -50,8 +50,6 @@ let octet_stream = {
(* Compatibility layer, to be removed ASAP. *) (* Compatibility layer, to be removed ASAP. *)
type 'a directory = 'a Directory.t
let empty = Directory.empty let empty = Directory.empty
let register d s f = Directory.register d s (fun p () i -> f p i) let register d s f = Directory.register d s (fun p () i -> f p i)

View File

@ -46,36 +46,34 @@ val shutdown : server -> unit Lwt.t
(** Compatibility layer, to be removed ASAP. *) (** Compatibility layer, to be removed ASAP. *)
type 'a directory = 'a Directory.t
val empty: 'a directory
val register: val register:
'prefix directory -> 'prefix Directory.t ->
([`POST], 'prefix, 'params, unit, 'input, 'output, unit) RPC.Service.t -> ([`POST], 'prefix, 'params, unit, 'input, 'output, unit) RPC.Service.t ->
('params -> 'input -> [< ('output, unit) RestoDirectory.Answer.t ] Lwt.t) -> ('params -> 'input -> [< ('output, unit) RestoDirectory.Answer.t ] Lwt.t) ->
'prefix directory 'prefix Directory.t
val register0: val register0:
unit directory -> unit Directory.t ->
([`POST], unit, unit, unit, 'i, 'o, unit) RPC.Service.t -> ([`POST], unit, unit, unit, 'i, 'o, unit) RPC.Service.t ->
('i -> [< ('o, unit) Answer.t ] Lwt.t) -> ('i -> [< ('o, unit) Answer.t ] Lwt.t) ->
unit directory unit Directory.t
val register1: val register1:
'prefix directory -> 'prefix Directory.t ->
([`POST], 'prefix, unit * 'a, unit, 'i, 'o, unit) RPC.Service.t -> ([`POST], 'prefix, unit * 'a, unit, 'i, 'o, unit) RPC.Service.t ->
('a -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) -> ('a -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
'prefix directory 'prefix Directory.t
val register2: val register2:
'prefix directory -> 'prefix Directory.t ->
([`POST], 'prefix, (unit * 'a) * 'b, unit, 'i, 'o, unit) RPC.Service.t -> ([`POST], 'prefix, (unit * 'a) * 'b, unit, 'i, 'o, unit) RPC.Service.t ->
('a -> 'b -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) -> ('a -> 'b -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
'prefix directory 'prefix Directory.t
val register_dynamic_directory1: val register_dynamic_directory1:
?descr:string -> ?descr:string ->
'prefix directory -> 'prefix Directory.t ->
('prefix, unit * 'a) RPC.Path.path -> ('prefix, unit * 'a) RPC.Path.path ->
('a -> (unit * 'a) directory Lwt.t) -> ('a -> (unit * 'a) Directory.t Lwt.t) ->
'prefix directory 'prefix Directory.t

View File

@ -89,7 +89,7 @@ module RPC : sig
t -> (Protocol_hash.t * Protocol.t) Lwt_stream.t * Lwt_watcher.stopper t -> (Protocol_hash.t * Protocol.t) Lwt_stream.t * Lwt_watcher.stopper
val context_dir: val context_dir:
t -> block -> 'a RPC_server.directory option Lwt.t t -> block -> 'a RPC_server.Directory.t option Lwt.t
val preapply: val preapply:
t -> block -> t -> block ->
@ -98,7 +98,7 @@ module RPC : sig
(Block_header.shell_header * error Preapply_result.t) tzresult Lwt.t (Block_header.shell_header * error Preapply_result.t) tzresult Lwt.t
val context_dir: val context_dir:
t -> block -> 'a RPC_server.directory option Lwt.t t -> block -> 'a RPC_server.Directory.t option Lwt.t
val complete: val complete:
t -> ?block:block -> string -> string list Lwt.t t -> ?block:block -> string -> string list Lwt.t

View File

@ -140,7 +140,7 @@ let register_bi_dir node dir =
dir dir
let ops_dir _node = let ops_dir _node =
let ops_dir = RPC_server.empty in let ops_dir = RPC_server.Directory.empty in
ops_dir ops_dir
let rec insert_future_block (bi: Services.Blocks.block_info) = function let rec insert_future_block (bi: Services.Blocks.block_info) = function
@ -369,7 +369,7 @@ let get_protocols node hash () =
| Error _ -> raise Not_found | Error _ -> raise Not_found
let build_rpc_directory node = let build_rpc_directory node =
let dir = RPC_server.empty in let dir = RPC_server.Directory.empty in
let dir = let dir =
RPC_server.register0 dir Services.Blocks.list (list_blocks node) in RPC_server.register0 dir Services.Blocks.list (list_blocks node) in
let dir = let dir =
@ -381,7 +381,7 @@ let build_rpc_directory node =
Node.RPC.context_dir node block >>= function Node.RPC.context_dir node block >>= function
| None -> Lwt.fail Not_found | None -> Lwt.fail Not_found
| Some context_dir -> Lwt.return context_dir) | Some context_dir -> Lwt.return context_dir)
(fun _ -> Lwt.return RPC_server.empty) in (fun _ -> Lwt.return RPC_server.Directory.empty) in
RPC_server.register_dynamic_directory1 RPC_server.register_dynamic_directory1
~descr: ~descr:
"All the RPCs which are specific to the protocol version." "All the RPCs which are specific to the protocol version."

View File

@ -7,4 +7,4 @@
(* *) (* *)
(**************************************************************************) (**************************************************************************)
val build_rpc_directory: Node.t -> unit RPC_server.directory val build_rpc_directory: Node.t -> unit RPC_server.Directory.t

View File

@ -153,7 +153,7 @@ module type RAW_PROTOCOL = sig
validation_state -> operation -> validation_state tzresult Lwt.t validation_state -> operation -> validation_state tzresult Lwt.t
val finalize_block: val finalize_block:
validation_state -> validation_result tzresult Lwt.t validation_state -> validation_result tzresult Lwt.t
val rpc_services: rpc_context RPC_server.directory val rpc_services: rpc_context RPC_server.Directory.t
val configure_sandbox: val configure_sandbox:
Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t
end end

View File

@ -67,7 +67,7 @@ module type RAW_PROTOCOL = sig
validation_state -> operation -> validation_state tzresult Lwt.t validation_state -> operation -> validation_state tzresult Lwt.t
val finalize_block: val finalize_block:
validation_state -> validation_result tzresult Lwt.t validation_state -> validation_result tzresult Lwt.t
val rpc_services: rpc_context RPC_server.directory val rpc_services: rpc_context RPC_server.Directory.t
val configure_sandbox: val configure_sandbox:
Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t
end end

View File

@ -288,39 +288,3 @@ module Directory : sig
'prefix directory 'prefix directory
end end
(** Compatibility layer, to be removed ASAP. *)
type 'a directory = 'a Directory.t
val register:
'prefix directory ->
([ `POST ], 'prefix,
'params, unit, 'input,
'output, unit) Service.t ->
('params -> 'input -> [< ('output, unit) Answer.t ] Lwt.t) ->
'prefix directory
val register0:
unit directory ->
([ `POST ], unit,
unit, unit, 'i,
'o, unit) Service.t ->
('i -> [< ('o, unit) Answer.t ] Lwt.t) ->
unit directory
val register1:
'prefix directory ->
([ `POST ], 'prefix,
unit * 'a, unit, 'i,
'o, unit) Service.t ->
('a -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
'prefix directory
val register2:
'prefix directory ->
([ `POST ], 'prefix,
(unit * 'a) * 'b, unit, 'i,
'o, unit) Service.t ->
('a -> 'b -> 'i -> [< ('o, unit) Answer.t ] Lwt.t) ->
'prefix directory

View File

@ -132,7 +132,7 @@ module type PROTOCOL = sig
validation_state -> validation_result tzresult Lwt.t validation_state -> validation_result tzresult Lwt.t
(** The list of remote procedures exported by this implementation *) (** The list of remote procedures exported by this implementation *)
val rpc_services: rpc_context RPC.directory val rpc_services: rpc_context RPC.Directory.t
(** An ad-hoc context patcher. It used only for debugging protocol (** An ad-hoc context patcher. It used only for debugging protocol
while running in the "sandbox" mode. This function is never used while running in the "sandbox" mode. This function is never used