diff options
Diffstat (limited to 'src/vyconf_pbt.ml')
-rw-r--r-- | src/vyconf_pbt.ml | 443 |
1 files changed, 391 insertions, 52 deletions
diff --git a/src/vyconf_pbt.ml b/src/vyconf_pbt.ml index 48a8e87..913fcea 100644 --- a/src/vyconf_pbt.ml +++ b/src/vyconf_pbt.ml @@ -8,13 +8,26 @@ type request_output_format = | Out_plain | Out_json -type request_status = unit +type request_prompt = unit type request_setup_session = { + client_pid : int32; client_application : string option; on_behalf_of : int32 option; } +type request_session_of_pid = { + client_pid : int32; +} + +type request_session_update_pid = { + client_pid : int32; +} + +type request_get_config = { + dummy : int32 option; +} + type request_teardown = { on_behalf_of : int32 option; } @@ -32,6 +45,14 @@ type request_delete = { path : string list; } +type request_discard = { + dummy : int32 option; +} + +type request_session_changed = { + dummy : int32 option; +} + type request_rename = { edit_level : string list; from : string; @@ -62,11 +83,13 @@ type request_rollback = { type request_load = { location : string; + cached : bool; format : request_config_format option; } type request_merge = { location : string; + destructive : bool; format : request_config_format option; } @@ -118,7 +141,7 @@ type request_reload_reftree = { } type request = - | Status + | Prompt | Setup_session of request_setup_session | Set of request_set | Delete of request_delete @@ -136,18 +159,24 @@ type request = | List_children of request_list_children | Run_op_mode of request_run_op_mode | Confirm - | Configure of request_enter_configuration_mode - | Exit_configure + | Enter_configuration_mode of request_enter_configuration_mode + | Exit_configuration_mode | Validate of request_validate | Teardown of request_teardown | Reload_reftree of request_reload_reftree + | Load of request_load + | Discard of request_discard + | Session_changed of request_session_changed + | Session_of_pid of request_session_of_pid + | Session_update_pid of request_session_update_pid + | Get_config of request_get_config type request_envelope = { token : string option; request : request; } -type status = +type errnum = | Success | Fail | Invalid_path @@ -157,9 +186,10 @@ type status = | Internal_error | Permission_denied | Path_already_exists + | Uncommited_changes type response = { - status : status; + status : errnum; output : string option; error : string option; warning : string option; @@ -169,16 +199,36 @@ let rec default_request_config_format () = (Curly:request_config_format) let rec default_request_output_format () = (Out_plain:request_output_format) -let rec default_request_status = () +let rec default_request_prompt = () let rec default_request_setup_session + ?client_pid:((client_pid:int32) = 0l) ?client_application:((client_application:string option) = None) ?on_behalf_of:((on_behalf_of:int32 option) = None) () : request_setup_session = { + client_pid; client_application; on_behalf_of; } +let rec default_request_session_of_pid + ?client_pid:((client_pid:int32) = 0l) + () : request_session_of_pid = { + client_pid; +} + +let rec default_request_session_update_pid + ?client_pid:((client_pid:int32) = 0l) + () : request_session_update_pid = { + client_pid; +} + +let rec default_request_get_config + ?dummy:((dummy:int32 option) = None) + () : request_get_config = { + dummy; +} + let rec default_request_teardown ?on_behalf_of:((on_behalf_of:int32 option) = None) () : request_teardown = { @@ -205,6 +255,18 @@ let rec default_request_delete path; } +let rec default_request_discard + ?dummy:((dummy:int32 option) = None) + () : request_discard = { + dummy; +} + +let rec default_request_session_changed + ?dummy:((dummy:int32 option) = None) + () : request_session_changed = { + dummy; +} + let rec default_request_rename ?edit_level:((edit_level:string list) = []) ?from:((from:string) = "") @@ -253,17 +315,21 @@ let rec default_request_rollback let rec default_request_load ?location:((location:string) = "") + ?cached:((cached:bool) = false) ?format:((format:request_config_format option) = None) () : request_load = { location; + cached; format; } let rec default_request_merge ?location:((location:string) = "") + ?destructive:((destructive:bool) = false) ?format:((format:request_config_format option) = None) () : request_merge = { location; + destructive; format; } @@ -339,7 +405,7 @@ let rec default_request_reload_reftree on_behalf_of; } -let rec default_request (): request = Status +let rec default_request (): request = Prompt let rec default_request_envelope ?token:((token:string option) = None) @@ -349,10 +415,10 @@ let rec default_request_envelope request; } -let rec default_status () = (Success:status) +let rec default_errnum () = (Success:errnum) let rec default_response - ?status:((status:status) = default_status ()) + ?status:((status:errnum) = default_errnum ()) ?output:((output:string option) = None) ?error:((error:string option) = None) ?warning:((warning:string option) = None) @@ -364,15 +430,41 @@ let rec default_response } type request_setup_session_mutable = { + mutable client_pid : int32; mutable client_application : string option; mutable on_behalf_of : int32 option; } let default_request_setup_session_mutable () : request_setup_session_mutable = { + client_pid = 0l; client_application = None; on_behalf_of = None; } +type request_session_of_pid_mutable = { + mutable client_pid : int32; +} + +let default_request_session_of_pid_mutable () : request_session_of_pid_mutable = { + client_pid = 0l; +} + +type request_session_update_pid_mutable = { + mutable client_pid : int32; +} + +let default_request_session_update_pid_mutable () : request_session_update_pid_mutable = { + client_pid = 0l; +} + +type request_get_config_mutable = { + mutable dummy : int32 option; +} + +let default_request_get_config_mutable () : request_get_config_mutable = { + dummy = None; +} + type request_teardown_mutable = { mutable on_behalf_of : int32 option; } @@ -407,6 +499,22 @@ let default_request_delete_mutable () : request_delete_mutable = { path = []; } +type request_discard_mutable = { + mutable dummy : int32 option; +} + +let default_request_discard_mutable () : request_discard_mutable = { + dummy = None; +} + +type request_session_changed_mutable = { + mutable dummy : int32 option; +} + +let default_request_session_changed_mutable () : request_session_changed_mutable = { + dummy = None; +} + type request_rename_mutable = { mutable edit_level : string list; mutable from : string; @@ -465,21 +573,25 @@ let default_request_rollback_mutable () : request_rollback_mutable = { type request_load_mutable = { mutable location : string; + mutable cached : bool; mutable format : request_config_format option; } let default_request_load_mutable () : request_load_mutable = { location = ""; + cached = false; format = None; } type request_merge_mutable = { mutable location : string; + mutable destructive : bool; mutable format : request_config_format option; } let default_request_merge_mutable () : request_merge_mutable = { location = ""; + destructive = false; format = None; } @@ -580,14 +692,14 @@ let default_request_envelope_mutable () : request_envelope_mutable = { } type response_mutable = { - mutable status : status; + mutable status : errnum; mutable output : string option; mutable error : string option; mutable warning : string option; } let default_response_mutable () : response_mutable = { - status = default_status (); + status = default_errnum (); output = None; error = None; warning = None; @@ -607,7 +719,7 @@ let rec pp_request_output_format fmt (v:request_output_format) = | Out_plain -> Format.fprintf fmt "Out_plain" | Out_json -> Format.fprintf fmt "Out_json" -let rec pp_request_status fmt (v:request_status) = +let rec pp_request_prompt fmt (v:request_prompt) = let pp_i fmt () = Pbrt.Pp.pp_unit fmt () in @@ -615,11 +727,30 @@ let rec pp_request_status fmt (v:request_status) = let rec pp_request_setup_session fmt (v:request_setup_session) = let pp_i fmt () = - Pbrt.Pp.pp_record_field ~first:true "client_application" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.client_application; + Pbrt.Pp.pp_record_field ~first:true "client_pid" Pbrt.Pp.pp_int32 fmt v.client_pid; + Pbrt.Pp.pp_record_field ~first:false "client_application" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.client_application; Pbrt.Pp.pp_record_field ~first:false "on_behalf_of" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.on_behalf_of; in Pbrt.Pp.pp_brk pp_i fmt () +let rec pp_request_session_of_pid fmt (v:request_session_of_pid) = + let pp_i fmt () = + Pbrt.Pp.pp_record_field ~first:true "client_pid" Pbrt.Pp.pp_int32 fmt v.client_pid; + in + Pbrt.Pp.pp_brk pp_i fmt () + +let rec pp_request_session_update_pid fmt (v:request_session_update_pid) = + let pp_i fmt () = + Pbrt.Pp.pp_record_field ~first:true "client_pid" Pbrt.Pp.pp_int32 fmt v.client_pid; + in + Pbrt.Pp.pp_brk pp_i fmt () + +let rec pp_request_get_config fmt (v:request_get_config) = + let pp_i fmt () = + Pbrt.Pp.pp_record_field ~first:true "dummy" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.dummy; + in + Pbrt.Pp.pp_brk pp_i fmt () + let rec pp_request_teardown fmt (v:request_teardown) = let pp_i fmt () = Pbrt.Pp.pp_record_field ~first:true "on_behalf_of" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.on_behalf_of; @@ -645,6 +776,18 @@ let rec pp_request_delete fmt (v:request_delete) = in Pbrt.Pp.pp_brk pp_i fmt () +let rec pp_request_discard fmt (v:request_discard) = + let pp_i fmt () = + Pbrt.Pp.pp_record_field ~first:true "dummy" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.dummy; + in + Pbrt.Pp.pp_brk pp_i fmt () + +let rec pp_request_session_changed fmt (v:request_session_changed) = + let pp_i fmt () = + Pbrt.Pp.pp_record_field ~first:true "dummy" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.dummy; + in + Pbrt.Pp.pp_brk pp_i fmt () + let rec pp_request_rename fmt (v:request_rename) = let pp_i fmt () = Pbrt.Pp.pp_record_field ~first:true "edit_level" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.edit_level; @@ -686,6 +829,7 @@ let rec pp_request_rollback fmt (v:request_rollback) = let rec pp_request_load fmt (v:request_load) = let pp_i fmt () = Pbrt.Pp.pp_record_field ~first:true "location" Pbrt.Pp.pp_string fmt v.location; + Pbrt.Pp.pp_record_field ~first:false "cached" Pbrt.Pp.pp_bool fmt v.cached; Pbrt.Pp.pp_record_field ~first:false "format" (Pbrt.Pp.pp_option pp_request_config_format) fmt v.format; in Pbrt.Pp.pp_brk pp_i fmt () @@ -693,6 +837,7 @@ let rec pp_request_load fmt (v:request_load) = let rec pp_request_merge fmt (v:request_merge) = let pp_i fmt () = Pbrt.Pp.pp_record_field ~first:true "location" Pbrt.Pp.pp_string fmt v.location; + Pbrt.Pp.pp_record_field ~first:false "destructive" Pbrt.Pp.pp_bool fmt v.destructive; Pbrt.Pp.pp_record_field ~first:false "format" (Pbrt.Pp.pp_option pp_request_config_format) fmt v.format; in Pbrt.Pp.pp_brk pp_i fmt () @@ -772,7 +917,7 @@ let rec pp_request_reload_reftree fmt (v:request_reload_reftree) = let rec pp_request fmt (v:request) = match v with - | Status -> Format.fprintf fmt "Status" + | Prompt -> Format.fprintf fmt "Prompt" | Setup_session x -> Format.fprintf fmt "@[<hv2>Setup_session(@,%a)@]" pp_request_setup_session x | Set x -> Format.fprintf fmt "@[<hv2>Set(@,%a)@]" pp_request_set x | Delete x -> Format.fprintf fmt "@[<hv2>Delete(@,%a)@]" pp_request_delete x @@ -790,11 +935,17 @@ let rec pp_request fmt (v:request) = | List_children x -> Format.fprintf fmt "@[<hv2>List_children(@,%a)@]" pp_request_list_children x | Run_op_mode x -> Format.fprintf fmt "@[<hv2>Run_op_mode(@,%a)@]" pp_request_run_op_mode x | Confirm -> Format.fprintf fmt "Confirm" - | Configure x -> Format.fprintf fmt "@[<hv2>Configure(@,%a)@]" pp_request_enter_configuration_mode x - | Exit_configure -> Format.fprintf fmt "Exit_configure" + | Enter_configuration_mode x -> Format.fprintf fmt "@[<hv2>Enter_configuration_mode(@,%a)@]" pp_request_enter_configuration_mode x + | Exit_configuration_mode -> Format.fprintf fmt "Exit_configuration_mode" | Validate x -> Format.fprintf fmt "@[<hv2>Validate(@,%a)@]" pp_request_validate x | Teardown x -> Format.fprintf fmt "@[<hv2>Teardown(@,%a)@]" pp_request_teardown x | Reload_reftree x -> Format.fprintf fmt "@[<hv2>Reload_reftree(@,%a)@]" pp_request_reload_reftree x + | Load x -> Format.fprintf fmt "@[<hv2>Load(@,%a)@]" pp_request_load x + | Discard x -> Format.fprintf fmt "@[<hv2>Discard(@,%a)@]" pp_request_discard x + | Session_changed x -> Format.fprintf fmt "@[<hv2>Session_changed(@,%a)@]" pp_request_session_changed x + | Session_of_pid x -> Format.fprintf fmt "@[<hv2>Session_of_pid(@,%a)@]" pp_request_session_of_pid x + | Session_update_pid x -> Format.fprintf fmt "@[<hv2>Session_update_pid(@,%a)@]" pp_request_session_update_pid x + | Get_config x -> Format.fprintf fmt "@[<hv2>Get_config(@,%a)@]" pp_request_get_config x let rec pp_request_envelope fmt (v:request_envelope) = let pp_i fmt () = @@ -803,7 +954,7 @@ let rec pp_request_envelope fmt (v:request_envelope) = in Pbrt.Pp.pp_brk pp_i fmt () -let rec pp_status fmt (v:status) = +let rec pp_errnum fmt (v:errnum) = match v with | Success -> Format.fprintf fmt "Success" | Fail -> Format.fprintf fmt "Fail" @@ -814,10 +965,11 @@ let rec pp_status fmt (v:status) = | Internal_error -> Format.fprintf fmt "Internal_error" | Permission_denied -> Format.fprintf fmt "Permission_denied" | Path_already_exists -> Format.fprintf fmt "Path_already_exists" + | Uncommited_changes -> Format.fprintf fmt "Uncommited_changes" let rec pp_response fmt (v:response) = let pp_i fmt () = - Pbrt.Pp.pp_record_field ~first:true "status" pp_status fmt v.status; + Pbrt.Pp.pp_record_field ~first:true "status" pp_errnum fmt v.status; Pbrt.Pp.pp_record_field ~first:false "output" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.output; Pbrt.Pp.pp_record_field ~first:false "error" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.error; Pbrt.Pp.pp_record_field ~first:false "warning" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.warning; @@ -838,20 +990,41 @@ let rec encode_pb_request_output_format (v:request_output_format) encoder = | Out_plain -> Pbrt.Encoder.int_as_varint (0) encoder | Out_json -> Pbrt.Encoder.int_as_varint 1 encoder -let rec encode_pb_request_status (v:request_status) encoder = +let rec encode_pb_request_prompt (v:request_prompt) encoder = () let rec encode_pb_request_setup_session (v:request_setup_session) encoder = + Pbrt.Encoder.int32_as_varint v.client_pid encoder; + Pbrt.Encoder.key 1 Pbrt.Varint encoder; begin match v.client_application with | Some x -> Pbrt.Encoder.string x encoder; - Pbrt.Encoder.key 1 Pbrt.Bytes encoder; + Pbrt.Encoder.key 2 Pbrt.Bytes encoder; | None -> (); end; begin match v.on_behalf_of with | Some x -> Pbrt.Encoder.int32_as_varint x encoder; - Pbrt.Encoder.key 2 Pbrt.Varint encoder; + Pbrt.Encoder.key 3 Pbrt.Varint encoder; + | None -> (); + end; + () + +let rec encode_pb_request_session_of_pid (v:request_session_of_pid) encoder = + Pbrt.Encoder.int32_as_varint v.client_pid encoder; + Pbrt.Encoder.key 1 Pbrt.Varint encoder; + () + +let rec encode_pb_request_session_update_pid (v:request_session_update_pid) encoder = + Pbrt.Encoder.int32_as_varint v.client_pid encoder; + Pbrt.Encoder.key 1 Pbrt.Varint encoder; + () + +let rec encode_pb_request_get_config (v:request_get_config) encoder = + begin match v.dummy with + | Some x -> + Pbrt.Encoder.int32_as_varint x encoder; + Pbrt.Encoder.key 1 Pbrt.Varint encoder; | None -> (); end; () @@ -892,6 +1065,24 @@ let rec encode_pb_request_delete (v:request_delete) encoder = ) v.path encoder; () +let rec encode_pb_request_discard (v:request_discard) encoder = + begin match v.dummy with + | Some x -> + Pbrt.Encoder.int32_as_varint x encoder; + Pbrt.Encoder.key 1 Pbrt.Varint encoder; + | None -> (); + end; + () + +let rec encode_pb_request_session_changed (v:request_session_changed) encoder = + begin match v.dummy with + | Some x -> + Pbrt.Encoder.int32_as_varint x encoder; + Pbrt.Encoder.key 1 Pbrt.Varint encoder; + | None -> (); + end; + () + let rec encode_pb_request_rename (v:request_rename) encoder = Pbrt.List_util.rev_iter_with (fun x encoder -> Pbrt.Encoder.string x encoder; @@ -958,10 +1149,12 @@ let rec encode_pb_request_rollback (v:request_rollback) encoder = let rec encode_pb_request_load (v:request_load) encoder = Pbrt.Encoder.string v.location encoder; Pbrt.Encoder.key 1 Pbrt.Bytes encoder; + Pbrt.Encoder.bool v.cached encoder; + Pbrt.Encoder.key 2 Pbrt.Varint encoder; begin match v.format with | Some x -> encode_pb_request_config_format x encoder; - Pbrt.Encoder.key 2 Pbrt.Varint encoder; + Pbrt.Encoder.key 3 Pbrt.Varint encoder; | None -> (); end; () @@ -969,10 +1162,12 @@ let rec encode_pb_request_load (v:request_load) encoder = let rec encode_pb_request_merge (v:request_merge) encoder = Pbrt.Encoder.string v.location encoder; Pbrt.Encoder.key 1 Pbrt.Bytes encoder; + Pbrt.Encoder.bool v.destructive encoder; + Pbrt.Encoder.key 2 Pbrt.Varint encoder; begin match v.format with | Some x -> encode_pb_request_config_format x encoder; - Pbrt.Encoder.key 2 Pbrt.Varint encoder; + Pbrt.Encoder.key 3 Pbrt.Varint encoder; | None -> (); end; () @@ -1084,7 +1279,7 @@ let rec encode_pb_request_reload_reftree (v:request_reload_reftree) encoder = let rec encode_pb_request (v:request) encoder = begin match v with - | Status -> + | Prompt -> Pbrt.Encoder.key 1 Pbrt.Bytes encoder; Pbrt.Encoder.empty_nested encoder | Setup_session x -> @@ -1138,10 +1333,10 @@ let rec encode_pb_request (v:request) encoder = | Confirm -> Pbrt.Encoder.key 18 Pbrt.Bytes encoder; Pbrt.Encoder.empty_nested encoder - | Configure x -> + | Enter_configuration_mode x -> Pbrt.Encoder.nested encode_pb_request_enter_configuration_mode x encoder; Pbrt.Encoder.key 19 Pbrt.Bytes encoder; - | Exit_configure -> + | Exit_configuration_mode -> Pbrt.Encoder.key 20 Pbrt.Bytes encoder; Pbrt.Encoder.empty_nested encoder | Validate x -> @@ -1153,6 +1348,24 @@ let rec encode_pb_request (v:request) encoder = | Reload_reftree x -> Pbrt.Encoder.nested encode_pb_request_reload_reftree x encoder; Pbrt.Encoder.key 23 Pbrt.Bytes encoder; + | Load x -> + Pbrt.Encoder.nested encode_pb_request_load x encoder; + Pbrt.Encoder.key 24 Pbrt.Bytes encoder; + | Discard x -> + Pbrt.Encoder.nested encode_pb_request_discard x encoder; + Pbrt.Encoder.key 25 Pbrt.Bytes encoder; + | Session_changed x -> + Pbrt.Encoder.nested encode_pb_request_session_changed x encoder; + Pbrt.Encoder.key 26 Pbrt.Bytes encoder; + | Session_of_pid x -> + Pbrt.Encoder.nested encode_pb_request_session_of_pid x encoder; + Pbrt.Encoder.key 27 Pbrt.Bytes encoder; + | Session_update_pid x -> + Pbrt.Encoder.nested encode_pb_request_session_update_pid x encoder; + Pbrt.Encoder.key 28 Pbrt.Bytes encoder; + | Get_config x -> + Pbrt.Encoder.nested encode_pb_request_get_config x encoder; + Pbrt.Encoder.key 29 Pbrt.Bytes encoder; end let rec encode_pb_request_envelope (v:request_envelope) encoder = @@ -1166,7 +1379,7 @@ let rec encode_pb_request_envelope (v:request_envelope) encoder = Pbrt.Encoder.key 2 Pbrt.Bytes encoder; () -let rec encode_pb_status (v:status) encoder = +let rec encode_pb_errnum (v:errnum) encoder = match v with | Success -> Pbrt.Encoder.int_as_varint (0) encoder | Fail -> Pbrt.Encoder.int_as_varint 1 encoder @@ -1177,9 +1390,10 @@ let rec encode_pb_status (v:status) encoder = | Internal_error -> Pbrt.Encoder.int_as_varint 6 encoder | Permission_denied -> Pbrt.Encoder.int_as_varint 7 encoder | Path_already_exists -> Pbrt.Encoder.int_as_varint 8 encoder + | Uncommited_changes -> Pbrt.Encoder.int_as_varint 9 encoder let rec encode_pb_response (v:response) encoder = - encode_pb_status v.status encoder; + encode_pb_errnum v.status encoder; Pbrt.Encoder.key 1 Pbrt.Varint encoder; begin match v.output with | Some x -> @@ -1217,36 +1431,102 @@ let rec decode_pb_request_output_format d = | 1 -> (Out_json:request_output_format) | _ -> Pbrt.Decoder.malformed_variant "request_output_format" -let rec decode_pb_request_status d = +let rec decode_pb_request_prompt d = match Pbrt.Decoder.key d with | None -> (); | Some (_, pk) -> - Pbrt.Decoder.unexpected_payload "Unexpected fields in empty message(request_status)" pk + Pbrt.Decoder.unexpected_payload "Unexpected fields in empty message(request_prompt)" pk let rec decode_pb_request_setup_session d = let v = default_request_setup_session_mutable () in let continue__= ref true in + let client_pid_is_set = ref false in while !continue__ do match Pbrt.Decoder.key d with | None -> ( ); continue__ := false - | Some (1, Pbrt.Bytes) -> begin - v.client_application <- Some (Pbrt.Decoder.string d); + | Some (1, Pbrt.Varint) -> begin + v.client_pid <- Pbrt.Decoder.int32_as_varint d; client_pid_is_set := true; end | Some (1, pk) -> Pbrt.Decoder.unexpected_payload "Message(request_setup_session), field(1)" pk - | Some (2, Pbrt.Varint) -> begin - v.on_behalf_of <- Some (Pbrt.Decoder.int32_as_varint d); + | Some (2, Pbrt.Bytes) -> begin + v.client_application <- Some (Pbrt.Decoder.string d); end | Some (2, pk) -> Pbrt.Decoder.unexpected_payload "Message(request_setup_session), field(2)" pk + | Some (3, Pbrt.Varint) -> begin + v.on_behalf_of <- Some (Pbrt.Decoder.int32_as_varint d); + end + | Some (3, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_setup_session), field(3)" pk | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind done; + begin if not !client_pid_is_set then Pbrt.Decoder.missing_field "client_pid" end; ({ + client_pid = v.client_pid; client_application = v.client_application; on_behalf_of = v.on_behalf_of; } : request_setup_session) +let rec decode_pb_request_session_of_pid d = + let v = default_request_session_of_pid_mutable () in + let continue__= ref true in + let client_pid_is_set = ref false in + while !continue__ do + match Pbrt.Decoder.key d with + | None -> ( + ); continue__ := false + | Some (1, Pbrt.Varint) -> begin + v.client_pid <- Pbrt.Decoder.int32_as_varint d; client_pid_is_set := true; + end + | Some (1, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_session_of_pid), field(1)" pk + | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind + done; + begin if not !client_pid_is_set then Pbrt.Decoder.missing_field "client_pid" end; + ({ + client_pid = v.client_pid; + } : request_session_of_pid) + +let rec decode_pb_request_session_update_pid d = + let v = default_request_session_update_pid_mutable () in + let continue__= ref true in + let client_pid_is_set = ref false in + while !continue__ do + match Pbrt.Decoder.key d with + | None -> ( + ); continue__ := false + | Some (1, Pbrt.Varint) -> begin + v.client_pid <- Pbrt.Decoder.int32_as_varint d; client_pid_is_set := true; + end + | Some (1, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_session_update_pid), field(1)" pk + | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind + done; + begin if not !client_pid_is_set then Pbrt.Decoder.missing_field "client_pid" end; + ({ + client_pid = v.client_pid; + } : request_session_update_pid) + +let rec decode_pb_request_get_config d = + let v = default_request_get_config_mutable () in + let continue__= ref true in + while !continue__ do + match Pbrt.Decoder.key d with + | None -> ( + ); continue__ := false + | Some (1, Pbrt.Varint) -> begin + v.dummy <- Some (Pbrt.Decoder.int32_as_varint d); + end + | Some (1, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_get_config), field(1)" pk + | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind + done; + ({ + dummy = v.dummy; + } : request_get_config) + let rec decode_pb_request_teardown d = let v = default_request_teardown_mutable () in let continue__= ref true in @@ -1328,6 +1608,42 @@ let rec decode_pb_request_delete d = path = v.path; } : request_delete) +let rec decode_pb_request_discard d = + let v = default_request_discard_mutable () in + let continue__= ref true in + while !continue__ do + match Pbrt.Decoder.key d with + | None -> ( + ); continue__ := false + | Some (1, Pbrt.Varint) -> begin + v.dummy <- Some (Pbrt.Decoder.int32_as_varint d); + end + | Some (1, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_discard), field(1)" pk + | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind + done; + ({ + dummy = v.dummy; + } : request_discard) + +let rec decode_pb_request_session_changed d = + let v = default_request_session_changed_mutable () in + let continue__= ref true in + while !continue__ do + match Pbrt.Decoder.key d with + | None -> ( + ); continue__ := false + | Some (1, Pbrt.Varint) -> begin + v.dummy <- Some (Pbrt.Decoder.int32_as_varint d); + end + | Some (1, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_session_changed), field(1)" pk + | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind + done; + ({ + dummy = v.dummy; + } : request_session_changed) + let rec decode_pb_request_rename d = let v = default_request_rename_mutable () in let continue__= ref true in @@ -1484,6 +1800,7 @@ let rec decode_pb_request_rollback d = let rec decode_pb_request_load d = let v = default_request_load_mutable () in let continue__= ref true in + let cached_is_set = ref false in let location_is_set = ref false in while !continue__ do match Pbrt.Decoder.key d with @@ -1495,21 +1812,29 @@ let rec decode_pb_request_load d = | Some (1, pk) -> Pbrt.Decoder.unexpected_payload "Message(request_load), field(1)" pk | Some (2, Pbrt.Varint) -> begin - v.format <- Some (decode_pb_request_config_format d); + v.cached <- Pbrt.Decoder.bool d; cached_is_set := true; end | Some (2, pk) -> Pbrt.Decoder.unexpected_payload "Message(request_load), field(2)" pk + | Some (3, Pbrt.Varint) -> begin + v.format <- Some (decode_pb_request_config_format d); + end + | Some (3, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_load), field(3)" pk | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind done; + begin if not !cached_is_set then Pbrt.Decoder.missing_field "cached" end; begin if not !location_is_set then Pbrt.Decoder.missing_field "location" end; ({ location = v.location; + cached = v.cached; format = v.format; } : request_load) let rec decode_pb_request_merge d = let v = default_request_merge_mutable () in let continue__= ref true in + let destructive_is_set = ref false in let location_is_set = ref false in while !continue__ do match Pbrt.Decoder.key d with @@ -1521,15 +1846,22 @@ let rec decode_pb_request_merge d = | Some (1, pk) -> Pbrt.Decoder.unexpected_payload "Message(request_merge), field(1)" pk | Some (2, Pbrt.Varint) -> begin - v.format <- Some (decode_pb_request_config_format d); + v.destructive <- Pbrt.Decoder.bool d; destructive_is_set := true; end | Some (2, pk) -> Pbrt.Decoder.unexpected_payload "Message(request_merge), field(2)" pk + | Some (3, Pbrt.Varint) -> begin + v.format <- Some (decode_pb_request_config_format d); + end + | Some (3, pk) -> + Pbrt.Decoder.unexpected_payload "Message(request_merge), field(3)" pk | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind done; + begin if not !destructive_is_set then Pbrt.Decoder.missing_field "destructive" end; begin if not !location_is_set then Pbrt.Decoder.missing_field "location" end; ({ location = v.location; + destructive = v.destructive; format = v.format; } : request_merge) @@ -1767,7 +2099,7 @@ let rec decode_pb_request d = | None -> Pbrt.Decoder.malformed_variant "request" | Some (1, _) -> begin Pbrt.Decoder.empty_nested d ; - (Status : request) + (Prompt : request) end | Some (2, _) -> (Setup_session (decode_pb_request_setup_session (Pbrt.Decoder.nested d)) : request) | Some (3, _) -> (Set (decode_pb_request_set (Pbrt.Decoder.nested d)) : request) @@ -1789,14 +2121,20 @@ let rec decode_pb_request d = Pbrt.Decoder.empty_nested d ; (Confirm : request) end - | Some (19, _) -> (Configure (decode_pb_request_enter_configuration_mode (Pbrt.Decoder.nested d)) : request) + | Some (19, _) -> (Enter_configuration_mode (decode_pb_request_enter_configuration_mode (Pbrt.Decoder.nested d)) : request) | Some (20, _) -> begin Pbrt.Decoder.empty_nested d ; - (Exit_configure : request) + (Exit_configuration_mode : request) end | Some (21, _) -> (Validate (decode_pb_request_validate (Pbrt.Decoder.nested d)) : request) | Some (22, _) -> (Teardown (decode_pb_request_teardown (Pbrt.Decoder.nested d)) : request) | Some (23, _) -> (Reload_reftree (decode_pb_request_reload_reftree (Pbrt.Decoder.nested d)) : request) + | Some (24, _) -> (Load (decode_pb_request_load (Pbrt.Decoder.nested d)) : request) + | Some (25, _) -> (Discard (decode_pb_request_discard (Pbrt.Decoder.nested d)) : request) + | Some (26, _) -> (Session_changed (decode_pb_request_session_changed (Pbrt.Decoder.nested d)) : request) + | Some (27, _) -> (Session_of_pid (decode_pb_request_session_of_pid (Pbrt.Decoder.nested d)) : request) + | Some (28, _) -> (Session_update_pid (decode_pb_request_session_update_pid (Pbrt.Decoder.nested d)) : request) + | Some (29, _) -> (Get_config (decode_pb_request_get_config (Pbrt.Decoder.nested d)) : request) | Some (n, payload_kind) -> ( Pbrt.Decoder.skip d payload_kind; loop () @@ -1832,18 +2170,19 @@ let rec decode_pb_request_envelope d = request = v.request; } : request_envelope) -let rec decode_pb_status d = +let rec decode_pb_errnum d = match Pbrt.Decoder.int_as_varint d with - | 0 -> (Success:status) - | 1 -> (Fail:status) - | 2 -> (Invalid_path:status) - | 3 -> (Invalid_value:status) - | 4 -> (Commit_in_progress:status) - | 5 -> (Configuration_locked:status) - | 6 -> (Internal_error:status) - | 7 -> (Permission_denied:status) - | 8 -> (Path_already_exists:status) - | _ -> Pbrt.Decoder.malformed_variant "status" + | 0 -> (Success:errnum) + | 1 -> (Fail:errnum) + | 2 -> (Invalid_path:errnum) + | 3 -> (Invalid_value:errnum) + | 4 -> (Commit_in_progress:errnum) + | 5 -> (Configuration_locked:errnum) + | 6 -> (Internal_error:errnum) + | 7 -> (Permission_denied:errnum) + | 8 -> (Path_already_exists:errnum) + | 9 -> (Uncommited_changes:errnum) + | _ -> Pbrt.Decoder.malformed_variant "errnum" let rec decode_pb_response d = let v = default_response_mutable () in @@ -1854,7 +2193,7 @@ let rec decode_pb_response d = | None -> ( ); continue__ := false | Some (1, Pbrt.Varint) -> begin - v.status <- decode_pb_status d; status_is_set := true; + v.status <- decode_pb_errnum d; status_is_set := true; end | Some (1, pk) -> Pbrt.Decoder.unexpected_payload "Message(response), field(1)" pk |