Skip to content

Commit

Permalink
Simplify Eventgen (#6188)
Browse files Browse the repository at this point in the history
This is a small effort to simplify the code within the `Eventgen`
module. The previous style is very unwieldy and makes the file appear
more complicated on the surface than it really is.

---

Passes BVT+BST (209475) but would appreciate review comments as I've
dropped the potential for stdout logging in some places (easy to add
back) and added commentary that may not be fully accurate.
  • Loading branch information
robhoes authored Dec 19, 2024
2 parents e861cb6 + d622dd8 commit 4cbacdb
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 236 deletions.
13 changes: 12 additions & 1 deletion ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10448,7 +10448,18 @@ let all_system =
* updated must come first. The second field will be automatically * kept
* up-to-date. *)

(** These are the pairs of (object, field) which are bound together in the database schema *)
(**
These are the pairs of (object, field) which are bound together in
the database schema.
It is assumed that, for any entry (p, p'), neither p nor p'
appears in any other entry. It may be the case that p = p', which
is the only instance where some object-field pair may appear more
than once.
This is implicitly assumed by other code which treats this list -
and its symmetric closure - as an association list
without duplicate keys. *)
let all_relations =
[
(* snapshots *)
Expand Down
3 changes: 1 addition & 2 deletions ocaml/idl/ocaml_backend/gen_db_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ let db_action api : O.Module.t =
O.Let.make ~name:"_" ~params:[] ~ty:"unit"
~body:
[
Printf.sprintf "Hashtbl.add Eventgen.get_record_table \"%s\""
obj.DT.name
Printf.sprintf "Eventgen.set_get_record \"%s\"" obj.DT.name
; Printf.sprintf
"(fun ~__context ~self -> (fun () -> API.rpc_of_%s_t \
(%s.get_record ~__context ~self:(Ref.of_%sstring self))))"
Expand Down
Loading

0 comments on commit 4cbacdb

Please sign in to comment.