Skip to content

Commit b28058c

Browse files
committed
New ocaml-rpc
Signed-off-by: Jon Ludlam <[email protected]>
1 parent 95ba1b2 commit b28058c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

main.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let missing_uri () =
5959
returns a successful RPC response *)
6060
let return_rpc typ result =
6161
(* Operator to unwrap the wrapped async return type of ocaml-rpc's Rpc_async *)
62-
let (>*=) a b = a |> Rpc_async.M.deferred >>= b in
62+
let (>*=) a b = a |> Rpc_async.T.get >>= b in
6363
Monitor.try_with
6464
~extract_exn:true
6565
(fun () ->
@@ -620,7 +620,7 @@ let bind ~volume_script_dir =
620620
return_data_rpc (fun () -> Datapath_client.attach rpc dbg uri domain)
621621
in
622622

623-
let wrap th = Rpc_async.M.{async=th} in
623+
let wrap th = Rpc_async.T.put th in
624624
(* the actual API call for this plugin, sharing same version ref across all calls *)
625625
let query_impl = (fun dbg ->
626626
let th =
@@ -715,7 +715,7 @@ let bind ~volume_script_dir =
715715
| Some "xeno+shm" ->
716716
let uid = Uri.path uri in
717717
let uid = if String.length uid > 1 then String.sub uid ~pos:1 ~len:(String.length uid - 1) else uid in
718-
(RRD.Client.Plugin.Local.register RRD.rpc uid Rrd.Five_Seconds Rrd_interface.V2).Rpc_async.M.async
718+
(RRD.Client.Plugin.Local.register RRD.rpc uid Rrd.Five_Seconds Rrd_interface.V2) |> Rpc_async.T.get
719719
>>= begin function
720720
| Ok _ -> loop (uid :: acc) datasources
721721
| Error x -> raise Rrd_interface.(Rrdd_error x) end
@@ -751,7 +751,7 @@ let bind ~volume_script_dir =
751751
| Some "xeno+shm" ->
752752
let uid = Uri.path uri in
753753
let uid = if String.length uid > 1 then String.sub uid ~pos:1 ~len:(String.length uid - 1) else uid in
754-
(RRD.Client.Plugin.Local.deregister RRD.rpc uid).Rpc_async.M.async
754+
(RRD.Client.Plugin.Local.deregister RRD.rpc uid) |> Rpc_async.T.get
755755
>>= begin function
756756
| Ok _ -> loop datasources
757757
| Error x -> raise Rrd_interface.(Rrdd_error x) end
@@ -1290,7 +1290,7 @@ let self_test_plugin ~root_dir plugin =
12901290
let module Test = Storage_interface.StorageAPI(Rpc_async.GenClient()) in
12911291
let dbg = "debug" in
12921292
Monitor.try_with (fun () ->
1293-
let open Rpc_async.M in
1293+
let open Rpc_async.ErrM in
12941294
begin
12951295
Test.Query.query rpc dbg >>= fun query_result ->
12961296
Test.Query.diagnostics rpc dbg >>= fun _msg ->
@@ -1336,8 +1336,8 @@ let self_test_plugin ~root_dir plugin =
13361336
return ()
13371337
else
13381338
return ()
1339-
end |> deferred)
1340-
>>= function | Ok x -> Async.Deferred.return x | Error y -> failwith "self test failed"
1339+
end |> Rpc_async.T.get) >>=
1340+
function | Ok x -> Async.Deferred.return x | Error y -> failwith "self test failed"
13411341

13421342
let self_test ~root_dir =
13431343
(self_test_plugin ~root_dir "org.xen.xapi.storage.dummy"

0 commit comments

Comments
 (0)