Commit fe12348
Add FunctionNode pointer to MethodMetadata
Summary:
Add a `const syntax_graph::FunctionNode* functionNode` field to `MethodMetadata`
to provide direct access to schema information for each method. This eliminates
the need for a separate FunctionNodeMap cache and lookups at runtime.
The field is populated at compile time by the Thrift compiler during code
generation. Helper functions `getFunctionNode<ServiceTag>()` and
`getInteractionFunctionNode<ServiceTag>()` look up the FunctionNode from the
SchemaRegistry and embed the pointer directly in the ServiceRequestInfo
initializer.
Implementation:
- Added `functionNode` field to `ServiceRequestInfo` struct
- Added `functionNode` parameter to `MethodMetadata` constructor
- Updated `GeneratedMethodMetadata` to pass `functionNode` through
- Modified `populateMethodMetadataMap` to propagate `functionNode`
- Created helper functions in `service_cpp.h` for FunctionNode lookup
- Updated Thrift compiler template `processmap.mustache` to populate the field
- Added comprehensive test verifying both regular and interaction methods
Reviewed By: praihan
Differential Revision: D91171976
fbshipit-source-id: 2c3a7e64b6d65b266f9ee7a37d1180d62fe357531 parent 3edd921 commit fe12348
71 files changed
Lines changed: 978 additions & 427 deletions
File tree
- third-party/thrift/src/thrift
- compiler
- generate/templates/cpp2/service_cpp
- test/fixtures
- adapter/out/cpp2/gen-cpp2
- basic-annotations/out/cpp2/gen-cpp2
- basic-stack-arguments/out/cpp2/gen-cpp2
- basic-structured-annotations/out/cpp2/gen-cpp2
- basic/out/cpp2/gen-cpp2
- bidi/out/cpp2/gen-cpp2
- client-methods/out/cpp2/gen-cpp2
- coroutines/out/cpp2/gen-cpp2
- cpp2-struct-footprint/out/cpp2/gen-cpp2
- doctext/out/cpp2/gen-cpp2
- exceptions/out/cpp2/gen-cpp2
- fatal/out/cpp2/gen-cpp2
- includes/out/cpp2_service/gen-cpp2
- inheritance/out/cpp2/gen-cpp2
- interactions/out
- cpp2/gen-cpp2
- mcpp2-compare/out
- cpp2_extra_services/gen-cpp2
- cpp2/gen-cpp2
- method_decorators/out/cpp2/gen-cpp2
- namespace_from_package_without_module_name/out/cpp2/gen-cpp2
- namespace_from_package/out/cpp2/gen-cpp2
- no_metadata/out/cpp2/gen-cpp2
- params/out/cpp2/gen-cpp2
- py3/out/cpp2/gen-py3cpp
- service-schema/out
- cpp2_sinit/gen-cpp2
- cpp2/gen-cpp2
- single_file_service/out/cpp2/gen-cpp2
- sink/out/cpp2/gen-cpp2
- split/out/cpp2/gen-cpp2
- stream/out/cpp2/gen-cpp2
- sync-methods-return-try/out/cpp2/gen-cpp2
- types/out/cpp2/gen-cpp2
- visitation/out/cpp2/gen-cpp2
- lib/cpp2
- async
- processor
- gen
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
| 391 | + | |
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
397 | | - | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
| 232 | + | |
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
388 | | - | |
| 389 | + | |
| 390 | + | |
389 | 391 | | |
390 | 392 | | |
391 | 393 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
| 545 | + | |
545 | 546 | | |
546 | 547 | | |
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
550 | 551 | | |
551 | | - | |
| 552 | + | |
| 553 | + | |
552 | 554 | | |
553 | 555 | | |
554 | 556 | | |
555 | 557 | | |
556 | 558 | | |
557 | 559 | | |
558 | | - | |
| 560 | + | |
| 561 | + | |
559 | 562 | | |
560 | 563 | | |
561 | 564 | | |
| |||
Lines changed: 14 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1165 | 1165 | | |
1166 | 1166 | | |
1167 | 1167 | | |
1168 | | - | |
| 1168 | + | |
| 1169 | + | |
1169 | 1170 | | |
1170 | 1171 | | |
1171 | 1172 | | |
1172 | 1173 | | |
1173 | 1174 | | |
1174 | 1175 | | |
1175 | | - | |
| 1176 | + | |
| 1177 | + | |
1176 | 1178 | | |
1177 | 1179 | | |
1178 | 1180 | | |
1179 | 1181 | | |
1180 | 1182 | | |
1181 | 1183 | | |
1182 | | - | |
| 1184 | + | |
| 1185 | + | |
1183 | 1186 | | |
1184 | 1187 | | |
1185 | 1188 | | |
1186 | 1189 | | |
1187 | 1190 | | |
1188 | 1191 | | |
1189 | | - | |
| 1192 | + | |
| 1193 | + | |
1190 | 1194 | | |
1191 | 1195 | | |
1192 | 1196 | | |
1193 | 1197 | | |
1194 | 1198 | | |
1195 | 1199 | | |
1196 | | - | |
| 1200 | + | |
| 1201 | + | |
1197 | 1202 | | |
1198 | 1203 | | |
1199 | 1204 | | |
1200 | 1205 | | |
1201 | 1206 | | |
1202 | 1207 | | |
1203 | | - | |
| 1208 | + | |
| 1209 | + | |
1204 | 1210 | | |
1205 | 1211 | | |
1206 | 1212 | | |
1207 | 1213 | | |
1208 | 1214 | | |
1209 | 1215 | | |
1210 | | - | |
| 1216 | + | |
| 1217 | + | |
1211 | 1218 | | |
1212 | 1219 | | |
1213 | 1220 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
| 389 | + | |
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
395 | | - | |
| 396 | + | |
| 397 | + | |
396 | 398 | | |
397 | 399 | | |
398 | 400 | | |
| |||
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
| 391 | + | |
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
397 | | - | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
699 | | - | |
| 699 | + | |
| 700 | + | |
700 | 701 | | |
701 | 702 | | |
702 | 703 | | |
703 | 704 | | |
704 | 705 | | |
705 | 706 | | |
706 | | - | |
| 707 | + | |
| 708 | + | |
707 | 709 | | |
708 | 710 | | |
709 | 711 | | |
710 | 712 | | |
711 | 713 | | |
712 | 714 | | |
713 | | - | |
| 715 | + | |
| 716 | + | |
714 | 717 | | |
715 | 718 | | |
716 | 719 | | |
717 | 720 | | |
718 | 721 | | |
719 | 722 | | |
720 | | - | |
| 723 | + | |
| 724 | + | |
721 | 725 | | |
722 | 726 | | |
723 | 727 | | |
| |||
0 commit comments