Expand description
Request/reply codegen data model — Spec §7.5.1.
This stage (C6.1.B) derives from a ServiceDef the wire data models
of the request and reply topics. The spec distinguishes two layouts:
-
Basic service (Spec §7.5.1.1): one request topic + one reply topic per service type, both with an untyped discriminated union over all methods. Wire form:
struct <Service>_Request { RequestHeader header; union <Service>_Call switch (long _d) { case OP_<m1>: <Service>_<m1>_In m1_args; case OP_<m2>: <Service>_<m2>_In m2_args; ... }; };<Service>_Replyanalogously with<Service>_<m>_OutandReplyHeader. -
Enhanced service (Spec §7.5.1.2): per method a dedicated request and reply topic with typed per-method structures. Wire form (per method):
struct <Service>_<m>_In { /* in/inout params */ }; struct <Service>_<m>_Out { /* return + out/inout */ };
We produce data structures here (RequestType, ReplyType)
with member lists — no language codegen. The language backends in
crates/idl-cpp, idl-csharp and idl-java consume the model
and emit bindings.
Oneway methods:
- In the basic layout, a oneway method appears in the request union, but is not included in the reply union — the reply topic is nonetheless shared.
- In the enhanced layout,
build_enhanced_pairreturns for a oneway methodSome(RequestType)andNoneas the reply (seeMethodPair).
Structs§
- Call
Union Case - Discriminator case of a call union (basic layout).
- Call
Union Def <Service>_Call(request) or<Service>_Result(reply) union.- Method
Pair - Pair for an enhanced method. Reply is
Noneforoneway. - Reply
Type - Reply wire data model. Analogous to
RequestType. - Request
Type - Request wire data model.
- Struct
Member - Member of a generated wire structure.
Enums§
- Member
Type - Type of a struct member. Either a known RPC header type
(
RequestHeader/ReplyHeader/<Service>_Call) or an IDL type fromzerodds_idl::ast::TypeSpec. - Service
Layout - Layout variant of the service wire model (Spec §7.5.1).
Functions§
- build_
basic_ pair - Returns the data models of the basic-layout topics
(
<Service>_Requestplus<Service>_Reply). An emptyServiceDefreturns a pair with empty unions — the caller must decide for itself whether to discard it. - build_
enhanced_ all - Returns all enhanced-layout pairs of a service.
- build_
enhanced_ pair - Returns the per-method pair (request + optional reply).