Skip to content

Commit b4ed68c

Browse files
committed
Change uses of "with rpc" camlp4 syntax to ppx
By running sed -i 's/with rpc/\[@@deriving rpc\]/g' **/*.ml This commit corresponds to 773dbc9 on master. Signed-off-by: Gabor Igloi <[email protected]>
1 parent fd28c32 commit b4ed68c

File tree

14 files changed

+51
-51
lines changed

14 files changed

+51
-51
lines changed

ocaml/doc/jsapi.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ open Datamodel_types
1616

1717
type change_t = lifecycle_change * string * string
1818
and changes_t = change_t list
19-
with rpc
19+
[@@deriving rpc]
2020

2121
let _ =
2222
let api = (Datamodel.all_api) in

ocaml/idl/datamodel_types.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ type ty =
9898
| Map of ty * ty
9999
| Ref of string
100100
| Record of string
101-
with rpc
101+
[@@deriving rpc]
102102

103103
type api_value =
104104
VString of string
@@ -111,7 +111,7 @@ type api_value =
111111
| VSet of api_value list
112112
| VRef of string
113113
| VCustom of string * api_value
114-
with rpc
114+
[@@deriving rpc]
115115

116116
(** Each database field has a qualifier associated with it:
117117
* "Static" means the initial value is specified as a parameter in the object constructor.
@@ -122,14 +122,14 @@ type qualifier =
122122
| RW (** Implicitly static: set in constructor and updatable through API *)
123123
| StaticRO (** Specified in constructor; no autogenerated setter in XenAPI. *)
124124
| DynamicRO (** Initial value is a default; no autogenerated setter in XenAPI. *)
125-
with rpc
125+
[@@deriving rpc]
126126

127127
(** Release keeps track of which versions of opensource/internal products fields and messages are included in *)
128128
type release = {
129129
opensource: string list;
130130
internal: string list;
131131
internal_deprecated_since: string option; (* first release we said it was deprecated *)
132-
} with rpc
132+
} [@@deriving rpc]
133133

134134
type lifecycle_change =
135135
| Prototyped
@@ -140,7 +140,7 @@ type lifecycle_change =
140140
| Removed
141141

142142
and lifecycle_transition = lifecycle_change * string * string
143-
with rpc
143+
[@@deriving rpc]
144144

145145
(** Messages are tagged with one of these indicating whether the message was
146146
specified explicitly in the datamodel, or is one of the automatically
@@ -219,7 +219,7 @@ and error = {
219219
and mess = {
220220
mess_name: string;
221221
mess_doc: string;
222-
} with rpc
222+
} [@@deriving rpc]
223223

224224
let default_message = {
225225
msg_name = "";
@@ -258,12 +258,12 @@ let default_message = {
258258
type content =
259259
| Field of field (** An individual field *)
260260
| Namespace of string * content list (** A nice namespace for a group of fields *)
261-
with rpc
261+
[@@deriving rpc]
262262

263263
(* Note: there used be more than 2 persist_options -- that's why it isn't a bool.
264264
I figured even though there's only 2 now I may as well leave it as an enumeration type.. *)
265265

266-
type persist_option = PersistNothing | PersistEverything with rpc
266+
type persist_option = PersistNothing | PersistEverything [@@deriving rpc]
267267
(* PersistEverything - all creates/writes persisted;
268268
PersistNothing - no creates/writes to this table persisted *)
269269

@@ -285,7 +285,7 @@ type obj = {
285285
obj_release: release;
286286
in_database: bool; (* If the object is in the database *)
287287
obj_doc_tags: doc_tag list;
288-
} with rpc
288+
} [@@deriving rpc]
289289

290290
(* val rpc_of_obj : obj -> Rpc.t *)
291291
(* let s = Jsonrpc.to_string (rpc_of_obj o) *)

ocaml/idl/ocaml_backend/event_types.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type event = {
2525
op: op;
2626
reference: string;
2727
snapshot: Rpc.t option;
28-
} with rpc
28+
} [@@deriving rpc]
2929

3030
let ev_struct_remap = [
3131
"id","id";
@@ -48,15 +48,15 @@ let rpc_of_event ev =
4848
let event_of_rpc rpc =
4949
event_of_rpc (remap (List.map (fun (k,v) -> (v,k)) ev_struct_remap) rpc)
5050

51-
type events = event list with rpc
51+
type events = event list [@@deriving rpc]
5252

53-
type token = string with rpc
53+
type token = string [@@deriving rpc]
5454

5555
type event_from = {
5656
events: event list;
5757
valid_ref_counts: (string * int32) list;
5858
token: token;
59-
} with rpc
59+
} [@@deriving rpc]
6060

6161
let rec rpc_of_event_from e =
6262
Rpc.Dict

ocaml/idl/ocaml_backend/gen_api.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ let gen_non_record_type highapi tys =
5757
| DT.Map (_, DT.Record _) :: t
5858
| DT.Set (DT.Record _) :: t -> aux accu t
5959
| DT.Set (DT.Enum (n,_) as e) as ty :: t ->
60-
aux (sprintf "type %s = %s list with rpc" (OU.alias_of_ty ty) (OU.alias_of_ty e) :: accu) t
60+
aux (sprintf "type %s = %s list [@@deriving rpc]" (OU.alias_of_ty ty) (OU.alias_of_ty e) :: accu) t
6161
| ty :: t ->
6262
let alias = OU.alias_of_ty ty in
6363
if List.mem_assoc alias overrides
6464
then aux ((sprintf "type %s = %s\n%s\n" alias (OU.ocaml_of_ty ty) (List.assoc alias overrides))::accu) t
65-
else aux (sprintf "type %s = %s with rpc" (OU.alias_of_ty ty) (OU.ocaml_of_ty ty) :: accu) t in
65+
else aux (sprintf "type %s = %s [@@deriving rpc]" (OU.alias_of_ty ty) (OU.ocaml_of_ty ty) :: accu) t in
6666
aux [] tys
6767

6868
(** Generate a list of modules for each record kind *)
@@ -93,8 +93,8 @@ let gen_record_type ~with_module highapi tys =
9393
else [
9494
sprintf "let rpc_of_%s_t x = Rpc.Dict [ %s ]" obj_name (map_fields make_of_field);
9595
sprintf "let %s_t_of_rpc x = on_dict (fun x -> { %s }) x" obj_name (map_fields make_to_field);
96-
sprintf "type ref_%s_to_%s_t_map = (ref_%s * %s_t) list with rpc" record obj_name record obj_name;
97-
sprintf "type %s_t_set = %s_t list with rpc" obj_name obj_name;
96+
sprintf "type ref_%s_to_%s_t_map = (ref_%s * %s_t) list [@@deriving rpc]" record obj_name record obj_name;
97+
sprintf "type %s_t_set = %s_t list [@@deriving rpc]" obj_name obj_name;
9898
""
9999
] in
100100
aux (type_t :: others @ accu) t
@@ -131,14 +131,14 @@ let gen_client_types highapi =
131131
List.iter (List.iter print)
132132
(List.between [""] [
133133
[
134-
"type failure = (string list) with rpc";
134+
"type failure = (string list) [@@deriving rpc]";
135135
"let response_of_failure code params =";
136136
" Rpc.failure (rpc_of_failure (code::params))";
137137
"let response_of_fault code =";
138138
" Rpc.failure (rpc_of_failure ([\"Fault\"; code]))";
139139
]; [
140140
"include Rpc";
141-
"type string_list = string list with rpc";
141+
"type string_list = string list [@@deriving rpc]";
142142
]; [
143143
"module Ref = struct";
144144
" include Ref";

ocaml/xapi/cancel_tests.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type operation =
6969
| VBD_unplug
7070
| VIF_plug
7171
| VIF_unplug
72-
with rpc
72+
[@@deriving rpc]
7373

7474
let operations = [
7575
VBD_plug

ocaml/xapi/config_file_sync.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ open Stdext.Xstringext
2020

2121
let superuser = "root"
2222

23-
type config = { password : string } with rpc
23+
type config = { password : string } [@@deriving rpc]
2424

2525
(* Increment this if config type changes *)
2626
let config_sync_version = 2

ocaml/xapi/features.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type feature =
5454
| Live_patching
5555
| Live_set_vcpus
5656
| PVS_proxy
57-
with rpc
57+
[@@deriving rpc]
5858

5959
type orientation = Positive | Negative
6060

ocaml/xapi/sparse_dd_wrapper.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type t = {
3737

3838
(* Store sparse_dd pids on disk so we can kill them after a xapi restart *)
3939
module State = struct
40-
type pids = int list with rpc
40+
type pids = int list [@@deriving rpc]
4141

4242
let filename = ref "/var/run/nonpersistent/xapi/sparse_dd_pids.json"
4343

ocaml/xapi/storage_impl.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let info (fmt: ('a, unit, string, unit) format4) = if !print_debug then log_to_
9898
let host_state_path = ref "/var/run/nonpersistent/xapi/storage.db"
9999

100100
module Dp = struct
101-
type t = string with rpc
101+
type t = string [@@deriving rpc]
102102
let make username = username
103103
end
104104

@@ -112,7 +112,7 @@ module Vdi = struct
112112
attach_info : attach_info option; (** Some path when attached; None otherwise *)
113113
dps: (Dp.t * Vdi_automaton.state) list; (** state of the VDI from each dp's PoV *)
114114
leaked: Dp.t list; (** "leaked" dps *)
115-
} with rpc
115+
} [@@deriving rpc]
116116
let empty () = {
117117
attach_info = None;
118118
dps = [];
@@ -159,11 +159,11 @@ end
159159

160160
module Sr = struct
161161
(** Represents the state of an SR *)
162-
type vdis = (string, Vdi.t) Hashtbl.t with rpc
162+
type vdis = (string, Vdi.t) Hashtbl.t [@@deriving rpc]
163163

164164
type t = {
165165
vdis: vdis; (** All tracked VDIs *)
166-
} with rpc
166+
} [@@deriving rpc]
167167

168168
let empty () = {
169169
vdis = Hashtbl.create 10;
@@ -184,7 +184,7 @@ module Host = struct
184184
(** Represents the state of a host *)
185185
type t = {
186186
srs: (string, Sr.t) Hashtbl.t;
187-
} with rpc
187+
} [@@deriving rpc]
188188

189189
let empty () = {
190190
srs = Hashtbl.create 10
@@ -207,9 +207,9 @@ module Errors = struct
207207
sr: string;
208208
vdi: string;
209209
error: string
210-
} with rpc
210+
} [@@deriving rpc]
211211

212-
type t = error list with rpc
212+
type t = error list [@@deriving rpc]
213213

214214
let max = 100
215215
let errors = ref []
@@ -234,7 +234,7 @@ module Everything = struct
234234
type t = {
235235
host: Host.t;
236236
errors: Errors.t;
237-
} with rpc
237+
} [@@deriving rpc]
238238

239239
let make () = { host = !Host.host; errors = !Errors.errors }
240240

ocaml/xapi/storage_migrate.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module State = struct
4141
leaf_dp : dp;
4242
parent_vdi : vdi;
4343
remote_vdi : vdi;
44-
} with rpc
44+
} [@@deriving rpc]
4545
end
4646

4747
module Send_state = struct
@@ -55,7 +55,7 @@ module State = struct
5555
tapdev : Tapctl.tapdev;
5656
mutable failed : bool;
5757
mutable watchdog : Updates.Scheduler.t option;
58-
} with rpc
58+
} [@@deriving rpc]
5959
end
6060

6161
module Copy_state = struct
@@ -66,15 +66,15 @@ module State = struct
6666
dest_sr: sr;
6767
copy_vdi: vdi;
6868
remote_url : string;
69-
} with rpc
69+
} [@@deriving rpc]
7070
end
7171

7272
let loaded = ref false
7373
let mutex = Mutex.create ()
7474

75-
type send_table = (string, Send_state.t) Hashtbl.t with rpc
76-
type recv_table = (string, Receive_state.t) Hashtbl.t with rpc
77-
type copy_table = (string, Copy_state.t) Hashtbl.t with rpc
75+
type send_table = (string, Send_state.t) Hashtbl.t [@@deriving rpc]
76+
type recv_table = (string, Receive_state.t) Hashtbl.t [@@deriving rpc]
77+
type copy_table = (string, Copy_state.t) Hashtbl.t [@@deriving rpc]
7878

7979
type osend
8080
type orecv

0 commit comments

Comments
 (0)