Skip to content

Commit 0a7f75f

Browse files
authored
Add service and method config (#1788)
Motivation: When resoling addresses, gRPC clients can discover configuration to use published by service maintainers. This is in the form of 'service config' and typically encoded as JSON. However the structure of the config is a translation of the service config protobuf message using the standard proto to JSON mappings. This change expands on the existing `MethodConfiguration` to allow it to be decoded from JSON and adds a `ServiceConfiguration` which can also be decoded from JSON. Modifications: - Add additional properties to `MethodConfiguration` and make it `Codabale` - Add `ServiceConfiguration` and make it `Codabale` - Add a `RuntimeError` - Add the `service_config.proto` message and its dependencies and generate these messages into the test module. Result: Service config and method config are more fully featured
1 parent 0daf4a1 commit 0a7f75f

20 files changed

+7220
-311
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ extension Target {
286286
.grpcCore,
287287
.grpcInProcessTransport,
288288
.dequeModule,
289-
.atomics
289+
.atomics,
290+
.protobuf,
290291
]
291292
)
292293

Protos/generate.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ function generate_reflection_data_example {
172172
done
173173
}
174174

175+
function generate_rpc_code_for_tests {
176+
local protos=(
177+
"$here/upstream/grpc/service_config/service_config.proto"
178+
"$here/upstream/grpc/lookup/v1/rls.proto"
179+
"$here/upstream/grpc/lookup/v1/rls_config.proto"
180+
"$here/upstream/google/rpc/code.proto"
181+
)
182+
local output="$root/Tests/GRPCCoreTests/Configuration/Generated"
183+
184+
for proto in "${protos[@]}"; do
185+
generate_message "$proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=DropPath"
186+
done
187+
}
188+
175189
#------------------------------------------------------------------------------
176190

177191
# Examples
@@ -187,3 +201,4 @@ generate_echo_reflection_data_for_tests
187201

188202
# Misc. tests
189203
generate_normalization_for_tests
204+
generate_rpc_code_for_tests

0 commit comments

Comments
 (0)