You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
idl/gen_client: Don't specify argument values when they're equal to defaults
This enables client.ml to skip specifying an arbitrary number of rightmost
arguments if they're all equal to their default values (since arguments are
positional, once an argument is not skipped, no arguments to its left can be
skipped).
Generated code for e.g. host.disable looks like the following:
let session_id = rpc_of_ref_session session_id in
let host = rpc_of_ref_host host in
let auto_enable = rpc_of_bool auto_enable in
let needed_args, _ = List.fold_right2
(fun param default (acc, skipped)->
(* Since arguments are positional, we can only skip specifying an
argument that's equal to its default value if all the arguments to
its right were also not specified *)
if skipped then
(match default with
| Some default_value when param = default_value -> (acc, true)
| _ -> (param::acc, false))
else
(param :: acc, false)
) [ session_id; host; auto_enable ] [ None; None; Some (Rpc.Bool true) ] ([], true)
in
rpc_wrapper rpc "host.disable" needed_args >>= fun x -> return (ignore x)
This fixes an issue with client.ml always specifying values for new parameters
that older server.ml did not know about (which happens during an RPU).
Fixes: cf5be62 ("host.disable: Add auto_enabled parameter for persistency")
Signed-off-by: Andrii Sultanov <[email protected]>
0 commit comments