grpc 1.82.0 → 1.83.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +8 -5
  3. data/etc/roots.pem +10400 -3855
  4. data/include/grpc/grpc_audit_logging.h +2 -2
  5. data/include/grpc/grpc_security_constants.h +2 -0
  6. data/include/grpc/impl/channel_arg_names.h +23 -0
  7. data/src/core/call/call_filters.h +19 -3
  8. data/src/core/call/call_spine.h +4 -4
  9. data/src/core/call/client_call.cc +1 -1
  10. data/src/core/call/metadata.cc +7 -2
  11. data/src/core/call/server_call.cc +13 -3
  12. data/src/core/call/server_call.h +5 -3
  13. data/src/core/client_channel/backup_poller.cc +2 -17
  14. data/src/core/client_channel/client_channel.cc +17 -14
  15. data/src/core/client_channel/client_channel.h +3 -1
  16. data/src/core/client_channel/client_channel_filter.cc +11 -13
  17. data/src/core/client_channel/client_channel_service_config.cc +5 -13
  18. data/src/core/client_channel/direct_channel.cc +5 -1
  19. data/src/core/client_channel/direct_channel.h +3 -1
  20. data/src/core/config/experiment_env_var.cc +30 -0
  21. data/src/core/config/experiment_env_var.h +26 -0
  22. data/src/core/credentials/call/regional_access_boundary_fetcher.cc +6 -6
  23. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +14 -2
  24. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.cc +172 -0
  25. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +103 -0
  26. data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +3 -2
  27. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +10 -3
  28. data/src/core/credentials/transport/tls/tls_security_connector.cc +14 -2
  29. data/src/core/credentials/transport/xds/xds_credentials.cc +4 -12
  30. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -1
  31. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -13
  32. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -9
  33. data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
  34. data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -2
  35. data/src/core/ext/transport/chttp2/transport/frame.cc +58 -1
  36. data/src/core/ext/transport/chttp2/transport/frame.h +13 -1
  37. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -4
  38. data/src/core/ext/transport/chttp2/transport/frame_security.cc +10 -1
  39. data/src/core/ext/transport/chttp2/transport/frame_security.h +2 -1
  40. data/src/core/ext/transport/chttp2/transport/goaway.cc +11 -1
  41. data/src/core/ext/transport/chttp2/transport/goaway.h +17 -1
  42. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -0
  43. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +117 -276
  44. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +44 -17
  45. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +382 -496
  46. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +75 -77
  47. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -1
  48. data/src/core/ext/transport/chttp2/transport/http2_settings.h +30 -11
  49. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +24 -9
  50. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +26 -0
  51. data/src/core/ext/transport/chttp2/transport/http2_transport.h +2 -0
  52. data/src/core/ext/transport/chttp2/transport/internal.h +4 -0
  53. data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -2
  54. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +1 -1
  55. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +4 -10
  56. data/src/core/ext/transport/chttp2/transport/read_context.h +62 -20
  57. data/src/core/ext/transport/chttp2/transport/security_frame.h +1 -0
  58. data/src/core/ext/transport/chttp2/transport/stream.h +271 -120
  59. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +77 -61
  60. data/src/core/handshaker/security/secure_endpoint.cc +0 -13
  61. data/src/core/lib/channel/promise_based_filter.cc +77 -3
  62. data/src/core/lib/channel/promise_based_filter.h +238 -184
  63. data/src/core/lib/event_engine/extensions/receive_coalescing_extension.h +0 -4
  64. data/src/core/lib/event_engine/extensions/tcp_trace.h +1 -1
  65. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -12
  66. data/src/core/lib/event_engine/shim.cc +2 -16
  67. data/src/core/lib/event_engine/shim.h +0 -4
  68. data/src/core/lib/experiments/experiments.cc +51 -102
  69. data/src/core/lib/experiments/experiments.h +37 -59
  70. data/src/core/lib/iomgr/error.cc +3 -73
  71. data/src/core/lib/iomgr/error.h +8 -6
  72. data/src/core/lib/iomgr/error_cfstream.cc +1 -2
  73. data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -6
  74. data/src/core/lib/iomgr/ev_poll_posix.cc +2 -6
  75. data/src/core/lib/iomgr/tcp_posix.cc +2 -6
  76. data/src/core/lib/security/authorization/audit_logging.cc +2 -2
  77. data/src/core/lib/security/authorization/audit_logging.h +3 -3
  78. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +11 -13
  79. data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
  80. data/src/core/lib/security/authorization/matchers.cc +20 -20
  81. data/src/core/lib/security/authorization/matchers.h +15 -16
  82. data/src/core/lib/security/authorization/rbac_policy.h +1 -1
  83. data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
  84. data/src/core/lib/security/authorization/stdout_logger.h +6 -5
  85. data/src/core/lib/surface/call.cc +0 -8
  86. data/src/core/lib/surface/call.h +2 -0
  87. data/src/core/lib/surface/channel.cc +21 -2
  88. data/src/core/lib/surface/channel.h +14 -6
  89. data/src/core/lib/surface/filter_stack_call.cc +10 -29
  90. data/src/core/lib/surface/legacy_channel.cc +7 -7
  91. data/src/core/lib/surface/legacy_channel.h +3 -1
  92. data/src/core/lib/surface/version.cc +2 -2
  93. data/src/core/lib/transport/bdp_estimator.cc +13 -13
  94. data/src/core/lib/transport/bdp_estimator.h +9 -5
  95. data/src/core/lib/transport/error_utils.cc +26 -138
  96. data/src/core/lib/transport/promise_endpoint.h +2 -4
  97. data/src/core/load_balancing/grpclb/grpclb.cc +2 -1
  98. data/src/core/load_balancing/pick_first/pick_first.cc +33 -2
  99. data/src/core/load_balancing/pick_first/pick_first.h +6 -0
  100. data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -10
  101. data/src/core/load_balancing/rls/rls.cc +2 -1
  102. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +2 -7
  103. data/src/core/load_balancing/xds/cds.cc +80 -56
  104. data/src/core/load_balancing/xds/cds.h +21 -0
  105. data/src/core/mitigation_engine/mitigation.h +53 -0
  106. data/src/core/mitigation_engine/mitigation_provider.h +62 -0
  107. data/src/core/resolver/dns/dns_resolver_plugin.cc +1 -6
  108. data/src/core/resolver/xds/xds_resolver.cc +14 -11
  109. data/src/core/server/server.h +1 -4
  110. data/src/core/server/server_config_selector.h +5 -4
  111. data/src/core/server/server_config_selector_filter.cc +67 -80
  112. data/src/core/server/xds_server_config_fetcher.cc +681 -692
  113. data/src/core/server/xds_server_config_fetcher_legacy.cc +15 -12
  114. data/src/core/telemetry/call_tracer.cc +49 -2
  115. data/src/core/telemetry/call_tracer.h +1 -0
  116. data/src/core/telemetry/tcp_tracer.h +38 -0
  117. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  118. data/src/core/tsi/ssl_telemetry_utils.cc +343 -0
  119. data/src/core/tsi/ssl_telemetry_utils.h +74 -0
  120. data/src/core/tsi/ssl_transport_security.cc +577 -301
  121. data/src/core/tsi/ssl_transport_security.h +22 -6
  122. data/src/core/tsi/ssl_transport_security_utils.cc +2 -0
  123. data/src/core/tsi/transport_security.h +7 -0
  124. data/src/core/util/http_client/httpcli.cc +1 -4
  125. data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
  126. data/src/core/util/status_helper.cc +71 -192
  127. data/src/core/util/status_helper.h +16 -21
  128. data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -11
  129. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -7
  130. data/src/core/xds/grpc/xds_cluster_parser.cc +5 -16
  131. data/src/core/xds/grpc/xds_common_types.cc +94 -38
  132. data/src/core/xds/grpc/xds_common_types.h +33 -18
  133. data/src/core/xds/grpc/xds_common_types_parser.cc +168 -100
  134. data/src/core/xds/grpc/xds_common_types_parser.h +18 -1
  135. data/src/core/xds/grpc/xds_endpoint_parser.cc +6 -17
  136. data/src/core/xds/grpc/xds_http_filter_registry.cc +2 -10
  137. data/src/core/xds/grpc/xds_http_rbac_filter.cc +3 -12
  138. data/src/core/xds/grpc/xds_metadata_parser.cc +0 -2
  139. data/src/core/xds/grpc/xds_route_config_parser.cc +7 -11
  140. data/src/core/xds/grpc/xds_routing.cc +113 -82
  141. data/src/core/xds/grpc/xds_routing.h +70 -20
  142. data/src/core/xds/grpc/xds_server_grpc.cc +22 -13
  143. data/src/core/xds/grpc/xds_server_grpc.h +16 -2
  144. data/src/core/xds/grpc/xds_server_grpc_interface.h +10 -0
  145. data/src/core/xds/grpc/xds_transport_grpc.cc +123 -18
  146. data/src/core/xds/grpc/xds_transport_grpc.h +28 -4
  147. data/src/core/xds/xds_client/lrs_client.cc +3 -7
  148. data/src/core/xds/xds_client/xds_bootstrap.cc +4 -16
  149. data/src/core/xds/xds_client/xds_client.cc +2 -15
  150. data/src/core/xds/xds_client/xds_transport.h +3 -0
  151. data/src/ruby/lib/grpc/version.rb +1 -1
  152. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +1 -1
  153. metadata +9 -1
