From 2eeab3a0aab0bb9ee1210e6410ff12b9e3894796 Mon Sep 17 00:00:00 2001 From: James Deikun Date: Fri, 18 May 2018 15:14:44 -0400 Subject: [PATCH] RPC: expose RPC base address in client context --- src/lib_client_base/client_context.ml | 1 + src/lib_rpc/RPC_context.ml | 1 + src/lib_rpc/RPC_context.mli | 1 + src/lib_rpc_http/RPC_client.ml | 1 + src/lib_rpc_http/RPC_client.mli | 1 + src/proto_alpha/lib_client/proto_alpha.ml | 1 + 6 files changed, 6 insertions(+) diff --git a/src/lib_client_base/client_context.ml b/src/lib_client_base/client_context.ml index e7613177bcc3..f6f121ff3280 100644 --- a/src/lib_client_base/client_context.ml +++ b/src/lib_client_base/client_context.ml @@ -78,6 +78,7 @@ class type full = object end class proxy_context (obj : full) = object + method base = obj#base method block = obj#block method answer : type a. (a, unit) lwt_format -> a = obj#answer method call_service : diff --git a/src/lib_rpc/RPC_context.ml b/src/lib_rpc/RPC_context.ml index 0663564392f8..1b469fa98759 100644 --- a/src/lib_rpc/RPC_context.ml +++ b/src/lib_rpc/RPC_context.ml @@ -59,6 +59,7 @@ class type json = object Uri.t -> (Data_encoding.json, Data_encoding.json option) rest_result Lwt.t + method base : Uri.t end diff --git a/src/lib_rpc/RPC_context.mli b/src/lib_rpc/RPC_context.mli index 561955993022..3a49f7b9d907 100644 --- a/src/lib_rpc/RPC_context.mli +++ b/src/lib_rpc/RPC_context.mli @@ -59,6 +59,7 @@ class type json = object Uri.t -> (Data_encoding.json, Data_encoding.json option) rest_result Lwt.t + method base : Uri.t end class ['pr] of_directory : 'pr RPC_directory.t -> ['pr] gen diff --git a/src/lib_rpc_http/RPC_client.ml b/src/lib_rpc_http/RPC_client.ml index a446e13277ac..1ce7f6133638 100644 --- a/src/lib_rpc_http/RPC_client.ml +++ b/src/lib_rpc_http/RPC_client.ml @@ -437,4 +437,5 @@ class http_ctxt config media_types : RPC_context.json = fun service ~on_chunk ~on_close params query body -> call_streamed_service media_types service ~logger ~base ~on_chunk ~on_close params query body + method base = base end diff --git a/src/lib_rpc_http/RPC_client.mli b/src/lib_rpc_http/RPC_client.mli index e2089fc74dca..f4f4aa6742c4 100644 --- a/src/lib_rpc_http/RPC_client.mli +++ b/src/lib_rpc_http/RPC_client.mli @@ -93,3 +93,4 @@ val generic_call : [< RPC_service.meth ] -> Uri.t -> (content, content) RPC_context.rest_result Lwt.t +val uri_encoding : Uri.t Data_encoding.t diff --git a/src/proto_alpha/lib_client/proto_alpha.ml b/src/proto_alpha/lib_client/proto_alpha.ml index 443a02ab9076..74e960d629cf 100644 --- a/src/proto_alpha/lib_client/proto_alpha.ml +++ b/src/proto_alpha/lib_client/proto_alpha.ml @@ -17,6 +17,7 @@ class type rpc_context = object end class wrap_proto_context (t : RPC_context.json) : rpc_context = object + method base : Uri.t = t#base method generic_json_call = t#generic_json_call method call_service : 'm 'p 'q 'i 'o. ([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t -> -- GitLab