Skip to content

Commit c88abd4

Browse files
authored
Merge 68df708 into c264219
2 parents c264219 + 68df708 commit c88abd4

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

ocaml/database/database_test.ml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,24 @@ functor
580580
let (_ : string) = Client.db_get_by_uuid t "VM" invalid_uuid in
581581
failwith "db_get_by_uuid <invalid uuid>"
582582
) ;
583+
Printf.printf "db_get_by_uuid_opt <valid uuid>\n" ;
584+
let r = Client.db_get_by_uuid_opt t "VM" valid_uuid in
585+
( if r <> Some valid_ref then
586+
let rs = Option.fold ~none:"None" ~some:Fun.id r in
587+
failwith
588+
(Printf.sprintf
589+
"db_get_by_uuid_opt <valid uuid>: got %s; expected %s" rs
590+
valid_ref
591+
)
592+
) ;
593+
Printf.printf "db_get_by_uuid_opt <invalid uuid>\n" ;
594+
let r = Client.db_get_by_uuid_opt t "VM" invalid_uuid in
595+
if not (Option.is_none r) then
596+
failwith
597+
(Printf.sprintf
598+
"db_get_by_uuid_opt <invalid uuid>: got %s; expected None"
599+
valid_ref
600+
) ;
583601
Printf.printf "get_by_name_label <invalid name label>\n" ;
584602
if Client.db_get_by_name_label t "VM" invalid_name <> [] then
585603
failwith "db_get_by_name_label <invalid name label>" ;

ocaml/database/db_remote_cache_access_v1.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ module DBCacheRemoteListener = struct
102102
let s, e = unmarshall_db_get_by_uuid_args args in
103103
success
104104
(marshall_db_get_by_uuid_response (DBCache.db_get_by_uuid t s e))
105+
| "db_get_by_uuid_opt" ->
106+
let s, e = unmarshall_db_get_by_uuid_args args in
107+
success
108+
(marshall_db_get_by_uuid_opt_response
109+
(DBCache.db_get_by_uuid_opt t s e)
110+
)
105111
| "db_get_by_name_label" ->
106112
let s, e = unmarshall_db_get_by_name_label_args args in
107113
success

ocaml/database/db_remote_cache_access_v2.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ let process_rpc (req : Rpc.t) =
3636
Response.Read_field_where (DB.read_field_where t w)
3737
| Request.Db_get_by_uuid (a, b) ->
3838
Response.Db_get_by_uuid (DB.db_get_by_uuid t a b)
39+
| Request.Db_get_by_uuid_opt (a, b) ->
40+
Response.Db_get_by_uuid_opt (DB.db_get_by_uuid_opt t a b)
3941
| Request.Db_get_by_name_label (a, b) ->
4042
Response.Db_get_by_name_label (DB.db_get_by_name_label t a b)
4143
| Request.Create_row (a, b, c) ->

ocaml/database/db_rpc_client_v2.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ functor
7878
raise Remote_db_server_returned_bad_message
7979

8080
let db_get_by_uuid_opt _ t u =
81-
match process (Request.Db_get_by_uuid (t, u)) with
81+
match process (Request.Db_get_by_uuid_opt (t, u)) with
8282
| Response.Db_get_by_uuid_opt y ->
8383
y
8484
| _ ->

ocaml/database/db_rpc_common_v1.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ let unmarshall_db_get_by_uuid_args xml = unmarshall_2strings xml
192192

193193
let marshall_db_get_by_uuid_response s = XMLRPC.To.string s
194194

195+
let marshall_db_get_by_uuid_opt_response = marshall_stringopt
196+
195197
let unmarshall_db_get_by_uuid_response xml = XMLRPC.From.string xml
196198

197199
let unmarshall_db_get_by_uuid_opt_response xml = unmarshall_stringopt xml

ocaml/database/db_rpc_common_v2.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module Request = struct
2323
| Find_refs_with_filter of string * Db_filter_types.expr
2424
| Read_field_where of Db_cache_types.where_record
2525
| Db_get_by_uuid of string * string
26+
| Db_get_by_uuid_opt of string * string
2627
| Db_get_by_name_label of string * string
2728
| Create_row of string * (string * string) list * string
2829
| Delete_row of string * string

0 commit comments

Comments
 (0)