diff options
-rw-r--r-- | _tags | 5 | ||||
-rw-r--r-- | data/vyconf.proto | 11 | ||||
-rw-r--r-- | myocamlbuild.ml | 5 | ||||
-rw-r--r-- | setup.ml | 149 | ||||
-rw-r--r-- | src/vyconf_pb.ml | 127 | ||||
-rw-r--r-- | src/vyconf_pb.mli | 14 |
6 files changed, 296 insertions, 15 deletions
@@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: 11f71f9fb0db5e0d6e22aa91f3d802d1) +# DO NOT EDIT (digest: c2be8ef2e29762b40de09512178308e2) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -32,6 +32,9 @@ true: annot, bin_annot # Library util "src/util.cmxs": use_util <src/*.ml{,i,y}>: pkg_xml-light +# Library vyconf_pb +"src/vyconf_pb.cmxs": use_vyconf_pb +<src/*.ml{,i,y}>: pkg_ocaml-protoc # Library session "src/session.cmxs": use_session # Library vyconf_config diff --git a/data/vyconf.proto b/data/vyconf.proto index fa53eec..e2f7496 100644 --- a/data/vyconf.proto +++ b/data/vyconf.proto @@ -4,12 +4,14 @@ message Request { JSON = 1; } - message Noop { + message Status { } message SetupSession { optional bool Exclusive = 1; optional bool OverrideExclusive = 2; + optional string ClientApplication = 3; + optional int32 OnBehalfOf = 4; } message Set { @@ -91,7 +93,7 @@ message Request { } oneof msg { - Noop noop = 1; + Status status = 1; SetupSession setup_session = 2; Set set = 3; Delete delete = 4; @@ -118,5 +120,8 @@ enum Status { message Response { required Status status = 1; - + optional string output = 2; + repeated string errors = 3; + repeated string warnings = 4; + repeated string notifications = 5; } diff --git a/myocamlbuild.ml b/myocamlbuild.ml index aa5f961..5f949e0 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -1,5 +1,5 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: fe421d7855eaa36f8c679b22e20ca400) *) +(* DO NOT EDIT (digest: 58bff247d86c1c73243351c92c8e76a6) *) module OASISGettext = struct (* # 22 "src/oasis/OASISGettext.ml" *) @@ -895,6 +895,7 @@ let package_default = ("curly_lexer", ["src"], []); ("curly_parser", ["src"], []); ("util", ["src"], []); + ("vyconf_pb", ["src"], []); ("session", ["src"], []); ("vyconf_config", ["src"], []); ("directories", ["src"], []); @@ -911,6 +912,6 @@ let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false} let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;; -# 915 "myocamlbuild.ml" +# 916 "myocamlbuild.ml" (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default;; @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.4.8 *) (* OASIS_START *) -(* DO NOT EDIT (digest: 864616e4170e766962c59cf4f1c4a434) *) +(* DO NOT EDIT (digest: 6648bc241749672812679ffa81a71ffe) *) (* Regenerated by OASIS v0.4.8 Visit http://oasis.forge.ocamlcore.org for more information and @@ -8365,6 +8365,149 @@ let setup_t = }); Library ({ + cs_name = "vyconf_pb"; + cs_data = PropList.Data.create (); + cs_plugin_data = [] + }, + { + bs_build = [(OASISExpr.EBool true, true)]; + bs_install = [(OASISExpr.EBool true, true)]; + bs_path = "src"; + bs_compiled_object = Best; + bs_build_depends = + [FindlibPackage ("ocaml-protoc", None)]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_interface_patterns = + [ + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("capitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".mli" + ]; + origin = "${capitalize_file module}.mli" + }; + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("uncapitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".mli" + ]; + origin = "${uncapitalize_file module}.mli" + } + ]; + bs_implementation_patterns = + [ + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("capitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".ml" + ]; + origin = "${capitalize_file module}.ml" + }; + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("uncapitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".ml" + ]; + origin = "${uncapitalize_file module}.ml" + }; + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("capitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".mll" + ]; + origin = "${capitalize_file module}.mll" + }; + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("uncapitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".mll" + ]; + origin = "${uncapitalize_file module}.mll" + }; + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("capitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".mly" + ]; + origin = "${capitalize_file module}.mly" + }; + { + OASISSourcePatterns.Templater.atoms = + [ + OASISSourcePatterns.Templater.Text ""; + OASISSourcePatterns.Templater.Expr + (OASISSourcePatterns.Templater.Call + ("uncapitalize_file", + OASISSourcePatterns.Templater.Ident + "module")); + OASISSourcePatterns.Templater.Text ".mly" + ]; + origin = "${uncapitalize_file module}.mly" + } + ]; + bs_c_sources = []; + bs_data_files = []; + bs_findlib_extra_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])] + }, + { + lib_modules = ["Vyconf_pb"]; + lib_pack = false; + lib_internal_modules = []; + lib_findlib_parent = Some "vyconf"; + lib_findlib_name = None; + lib_findlib_directory = None; + lib_findlib_containers = [] + }); + Library + ({ cs_name = "session"; cs_data = PropList.Data.create (); cs_plugin_data = [] @@ -10813,7 +10956,7 @@ let setup_t = }; oasis_fn = Some "_oasis"; oasis_version = "0.4.8"; - oasis_digest = Some "w\168\147\244\020;\181\n\r\243\131>os\2135"; + oasis_digest = Some "`\144\186'\244h\229%q\147\213P+\217$\207"; oasis_exec = None; oasis_setup_args = []; setup_update = false @@ -10821,7 +10964,7 @@ let setup_t = let setup () = BaseSetup.setup setup_t;; -# 10825 "setup.ml" +# 10968 "setup.ml" let setup_t = BaseCompat.Compat_0_4.adapt_setup_t setup_t open BaseCompat.Compat_0_4 (* OASIS_STOP *) diff --git a/src/vyconf_pb.ml b/src/vyconf_pb.ml index 9e3c8ca..8cb7de3 100644 --- a/src/vyconf_pb.ml +++ b/src/vyconf_pb.ml @@ -7,11 +7,15 @@ type request_config_format = type request_setup_session = { exclusive : bool option; override_exclusive : bool option; + client_application : string option; + on_behalf_of : int32 option; } and request_setup_session_mutable = { mutable exclusive : bool option; mutable override_exclusive : bool option; + mutable client_application : string option; + mutable on_behalf_of : int32 option; } type request_set = { @@ -171,7 +175,7 @@ and request_run_op_mode_mutable = { } type request = - | Noop + | Status | Setup_session of request_setup_session | Set of request_set | Delete of request_delete @@ -195,10 +199,18 @@ type status = type response = { status : status; + output : string option; + errors : string list; + warnings : string list; + notifications : string list; } and response_mutable = { mutable status : status; + mutable output : string option; + mutable errors : string list; + mutable warnings : string list; + mutable notifications : string list; } let rec default_request_config_format () = (Curly:request_config_format) @@ -206,14 +218,20 @@ let rec default_request_config_format () = (Curly:request_config_format) let rec default_request_setup_session ?exclusive:((exclusive:bool option) = None) ?override_exclusive:((override_exclusive:bool option) = None) + ?client_application:((client_application:string option) = None) + ?on_behalf_of:((on_behalf_of:int32 option) = None) () : request_setup_session = { exclusive; override_exclusive; + client_application; + on_behalf_of; } and default_request_setup_session_mutable () : request_setup_session_mutable = { exclusive = None; override_exclusive = None; + client_application = None; + on_behalf_of = None; } let rec default_request_set @@ -418,18 +436,30 @@ and default_request_run_op_mode_mutable () : request_run_op_mode_mutable = { path = []; } -let rec default_request (): request = Noop +let rec default_request (): request = Status let rec default_status () = (Success:status) let rec default_response ?status:((status:status) = default_status ()) + ?output:((output:string option) = None) + ?errors:((errors:string list) = []) + ?warnings:((warnings:string list) = []) + ?notifications:((notifications:string list) = []) () : response = { status; + output; + errors; + warnings; + notifications; } and default_response_mutable () : response_mutable = { status = default_status (); + output = None; + errors = []; + warnings = []; + notifications = []; } let rec decode_request_config_format d = @@ -458,6 +488,20 @@ let rec decode_request_setup_session d = | Some (2, pk) -> raise ( Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_setup_session), field(2)", pk)) ) + | Some (3, Pbrt.Bytes) -> ( + v.client_application <- Some (Pbrt.Decoder.string d); + loop () + ) + | Some (3, pk) -> raise ( + Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_setup_session), field(3)", pk)) + ) + | Some (4, Pbrt.Varint) -> ( + v.on_behalf_of <- Some (Pbrt.Decoder.int32_as_varint d); + loop () + ) + | Some (4, pk) -> raise ( + Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(request_setup_session), field(4)", pk)) + ) | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop () in loop (); @@ -881,7 +925,7 @@ let rec decode_request d = let rec loop () = let ret:request = match Pbrt.Decoder.key d with | None -> failwith "None of the known key is found" - | Some (1, _) -> (Pbrt.Decoder.empty_nested d ; Noop) + | Some (1, _) -> (Pbrt.Decoder.empty_nested d ; Status) | Some (2, _) -> Setup_session (decode_request_setup_session (Pbrt.Decoder.nested d)) | Some (3, _) -> Set (decode_request_set (Pbrt.Decoder.nested d)) | Some (4, _) -> Delete (decode_request_delete (Pbrt.Decoder.nested d)) @@ -918,6 +962,9 @@ let rec decode_response d = let rec loop () = match Pbrt.Decoder.key d with | None -> ( + v.notifications <- List.rev v.notifications; + v.warnings <- List.rev v.warnings; + v.errors <- List.rev v.errors; ) | Some (1, Pbrt.Varint) -> ( v.status <- decode_status d; @@ -926,6 +973,34 @@ let rec decode_response d = | Some (1, pk) -> raise ( Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(1)", pk)) ) + | Some (2, Pbrt.Bytes) -> ( + v.output <- Some (Pbrt.Decoder.string d); + loop () + ) + | Some (2, pk) -> raise ( + Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(2)", pk)) + ) + | Some (3, Pbrt.Bytes) -> ( + v.errors <- (Pbrt.Decoder.string d) :: v.errors; + loop () + ) + | Some (3, pk) -> raise ( + Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(3)", pk)) + ) + | Some (4, Pbrt.Bytes) -> ( + v.warnings <- (Pbrt.Decoder.string d) :: v.warnings; + loop () + ) + | Some (4, pk) -> raise ( + Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(4)", pk)) + ) + | Some (5, Pbrt.Bytes) -> ( + v.notifications <- (Pbrt.Decoder.string d) :: v.notifications; + loop () + ) + | Some (5, pk) -> raise ( + Protobuf.Decoder.Failure (Protobuf.Decoder.Unexpected_payload ("Message(response), field(5)", pk)) + ) | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind; loop () in loop (); @@ -954,6 +1029,22 @@ let rec encode_request_setup_session (v:request_setup_session) encoder = ) | None -> (); ); + ( + match v.client_application with + | Some x -> ( + Pbrt.Encoder.key (3, Pbrt.Bytes) encoder; + Pbrt.Encoder.string x encoder; + ) + | None -> (); + ); + ( + match v.on_behalf_of with + | Some x -> ( + Pbrt.Encoder.key (4, Pbrt.Varint) encoder; + Pbrt.Encoder.int32_as_varint x encoder; + ) + | None -> (); + ); () let rec encode_request_set (v:request_set) encoder = @@ -1148,7 +1239,7 @@ let rec encode_request_run_op_mode (v:request_run_op_mode) encoder = let rec encode_request (v:request) encoder = match v with - | Noop -> ( + | Status -> ( Pbrt.Encoder.key (1, Pbrt.Bytes) encoder; Pbrt.Encoder.empty_nested encoder ) @@ -1225,6 +1316,26 @@ let rec encode_status (v:status) encoder = let rec encode_response (v:response) encoder = Pbrt.Encoder.key (1, Pbrt.Varint) encoder; encode_status v.status encoder; + ( + match v.output with + | Some x -> ( + Pbrt.Encoder.key (2, Pbrt.Bytes) encoder; + Pbrt.Encoder.string x encoder; + ) + | None -> (); + ); + List.iter (fun x -> + Pbrt.Encoder.key (3, Pbrt.Bytes) encoder; + Pbrt.Encoder.string x encoder; + ) v.errors; + List.iter (fun x -> + Pbrt.Encoder.key (4, Pbrt.Bytes) encoder; + Pbrt.Encoder.string x encoder; + ) v.warnings; + List.iter (fun x -> + Pbrt.Encoder.key (5, Pbrt.Bytes) encoder; + Pbrt.Encoder.string x encoder; + ) v.notifications; () let rec pp_request_config_format fmt (v:request_config_format) = @@ -1237,6 +1348,8 @@ let rec pp_request_setup_session fmt (v:request_setup_session) = Format.pp_open_vbox fmt 1; Pbrt.Pp.pp_record_field "exclusive" (Pbrt.Pp.pp_option Pbrt.Pp.pp_bool) fmt v.exclusive; Pbrt.Pp.pp_record_field "override_exclusive" (Pbrt.Pp.pp_option Pbrt.Pp.pp_bool) fmt v.override_exclusive; + Pbrt.Pp.pp_record_field "client_application" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.client_application; + Pbrt.Pp.pp_record_field "on_behalf_of" (Pbrt.Pp.pp_option Pbrt.Pp.pp_int32) fmt v.on_behalf_of; Format.pp_close_box fmt () in Pbrt.Pp.pp_brk pp_i fmt () @@ -1385,7 +1498,7 @@ let rec pp_request_run_op_mode fmt (v:request_run_op_mode) = let rec pp_request fmt (v:request) = match v with - | Noop -> Format.fprintf fmt "Noop" + | Status -> Format.fprintf fmt "Status" | Setup_session x -> Format.fprintf fmt "@[Setup_session(%a)@]" pp_request_setup_session x | Set x -> Format.fprintf fmt "@[Set(%a)@]" pp_request_set x | Delete x -> Format.fprintf fmt "@[Delete(%a)@]" pp_request_delete x @@ -1412,6 +1525,10 @@ let rec pp_response fmt (v:response) = let pp_i fmt () = Format.pp_open_vbox fmt 1; Pbrt.Pp.pp_record_field "status" pp_status fmt v.status; + Pbrt.Pp.pp_record_field "output" (Pbrt.Pp.pp_option Pbrt.Pp.pp_string) fmt v.output; + Pbrt.Pp.pp_record_field "errors" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.errors; + Pbrt.Pp.pp_record_field "warnings" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.warnings; + Pbrt.Pp.pp_record_field "notifications" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.notifications; Format.pp_close_box fmt () in Pbrt.Pp.pp_brk pp_i fmt () diff --git a/src/vyconf_pb.mli b/src/vyconf_pb.mli index 18abc00..33cbd73 100644 --- a/src/vyconf_pb.mli +++ b/src/vyconf_pb.mli @@ -10,6 +10,8 @@ type request_config_format = type request_setup_session = { exclusive : bool option; override_exclusive : bool option; + client_application : string option; + on_behalf_of : int32 option; } type request_set = { @@ -91,7 +93,7 @@ type request_run_op_mode = { } type request = - | Noop + | Status | Setup_session of request_setup_session | Set of request_set | Delete of request_delete @@ -115,6 +117,10 @@ type status = type response = { status : status; + output : string option; + errors : string list; + warnings : string list; + notifications : string list; } @@ -126,6 +132,8 @@ val default_request_config_format : unit -> request_config_format val default_request_setup_session : ?exclusive:bool option -> ?override_exclusive:bool option -> + ?client_application:string option -> + ?on_behalf_of:int32 option -> unit -> request_setup_session (** [default_request_setup_session ()] is the default value for type [request_setup_session] *) @@ -248,6 +256,10 @@ val default_status : unit -> status val default_response : ?status:status -> + ?output:string option -> + ?errors:string list -> + ?warnings:string list -> + ?notifications:string list -> unit -> response (** [default_response ()] is the default value for type [response] *) |