@@ -71,11 +71,10 @@ inline bool IsCallTracerSendTrailingMetadataIsAnAnnotationEnabled() {
71
71
  inline bool IsCallv3BatchValidationEnabled() { return true; }
72
72
  #define GRPC_EXPERIMENT_IS_INCLUDED_CHAOTIC_GOOD_FRAMING_LAYER
73
73
  inline bool IsChaoticGoodFramingLayerEnabled() { return true; }
74
- inline bool IsChaoticGoodSendSupportedFeaturesEnabled() { return false; }
74
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHAOTIC_GOOD_SEND_SUPPORTED_FEATURES
75
+ inline bool IsChaoticGoodSendSupportedFeaturesEnabled() { return true; }
75
76
  #define GRPC_EXPERIMENT_IS_INCLUDED_CUSTOM_FRAME_CHECK
76
77
  inline bool IsCustomFrameCheckEnabled() { return true; }
77
- #define GRPC_EXPERIMENT_IS_INCLUDED_ERROR_FLATTEN
78
- inline bool IsErrorFlattenEnabled() { return true; }
79
78
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
80
79
  inline bool IsEventEngineClientEnabled() { return true; }
81
80
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
@@ -90,8 +89,6 @@ inline bool IsEventEngineListenerEnabled() { return true; }
90
89
  inline bool IsEventEngineCallbackCqEnabled() { return true; }
91
90
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_FOR_ALL_OTHER_ENDPOINTS
92
91
  inline bool IsEventEngineForAllOtherEndpointsEnabled() { return true; }
93
- #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_POLLER_FOR_PYTHON
94
- inline bool IsEventEnginePollerForPythonEnabled() { return true; }
95
92
  inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() { return false; }
96
93
  inline bool IsFreeLargeAllocatorEnabled() { return false; }
97
94
  inline bool IsFuseFiltersEnabled() { return false; }
@@ -100,14 +97,11 @@ inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() { return false; }
100
97
  inline bool IsInprocCancelStreamEnabled() { return true; }
101
98
  inline bool IsKeepAlivePingTimerBatchEnabled() { return false; }
102
99
  inline bool IsLocalConnectorSecureEnabled() { return false; }
103
- #define GRPC_EXPERIMENT_IS_INCLUDED_MAX_INFLIGHT_PINGS_STRICT_LIMIT
104
- inline bool IsMaxInflightPingsStrictLimitEnabled() { return true; }
105
100
  inline bool IsMemoryOptimization01Enabled() { return false; }
106
101
  inline bool IsMemoryOptimization02Enabled() { return false; }
107
102
  inline bool IsMessageSizeRefactoringEnabled() { return false; }
108
103
  inline bool IsMetadataOutstandingTokenRefactorEnabled() { return false; }
109
- #define GRPC_EXPERIMENT_IS_INCLUDED_METADATA_PUBLISH_TO_APP_TAG
110
- inline bool IsMetadataPublishToAppTagEnabled() { return true; }
104
+ inline bool IsMetadataPublishToAppTagEnabled() { return false; }
111
105
  #define GRPC_EXPERIMENT_IS_INCLUDED_MONITORING_EXPERIMENT
112
106
  inline bool IsMonitoringExperimentEnabled() { return true; }
113
107
  inline bool IsMultipingEnabled() { return false; }
@@ -119,6 +113,8 @@ inline bool IsOptimization02Enabled() { return true; }
119
113
  inline bool IsOptimization03Enabled() { return true; }
120
114
  #define GRPC_EXPERIMENT_IS_INCLUDED_OPTIMIZATION_04
121
115
  inline bool IsOptimization04Enabled() { return true; }
116
+ inline bool IsOptimization05Enabled() { return false; }
117
+ inline bool IsOptimization06Enabled() { return false; }
122
118
  inline bool IsOtelExportTelemetryDomainsEnabled() { return false; }
123
119
  inline bool IsPh2ClientEnabled() { return false; }
124
120
  inline bool IsPh2ClientServerEnabled() { return false; }
@@ -133,15 +129,15 @@ inline bool IsPromiseBasedInprocTransportEnabled() { return false; }
133
129
  inline bool IsPromiseBatchCleanupOnCancelEnabled() { return true; }
134
130
  inline bool IsPromiseFilterSendCancelMetadataEnabled() { return false; }
135
131
  inline bool IsRetryInCallv3Enabled() { return false; }
136
- inline bool IsReturnPreexistingErrorsEnabled() { return false; }
132
+ #define GRPC_EXPERIMENT_IS_INCLUDED_RETURN_PREEXISTING_ERRORS
133
+ inline bool IsReturnPreexistingErrorsEnabled() { return true; }
137
134
  inline bool IsScheduleCancellationOverWriteEnabled() { return false; }
138
135
  inline bool IsSecureEndpointOffloadLargeReadsEnabled() { return false; }
139
136
  inline bool IsSecureEndpointOffloadLargeWritesEnabled() { return false; }
140
137
  inline bool IsSecureEndpointReadCoalescingEnabled() { return false; }
141
138
  inline bool IsSkipClearPeerOnCancellationEnabled() { return false; }
142
- inline bool IsSubchannelConnectionScalingEnabled() { return false; }
143
- #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_WRAPPER_CLEANUP_ON_ORPHAN
144
- inline bool IsSubchannelWrapperCleanupOnOrphanEnabled() { return true; }
139
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_CONNECTION_SCALING
140
+ inline bool IsSubchannelConnectionScalingEnabled() { return true; }
145
141
  inline bool IsTcpFrameSizeTuningEnabled() { return false; }
146
142
  inline bool IsTcpRcvLowatEnabled() { return false; }
147
143
  inline bool IsTsiFrameProtectorWithoutLocksEnabled() { return false; }
@@ -167,11 +163,10 @@ inline bool IsCallTracerSendTrailingMetadataIsAnAnnotationEnabled() {
167
163
  inline bool IsCallv3BatchValidationEnabled() { return true; }
168
164
  #define GRPC_EXPERIMENT_IS_INCLUDED_CHAOTIC_GOOD_FRAMING_LAYER
169
165
  inline bool IsChaoticGoodFramingLayerEnabled() { return true; }
170
- inline bool IsChaoticGoodSendSupportedFeaturesEnabled() { return false; }
166
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHAOTIC_GOOD_SEND_SUPPORTED_FEATURES
167
+ inline bool IsChaoticGoodSendSupportedFeaturesEnabled() { return true; }
171
168
  #define GRPC_EXPERIMENT_IS_INCLUDED_CUSTOM_FRAME_CHECK
172
169
  inline bool IsCustomFrameCheckEnabled() { return true; }
173
- #define GRPC_EXPERIMENT_IS_INCLUDED_ERROR_FLATTEN
174
- inline bool IsErrorFlattenEnabled() { return true; }
175
170
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
176
171
  inline bool IsEventEngineClientEnabled() { return true; }
177
172
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
@@ -186,8 +181,6 @@ inline bool IsEventEngineListenerEnabled() { return true; }
186
181
  inline bool IsEventEngineCallbackCqEnabled() { return true; }
187
182
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_FOR_ALL_OTHER_ENDPOINTS
188
183
  inline bool IsEventEngineForAllOtherEndpointsEnabled() { return true; }
189
- #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_POLLER_FOR_PYTHON
190
- inline bool IsEventEnginePollerForPythonEnabled() { return true; }
191
184
  inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() { return false; }
192
185
  inline bool IsFreeLargeAllocatorEnabled() { return false; }
193
186
  inline bool IsFuseFiltersEnabled() { return false; }
@@ -196,14 +189,11 @@ inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() { return false; }
196
189
  inline bool IsInprocCancelStreamEnabled() { return true; }
197
190
  inline bool IsKeepAlivePingTimerBatchEnabled() { return false; }
198
191
  inline bool IsLocalConnectorSecureEnabled() { return false; }
199
- #define GRPC_EXPERIMENT_IS_INCLUDED_MAX_INFLIGHT_PINGS_STRICT_LIMIT
200
- inline bool IsMaxInflightPingsStrictLimitEnabled() { return true; }
201
192
  inline bool IsMemoryOptimization01Enabled() { return false; }
202
193
  inline bool IsMemoryOptimization02Enabled() { return false; }
203
194
  inline bool IsMessageSizeRefactoringEnabled() { return false; }
204
195
  inline bool IsMetadataOutstandingTokenRefactorEnabled() { return false; }
205
- #define GRPC_EXPERIMENT_IS_INCLUDED_METADATA_PUBLISH_TO_APP_TAG
206
- inline bool IsMetadataPublishToAppTagEnabled() { return true; }
196
+ inline bool IsMetadataPublishToAppTagEnabled() { return false; }
207
197
  #define GRPC_EXPERIMENT_IS_INCLUDED_MONITORING_EXPERIMENT
208
198
  inline bool IsMonitoringExperimentEnabled() { return true; }
209
199
  inline bool IsMultipingEnabled() { return false; }
@@ -215,6 +205,8 @@ inline bool IsOptimization02Enabled() { return true; }
215
205
  inline bool IsOptimization03Enabled() { return true; }
216
206
  #define GRPC_EXPERIMENT_IS_INCLUDED_OPTIMIZATION_04
217
207
  inline bool IsOptimization04Enabled() { return true; }
208
+ inline bool IsOptimization05Enabled() { return false; }
209
+ inline bool IsOptimization06Enabled() { return false; }
218
210
  inline bool IsOtelExportTelemetryDomainsEnabled() { return false; }
219
211
  inline bool IsPh2ClientEnabled() { return false; }
220
212
  inline bool IsPh2ClientServerEnabled() { return false; }
@@ -229,15 +221,15 @@ inline bool IsPromiseBasedInprocTransportEnabled() { return false; }
229
221
  inline bool IsPromiseBatchCleanupOnCancelEnabled() { return true; }
230
222
  inline bool IsPromiseFilterSendCancelMetadataEnabled() { return false; }
231
223
  inline bool IsRetryInCallv3Enabled() { return false; }
232
- inline bool IsReturnPreexistingErrorsEnabled() { return false; }
224
+ #define GRPC_EXPERIMENT_IS_INCLUDED_RETURN_PREEXISTING_ERRORS
225
+ inline bool IsReturnPreexistingErrorsEnabled() { return true; }
233
226
  inline bool IsScheduleCancellationOverWriteEnabled() { return false; }
234
227
  inline bool IsSecureEndpointOffloadLargeReadsEnabled() { return false; }
235
228
  inline bool IsSecureEndpointOffloadLargeWritesEnabled() { return false; }
236
229
  inline bool IsSecureEndpointReadCoalescingEnabled() { return false; }
237
230
  inline bool IsSkipClearPeerOnCancellationEnabled() { return false; }
238
- inline bool IsSubchannelConnectionScalingEnabled() { return false; }
239
- #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_WRAPPER_CLEANUP_ON_ORPHAN
240
- inline bool IsSubchannelWrapperCleanupOnOrphanEnabled() { return true; }
231
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_CONNECTION_SCALING
232
+ inline bool IsSubchannelConnectionScalingEnabled() { return true; }
241
233
  inline bool IsTcpFrameSizeTuningEnabled() { return false; }
242
234
  inline bool IsTcpRcvLowatEnabled() { return false; }
243
235
  inline bool IsTsiFrameProtectorWithoutLocksEnabled() { return false; }
@@ -263,11 +255,10 @@ inline bool IsCallTracerSendTrailingMetadataIsAnAnnotationEnabled() {
263
255
  inline bool IsCallv3BatchValidationEnabled() { return true; }
264
256
  #define GRPC_EXPERIMENT_IS_INCLUDED_CHAOTIC_GOOD_FRAMING_LAYER
265
257
  inline bool IsChaoticGoodFramingLayerEnabled() { return true; }
266
- inline bool IsChaoticGoodSendSupportedFeaturesEnabled() { return false; }
258
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHAOTIC_GOOD_SEND_SUPPORTED_FEATURES
259
+ inline bool IsChaoticGoodSendSupportedFeaturesEnabled() { return true; }
267
260
  #define GRPC_EXPERIMENT_IS_INCLUDED_CUSTOM_FRAME_CHECK
268
261
  inline bool IsCustomFrameCheckEnabled() { return true; }
269
- #define GRPC_EXPERIMENT_IS_INCLUDED_ERROR_FLATTEN
270
- inline bool IsErrorFlattenEnabled() { return true; }
271
262
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
272
263
  inline bool IsEventEngineClientEnabled() { return true; }
273
264
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS
@@ -282,8 +273,6 @@ inline bool IsEventEngineListenerEnabled() { return true; }
282
273
  inline bool IsEventEngineCallbackCqEnabled() { return true; }
283
274
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_FOR_ALL_OTHER_ENDPOINTS
284
275
  inline bool IsEventEngineForAllOtherEndpointsEnabled() { return true; }
285
- #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_POLLER_FOR_PYTHON
286
- inline bool IsEventEnginePollerForPythonEnabled() { return true; }
287
276
  inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() { return false; }
288
277
  inline bool IsFreeLargeAllocatorEnabled() { return false; }
289
278
  inline bool IsFuseFiltersEnabled() { return false; }
@@ -292,14 +281,11 @@ inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() { return false; }
292
281
  inline bool IsInprocCancelStreamEnabled() { return true; }
293
282
  inline bool IsKeepAlivePingTimerBatchEnabled() { return false; }
294
283
  inline bool IsLocalConnectorSecureEnabled() { return false; }
295
- #define GRPC_EXPERIMENT_IS_INCLUDED_MAX_INFLIGHT_PINGS_STRICT_LIMIT
296
- inline bool IsMaxInflightPingsStrictLimitEnabled() { return true; }
297
284
  inline bool IsMemoryOptimization01Enabled() { return false; }
298
285
  inline bool IsMemoryOptimization02Enabled() { return false; }
299
286
  inline bool IsMessageSizeRefactoringEnabled() { return false; }
300
287
  inline bool IsMetadataOutstandingTokenRefactorEnabled() { return false; }
301
- #define GRPC_EXPERIMENT_IS_INCLUDED_METADATA_PUBLISH_TO_APP_TAG
302
- inline bool IsMetadataPublishToAppTagEnabled() { return true; }
288
+ inline bool IsMetadataPublishToAppTagEnabled() { return false; }
303
289
  #define GRPC_EXPERIMENT_IS_INCLUDED_MONITORING_EXPERIMENT
304
290
  inline bool IsMonitoringExperimentEnabled() { return true; }
305
291
  inline bool IsMultipingEnabled() { return false; }
@@ -311,6 +297,8 @@ inline bool IsOptimization02Enabled() { return true; }
311
297
  inline bool IsOptimization03Enabled() { return true; }
312
298
  #define GRPC_EXPERIMENT_IS_INCLUDED_OPTIMIZATION_04
313
299
  inline bool IsOptimization04Enabled() { return true; }
300
+ inline bool IsOptimization05Enabled() { return false; }
301
+ inline bool IsOptimization06Enabled() { return false; }
314
302
  inline bool IsOtelExportTelemetryDomainsEnabled() { return false; }
315
303
  inline bool IsPh2ClientEnabled() { return false; }
316
304
  inline bool IsPh2ClientServerEnabled() { return false; }
@@ -325,15 +313,15 @@ inline bool IsPromiseBasedInprocTransportEnabled() { return false; }
325
313
  inline bool IsPromiseBatchCleanupOnCancelEnabled() { return true; }
326
314
  inline bool IsPromiseFilterSendCancelMetadataEnabled() { return false; }
327
315
  inline bool IsRetryInCallv3Enabled() { return false; }
328
- inline bool IsReturnPreexistingErrorsEnabled() { return false; }
316
+ #define GRPC_EXPERIMENT_IS_INCLUDED_RETURN_PREEXISTING_ERRORS
317
+ inline bool IsReturnPreexistingErrorsEnabled() { return true; }
329
318
  inline bool IsScheduleCancellationOverWriteEnabled() { return false; }
330
319
  inline bool IsSecureEndpointOffloadLargeReadsEnabled() { return false; }
331
320
  inline bool IsSecureEndpointOffloadLargeWritesEnabled() { return false; }
332
321
  inline bool IsSecureEndpointReadCoalescingEnabled() { return false; }
333
322
  inline bool IsSkipClearPeerOnCancellationEnabled() { return false; }
334
- inline bool IsSubchannelConnectionScalingEnabled() { return false; }
335
- #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_WRAPPER_CLEANUP_ON_ORPHAN
336
- inline bool IsSubchannelWrapperCleanupOnOrphanEnabled() { return true; }
323
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_CONNECTION_SCALING
324
+ inline bool IsSubchannelConnectionScalingEnabled() { return true; }
337
325
  inline bool IsTcpFrameSizeTuningEnabled() { return false; }
338
326
  inline bool IsTcpRcvLowatEnabled() { return false; }
339
327
  inline bool IsTsiFrameProtectorWithoutLocksEnabled() { return false; }
@@ -355,7 +343,6 @@ enum ExperimentIds {
355
343
  kExperimentIdChaoticGoodFramingLayer,
356
344
  kExperimentIdChaoticGoodSendSupportedFeatures,
357
345
  kExperimentIdCustomFrameCheck,
358
- kExperimentIdErrorFlatten,
359
346
  kExperimentIdEventEngineClient,
360
347
  kExperimentIdEventEngineDns,
361
348
  kExperimentIdEventEngineDnsNonClientChannel,
@@ -363,7 +350,6 @@ enum ExperimentIds {
363
350
  kExperimentIdEventEngineListener,
364
351
  kExperimentIdEventEngineCallbackCq,
365
352
  kExperimentIdEventEngineForAllOtherEndpoints,
366
- kExperimentIdEventEnginePollerForPython,
367
353
  kExperimentIdFailRecvMetadataOnDeadlineExceeded,
368
354
  kExperimentIdFreeLargeAllocator,
369
355
  kExperimentIdFuseFilters,
@@ -371,7 +357,6 @@ enum ExperimentIds {
371
357
  kExperimentIdInprocCancelStream,
372
358
  kExperimentIdKeepAlivePingTimerBatch,
373
359
  kExperimentIdLocalConnectorSecure,
374
- kExperimentIdMaxInflightPingsStrictLimit,
375
360
  kExperimentIdMemoryOptimization01,
376
361
  kExperimentIdMemoryOptimization02,
377
362
  kExperimentIdMessageSizeRefactoring,
@@ -383,6 +368,8 @@ enum ExperimentIds {
383
368
  kExperimentIdOptimization02,
384
369
  kExperimentIdOptimization03,
385
370
  kExperimentIdOptimization04,
371
+ kExperimentIdOptimization05,
372
+ kExperimentIdOptimization06,
386
373
  kExperimentIdOtelExportTelemetryDomains,
387
374
  kExperimentIdPh2Client,
388
375
  kExperimentIdPh2ClientServer,
@@ -403,7 +390,6 @@ enum ExperimentIds {
403
390
  kExperimentIdSecureEndpointReadCoalescing,
404
391
  kExperimentIdSkipClearPeerOnCancellation,
405
392
  kExperimentIdSubchannelConnectionScaling,
406
- kExperimentIdSubchannelWrapperCleanupOnOrphan,
407
393
  kExperimentIdTcpFrameSizeTuning,
408
394
  kExperimentIdTcpRcvLowat,
409
395
  kExperimentIdTsiFrameProtectorWithoutLocks,
@@ -449,10 +435,6 @@ inline bool IsChaoticGoodSendSupportedFeaturesEnabled() {
449
435
  inline bool IsCustomFrameCheckEnabled() {
450
436
  return IsExperimentEnabled<kExperimentIdCustomFrameCheck>();
451
437
  }
452
- #define GRPC_EXPERIMENT_IS_INCLUDED_ERROR_FLATTEN
453
- inline bool IsErrorFlattenEnabled() {
454
- return IsExperimentEnabled<kExperimentIdErrorFlatten>();
455
- }
456
438
  #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_CLIENT
457
439
  inline bool IsEventEngineClientEnabled() {
458
440
  return IsExperimentEnabled<kExperimentIdEventEngineClient>();
@@ -481,10 +463,6 @@ inline bool IsEventEngineCallbackCqEnabled() {
481
463
  inline bool IsEventEngineForAllOtherEndpointsEnabled() {
482
464
  return IsExperimentEnabled<kExperimentIdEventEngineForAllOtherEndpoints>();
483
465
  }
484
- #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_POLLER_FOR_PYTHON
485
- inline bool IsEventEnginePollerForPythonEnabled() {
486
- return IsExperimentEnabled<kExperimentIdEventEnginePollerForPython>();
487
- }
488
466
  #define GRPC_EXPERIMENT_IS_INCLUDED_FAIL_RECV_METADATA_ON_DEADLINE_EXCEEDED
489
467
  inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() {
490
468
  return IsExperimentEnabled<kExperimentIdFailRecvMetadataOnDeadlineExceeded>();
@@ -513,10 +491,6 @@ inline bool IsKeepAlivePingTimerBatchEnabled() {
513
491
  inline bool IsLocalConnectorSecureEnabled() {
514
492
  return IsExperimentEnabled<kExperimentIdLocalConnectorSecure>();
515
493
  }
516
- #define GRPC_EXPERIMENT_IS_INCLUDED_MAX_INFLIGHT_PINGS_STRICT_LIMIT
517
- inline bool IsMaxInflightPingsStrictLimitEnabled() {
518
- return IsExperimentEnabled<kExperimentIdMaxInflightPingsStrictLimit>();
519
- }
520
494
  #define GRPC_EXPERIMENT_IS_INCLUDED_MEMORY_OPTIMIZATION_01
521
495
  inline bool IsMemoryOptimization01Enabled() {
522
496
  return IsExperimentEnabled<kExperimentIdMemoryOptimization01>();
@@ -561,6 +535,14 @@ inline bool IsOptimization03Enabled() {
561
535
  inline bool IsOptimization04Enabled() {
562
536
  return IsExperimentEnabled<kExperimentIdOptimization04>();
563
537
  }
538
+ #define GRPC_EXPERIMENT_IS_INCLUDED_OPTIMIZATION_05
539
+ inline bool IsOptimization05Enabled() {
540
+ return IsExperimentEnabled<kExperimentIdOptimization05>();
541
+ }
542
+ #define GRPC_EXPERIMENT_IS_INCLUDED_OPTIMIZATION_06
543
+ inline bool IsOptimization06Enabled() {
544
+ return IsExperimentEnabled<kExperimentIdOptimization06>();
545
+ }
564
546
  #define GRPC_EXPERIMENT_IS_INCLUDED_OTEL_EXPORT_TELEMETRY_DOMAINS
565
547
  inline bool IsOtelExportTelemetryDomainsEnabled() {
566
548
  return IsExperimentEnabled<kExperimentIdOtelExportTelemetryDomains>();
@@ -641,10 +623,6 @@ inline bool IsSkipClearPeerOnCancellationEnabled() {
641
623
  inline bool IsSubchannelConnectionScalingEnabled() {
642
624
  return IsExperimentEnabled<kExperimentIdSubchannelConnectionScaling>();
643
625
  }
644
- #define GRPC_EXPERIMENT_IS_INCLUDED_SUBCHANNEL_WRAPPER_CLEANUP_ON_ORPHAN
645
- inline bool IsSubchannelWrapperCleanupOnOrphanEnabled() {
646
- return IsExperimentEnabled<kExperimentIdSubchannelWrapperCleanupOnOrphan>();
647
- }
648
626
  #define GRPC_EXPERIMENT_IS_INCLUDED_TCP_FRAME_SIZE_TUNING
649
627
  inline bool IsTcpFrameSizeTuningEnabled() {
650
628
  return IsExperimentEnabled<kExperimentIdTcpFrameSizeTuning>();
@@ -110,11 +110,6 @@ absl::Status grpc_wsa_error(const grpc_core::DebugLocation& location, int err,
110
110
  grpc_error_handle grpc_error_set_int(grpc_error_handle src,
111
111
  grpc_core::StatusIntProperty which,
112
112
  intptr_t value) {
113
- if (!grpc_core::IsErrorFlattenEnabled() && src.ok()) {
114
- src = absl::UnknownError("");
115
- StatusSetInt(&src, grpc_core::StatusIntProperty::kRpcStatus,
116
- GRPC_STATUS_OK);
117
- }
118
113
  grpc_core::StatusSetInt(&src, which, value);
119
114
  return src;
120
115
  }
@@ -125,79 +120,14 @@ bool grpc_error_get_int(grpc_error_handle error,
125
120
  if (value.has_value()) {
126
121
  *p = *value;
127
122
  return true;
128
- } else {
129
- // TODO(veblush): Remove this once absl::Status migration is done
130
- if (!grpc_core::IsErrorFlattenEnabled() &&
131
- which == grpc_core::StatusIntProperty::kRpcStatus) {
132
- switch (error.code()) {
133
- case absl::StatusCode::kOk:
134
- *p = GRPC_STATUS_OK;
135
- return true;
136
- case absl::StatusCode::kResourceExhausted:
137
- *p = GRPC_STATUS_RESOURCE_EXHAUSTED;
138
- return true;
139
- case absl::StatusCode::kCancelled:
140
- *p = GRPC_STATUS_CANCELLED;
141
- return true;
142
- default:
143
- break;
144
- }
145
- }
146
- return false;
147
- }
148
- }
149
-
150
- grpc_error_handle grpc_error_set_str(grpc_error_handle src,
151
- grpc_core::StatusStrProperty which,
152
- absl::string_view str) {
153
- if (!grpc_core::IsErrorFlattenEnabled() && src.ok()) {
154
- src = absl::UnknownError("");
155
- StatusSetInt(&src, grpc_core::StatusIntProperty::kRpcStatus,
156
- GRPC_STATUS_OK);
157
- }
158
- grpc_core::StatusSetStr(&src, which, str);
159
- return src;
160
- }
161
-
162
- bool grpc_error_get_str(grpc_error_handle error,
163
- grpc_core::StatusStrProperty which, std::string* s) {
164
- std::optional<std::string> value = grpc_core::StatusGetStr(error, which);
165
- if (value.has_value()) {
166
- *s = std::move(*value);
167
- return true;
168
- } else {
169
- // TODO(veblush): Remove this once absl::Status migration is done
170
- if (!grpc_core::IsErrorFlattenEnabled() &&
171
- which == grpc_core::StatusStrProperty::kGrpcMessage) {
172
- switch (error.code()) {
173
- case absl::StatusCode::kOk:
174
- *s = "";
175
- return true;
176
- case absl::StatusCode::kCancelled:
177
- *s = "CANCELLED";
178
- return true;
179
- default:
180
- break;
181
- }
182
- }
183
- return false;
184
123
  }
124
+ return false;
185
125
  }
186
126
 
187
127
  grpc_error_handle grpc_error_add_child(grpc_error_handle src,
188
128
  grpc_error_handle child) {
189
- if (grpc_core::IsErrorFlattenEnabled()) {
190
- grpc_core::StatusAddChild(&src, child);
191
- return src;
192
- }
193
- if (src.ok()) {
194
- return child;
195
- } else {
196
- if (!child.ok()) {
197
- grpc_core::StatusAddChild(&src, child);
198
- }
199
- return src;
200
- }
129
+ grpc_core::StatusAddChild(&src, child);
130
+ return src;
201
131
  }
202
132
 
203
133
  bool grpc_log_error(const char* what, grpc_error_handle error, const char* file,
@@ -19,6 +19,14 @@
19
19
  #ifndef GRPC_SRC_CORE_LIB_IOMGR_ERROR_H
20
20
  #define GRPC_SRC_CORE_LIB_IOMGR_ERROR_H
21
21
 
22
+ ///////////////////////////////////////////////////////////////////////////////
23
+ //
24
+ // ALL APIs IN THIS FILE ARE DEPRECATED!
25
+ //
26
+ // Callers should instead use absl::Status APIs directly.
27
+ //
28
+ ///////////////////////////////////////////////////////////////////////////////
29
+
22
30
  #include <grpc/slice.h>
23
31
  #include <grpc/status.h>
24
32
  #include <grpc/support/port_platform.h>
@@ -94,12 +102,6 @@ grpc_error_handle grpc_error_set_int(grpc_error_handle src,
94
102
  /// intptr_t for `p`, even if the value of `p` is not used.
95
103
  bool grpc_error_get_int(grpc_error_handle error,
96
104
  grpc_core::StatusIntProperty which, intptr_t* p);
97
- grpc_error_handle grpc_error_set_str(grpc_error_handle src,
98
- grpc_core::StatusStrProperty which,
99
- absl::string_view str);
100
- /// Returns false if the specified string is not set.
101
- bool grpc_error_get_str(grpc_error_handle error,
102
- grpc_core::StatusStrProperty which, std::string* str);
103
105
 
104
106
  /// Add a child error: an error that is believed to have contributed to this
105
107
  /// error occurring. Allows root causing high level errors from lower level
@@ -46,7 +46,6 @@ grpc_error_handle grpc_error_create_from_cferror(const char* file, int line,
46
46
  absl::StrFormat("%s (error domain:%s, code:%ld, description:%s)",
47
47
  custom_desc, buf_domain, code, buf_desc);
48
48
  CFRelease(desc);
49
- return StatusCreate(absl::StatusCode::kUnknown, error_msg,
50
- grpc_core::DebugLocation(file, line), {});
49
+ return absl::UnknownError(error_msg);
51
50
  }
52
51
  #endif // GRPC_CFSTREAM
@@ -334,9 +334,7 @@ static void fork_fd_list_remove_grpc_fd(grpc_fd* fd) {
334
334
 
335
335
  static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
336
336
  grpc_fd* new_fd = nullptr;
337
- if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled() &&
338
- !grpc_event_engine::experimental::
339
- EventEngineExperimentDisabledForPython()) {
337
+ if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled()) {
340
338
  grpc_fd* new_fd = static_cast<grpc_fd*>(gpr_malloc(sizeof(grpc_fd)));
341
339
  new_fd->fd = fd;
342
340
  return new_fd;
@@ -418,9 +416,7 @@ static void fd_shutdown(grpc_fd* fd, grpc_error_handle why) {
418
416
 
419
417
  static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
420
418
  const char* reason) {
421
- if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled() &&
422
- !grpc_event_engine::experimental::
423
- EventEngineExperimentDisabledForPython()) {
419
+ if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled()) {
424
420
  GRPC_CHECK_NE(release_fd, nullptr);
425
421
  GRPC_CHECK_EQ(on_done, nullptr);
426
422
  *release_fd = fd->fd;
@@ -379,9 +379,7 @@ static void unref_by(grpc_fd* fd, int n) {
379
379
  }
380
380
 
381
381
  static grpc_fd* fd_create(int fd, const char* name, bool track_err) {
382
- if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled() &&
383
- !grpc_event_engine::experimental::
384
- EventEngineExperimentDisabledForPython()) {
382
+ if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled()) {
385
383
  GRPC_TRACE_LOG(event_engine, ERROR)
386
384
  << "Creating a wrapped EventEngine grpc_fd with fd:" << fd;
387
385
  grpc_fd* new_fd = static_cast<grpc_fd*>(gpr_malloc(sizeof(grpc_fd)));
@@ -480,9 +478,7 @@ static int fd_wrapped_fd(grpc_fd* fd) {
480
478
 
481
479
  static void fd_orphan(grpc_fd* fd, grpc_closure* on_done, int* release_fd,
482
480
  const char* reason) {
483
- if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled() &&
484
- !grpc_event_engine::experimental::
485
- EventEngineExperimentDisabledForPython()) {
481
+ if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled()) {
486
482
  GRPC_CHECK_NE(release_fd, nullptr);
487
483
  GRPC_CHECK_EQ(on_done, nullptr);
488
484
  *release_fd = fd->fd;
@@ -1926,9 +1926,7 @@ static const grpc_endpoint_vtable vtable = {tcp_read,
1926
1926
  grpc_endpoint* grpc_tcp_create(
1927
1927
  grpc_fd* fd, const grpc_event_engine::experimental::EndpointConfig& config,
1928
1928
  absl::string_view peer_string) {
1929
- if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled() &&
1930
- !grpc_event_engine::experimental::
1931
- EventEngineExperimentDisabledForPython()) {
1929
+ if (grpc_core::IsEventEngineForAllOtherEndpointsEnabled()) {
1932
1930
  // Create an EventEngine endpoint when creating the transport.
1933
1931
  auto* engine =
1934
1932
  reinterpret_cast<grpc_event_engine::experimental::EventEngine*>(
@@ -1956,9 +1954,7 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd,
1956
1954
  GRPC_CHECK(!grpc_event_engine::experimental::UsePollsetAlternative())
1957
1955
  << "This function must not be called when the pollset_alternative "
1958
1956
  "experiment is enabled. This is a bug.";
1959
- GRPC_CHECK(
1960
- !grpc_core::IsEventEngineForAllOtherEndpointsEnabled() ||
1961
- grpc_event_engine::experimental::EventEngineExperimentDisabledForPython())
1957
+ GRPC_CHECK(!grpc_core::IsEventEngineForAllOtherEndpointsEnabled())
1962
1958
  << "The event_engine_for_all_other_endpoints experiment should prevent "
1963
1959
  "this method from being called. This is a bug.";
1964
1960
  grpc_tcp* tcp = new grpc_tcp(options);
@@ -62,7 +62,7 @@ bool AuditLoggerRegistry::FactoryExists(absl::string_view name) {
62
62
  registry->logger_factories_map_.end();
63
63
  }
64
64
 
65
- absl::StatusOr<std::unique_ptr<AuditLoggerFactory::Config>>
65
+ absl::StatusOr<std::shared_ptr<const AuditLoggerFactory::Config>>
66
66
  AuditLoggerRegistry::ParseConfig(absl::string_view name, const Json& json) {
67
67
  MutexLock lock(mu);
68
68
  auto it = registry->logger_factories_map_.find(name);
@@ -74,7 +74,7 @@ AuditLoggerRegistry::ParseConfig(absl::string_view name, const Json& json) {
74
74
  }
75
75
 
76
76
  std::unique_ptr<AuditLogger> AuditLoggerRegistry::CreateAuditLogger(
77
- std::unique_ptr<AuditLoggerFactory::Config> config) {
77
+ std::shared_ptr<const AuditLoggerFactory::Config> config) {
78
78
  MutexLock lock(mu);
79
79
  auto it = registry->logger_factories_map_.find(config->name());
80
80
  GRPC_CHECK(it != registry->logger_factories_map_.end());
@@ -36,17 +36,17 @@ namespace experimental {
36
36
 
37
37
  class AuditLoggerRegistry {
38
38
  public:
39
- static void RegisterFactory(std::unique_ptr<AuditLoggerFactory>);
39
+ static void RegisterFactory(std::unique_ptr<AuditLoggerFactory> factory);
40
40
 
41
41
  static bool FactoryExists(absl::string_view name);
42
42
 
43
- static absl::StatusOr<std::unique_ptr<AuditLoggerFactory::Config>>
43
+ static absl::StatusOr<std::shared_ptr<const AuditLoggerFactory::Config>>
44
44
  ParseConfig(absl::string_view name, const Json& json);
45
45
 
46
46
  // This assume the given config is parsed and validated already.
47
47
  // Therefore, it should always succeed in creating a logger.
48
48
  static std::unique_ptr<AuditLogger> CreateAuditLogger(
49
- std::unique_ptr<AuditLoggerFactory::Config>);
49
+ std::shared_ptr<const AuditLoggerFactory::Config> config);
50
50
 
51
51
  // Factories are registered during initialization. They should never be
52
52
  // unregistered since they will be looked up at any time till the program
@@ -44,20 +44,18 @@ bool ShouldLog(const Decision& decision,
44
44
 
45
45
  } // namespace
46
46
 
47
- GrpcAuthorizationEngine::GrpcAuthorizationEngine(Rbac policy)
48
- : name_(std::move(policy.name)),
49
- action_(policy.action),
50
- audit_condition_(policy.audit_condition) {
51
- for (auto& sub_policy : policy.policies) {
52
- Policy policy;
53
- policy.name = sub_policy.first;
54
- policy.matcher = std::make_unique<PolicyAuthorizationMatcher>(
55
- std::move(sub_policy.second));
56
- policies_.push_back(std::move(policy));
47
+ GrpcAuthorizationEngine::GrpcAuthorizationEngine(const Rbac& rbac)
48
+ : name_(rbac.name),
49
+ action_(rbac.action),
50
+ audit_condition_(rbac.audit_condition) {
51
+ for (auto& [name, policy] : rbac.policies) {
52
+ auto& engine_policy = policies_.emplace_back();
53
+ engine_policy.name = name;
54
+ engine_policy.matcher =
55
+ std::make_unique<PolicyAuthorizationMatcher>(policy);
57
56
  }
58
- for (auto& logger_config : policy.logger_configs) {
59
- auto logger =
60
- AuditLoggerRegistry::CreateAuditLogger(std::move(logger_config));
57
+ for (const auto& logger_config : rbac.logger_configs) {
58
+ auto logger = AuditLoggerRegistry::CreateAuditLogger(logger_config);
61
59
  GRPC_CHECK(logger != nullptr);
62
60
  audit_loggers_.push_back(std::move(logger));
63
61
  }
@@ -44,7 +44,7 @@ class GrpcAuthorizationEngine : public AuthorizationEngine {
44
44
  explicit GrpcAuthorizationEngine(Rbac::Action action)
45
45
  : action_(action), audit_condition_(Rbac::AuditCondition::kNone) {}
46
46
  // Builds GrpcAuthorizationEngine with allow/deny RBAC policy.
47
- explicit GrpcAuthorizationEngine(Rbac policy);
47
+ explicit GrpcAuthorizationEngine(const Rbac& rbac);
48
48
 
49
49
  GrpcAuthorizationEngine(GrpcAuthorizationEngine&& other) noexcept;
50
50
  GrpcAuthorizationEngine& operator=(GrpcAuthorizationEngine&& other) noexcept;