From d8470a110363fe8d60020b7c9b4e78393565ffc5 Mon Sep 17 00:00:00 2001 From: Stefana Dranca Date: Wed, 13 Mar 2024 10:38:27 +0000 Subject: [PATCH 1/6] Add target and generated code for QPS Motivation: The first step in implementing QPS testing for V2 is to add the proto files representing the services and messages used in QPS and generating the code for them. Modifications: - Modified the fetch script to add the proto files we need - Modified the generate script to generate code for them -Created executable target for QPS worker Result: We can start implementing the performance worker. --- Package.swift | 10 + Protos/fetch.sh | 11 +- Protos/generate.sh | 23 + Protos/upstream/grpc/core/stats.proto | 38 + .../grpc/testing/benchmark_service.proto | 48 + Protos/upstream/grpc/testing/control.proto | 299 ++ Protos/upstream/grpc/testing/messages.proto | 347 +++ Protos/upstream/grpc/testing/payloads.proto | 44 + Protos/upstream/grpc/testing/stats.proto | 87 + .../grpc/testing/worker_service.proto | 49 + .../Generated/control.pb.swift | 2420 +++++++++++++++++ .../Generated/grpc_core_stats.pb.swift | 312 +++ .../Generated/messages.pb.swift | 2200 +++++++++++++++ .../Generated/payloads.pb.swift | 335 +++ .../Generated/stats.pb.swift | 470 ++++ .../Generated/worker_service.grpc.swift | 362 +++ .../Generated/worker_service.pb.swift | 38 + 17 files changed, 7092 insertions(+), 1 deletion(-) create mode 100644 Protos/upstream/grpc/core/stats.proto create mode 100644 Protos/upstream/grpc/testing/benchmark_service.proto create mode 100644 Protos/upstream/grpc/testing/control.proto create mode 100644 Protos/upstream/grpc/testing/messages.proto create mode 100644 Protos/upstream/grpc/testing/payloads.proto create mode 100644 Protos/upstream/grpc/testing/stats.proto create mode 100644 Protos/upstream/grpc/testing/worker_service.proto create mode 100644 Sources/performance-worker/Generated/control.pb.swift create mode 100644 Sources/performance-worker/Generated/grpc_core_stats.pb.swift create mode 100644 Sources/performance-worker/Generated/messages.pb.swift create mode 100644 Sources/performance-worker/Generated/payloads.pb.swift create mode 100644 Sources/performance-worker/Generated/stats.pb.swift create mode 100644 Sources/performance-worker/Generated/worker_service.grpc.swift create mode 100644 Sources/performance-worker/Generated/worker_service.pb.swift diff --git a/Package.swift b/Package.swift index 41b6bffa8..e6b4fb0bb 100644 --- a/Package.swift +++ b/Package.swift @@ -91,6 +91,7 @@ extension Target.Dependency { static let grpc: Self = .target(name: grpcTargetName) static let cgrpcZlib: Self = .target(name: cgrpcZlibTargetName) static let protocGenGRPCSwift: Self = .target(name: "protoc-gen-grpc-swift") + static let performanceWorker: Self = .target(name: "performance-worker") static let reflectionService: Self = .target(name: "GRPCReflectionService") static let grpcCodeGen: Self = .target(name: "GRPCCodeGen") static let grpcProtobuf: Self = .target(name: "GRPCProtobuf") @@ -245,6 +246,14 @@ extension Target { ] ) + static let performanceWorker: Target = .executableTarget( + name: "performance-worker", + dependencies: [ + .grpcCore, + .grpcProtobuf + ] + ) + static let grpcSwiftPlugin: Target = .plugin( name: "GRPCSwiftPlugin", capability: .buildTool(), @@ -722,6 +731,7 @@ let package = Package( .grpcProtobuf, .grpcProtobufCodeGen, .interoperabilityTestImplementation, + .performanceWorker, // v2 tests .grpcCoreTests, diff --git a/Protos/fetch.sh b/Protos/fetch.sh index 36cf64580..7db76f360 100755 --- a/Protos/fetch.sh +++ b/Protos/fetch.sh @@ -23,7 +23,7 @@ upstream="$here/upstream" checkouts="$(mktemp -d)" # Clone the grpc and google protos into the staging area. -git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto" +git clone --depth 2 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto" git clone --depth 1 https://github.com/googleapis/googleapis.git "$checkouts/googleapis" # Remove the old protos. @@ -33,12 +33,21 @@ rm -rf "$upstream" # rather than source repository name. mkdir -p "$upstream/grpc" mkdir -p "$upstream/google" +mkdir -p "$upstream/grpc/testing" +mkdir -p "$upstream/grpc/core" # Copy over the grpc-proto protos. cp -rp "$checkouts/grpc-proto/grpc/service_config" "$upstream/grpc/service_config" cp -rp "$checkouts/grpc-proto/grpc/lookup" "$upstream/grpc/lookup" cp -rp "$checkouts/grpc-proto/grpc/reflection" "$upstream/grpc/reflection" cp -rp "$checkouts/grpc-proto/grpc/examples" "$upstream/grpc/examples" +cp -rp "$checkouts/grpc-proto/grpc/testing/benchmark_service.proto" "$upstream/grpc/testing/benchmark_service.proto" +cp -rp "$checkouts/grpc-proto/grpc/testing/messages.proto" "$upstream/grpc/testing/messages.proto" +cp -rp "$checkouts/grpc-proto/grpc/testing/worker_service.proto" "$upstream/grpc/testing/worker_service.proto" +cp -rp "$checkouts/grpc-proto/grpc/testing/control.proto" "$upstream/grpc/testing/control.proto" +cp -rp "$checkouts/grpc-proto/grpc/testing/payloads.proto" "$upstream/grpc/testing/payloads.proto" +cp -rp "$checkouts/grpc-proto/grpc/testing/stats.proto" "$upstream/grpc/testing/stats.proto" +cp -rp "$checkouts/grpc-proto/grpc/core/stats.proto" "$upstream/grpc/core/stats.proto" # Copy over the googleapis protos. mkdir -p "$upstream/google/rpc" diff --git a/Protos/generate.sh b/Protos/generate.sh index 6a392597e..846325ed0 100755 --- a/Protos/generate.sh +++ b/Protos/generate.sh @@ -201,6 +201,26 @@ function generate_service_messages_interop_tests { done } +function generate_qps_code { + local protos=( + "$here/upstream/grpc/testing/payloads.proto" + "$here/upstream/grpc/testing/control.proto" + "$here/upstream/grpc/testing/messages.proto" + "$here/upstream/grpc/testing/messages.proto" + "$here/upstream/grpc/testing/stats.proto" + "$here/upstream/grpc/testing/worker_service.proto" + ) + + local output="$root/Sources/performance-worker/Generated" + + generate_message "$here/upstream/grpc/core/stats.proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=PathToUnderscores" + + for proto in "${protos[@]}"; do + generate_message "$proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=DropPath" + generate_grpc "$proto" "$here/upstream/" "$output" "Visibility=Internal" "Server=true" "_V2=true" "FileNaming=DropPath" + done +} + #------------------------------------------------------------------------------ # Examples @@ -220,3 +240,6 @@ generate_service_messages_interop_tests # Misc. tests generate_normalization_for_tests generate_rpc_code_for_tests + +# QPS Tests +generate_qps_code diff --git a/Protos/upstream/grpc/core/stats.proto b/Protos/upstream/grpc/core/stats.proto new file mode 100644 index 000000000..ac181b043 --- /dev/null +++ b/Protos/upstream/grpc/core/stats.proto @@ -0,0 +1,38 @@ +// Copyright 2017 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.core; + +message Bucket { + double start = 1; + uint64 count = 2; +} + +message Histogram { + repeated Bucket buckets = 1; +} + +message Metric { + string name = 1; + oneof value { + uint64 count = 10; + Histogram histogram = 11; + } +} + +message Stats { + repeated Metric metrics = 1; +} diff --git a/Protos/upstream/grpc/testing/benchmark_service.proto b/Protos/upstream/grpc/testing/benchmark_service.proto new file mode 100644 index 000000000..5209bd6ef --- /dev/null +++ b/Protos/upstream/grpc/testing/benchmark_service.proto @@ -0,0 +1,48 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto3"; + +import "grpc/testing/messages.proto"; + +package grpc.testing; + +option java_multiple_files = true; +option java_package = "io.grpc.testing"; +option java_outer_classname = "BenchmarkServiceProto"; + +service BenchmarkService { + // One request followed by one response. + // The server returns the client payload as-is. + rpc UnaryCall(SimpleRequest) returns (SimpleResponse); + + // Repeated sequence of one request followed by one response. + // Should be called streaming ping-pong + // The server returns the client payload as-is on each response + rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse); + + // Single-sided unbounded streaming from client to server + // The server returns the client payload as-is once the client does WritesDone + rpc StreamingFromClient(stream SimpleRequest) returns (SimpleResponse); + + // Single-sided unbounded streaming from server to client + // The server repeatedly returns the client payload as-is + rpc StreamingFromServer(SimpleRequest) returns (stream SimpleResponse); + + // Two-sided unbounded streaming between server to client + // Both sides send the content of their own choice to the other + rpc StreamingBothWays(stream SimpleRequest) returns (stream SimpleResponse); +} diff --git a/Protos/upstream/grpc/testing/control.proto b/Protos/upstream/grpc/testing/control.proto new file mode 100644 index 000000000..e309e5f9c --- /dev/null +++ b/Protos/upstream/grpc/testing/control.proto @@ -0,0 +1,299 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +import "grpc/testing/payloads.proto"; +import "grpc/testing/stats.proto"; +import "google/protobuf/timestamp.proto"; + +package grpc.testing; + +option java_multiple_files = true; +option java_package = "io.grpc.testing"; +option java_outer_classname = "ControlProto"; + +enum ClientType { + // Many languages support a basic distinction between using + // sync or async client, and this allows the specification + SYNC_CLIENT = 0; + ASYNC_CLIENT = 1; + OTHER_CLIENT = 2; // used for some language-specific variants + CALLBACK_CLIENT = 3; +} + +enum ServerType { + SYNC_SERVER = 0; + ASYNC_SERVER = 1; + ASYNC_GENERIC_SERVER = 2; + OTHER_SERVER = 3; // used for some language-specific variants + CALLBACK_SERVER = 4; +} + +enum RpcType { + UNARY = 0; + STREAMING = 1; + STREAMING_FROM_CLIENT = 2; + STREAMING_FROM_SERVER = 3; + STREAMING_BOTH_WAYS = 4; +} + +// Parameters of poisson process distribution, which is a good representation +// of activity coming in from independent identical stationary sources. +message PoissonParams { + // The rate of arrivals (a.k.a. lambda parameter of the exp distribution). + double offered_load = 1; +} + +// Once an RPC finishes, immediately start a new one. +// No configuration parameters needed. +message ClosedLoopParams {} + +message LoadParams { + oneof load { + ClosedLoopParams closed_loop = 1; + PoissonParams poisson = 2; + }; +} + +// presence of SecurityParams implies use of TLS +message SecurityParams { + bool use_test_ca = 1; + string server_host_override = 2; + string cred_type = 3; +} + +message ChannelArg { + string name = 1; + oneof value { + string str_value = 2; + int32 int_value = 3; + } +} + +message ClientConfig { + // List of targets to connect to. At least one target needs to be specified. + repeated string server_targets = 1; + ClientType client_type = 2; + SecurityParams security_params = 3; + // How many concurrent RPCs to start for each channel. + // For synchronous client, use a separate thread for each outstanding RPC. + int32 outstanding_rpcs_per_channel = 4; + // Number of independent client channels to create. + // i-th channel will connect to server_target[i % server_targets.size()] + int32 client_channels = 5; + // Only for async client. Number of threads to use to start/manage RPCs. + int32 async_client_threads = 7; + RpcType rpc_type = 8; + // The requested load for the entire client (aggregated over all the threads). + LoadParams load_params = 10; + PayloadConfig payload_config = 11; + HistogramParams histogram_params = 12; + + // Specify the cores we should run the client on, if desired + repeated int32 core_list = 13; + int32 core_limit = 14; + + // If we use an OTHER_CLIENT client_type, this string gives more detail + string other_client_api = 15; + + repeated ChannelArg channel_args = 16; + + // Number of threads that share each completion queue + int32 threads_per_cq = 17; + + // Number of messages on a stream before it gets finished/restarted + int32 messages_per_stream = 18; + + // Use coalescing API when possible. + bool use_coalesce_api = 19; + + // If 0, disabled. Else, specifies the period between gathering latency + // medians in milliseconds. + int32 median_latency_collection_interval_millis = 20; + + // Number of client processes. 0 indicates no restriction. + int32 client_processes = 21; +} + +message ClientStatus { ClientStats stats = 1; } + +// Request current stats +message Mark { + // if true, the stats will be reset after taking their snapshot. + bool reset = 1; +} + +message ClientArgs { + oneof argtype { + ClientConfig setup = 1; + Mark mark = 2; + } +} + +message ServerConfig { + ServerType server_type = 1; + SecurityParams security_params = 2; + // Port on which to listen. Zero means pick unused port. + int32 port = 4; + // Only for async server. Number of threads used to serve the requests. + int32 async_server_threads = 7; + // Specify the number of cores to limit server to, if desired + int32 core_limit = 8; + // payload config, used in generic server. + // Note this must NOT be used in proto (non-generic) servers. For proto servers, + // 'response sizes' must be configured from the 'response_size' field of the + // 'SimpleRequest' objects in RPC requests. + PayloadConfig payload_config = 9; + + // Specify the cores we should run the server on, if desired + repeated int32 core_list = 10; + + // If we use an OTHER_SERVER client_type, this string gives more detail + string other_server_api = 11; + + // Number of threads that share each completion queue + int32 threads_per_cq = 12; + + // c++-only options (for now) -------------------------------- + + // Buffer pool size (no buffer pool specified if unset) + int32 resource_quota_size = 1001; + repeated ChannelArg channel_args = 1002; + + // Number of server processes. 0 indicates no restriction. + int32 server_processes = 21; +} + +message ServerArgs { + oneof argtype { + ServerConfig setup = 1; + Mark mark = 2; + } +} + +message ServerStatus { + ServerStats stats = 1; + // the port bound by the server + int32 port = 2; + // Number of cores available to the server + int32 cores = 3; +} + +message CoreRequest { +} + +message CoreResponse { + // Number of cores available on the server + int32 cores = 1; +} + +message Void { +} + +// A single performance scenario: input to qps_json_driver +message Scenario { + // Human readable name for this scenario + string name = 1; + // Client configuration + ClientConfig client_config = 2; + // Number of clients to start for the test + int32 num_clients = 3; + // Server configuration + ServerConfig server_config = 4; + // Number of servers to start for the test + int32 num_servers = 5; + // Warmup period, in seconds + int32 warmup_seconds = 6; + // Benchmark time, in seconds + int32 benchmark_seconds = 7; + // Number of workers to spawn locally (usually zero) + int32 spawn_local_worker_count = 8; +} + +// A set of scenarios to be run with qps_json_driver +message Scenarios { + repeated Scenario scenarios = 1; +} + +// Basic summary that can be computed from ClientStats and ServerStats +// once the scenario has finished. +message ScenarioResultSummary +{ + // Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: + // For unary benchmarks, an operation is processing of a single unary RPC. + // For streaming benchmarks, an operation is processing of a single ping pong of request and response. + double qps = 1; + // QPS per server core. + double qps_per_server_core = 2; + // The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. + // For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + // processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + // Same explanation for the total client cpu load below. + double server_system_time = 3; + // The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + double server_user_time = 4; + // The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + double client_system_time = 5; + // The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + double client_user_time = 6; + + // X% latency percentiles (in nanoseconds) + double latency_50 = 7; + double latency_90 = 8; + double latency_95 = 9; + double latency_99 = 10; + double latency_999 = 11; + + // server cpu usage percentage + double server_cpu_usage = 12; + + // Number of requests that succeeded/failed + double successful_requests_per_second = 13; + double failed_requests_per_second = 14; + + // Number of polls called inside completion queue per request + double client_polls_per_request = 15; + double server_polls_per_request = 16; + + // Queries per CPU-sec over all servers or clients + double server_queries_per_cpu_sec = 17; + double client_queries_per_cpu_sec = 18; + + + // Start and end time for the test scenario + google.protobuf.Timestamp start_time = 19; + google.protobuf.Timestamp end_time =20; +} + +// Results of a single benchmark scenario. +message ScenarioResult { + // Inputs used to run the scenario. + Scenario scenario = 1; + // Histograms from all clients merged into one histogram. + HistogramData latencies = 2; + // Client stats for each client + repeated ClientStats client_stats = 3; + // Server stats for each server + repeated ServerStats server_stats = 4; + // Number of cores available to each server + repeated int32 server_cores = 5; + // An after-the-fact computed summary + ScenarioResultSummary summary = 6; + // Information on success or failure of each worker + repeated bool client_success = 7; + repeated bool server_success = 8; + // Number of failed requests (one row per status code seen) + repeated RequestResultCount request_results = 9; +} diff --git a/Protos/upstream/grpc/testing/messages.proto b/Protos/upstream/grpc/testing/messages.proto new file mode 100644 index 000000000..99e34dcc8 --- /dev/null +++ b/Protos/upstream/grpc/testing/messages.proto @@ -0,0 +1,347 @@ +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Message definitions to be used by integration test service definitions. + +syntax = "proto3"; + +package grpc.testing; + +option java_package = "io.grpc.testing.integration"; + +// TODO(dgq): Go back to using well-known types once +// https://github.com/grpc/grpc/issues/6980 has been fixed. +// import "google/protobuf/wrappers.proto"; +message BoolValue { + // The bool value. + bool value = 1; +} + +// The type of payload that should be returned. +enum PayloadType { + // Compressable text format. + COMPRESSABLE = 0; +} + +// A block of data, to simply increase gRPC message size. +message Payload { + // The type of data in body. + PayloadType type = 1; + // Primary contents of payload. + bytes body = 2; +} + +// A protobuf representation for grpc status. This is used by test +// clients to specify a status that the server should attempt to return. +message EchoStatus { + int32 code = 1; + string message = 2; +} + +// The type of route that a client took to reach a server w.r.t. gRPCLB. +// The server must fill in "fallback" if it detects that the RPC reached +// the server via the "gRPCLB fallback" path, and "backend" if it detects +// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got +// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly +// how this detection is done is context and server dependent. +enum GrpclbRouteType { + // Server didn't detect the route that a client took to reach it. + GRPCLB_ROUTE_TYPE_UNKNOWN = 0; + // Indicates that a client reached a server via gRPCLB fallback. + GRPCLB_ROUTE_TYPE_FALLBACK = 1; + // Indicates that a client reached a server as a gRPCLB-given backend. + GRPCLB_ROUTE_TYPE_BACKEND = 2; +} + +// Unary request. +message SimpleRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, server randomly chooses one from other formats. + PayloadType response_type = 1; + + // Desired payload size in the response from the server. + int32 response_size = 2; + + // Optional input payload sent along with the request. + Payload payload = 3; + + // Whether SimpleResponse should include username. + bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + bool fill_oauth_scope = 5; + + // Whether to request the server to compress the response. This field is + // "nullable" in order to interoperate seamlessly with clients not able to + // implement the full compression tests by introspecting the call to verify + // the response's compression status. + BoolValue response_compressed = 6; + + // Whether server should return a given status + EchoStatus response_status = 7; + + // Whether the server should expect this request to be compressed. + BoolValue expect_compressed = 8; + + // Whether SimpleResponse should include server_id. + bool fill_server_id = 9; + + // Whether SimpleResponse should include grpclb_route_type. + bool fill_grpclb_route_type = 10; + + // If set the server should record this metrics report data for the current RPC. + TestOrcaReport orca_per_query_report = 11; +} + +// Unary response, as configured by the request. +message SimpleResponse { + // Payload to increase message size. + Payload payload = 1; + // The user the request came from, for verifying authentication was + // successful when the client expected it. + string username = 2; + // OAuth scope. + string oauth_scope = 3; + + // Server ID. This must be unique among different server instances, + // but the same across all RPC's made to a particular server instance. + string server_id = 4; + // gRPCLB Path. + GrpclbRouteType grpclb_route_type = 5; + + // Server hostname. + string hostname = 6; +} + +// Client-streaming request. +message StreamingInputCallRequest { + // Optional input payload sent along with the request. + Payload payload = 1; + + // Whether the server should expect this request to be compressed. This field + // is "nullable" in order to interoperate seamlessly with servers not able to + // implement the full compression tests by introspecting the call to verify + // the request's compression status. + BoolValue expect_compressed = 2; + + // Not expecting any payload from the response. +} + +// Client-streaming response. +message StreamingInputCallResponse { + // Aggregated size of payloads received from the client. + int32 aggregated_payload_size = 1; +} + +// Configuration for a particular response. +message ResponseParameters { + // Desired payload sizes in responses from the server. + int32 size = 1; + + // Desired interval between consecutive responses in the response stream in + // microseconds. + int32 interval_us = 2; + + // Whether to request the server to compress the response. This field is + // "nullable" in order to interoperate seamlessly with clients not able to + // implement the full compression tests by introspecting the call to verify + // the response's compression status. + BoolValue compressed = 3; +} + +// Server-streaming request. +message StreamingOutputCallRequest { + // Desired payload type in the response from the server. + // If response_type is RANDOM, the payload from each response in the stream + // might be of different types. This is to simulate a mixed type of payload + // stream. + PayloadType response_type = 1; + + // Configuration for each expected response message. + repeated ResponseParameters response_parameters = 2; + + // Optional input payload sent along with the request. + Payload payload = 3; + + // Whether server should return a given status + EchoStatus response_status = 7; + + // If set the server should update this metrics report data at the OOB server. + TestOrcaReport orca_oob_report = 8; +} + +// Server-streaming response, as configured by the request and parameters. +message StreamingOutputCallResponse { + // Payload to increase response size. + Payload payload = 1; +} + +// For reconnect interop test only. +// Client tells server what reconnection parameters it used. +message ReconnectParams { + int32 max_reconnect_backoff_ms = 1; +} + +// For reconnect interop test only. +// Server tells client whether its reconnects are following the spec and the +// reconnect backoffs it saw. +message ReconnectInfo { + bool passed = 1; + repeated int32 backoff_ms = 2; +} + +message LoadBalancerStatsRequest { + // Request stats for the next num_rpcs sent by client. + int32 num_rpcs = 1; + // If num_rpcs have not completed within timeout_sec, return partial results. + int32 timeout_sec = 2; + // Response header + trailer metadata entries we want the values of. + // Matching of the keys is case-insensitive as per rfc7540#section-8.1.2 + // * (asterisk) is a special value that will return all metadata entries + repeated string metadata_keys = 3; +} + +message LoadBalancerStatsResponse { + enum MetadataType { + UNKNOWN = 0; + INITIAL = 1; + TRAILING = 2; + } + message MetadataEntry { + // Key, exactly as received from the server. Case may be different from what + // was requested in the LoadBalancerStatsRequest) + string key = 1; + // Value, exactly as received from the server. + string value = 2; + // Metadata type + MetadataType type = 3; + } + message RpcMetadata { + // metadata values for each rpc for the keys specified in + // LoadBalancerStatsRequest.metadata_keys. + repeated MetadataEntry metadata = 1; + } + message MetadataByPeer { + // List of RpcMetadata in for each RPC with a given peer + repeated RpcMetadata rpc_metadata = 1; + } + message RpcsByPeer { + // The number of completed RPCs for each peer. + map rpcs_by_peer = 1; + } + // The number of completed RPCs for each peer. + map rpcs_by_peer = 1; + // The number of RPCs that failed to record a remote peer. + int32 num_failures = 2; + map rpcs_by_method = 3; + // All the metadata of all RPCs for each peer. + map metadatas_by_peer = 4; +} + +// Request for retrieving a test client's accumulated stats. +message LoadBalancerAccumulatedStatsRequest {} + +// Accumulated stats for RPCs sent by a test client. +message LoadBalancerAccumulatedStatsResponse { + // The total number of RPCs have ever issued for each type. + // Deprecated: use stats_per_method.rpcs_started instead. + map num_rpcs_started_by_method = 1 [deprecated = true]; + // The total number of RPCs have ever completed successfully for each type. + // Deprecated: use stats_per_method.result instead. + map num_rpcs_succeeded_by_method = 2 [deprecated = true]; + // The total number of RPCs have ever failed for each type. + // Deprecated: use stats_per_method.result instead. + map num_rpcs_failed_by_method = 3 [deprecated = true]; + + message MethodStats { + // The number of RPCs that were started for this method. + int32 rpcs_started = 1; + + // The number of RPCs that completed with each status for this method. The + // key is the integral value of a google.rpc.Code; the value is the count. + map result = 2; + } + + // Per-method RPC statistics. The key is the RpcType in string form; e.g. + // 'EMPTY_CALL' or 'UNARY_CALL' + map stats_per_method = 4; +} + +// Configurations for a test client. +message ClientConfigureRequest { + // Type of RPCs to send. + enum RpcType { + EMPTY_CALL = 0; + UNARY_CALL = 1; + } + + // Metadata to be attached for the given type of RPCs. + message Metadata { + RpcType type = 1; + string key = 2; + string value = 3; + } + + // The types of RPCs the client sends. + repeated RpcType types = 1; + // The collection of custom metadata to be attached to RPCs sent by the client. + repeated Metadata metadata = 2; + // The deadline to use, in seconds, for all RPCs. If unset or zero, the + // client will use the default from the command-line. + int32 timeout_sec = 3; +} + +// Response for updating a test client's configuration. +message ClientConfigureResponse {} + +message MemorySize { + int64 rss = 1; +} + +// Metrics data the server will update and send to the client. It mirrors orca load report +// https://github.com/cncf/xds/blob/eded343319d09f30032952beda9840bbd3dcf7ac/xds/data/orca/v3/orca_load_report.proto#L15, +// but avoids orca dependency. Used by both per-query and out-of-band reporting tests. +message TestOrcaReport { + double cpu_utilization = 1; + double memory_utilization = 2; + map request_cost = 3; + map utilization = 4; +} + +// Status that will be return to callers of the Hook method +message SetReturnStatusRequest { + int32 grpc_code_to_return = 1; + string grpc_status_description = 2; +} + +message HookRequest { + enum HookRequestCommand { + // Default value + UNSPECIFIED = 0; + // Start the HTTP endpoint + START = 1; + // Stop + STOP = 2; + // Return from HTTP GET/POST + RETURN = 3; + } + HookRequestCommand command = 1; + int32 grpc_code_to_return = 2; + string grpc_status_description = 3; + // Server port to listen to + int32 server_port = 4; +} + +message HookResponse { +} diff --git a/Protos/upstream/grpc/testing/payloads.proto b/Protos/upstream/grpc/testing/payloads.proto new file mode 100644 index 000000000..8cbc9db6c --- /dev/null +++ b/Protos/upstream/grpc/testing/payloads.proto @@ -0,0 +1,44 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.testing; + +option java_multiple_files = true; +option java_package = "io.grpc.testing"; +option java_outer_classname = "PayloadsProto"; + +message ByteBufferParams { + int32 req_size = 1; + int32 resp_size = 2; +} + +message SimpleProtoParams { + int32 req_size = 1; + int32 resp_size = 2; +} + +message ComplexProtoParams { + // TODO (vpai): Fill this in once the details of complex, representative + // protos are decided +} + +message PayloadConfig { + oneof payload { + ByteBufferParams bytebuf_params = 1; + SimpleProtoParams simple_params = 2; + ComplexProtoParams complex_params = 3; + } +} diff --git a/Protos/upstream/grpc/testing/stats.proto b/Protos/upstream/grpc/testing/stats.proto new file mode 100644 index 000000000..1f0fae4e5 --- /dev/null +++ b/Protos/upstream/grpc/testing/stats.proto @@ -0,0 +1,87 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.testing; + +import "grpc/core/stats.proto"; + +option java_multiple_files = true; +option java_package = "io.grpc.testing"; +option java_outer_classname = "StatsProto"; + +message ServerStats { + // wall clock time change in seconds since last reset + double time_elapsed = 1; + + // change in user time (in seconds) used by the server since last reset + double time_user = 2; + + // change in server time (in seconds) used by the server process and all + // threads since last reset + double time_system = 3; + + // change in total cpu time of the server (data from proc/stat) + uint64 total_cpu_time = 4; + + // change in idle time of the server (data from proc/stat) + uint64 idle_cpu_time = 5; + + // Number of polls called inside completion queue + uint64 cq_poll_count = 6; + + // Core library stats + grpc.core.Stats core_stats = 7; +} + +// Histogram params based on grpc/support/histogram.c +message HistogramParams { + double resolution = 1; // first bucket is [0, 1 + resolution) + double max_possible = 2; // use enough buckets to allow this value +} + +// Histogram data based on grpc/support/histogram.c +message HistogramData { + repeated uint32 bucket = 1; + double min_seen = 2; + double max_seen = 3; + double sum = 4; + double sum_of_squares = 5; + double count = 6; +} + +message RequestResultCount { + int32 status_code = 1; + int64 count = 2; +} + +message ClientStats { + // Latency histogram. Data points are in nanoseconds. + HistogramData latencies = 1; + + // See ServerStats for details. + double time_elapsed = 2; + double time_user = 3; + double time_system = 4; + + // Number of failed requests (one row per status code seen) + repeated RequestResultCount request_results = 5; + + // Number of polls called inside completion queue + uint64 cq_poll_count = 6; + + // Core library stats + grpc.core.Stats core_stats = 7; +} diff --git a/Protos/upstream/grpc/testing/worker_service.proto b/Protos/upstream/grpc/testing/worker_service.proto new file mode 100644 index 000000000..ff3aa2931 --- /dev/null +++ b/Protos/upstream/grpc/testing/worker_service.proto @@ -0,0 +1,49 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// An integration test service that covers all the method signature permutations +// of unary/streaming requests/responses. +syntax = "proto3"; + +import "grpc/testing/control.proto"; + +package grpc.testing; + +option java_multiple_files = true; +option java_package = "io.grpc.testing"; +option java_outer_classname = "WorkerServiceProto"; + +service WorkerService { + // Start server with specified workload. + // First request sent specifies the ServerConfig followed by ServerStatus + // response. After that, a "Mark" can be sent anytime to request the latest + // stats. Closing the stream will initiate shutdown of the test server + // and once the shutdown has finished, the OK status is sent to terminate + // this RPC. + rpc RunServer(stream ServerArgs) returns (stream ServerStatus); + + // Start client with specified workload. + // First request sent specifies the ClientConfig followed by ClientStatus + // response. After that, a "Mark" can be sent anytime to request the latest + // stats. Closing the stream will initiate shutdown of the test client + // and once the shutdown has finished, the OK status is sent to terminate + // this RPC. + rpc RunClient(stream ClientArgs) returns (stream ClientStatus); + + // Just return the core count - unary call + rpc CoreCount(CoreRequest) returns (CoreResponse); + + // Quit this worker + rpc QuitWorker(Void) returns (Void); +} diff --git a/Sources/performance-worker/Generated/control.pb.swift b/Sources/performance-worker/Generated/control.pb.swift new file mode 100644 index 000000000..29c5cda47 --- /dev/null +++ b/Sources/performance-worker/Generated/control.pb.swift @@ -0,0 +1,2420 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/control.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +enum Grpc_Testing_ClientType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Many languages support a basic distinction between using + /// sync or async client, and this allows the specification + case syncClient // = 0 + case asyncClient // = 1 + + /// used for some language-specific variants + case otherClient // = 2 + case callbackClient // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .syncClient + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .syncClient + case 1: self = .asyncClient + case 2: self = .otherClient + case 3: self = .callbackClient + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .syncClient: return 0 + case .asyncClient: return 1 + case .otherClient: return 2 + case .callbackClient: return 3 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Grpc_Testing_ClientType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_ClientType] = [ + .syncClient, + .asyncClient, + .otherClient, + .callbackClient, + ] +} + +#endif // swift(>=4.2) + +enum Grpc_Testing_ServerType: SwiftProtobuf.Enum { + typealias RawValue = Int + case syncServer // = 0 + case asyncServer // = 1 + case asyncGenericServer // = 2 + + /// used for some language-specific variants + case otherServer // = 3 + case callbackServer // = 4 + case UNRECOGNIZED(Int) + + init() { + self = .syncServer + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .syncServer + case 1: self = .asyncServer + case 2: self = .asyncGenericServer + case 3: self = .otherServer + case 4: self = .callbackServer + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .syncServer: return 0 + case .asyncServer: return 1 + case .asyncGenericServer: return 2 + case .otherServer: return 3 + case .callbackServer: return 4 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Grpc_Testing_ServerType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_ServerType] = [ + .syncServer, + .asyncServer, + .asyncGenericServer, + .otherServer, + .callbackServer, + ] +} + +#endif // swift(>=4.2) + +enum Grpc_Testing_RpcType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unary // = 0 + case streaming // = 1 + case streamingFromClient // = 2 + case streamingFromServer // = 3 + case streamingBothWays // = 4 + case UNRECOGNIZED(Int) + + init() { + self = .unary + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unary + case 1: self = .streaming + case 2: self = .streamingFromClient + case 3: self = .streamingFromServer + case 4: self = .streamingBothWays + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unary: return 0 + case .streaming: return 1 + case .streamingFromClient: return 2 + case .streamingFromServer: return 3 + case .streamingBothWays: return 4 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Grpc_Testing_RpcType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_RpcType] = [ + .unary, + .streaming, + .streamingFromClient, + .streamingFromServer, + .streamingBothWays, + ] +} + +#endif // swift(>=4.2) + +/// Parameters of poisson process distribution, which is a good representation +/// of activity coming in from independent identical stationary sources. +struct Grpc_Testing_PoissonParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The rate of arrivals (a.k.a. lambda parameter of the exp distribution). + var offeredLoad: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Once an RPC finishes, immediately start a new one. +/// No configuration parameters needed. +struct Grpc_Testing_ClosedLoopParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_LoadParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var load: Grpc_Testing_LoadParams.OneOf_Load? = nil + + var closedLoop: Grpc_Testing_ClosedLoopParams { + get { + if case .closedLoop(let v)? = load {return v} + return Grpc_Testing_ClosedLoopParams() + } + set {load = .closedLoop(newValue)} + } + + var poisson: Grpc_Testing_PoissonParams { + get { + if case .poisson(let v)? = load {return v} + return Grpc_Testing_PoissonParams() + } + set {load = .poisson(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Load: Equatable { + case closedLoop(Grpc_Testing_ClosedLoopParams) + case poisson(Grpc_Testing_PoissonParams) + + #if !swift(>=4.1) + static func ==(lhs: Grpc_Testing_LoadParams.OneOf_Load, rhs: Grpc_Testing_LoadParams.OneOf_Load) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.closedLoop, .closedLoop): return { + guard case .closedLoop(let l) = lhs, case .closedLoop(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.poisson, .poisson): return { + guard case .poisson(let l) = lhs, case .poisson(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + +/// presence of SecurityParams implies use of TLS +struct Grpc_Testing_SecurityParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var useTestCa: Bool = false + + var serverHostOverride: String = String() + + var credType: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_ChannelArg { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var value: Grpc_Testing_ChannelArg.OneOf_Value? = nil + + var strValue: String { + get { + if case .strValue(let v)? = value {return v} + return String() + } + set {value = .strValue(newValue)} + } + + var intValue: Int32 { + get { + if case .intValue(let v)? = value {return v} + return 0 + } + set {value = .intValue(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Value: Equatable { + case strValue(String) + case intValue(Int32) + + #if !swift(>=4.1) + static func ==(lhs: Grpc_Testing_ChannelArg.OneOf_Value, rhs: Grpc_Testing_ChannelArg.OneOf_Value) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.strValue, .strValue): return { + guard case .strValue(let l) = lhs, case .strValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.intValue, .intValue): return { + guard case .intValue(let l) = lhs, case .intValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + +struct Grpc_Testing_ClientConfig { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// List of targets to connect to. At least one target needs to be specified. + var serverTargets: [String] { + get {return _storage._serverTargets} + set {_uniqueStorage()._serverTargets = newValue} + } + + var clientType: Grpc_Testing_ClientType { + get {return _storage._clientType} + set {_uniqueStorage()._clientType = newValue} + } + + var securityParams: Grpc_Testing_SecurityParams { + get {return _storage._securityParams ?? Grpc_Testing_SecurityParams()} + set {_uniqueStorage()._securityParams = newValue} + } + /// Returns true if `securityParams` has been explicitly set. + var hasSecurityParams: Bool {return _storage._securityParams != nil} + /// Clears the value of `securityParams`. Subsequent reads from it will return its default value. + mutating func clearSecurityParams() {_uniqueStorage()._securityParams = nil} + + /// How many concurrent RPCs to start for each channel. + /// For synchronous client, use a separate thread for each outstanding RPC. + var outstandingRpcsPerChannel: Int32 { + get {return _storage._outstandingRpcsPerChannel} + set {_uniqueStorage()._outstandingRpcsPerChannel = newValue} + } + + /// Number of independent client channels to create. + /// i-th channel will connect to server_target[i % server_targets.size()] + var clientChannels: Int32 { + get {return _storage._clientChannels} + set {_uniqueStorage()._clientChannels = newValue} + } + + /// Only for async client. Number of threads to use to start/manage RPCs. + var asyncClientThreads: Int32 { + get {return _storage._asyncClientThreads} + set {_uniqueStorage()._asyncClientThreads = newValue} + } + + var rpcType: Grpc_Testing_RpcType { + get {return _storage._rpcType} + set {_uniqueStorage()._rpcType = newValue} + } + + /// The requested load for the entire client (aggregated over all the threads). + var loadParams: Grpc_Testing_LoadParams { + get {return _storage._loadParams ?? Grpc_Testing_LoadParams()} + set {_uniqueStorage()._loadParams = newValue} + } + /// Returns true if `loadParams` has been explicitly set. + var hasLoadParams: Bool {return _storage._loadParams != nil} + /// Clears the value of `loadParams`. Subsequent reads from it will return its default value. + mutating func clearLoadParams() {_uniqueStorage()._loadParams = nil} + + var payloadConfig: Grpc_Testing_PayloadConfig { + get {return _storage._payloadConfig ?? Grpc_Testing_PayloadConfig()} + set {_uniqueStorage()._payloadConfig = newValue} + } + /// Returns true if `payloadConfig` has been explicitly set. + var hasPayloadConfig: Bool {return _storage._payloadConfig != nil} + /// Clears the value of `payloadConfig`. Subsequent reads from it will return its default value. + mutating func clearPayloadConfig() {_uniqueStorage()._payloadConfig = nil} + + var histogramParams: Grpc_Testing_HistogramParams { + get {return _storage._histogramParams ?? Grpc_Testing_HistogramParams()} + set {_uniqueStorage()._histogramParams = newValue} + } + /// Returns true if `histogramParams` has been explicitly set. + var hasHistogramParams: Bool {return _storage._histogramParams != nil} + /// Clears the value of `histogramParams`. Subsequent reads from it will return its default value. + mutating func clearHistogramParams() {_uniqueStorage()._histogramParams = nil} + + /// Specify the cores we should run the client on, if desired + var coreList: [Int32] { + get {return _storage._coreList} + set {_uniqueStorage()._coreList = newValue} + } + + var coreLimit: Int32 { + get {return _storage._coreLimit} + set {_uniqueStorage()._coreLimit = newValue} + } + + /// If we use an OTHER_CLIENT client_type, this string gives more detail + var otherClientApi: String { + get {return _storage._otherClientApi} + set {_uniqueStorage()._otherClientApi = newValue} + } + + var channelArgs: [Grpc_Testing_ChannelArg] { + get {return _storage._channelArgs} + set {_uniqueStorage()._channelArgs = newValue} + } + + /// Number of threads that share each completion queue + var threadsPerCq: Int32 { + get {return _storage._threadsPerCq} + set {_uniqueStorage()._threadsPerCq = newValue} + } + + /// Number of messages on a stream before it gets finished/restarted + var messagesPerStream: Int32 { + get {return _storage._messagesPerStream} + set {_uniqueStorage()._messagesPerStream = newValue} + } + + /// Use coalescing API when possible. + var useCoalesceApi: Bool { + get {return _storage._useCoalesceApi} + set {_uniqueStorage()._useCoalesceApi = newValue} + } + + /// If 0, disabled. Else, specifies the period between gathering latency + /// medians in milliseconds. + var medianLatencyCollectionIntervalMillis: Int32 { + get {return _storage._medianLatencyCollectionIntervalMillis} + set {_uniqueStorage()._medianLatencyCollectionIntervalMillis = newValue} + } + + /// Number of client processes. 0 indicates no restriction. + var clientProcesses: Int32 { + get {return _storage._clientProcesses} + set {_uniqueStorage()._clientProcesses = newValue} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Grpc_Testing_ClientStatus { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var stats: Grpc_Testing_ClientStats { + get {return _stats ?? Grpc_Testing_ClientStats()} + set {_stats = newValue} + } + /// Returns true if `stats` has been explicitly set. + var hasStats: Bool {return self._stats != nil} + /// Clears the value of `stats`. Subsequent reads from it will return its default value. + mutating func clearStats() {self._stats = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _stats: Grpc_Testing_ClientStats? = nil +} + +/// Request current stats +struct Grpc_Testing_Mark { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// if true, the stats will be reset after taking their snapshot. + var reset: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_ClientArgs { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var argtype: Grpc_Testing_ClientArgs.OneOf_Argtype? = nil + + var setup: Grpc_Testing_ClientConfig { + get { + if case .setup(let v)? = argtype {return v} + return Grpc_Testing_ClientConfig() + } + set {argtype = .setup(newValue)} + } + + var mark: Grpc_Testing_Mark { + get { + if case .mark(let v)? = argtype {return v} + return Grpc_Testing_Mark() + } + set {argtype = .mark(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Argtype: Equatable { + case setup(Grpc_Testing_ClientConfig) + case mark(Grpc_Testing_Mark) + + #if !swift(>=4.1) + static func ==(lhs: Grpc_Testing_ClientArgs.OneOf_Argtype, rhs: Grpc_Testing_ClientArgs.OneOf_Argtype) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.setup, .setup): return { + guard case .setup(let l) = lhs, case .setup(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.mark, .mark): return { + guard case .mark(let l) = lhs, case .mark(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + +struct Grpc_Testing_ServerConfig { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var serverType: Grpc_Testing_ServerType = .syncServer + + var securityParams: Grpc_Testing_SecurityParams { + get {return _securityParams ?? Grpc_Testing_SecurityParams()} + set {_securityParams = newValue} + } + /// Returns true if `securityParams` has been explicitly set. + var hasSecurityParams: Bool {return self._securityParams != nil} + /// Clears the value of `securityParams`. Subsequent reads from it will return its default value. + mutating func clearSecurityParams() {self._securityParams = nil} + + /// Port on which to listen. Zero means pick unused port. + var port: Int32 = 0 + + /// Only for async server. Number of threads used to serve the requests. + var asyncServerThreads: Int32 = 0 + + /// Specify the number of cores to limit server to, if desired + var coreLimit: Int32 = 0 + + /// payload config, used in generic server. + /// Note this must NOT be used in proto (non-generic) servers. For proto servers, + /// 'response sizes' must be configured from the 'response_size' field of the + /// 'SimpleRequest' objects in RPC requests. + var payloadConfig: Grpc_Testing_PayloadConfig { + get {return _payloadConfig ?? Grpc_Testing_PayloadConfig()} + set {_payloadConfig = newValue} + } + /// Returns true if `payloadConfig` has been explicitly set. + var hasPayloadConfig: Bool {return self._payloadConfig != nil} + /// Clears the value of `payloadConfig`. Subsequent reads from it will return its default value. + mutating func clearPayloadConfig() {self._payloadConfig = nil} + + /// Specify the cores we should run the server on, if desired + var coreList: [Int32] = [] + + /// If we use an OTHER_SERVER client_type, this string gives more detail + var otherServerApi: String = String() + + /// Number of threads that share each completion queue + var threadsPerCq: Int32 = 0 + + /// Buffer pool size (no buffer pool specified if unset) + var resourceQuotaSize: Int32 = 0 + + var channelArgs: [Grpc_Testing_ChannelArg] = [] + + /// Number of server processes. 0 indicates no restriction. + var serverProcesses: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _securityParams: Grpc_Testing_SecurityParams? = nil + fileprivate var _payloadConfig: Grpc_Testing_PayloadConfig? = nil +} + +struct Grpc_Testing_ServerArgs { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var argtype: Grpc_Testing_ServerArgs.OneOf_Argtype? = nil + + var setup: Grpc_Testing_ServerConfig { + get { + if case .setup(let v)? = argtype {return v} + return Grpc_Testing_ServerConfig() + } + set {argtype = .setup(newValue)} + } + + var mark: Grpc_Testing_Mark { + get { + if case .mark(let v)? = argtype {return v} + return Grpc_Testing_Mark() + } + set {argtype = .mark(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Argtype: Equatable { + case setup(Grpc_Testing_ServerConfig) + case mark(Grpc_Testing_Mark) + + #if !swift(>=4.1) + static func ==(lhs: Grpc_Testing_ServerArgs.OneOf_Argtype, rhs: Grpc_Testing_ServerArgs.OneOf_Argtype) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.setup, .setup): return { + guard case .setup(let l) = lhs, case .setup(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.mark, .mark): return { + guard case .mark(let l) = lhs, case .mark(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + +struct Grpc_Testing_ServerStatus { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var stats: Grpc_Testing_ServerStats { + get {return _stats ?? Grpc_Testing_ServerStats()} + set {_stats = newValue} + } + /// Returns true if `stats` has been explicitly set. + var hasStats: Bool {return self._stats != nil} + /// Clears the value of `stats`. Subsequent reads from it will return its default value. + mutating func clearStats() {self._stats = nil} + + /// the port bound by the server + var port: Int32 = 0 + + /// Number of cores available to the server + var cores: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _stats: Grpc_Testing_ServerStats? = nil +} + +struct Grpc_Testing_CoreRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_CoreResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Number of cores available on the server + var cores: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_Void { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// A single performance scenario: input to qps_json_driver +struct Grpc_Testing_Scenario { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Human readable name for this scenario + var name: String { + get {return _storage._name} + set {_uniqueStorage()._name = newValue} + } + + /// Client configuration + var clientConfig: Grpc_Testing_ClientConfig { + get {return _storage._clientConfig ?? Grpc_Testing_ClientConfig()} + set {_uniqueStorage()._clientConfig = newValue} + } + /// Returns true if `clientConfig` has been explicitly set. + var hasClientConfig: Bool {return _storage._clientConfig != nil} + /// Clears the value of `clientConfig`. Subsequent reads from it will return its default value. + mutating func clearClientConfig() {_uniqueStorage()._clientConfig = nil} + + /// Number of clients to start for the test + var numClients: Int32 { + get {return _storage._numClients} + set {_uniqueStorage()._numClients = newValue} + } + + /// Server configuration + var serverConfig: Grpc_Testing_ServerConfig { + get {return _storage._serverConfig ?? Grpc_Testing_ServerConfig()} + set {_uniqueStorage()._serverConfig = newValue} + } + /// Returns true if `serverConfig` has been explicitly set. + var hasServerConfig: Bool {return _storage._serverConfig != nil} + /// Clears the value of `serverConfig`. Subsequent reads from it will return its default value. + mutating func clearServerConfig() {_uniqueStorage()._serverConfig = nil} + + /// Number of servers to start for the test + var numServers: Int32 { + get {return _storage._numServers} + set {_uniqueStorage()._numServers = newValue} + } + + /// Warmup period, in seconds + var warmupSeconds: Int32 { + get {return _storage._warmupSeconds} + set {_uniqueStorage()._warmupSeconds = newValue} + } + + /// Benchmark time, in seconds + var benchmarkSeconds: Int32 { + get {return _storage._benchmarkSeconds} + set {_uniqueStorage()._benchmarkSeconds = newValue} + } + + /// Number of workers to spawn locally (usually zero) + var spawnLocalWorkerCount: Int32 { + get {return _storage._spawnLocalWorkerCount} + set {_uniqueStorage()._spawnLocalWorkerCount = newValue} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +/// A set of scenarios to be run with qps_json_driver +struct Grpc_Testing_Scenarios { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var scenarios: [Grpc_Testing_Scenario] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Basic summary that can be computed from ClientStats and ServerStats +/// once the scenario has finished. +struct Grpc_Testing_ScenarioResultSummary { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: + /// For unary benchmarks, an operation is processing of a single unary RPC. + /// For streaming benchmarks, an operation is processing of a single ping pong of request and response. + var qps: Double { + get {return _storage._qps} + set {_uniqueStorage()._qps = newValue} + } + + /// QPS per server core. + var qpsPerServerCore: Double { + get {return _storage._qpsPerServerCore} + set {_uniqueStorage()._qpsPerServerCore = newValue} + } + + /// The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. + /// For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + /// processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + /// Same explanation for the total client cpu load below. + var serverSystemTime: Double { + get {return _storage._serverSystemTime} + set {_uniqueStorage()._serverSystemTime = newValue} + } + + /// The total server cpu load based on user time across all server processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + var serverUserTime: Double { + get {return _storage._serverUserTime} + set {_uniqueStorage()._serverUserTime = newValue} + } + + /// The total client cpu load based on system time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + var clientSystemTime: Double { + get {return _storage._clientSystemTime} + set {_uniqueStorage()._clientSystemTime = newValue} + } + + /// The total client cpu load based on user time across all client processes, expressed as percentage of a single cpu core. (85 => 85%, 125 => 125%) + var clientUserTime: Double { + get {return _storage._clientUserTime} + set {_uniqueStorage()._clientUserTime = newValue} + } + + /// X% latency percentiles (in nanoseconds) + var latency50: Double { + get {return _storage._latency50} + set {_uniqueStorage()._latency50 = newValue} + } + + var latency90: Double { + get {return _storage._latency90} + set {_uniqueStorage()._latency90 = newValue} + } + + var latency95: Double { + get {return _storage._latency95} + set {_uniqueStorage()._latency95 = newValue} + } + + var latency99: Double { + get {return _storage._latency99} + set {_uniqueStorage()._latency99 = newValue} + } + + var latency999: Double { + get {return _storage._latency999} + set {_uniqueStorage()._latency999 = newValue} + } + + /// server cpu usage percentage + var serverCpuUsage: Double { + get {return _storage._serverCpuUsage} + set {_uniqueStorage()._serverCpuUsage = newValue} + } + + /// Number of requests that succeeded/failed + var successfulRequestsPerSecond: Double { + get {return _storage._successfulRequestsPerSecond} + set {_uniqueStorage()._successfulRequestsPerSecond = newValue} + } + + var failedRequestsPerSecond: Double { + get {return _storage._failedRequestsPerSecond} + set {_uniqueStorage()._failedRequestsPerSecond = newValue} + } + + /// Number of polls called inside completion queue per request + var clientPollsPerRequest: Double { + get {return _storage._clientPollsPerRequest} + set {_uniqueStorage()._clientPollsPerRequest = newValue} + } + + var serverPollsPerRequest: Double { + get {return _storage._serverPollsPerRequest} + set {_uniqueStorage()._serverPollsPerRequest = newValue} + } + + /// Queries per CPU-sec over all servers or clients + var serverQueriesPerCpuSec: Double { + get {return _storage._serverQueriesPerCpuSec} + set {_uniqueStorage()._serverQueriesPerCpuSec = newValue} + } + + var clientQueriesPerCpuSec: Double { + get {return _storage._clientQueriesPerCpuSec} + set {_uniqueStorage()._clientQueriesPerCpuSec = newValue} + } + + /// Start and end time for the test scenario + var startTime: SwiftProtobuf.Google_Protobuf_Timestamp { + get {return _storage._startTime ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_uniqueStorage()._startTime = newValue} + } + /// Returns true if `startTime` has been explicitly set. + var hasStartTime: Bool {return _storage._startTime != nil} + /// Clears the value of `startTime`. Subsequent reads from it will return its default value. + mutating func clearStartTime() {_uniqueStorage()._startTime = nil} + + var endTime: SwiftProtobuf.Google_Protobuf_Timestamp { + get {return _storage._endTime ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_uniqueStorage()._endTime = newValue} + } + /// Returns true if `endTime` has been explicitly set. + var hasEndTime: Bool {return _storage._endTime != nil} + /// Clears the value of `endTime`. Subsequent reads from it will return its default value. + mutating func clearEndTime() {_uniqueStorage()._endTime = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +/// Results of a single benchmark scenario. +struct Grpc_Testing_ScenarioResult { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Inputs used to run the scenario. + var scenario: Grpc_Testing_Scenario { + get {return _scenario ?? Grpc_Testing_Scenario()} + set {_scenario = newValue} + } + /// Returns true if `scenario` has been explicitly set. + var hasScenario: Bool {return self._scenario != nil} + /// Clears the value of `scenario`. Subsequent reads from it will return its default value. + mutating func clearScenario() {self._scenario = nil} + + /// Histograms from all clients merged into one histogram. + var latencies: Grpc_Testing_HistogramData { + get {return _latencies ?? Grpc_Testing_HistogramData()} + set {_latencies = newValue} + } + /// Returns true if `latencies` has been explicitly set. + var hasLatencies: Bool {return self._latencies != nil} + /// Clears the value of `latencies`. Subsequent reads from it will return its default value. + mutating func clearLatencies() {self._latencies = nil} + + /// Client stats for each client + var clientStats: [Grpc_Testing_ClientStats] = [] + + /// Server stats for each server + var serverStats: [Grpc_Testing_ServerStats] = [] + + /// Number of cores available to each server + var serverCores: [Int32] = [] + + /// An after-the-fact computed summary + var summary: Grpc_Testing_ScenarioResultSummary { + get {return _summary ?? Grpc_Testing_ScenarioResultSummary()} + set {_summary = newValue} + } + /// Returns true if `summary` has been explicitly set. + var hasSummary: Bool {return self._summary != nil} + /// Clears the value of `summary`. Subsequent reads from it will return its default value. + mutating func clearSummary() {self._summary = nil} + + /// Information on success or failure of each worker + var clientSuccess: [Bool] = [] + + var serverSuccess: [Bool] = [] + + /// Number of failed requests (one row per status code seen) + var requestResults: [Grpc_Testing_RequestResultCount] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _scenario: Grpc_Testing_Scenario? = nil + fileprivate var _latencies: Grpc_Testing_HistogramData? = nil + fileprivate var _summary: Grpc_Testing_ScenarioResultSummary? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Grpc_Testing_ClientType: @unchecked Sendable {} +extension Grpc_Testing_ServerType: @unchecked Sendable {} +extension Grpc_Testing_RpcType: @unchecked Sendable {} +extension Grpc_Testing_PoissonParams: @unchecked Sendable {} +extension Grpc_Testing_ClosedLoopParams: @unchecked Sendable {} +extension Grpc_Testing_LoadParams: @unchecked Sendable {} +extension Grpc_Testing_LoadParams.OneOf_Load: @unchecked Sendable {} +extension Grpc_Testing_SecurityParams: @unchecked Sendable {} +extension Grpc_Testing_ChannelArg: @unchecked Sendable {} +extension Grpc_Testing_ChannelArg.OneOf_Value: @unchecked Sendable {} +extension Grpc_Testing_ClientConfig: @unchecked Sendable {} +extension Grpc_Testing_ClientStatus: @unchecked Sendable {} +extension Grpc_Testing_Mark: @unchecked Sendable {} +extension Grpc_Testing_ClientArgs: @unchecked Sendable {} +extension Grpc_Testing_ClientArgs.OneOf_Argtype: @unchecked Sendable {} +extension Grpc_Testing_ServerConfig: @unchecked Sendable {} +extension Grpc_Testing_ServerArgs: @unchecked Sendable {} +extension Grpc_Testing_ServerArgs.OneOf_Argtype: @unchecked Sendable {} +extension Grpc_Testing_ServerStatus: @unchecked Sendable {} +extension Grpc_Testing_CoreRequest: @unchecked Sendable {} +extension Grpc_Testing_CoreResponse: @unchecked Sendable {} +extension Grpc_Testing_Void: @unchecked Sendable {} +extension Grpc_Testing_Scenario: @unchecked Sendable {} +extension Grpc_Testing_Scenarios: @unchecked Sendable {} +extension Grpc_Testing_ScenarioResultSummary: @unchecked Sendable {} +extension Grpc_Testing_ScenarioResult: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "grpc.testing" + +extension Grpc_Testing_ClientType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "SYNC_CLIENT"), + 1: .same(proto: "ASYNC_CLIENT"), + 2: .same(proto: "OTHER_CLIENT"), + 3: .same(proto: "CALLBACK_CLIENT"), + ] +} + +extension Grpc_Testing_ServerType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "SYNC_SERVER"), + 1: .same(proto: "ASYNC_SERVER"), + 2: .same(proto: "ASYNC_GENERIC_SERVER"), + 3: .same(proto: "OTHER_SERVER"), + 4: .same(proto: "CALLBACK_SERVER"), + ] +} + +extension Grpc_Testing_RpcType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNARY"), + 1: .same(proto: "STREAMING"), + 2: .same(proto: "STREAMING_FROM_CLIENT"), + 3: .same(proto: "STREAMING_FROM_SERVER"), + 4: .same(proto: "STREAMING_BOTH_WAYS"), + ] +} + +extension Grpc_Testing_PoissonParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PoissonParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "offered_load"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &self.offeredLoad) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.offeredLoad != 0 { + try visitor.visitSingularDoubleField(value: self.offeredLoad, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_PoissonParams, rhs: Grpc_Testing_PoissonParams) -> Bool { + if lhs.offeredLoad != rhs.offeredLoad {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClosedLoopParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClosedLoopParams" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClosedLoopParams, rhs: Grpc_Testing_ClosedLoopParams) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LoadParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "closed_loop"), + 2: .same(proto: "poisson"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { + var v: Grpc_Testing_ClosedLoopParams? + var hadOneofValue = false + if let current = self.load { + hadOneofValue = true + if case .closedLoop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.load = .closedLoop(v) + } + }() + case 2: try { + var v: Grpc_Testing_PoissonParams? + var hadOneofValue = false + if let current = self.load { + hadOneofValue = true + if case .poisson(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.load = .poisson(v) + } + }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + switch self.load { + case .closedLoop?: try { + guard case .closedLoop(let v)? = self.load else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .poisson?: try { + guard case .poisson(let v)? = self.load else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadParams, rhs: Grpc_Testing_LoadParams) -> Bool { + if lhs.load != rhs.load {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_SecurityParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SecurityParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "use_test_ca"), + 2: .standard(proto: "server_host_override"), + 3: .standard(proto: "cred_type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self.useTestCa) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.serverHostOverride) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.credType) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.useTestCa != false { + try visitor.visitSingularBoolField(value: self.useTestCa, fieldNumber: 1) + } + if !self.serverHostOverride.isEmpty { + try visitor.visitSingularStringField(value: self.serverHostOverride, fieldNumber: 2) + } + if !self.credType.isEmpty { + try visitor.visitSingularStringField(value: self.credType, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_SecurityParams, rhs: Grpc_Testing_SecurityParams) -> Bool { + if lhs.useTestCa != rhs.useTestCa {return false} + if lhs.serverHostOverride != rhs.serverHostOverride {return false} + if lhs.credType != rhs.credType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ChannelArg: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelArg" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .standard(proto: "str_value"), + 3: .standard(proto: "int_value"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { + var v: String? + try decoder.decodeSingularStringField(value: &v) + if let v = v { + if self.value != nil {try decoder.handleConflictingOneOf()} + self.value = .strValue(v) + } + }() + case 3: try { + var v: Int32? + try decoder.decodeSingularInt32Field(value: &v) + if let v = v { + if self.value != nil {try decoder.handleConflictingOneOf()} + self.value = .intValue(v) + } + }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + switch self.value { + case .strValue?: try { + guard case .strValue(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + }() + case .intValue?: try { + guard case .intValue(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ChannelArg, rhs: Grpc_Testing_ChannelArg) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClientConfig" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "server_targets"), + 2: .standard(proto: "client_type"), + 3: .standard(proto: "security_params"), + 4: .standard(proto: "outstanding_rpcs_per_channel"), + 5: .standard(proto: "client_channels"), + 7: .standard(proto: "async_client_threads"), + 8: .standard(proto: "rpc_type"), + 10: .standard(proto: "load_params"), + 11: .standard(proto: "payload_config"), + 12: .standard(proto: "histogram_params"), + 13: .standard(proto: "core_list"), + 14: .standard(proto: "core_limit"), + 15: .standard(proto: "other_client_api"), + 16: .standard(proto: "channel_args"), + 17: .standard(proto: "threads_per_cq"), + 18: .standard(proto: "messages_per_stream"), + 19: .standard(proto: "use_coalesce_api"), + 20: .standard(proto: "median_latency_collection_interval_millis"), + 21: .standard(proto: "client_processes"), + ] + + fileprivate class _StorageClass { + var _serverTargets: [String] = [] + var _clientType: Grpc_Testing_ClientType = .syncClient + var _securityParams: Grpc_Testing_SecurityParams? = nil + var _outstandingRpcsPerChannel: Int32 = 0 + var _clientChannels: Int32 = 0 + var _asyncClientThreads: Int32 = 0 + var _rpcType: Grpc_Testing_RpcType = .unary + var _loadParams: Grpc_Testing_LoadParams? = nil + var _payloadConfig: Grpc_Testing_PayloadConfig? = nil + var _histogramParams: Grpc_Testing_HistogramParams? = nil + var _coreList: [Int32] = [] + var _coreLimit: Int32 = 0 + var _otherClientApi: String = String() + var _channelArgs: [Grpc_Testing_ChannelArg] = [] + var _threadsPerCq: Int32 = 0 + var _messagesPerStream: Int32 = 0 + var _useCoalesceApi: Bool = false + var _medianLatencyCollectionIntervalMillis: Int32 = 0 + var _clientProcesses: Int32 = 0 + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _serverTargets = source._serverTargets + _clientType = source._clientType + _securityParams = source._securityParams + _outstandingRpcsPerChannel = source._outstandingRpcsPerChannel + _clientChannels = source._clientChannels + _asyncClientThreads = source._asyncClientThreads + _rpcType = source._rpcType + _loadParams = source._loadParams + _payloadConfig = source._payloadConfig + _histogramParams = source._histogramParams + _coreList = source._coreList + _coreLimit = source._coreLimit + _otherClientApi = source._otherClientApi + _channelArgs = source._channelArgs + _threadsPerCq = source._threadsPerCq + _messagesPerStream = source._messagesPerStream + _useCoalesceApi = source._useCoalesceApi + _medianLatencyCollectionIntervalMillis = source._medianLatencyCollectionIntervalMillis + _clientProcesses = source._clientProcesses + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedStringField(value: &_storage._serverTargets) }() + case 2: try { try decoder.decodeSingularEnumField(value: &_storage._clientType) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._securityParams) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &_storage._outstandingRpcsPerChannel) }() + case 5: try { try decoder.decodeSingularInt32Field(value: &_storage._clientChannels) }() + case 7: try { try decoder.decodeSingularInt32Field(value: &_storage._asyncClientThreads) }() + case 8: try { try decoder.decodeSingularEnumField(value: &_storage._rpcType) }() + case 10: try { try decoder.decodeSingularMessageField(value: &_storage._loadParams) }() + case 11: try { try decoder.decodeSingularMessageField(value: &_storage._payloadConfig) }() + case 12: try { try decoder.decodeSingularMessageField(value: &_storage._histogramParams) }() + case 13: try { try decoder.decodeRepeatedInt32Field(value: &_storage._coreList) }() + case 14: try { try decoder.decodeSingularInt32Field(value: &_storage._coreLimit) }() + case 15: try { try decoder.decodeSingularStringField(value: &_storage._otherClientApi) }() + case 16: try { try decoder.decodeRepeatedMessageField(value: &_storage._channelArgs) }() + case 17: try { try decoder.decodeSingularInt32Field(value: &_storage._threadsPerCq) }() + case 18: try { try decoder.decodeSingularInt32Field(value: &_storage._messagesPerStream) }() + case 19: try { try decoder.decodeSingularBoolField(value: &_storage._useCoalesceApi) }() + case 20: try { try decoder.decodeSingularInt32Field(value: &_storage._medianLatencyCollectionIntervalMillis) }() + case 21: try { try decoder.decodeSingularInt32Field(value: &_storage._clientProcesses) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !_storage._serverTargets.isEmpty { + try visitor.visitRepeatedStringField(value: _storage._serverTargets, fieldNumber: 1) + } + if _storage._clientType != .syncClient { + try visitor.visitSingularEnumField(value: _storage._clientType, fieldNumber: 2) + } + try { if let v = _storage._securityParams { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + if _storage._outstandingRpcsPerChannel != 0 { + try visitor.visitSingularInt32Field(value: _storage._outstandingRpcsPerChannel, fieldNumber: 4) + } + if _storage._clientChannels != 0 { + try visitor.visitSingularInt32Field(value: _storage._clientChannels, fieldNumber: 5) + } + if _storage._asyncClientThreads != 0 { + try visitor.visitSingularInt32Field(value: _storage._asyncClientThreads, fieldNumber: 7) + } + if _storage._rpcType != .unary { + try visitor.visitSingularEnumField(value: _storage._rpcType, fieldNumber: 8) + } + try { if let v = _storage._loadParams { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } }() + try { if let v = _storage._payloadConfig { + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + } }() + try { if let v = _storage._histogramParams { + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + } }() + if !_storage._coreList.isEmpty { + try visitor.visitPackedInt32Field(value: _storage._coreList, fieldNumber: 13) + } + if _storage._coreLimit != 0 { + try visitor.visitSingularInt32Field(value: _storage._coreLimit, fieldNumber: 14) + } + if !_storage._otherClientApi.isEmpty { + try visitor.visitSingularStringField(value: _storage._otherClientApi, fieldNumber: 15) + } + if !_storage._channelArgs.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._channelArgs, fieldNumber: 16) + } + if _storage._threadsPerCq != 0 { + try visitor.visitSingularInt32Field(value: _storage._threadsPerCq, fieldNumber: 17) + } + if _storage._messagesPerStream != 0 { + try visitor.visitSingularInt32Field(value: _storage._messagesPerStream, fieldNumber: 18) + } + if _storage._useCoalesceApi != false { + try visitor.visitSingularBoolField(value: _storage._useCoalesceApi, fieldNumber: 19) + } + if _storage._medianLatencyCollectionIntervalMillis != 0 { + try visitor.visitSingularInt32Field(value: _storage._medianLatencyCollectionIntervalMillis, fieldNumber: 20) + } + if _storage._clientProcesses != 0 { + try visitor.visitSingularInt32Field(value: _storage._clientProcesses, fieldNumber: 21) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientConfig, rhs: Grpc_Testing_ClientConfig) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._serverTargets != rhs_storage._serverTargets {return false} + if _storage._clientType != rhs_storage._clientType {return false} + if _storage._securityParams != rhs_storage._securityParams {return false} + if _storage._outstandingRpcsPerChannel != rhs_storage._outstandingRpcsPerChannel {return false} + if _storage._clientChannels != rhs_storage._clientChannels {return false} + if _storage._asyncClientThreads != rhs_storage._asyncClientThreads {return false} + if _storage._rpcType != rhs_storage._rpcType {return false} + if _storage._loadParams != rhs_storage._loadParams {return false} + if _storage._payloadConfig != rhs_storage._payloadConfig {return false} + if _storage._histogramParams != rhs_storage._histogramParams {return false} + if _storage._coreList != rhs_storage._coreList {return false} + if _storage._coreLimit != rhs_storage._coreLimit {return false} + if _storage._otherClientApi != rhs_storage._otherClientApi {return false} + if _storage._channelArgs != rhs_storage._channelArgs {return false} + if _storage._threadsPerCq != rhs_storage._threadsPerCq {return false} + if _storage._messagesPerStream != rhs_storage._messagesPerStream {return false} + if _storage._useCoalesceApi != rhs_storage._useCoalesceApi {return false} + if _storage._medianLatencyCollectionIntervalMillis != rhs_storage._medianLatencyCollectionIntervalMillis {return false} + if _storage._clientProcesses != rhs_storage._clientProcesses {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClientStatus" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "stats"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._stats) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._stats { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientStatus, rhs: Grpc_Testing_ClientStatus) -> Bool { + if lhs._stats != rhs._stats {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_Mark: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Mark" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "reset"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self.reset) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.reset != false { + try visitor.visitSingularBoolField(value: self.reset, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_Mark, rhs: Grpc_Testing_Mark) -> Bool { + if lhs.reset != rhs.reset {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientArgs: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClientArgs" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "setup"), + 2: .same(proto: "mark"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { + var v: Grpc_Testing_ClientConfig? + var hadOneofValue = false + if let current = self.argtype { + hadOneofValue = true + if case .setup(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.argtype = .setup(v) + } + }() + case 2: try { + var v: Grpc_Testing_Mark? + var hadOneofValue = false + if let current = self.argtype { + hadOneofValue = true + if case .mark(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.argtype = .mark(v) + } + }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + switch self.argtype { + case .setup?: try { + guard case .setup(let v)? = self.argtype else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .mark?: try { + guard case .mark(let v)? = self.argtype else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientArgs, rhs: Grpc_Testing_ClientArgs) -> Bool { + if lhs.argtype != rhs.argtype {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ServerConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ServerConfig" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "server_type"), + 2: .standard(proto: "security_params"), + 4: .same(proto: "port"), + 7: .standard(proto: "async_server_threads"), + 8: .standard(proto: "core_limit"), + 9: .standard(proto: "payload_config"), + 10: .standard(proto: "core_list"), + 11: .standard(proto: "other_server_api"), + 12: .standard(proto: "threads_per_cq"), + 1001: .standard(proto: "resource_quota_size"), + 1002: .standard(proto: "channel_args"), + 21: .standard(proto: "server_processes"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.serverType) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._securityParams) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self.port) }() + case 7: try { try decoder.decodeSingularInt32Field(value: &self.asyncServerThreads) }() + case 8: try { try decoder.decodeSingularInt32Field(value: &self.coreLimit) }() + case 9: try { try decoder.decodeSingularMessageField(value: &self._payloadConfig) }() + case 10: try { try decoder.decodeRepeatedInt32Field(value: &self.coreList) }() + case 11: try { try decoder.decodeSingularStringField(value: &self.otherServerApi) }() + case 12: try { try decoder.decodeSingularInt32Field(value: &self.threadsPerCq) }() + case 21: try { try decoder.decodeSingularInt32Field(value: &self.serverProcesses) }() + case 1001: try { try decoder.decodeSingularInt32Field(value: &self.resourceQuotaSize) }() + case 1002: try { try decoder.decodeRepeatedMessageField(value: &self.channelArgs) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if self.serverType != .syncServer { + try visitor.visitSingularEnumField(value: self.serverType, fieldNumber: 1) + } + try { if let v = self._securityParams { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if self.port != 0 { + try visitor.visitSingularInt32Field(value: self.port, fieldNumber: 4) + } + if self.asyncServerThreads != 0 { + try visitor.visitSingularInt32Field(value: self.asyncServerThreads, fieldNumber: 7) + } + if self.coreLimit != 0 { + try visitor.visitSingularInt32Field(value: self.coreLimit, fieldNumber: 8) + } + try { if let v = self._payloadConfig { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + if !self.coreList.isEmpty { + try visitor.visitPackedInt32Field(value: self.coreList, fieldNumber: 10) + } + if !self.otherServerApi.isEmpty { + try visitor.visitSingularStringField(value: self.otherServerApi, fieldNumber: 11) + } + if self.threadsPerCq != 0 { + try visitor.visitSingularInt32Field(value: self.threadsPerCq, fieldNumber: 12) + } + if self.serverProcesses != 0 { + try visitor.visitSingularInt32Field(value: self.serverProcesses, fieldNumber: 21) + } + if self.resourceQuotaSize != 0 { + try visitor.visitSingularInt32Field(value: self.resourceQuotaSize, fieldNumber: 1001) + } + if !self.channelArgs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.channelArgs, fieldNumber: 1002) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ServerConfig, rhs: Grpc_Testing_ServerConfig) -> Bool { + if lhs.serverType != rhs.serverType {return false} + if lhs._securityParams != rhs._securityParams {return false} + if lhs.port != rhs.port {return false} + if lhs.asyncServerThreads != rhs.asyncServerThreads {return false} + if lhs.coreLimit != rhs.coreLimit {return false} + if lhs._payloadConfig != rhs._payloadConfig {return false} + if lhs.coreList != rhs.coreList {return false} + if lhs.otherServerApi != rhs.otherServerApi {return false} + if lhs.threadsPerCq != rhs.threadsPerCq {return false} + if lhs.resourceQuotaSize != rhs.resourceQuotaSize {return false} + if lhs.channelArgs != rhs.channelArgs {return false} + if lhs.serverProcesses != rhs.serverProcesses {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ServerArgs: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ServerArgs" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "setup"), + 2: .same(proto: "mark"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { + var v: Grpc_Testing_ServerConfig? + var hadOneofValue = false + if let current = self.argtype { + hadOneofValue = true + if case .setup(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.argtype = .setup(v) + } + }() + case 2: try { + var v: Grpc_Testing_Mark? + var hadOneofValue = false + if let current = self.argtype { + hadOneofValue = true + if case .mark(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.argtype = .mark(v) + } + }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + switch self.argtype { + case .setup?: try { + guard case .setup(let v)? = self.argtype else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .mark?: try { + guard case .mark(let v)? = self.argtype else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ServerArgs, rhs: Grpc_Testing_ServerArgs) -> Bool { + if lhs.argtype != rhs.argtype {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ServerStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ServerStatus" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "stats"), + 2: .same(proto: "port"), + 3: .same(proto: "cores"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._stats) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.port) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self.cores) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._stats { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.port != 0 { + try visitor.visitSingularInt32Field(value: self.port, fieldNumber: 2) + } + if self.cores != 0 { + try visitor.visitSingularInt32Field(value: self.cores, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ServerStatus, rhs: Grpc_Testing_ServerStatus) -> Bool { + if lhs._stats != rhs._stats {return false} + if lhs.port != rhs.port {return false} + if lhs.cores != rhs.cores {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_CoreRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CoreRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_CoreRequest, rhs: Grpc_Testing_CoreRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_CoreResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CoreResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "cores"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.cores) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.cores != 0 { + try visitor.visitSingularInt32Field(value: self.cores, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_CoreResponse, rhs: Grpc_Testing_CoreResponse) -> Bool { + if lhs.cores != rhs.cores {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_Void: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Void" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_Void, rhs: Grpc_Testing_Void) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_Scenario: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Scenario" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .standard(proto: "client_config"), + 3: .standard(proto: "num_clients"), + 4: .standard(proto: "server_config"), + 5: .standard(proto: "num_servers"), + 6: .standard(proto: "warmup_seconds"), + 7: .standard(proto: "benchmark_seconds"), + 8: .standard(proto: "spawn_local_worker_count"), + ] + + fileprivate class _StorageClass { + var _name: String = String() + var _clientConfig: Grpc_Testing_ClientConfig? = nil + var _numClients: Int32 = 0 + var _serverConfig: Grpc_Testing_ServerConfig? = nil + var _numServers: Int32 = 0 + var _warmupSeconds: Int32 = 0 + var _benchmarkSeconds: Int32 = 0 + var _spawnLocalWorkerCount: Int32 = 0 + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _name = source._name + _clientConfig = source._clientConfig + _numClients = source._numClients + _serverConfig = source._serverConfig + _numServers = source._numServers + _warmupSeconds = source._warmupSeconds + _benchmarkSeconds = source._benchmarkSeconds + _spawnLocalWorkerCount = source._spawnLocalWorkerCount + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &_storage._name) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._clientConfig) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &_storage._numClients) }() + case 4: try { try decoder.decodeSingularMessageField(value: &_storage._serverConfig) }() + case 5: try { try decoder.decodeSingularInt32Field(value: &_storage._numServers) }() + case 6: try { try decoder.decodeSingularInt32Field(value: &_storage._warmupSeconds) }() + case 7: try { try decoder.decodeSingularInt32Field(value: &_storage._benchmarkSeconds) }() + case 8: try { try decoder.decodeSingularInt32Field(value: &_storage._spawnLocalWorkerCount) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !_storage._name.isEmpty { + try visitor.visitSingularStringField(value: _storage._name, fieldNumber: 1) + } + try { if let v = _storage._clientConfig { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if _storage._numClients != 0 { + try visitor.visitSingularInt32Field(value: _storage._numClients, fieldNumber: 3) + } + try { if let v = _storage._serverConfig { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + if _storage._numServers != 0 { + try visitor.visitSingularInt32Field(value: _storage._numServers, fieldNumber: 5) + } + if _storage._warmupSeconds != 0 { + try visitor.visitSingularInt32Field(value: _storage._warmupSeconds, fieldNumber: 6) + } + if _storage._benchmarkSeconds != 0 { + try visitor.visitSingularInt32Field(value: _storage._benchmarkSeconds, fieldNumber: 7) + } + if _storage._spawnLocalWorkerCount != 0 { + try visitor.visitSingularInt32Field(value: _storage._spawnLocalWorkerCount, fieldNumber: 8) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_Scenario, rhs: Grpc_Testing_Scenario) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._name != rhs_storage._name {return false} + if _storage._clientConfig != rhs_storage._clientConfig {return false} + if _storage._numClients != rhs_storage._numClients {return false} + if _storage._serverConfig != rhs_storage._serverConfig {return false} + if _storage._numServers != rhs_storage._numServers {return false} + if _storage._warmupSeconds != rhs_storage._warmupSeconds {return false} + if _storage._benchmarkSeconds != rhs_storage._benchmarkSeconds {return false} + if _storage._spawnLocalWorkerCount != rhs_storage._spawnLocalWorkerCount {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_Scenarios: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Scenarios" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "scenarios"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.scenarios) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.scenarios.isEmpty { + try visitor.visitRepeatedMessageField(value: self.scenarios, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_Scenarios, rhs: Grpc_Testing_Scenarios) -> Bool { + if lhs.scenarios != rhs.scenarios {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ScenarioResultSummary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ScenarioResultSummary" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "qps"), + 2: .standard(proto: "qps_per_server_core"), + 3: .standard(proto: "server_system_time"), + 4: .standard(proto: "server_user_time"), + 5: .standard(proto: "client_system_time"), + 6: .standard(proto: "client_user_time"), + 7: .standard(proto: "latency_50"), + 8: .standard(proto: "latency_90"), + 9: .standard(proto: "latency_95"), + 10: .standard(proto: "latency_99"), + 11: .standard(proto: "latency_999"), + 12: .standard(proto: "server_cpu_usage"), + 13: .standard(proto: "successful_requests_per_second"), + 14: .standard(proto: "failed_requests_per_second"), + 15: .standard(proto: "client_polls_per_request"), + 16: .standard(proto: "server_polls_per_request"), + 17: .standard(proto: "server_queries_per_cpu_sec"), + 18: .standard(proto: "client_queries_per_cpu_sec"), + 19: .standard(proto: "start_time"), + 20: .standard(proto: "end_time"), + ] + + fileprivate class _StorageClass { + var _qps: Double = 0 + var _qpsPerServerCore: Double = 0 + var _serverSystemTime: Double = 0 + var _serverUserTime: Double = 0 + var _clientSystemTime: Double = 0 + var _clientUserTime: Double = 0 + var _latency50: Double = 0 + var _latency90: Double = 0 + var _latency95: Double = 0 + var _latency99: Double = 0 + var _latency999: Double = 0 + var _serverCpuUsage: Double = 0 + var _successfulRequestsPerSecond: Double = 0 + var _failedRequestsPerSecond: Double = 0 + var _clientPollsPerRequest: Double = 0 + var _serverPollsPerRequest: Double = 0 + var _serverQueriesPerCpuSec: Double = 0 + var _clientQueriesPerCpuSec: Double = 0 + var _startTime: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + var _endTime: SwiftProtobuf.Google_Protobuf_Timestamp? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _qps = source._qps + _qpsPerServerCore = source._qpsPerServerCore + _serverSystemTime = source._serverSystemTime + _serverUserTime = source._serverUserTime + _clientSystemTime = source._clientSystemTime + _clientUserTime = source._clientUserTime + _latency50 = source._latency50 + _latency90 = source._latency90 + _latency95 = source._latency95 + _latency99 = source._latency99 + _latency999 = source._latency999 + _serverCpuUsage = source._serverCpuUsage + _successfulRequestsPerSecond = source._successfulRequestsPerSecond + _failedRequestsPerSecond = source._failedRequestsPerSecond + _clientPollsPerRequest = source._clientPollsPerRequest + _serverPollsPerRequest = source._serverPollsPerRequest + _serverQueriesPerCpuSec = source._serverQueriesPerCpuSec + _clientQueriesPerCpuSec = source._clientQueriesPerCpuSec + _startTime = source._startTime + _endTime = source._endTime + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &_storage._qps) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &_storage._qpsPerServerCore) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &_storage._serverSystemTime) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &_storage._serverUserTime) }() + case 5: try { try decoder.decodeSingularDoubleField(value: &_storage._clientSystemTime) }() + case 6: try { try decoder.decodeSingularDoubleField(value: &_storage._clientUserTime) }() + case 7: try { try decoder.decodeSingularDoubleField(value: &_storage._latency50) }() + case 8: try { try decoder.decodeSingularDoubleField(value: &_storage._latency90) }() + case 9: try { try decoder.decodeSingularDoubleField(value: &_storage._latency95) }() + case 10: try { try decoder.decodeSingularDoubleField(value: &_storage._latency99) }() + case 11: try { try decoder.decodeSingularDoubleField(value: &_storage._latency999) }() + case 12: try { try decoder.decodeSingularDoubleField(value: &_storage._serverCpuUsage) }() + case 13: try { try decoder.decodeSingularDoubleField(value: &_storage._successfulRequestsPerSecond) }() + case 14: try { try decoder.decodeSingularDoubleField(value: &_storage._failedRequestsPerSecond) }() + case 15: try { try decoder.decodeSingularDoubleField(value: &_storage._clientPollsPerRequest) }() + case 16: try { try decoder.decodeSingularDoubleField(value: &_storage._serverPollsPerRequest) }() + case 17: try { try decoder.decodeSingularDoubleField(value: &_storage._serverQueriesPerCpuSec) }() + case 18: try { try decoder.decodeSingularDoubleField(value: &_storage._clientQueriesPerCpuSec) }() + case 19: try { try decoder.decodeSingularMessageField(value: &_storage._startTime) }() + case 20: try { try decoder.decodeSingularMessageField(value: &_storage._endTime) }() + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if _storage._qps != 0 { + try visitor.visitSingularDoubleField(value: _storage._qps, fieldNumber: 1) + } + if _storage._qpsPerServerCore != 0 { + try visitor.visitSingularDoubleField(value: _storage._qpsPerServerCore, fieldNumber: 2) + } + if _storage._serverSystemTime != 0 { + try visitor.visitSingularDoubleField(value: _storage._serverSystemTime, fieldNumber: 3) + } + if _storage._serverUserTime != 0 { + try visitor.visitSingularDoubleField(value: _storage._serverUserTime, fieldNumber: 4) + } + if _storage._clientSystemTime != 0 { + try visitor.visitSingularDoubleField(value: _storage._clientSystemTime, fieldNumber: 5) + } + if _storage._clientUserTime != 0 { + try visitor.visitSingularDoubleField(value: _storage._clientUserTime, fieldNumber: 6) + } + if _storage._latency50 != 0 { + try visitor.visitSingularDoubleField(value: _storage._latency50, fieldNumber: 7) + } + if _storage._latency90 != 0 { + try visitor.visitSingularDoubleField(value: _storage._latency90, fieldNumber: 8) + } + if _storage._latency95 != 0 { + try visitor.visitSingularDoubleField(value: _storage._latency95, fieldNumber: 9) + } + if _storage._latency99 != 0 { + try visitor.visitSingularDoubleField(value: _storage._latency99, fieldNumber: 10) + } + if _storage._latency999 != 0 { + try visitor.visitSingularDoubleField(value: _storage._latency999, fieldNumber: 11) + } + if _storage._serverCpuUsage != 0 { + try visitor.visitSingularDoubleField(value: _storage._serverCpuUsage, fieldNumber: 12) + } + if _storage._successfulRequestsPerSecond != 0 { + try visitor.visitSingularDoubleField(value: _storage._successfulRequestsPerSecond, fieldNumber: 13) + } + if _storage._failedRequestsPerSecond != 0 { + try visitor.visitSingularDoubleField(value: _storage._failedRequestsPerSecond, fieldNumber: 14) + } + if _storage._clientPollsPerRequest != 0 { + try visitor.visitSingularDoubleField(value: _storage._clientPollsPerRequest, fieldNumber: 15) + } + if _storage._serverPollsPerRequest != 0 { + try visitor.visitSingularDoubleField(value: _storage._serverPollsPerRequest, fieldNumber: 16) + } + if _storage._serverQueriesPerCpuSec != 0 { + try visitor.visitSingularDoubleField(value: _storage._serverQueriesPerCpuSec, fieldNumber: 17) + } + if _storage._clientQueriesPerCpuSec != 0 { + try visitor.visitSingularDoubleField(value: _storage._clientQueriesPerCpuSec, fieldNumber: 18) + } + try { if let v = _storage._startTime { + try visitor.visitSingularMessageField(value: v, fieldNumber: 19) + } }() + try { if let v = _storage._endTime { + try visitor.visitSingularMessageField(value: v, fieldNumber: 20) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ScenarioResultSummary, rhs: Grpc_Testing_ScenarioResultSummary) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._qps != rhs_storage._qps {return false} + if _storage._qpsPerServerCore != rhs_storage._qpsPerServerCore {return false} + if _storage._serverSystemTime != rhs_storage._serverSystemTime {return false} + if _storage._serverUserTime != rhs_storage._serverUserTime {return false} + if _storage._clientSystemTime != rhs_storage._clientSystemTime {return false} + if _storage._clientUserTime != rhs_storage._clientUserTime {return false} + if _storage._latency50 != rhs_storage._latency50 {return false} + if _storage._latency90 != rhs_storage._latency90 {return false} + if _storage._latency95 != rhs_storage._latency95 {return false} + if _storage._latency99 != rhs_storage._latency99 {return false} + if _storage._latency999 != rhs_storage._latency999 {return false} + if _storage._serverCpuUsage != rhs_storage._serverCpuUsage {return false} + if _storage._successfulRequestsPerSecond != rhs_storage._successfulRequestsPerSecond {return false} + if _storage._failedRequestsPerSecond != rhs_storage._failedRequestsPerSecond {return false} + if _storage._clientPollsPerRequest != rhs_storage._clientPollsPerRequest {return false} + if _storage._serverPollsPerRequest != rhs_storage._serverPollsPerRequest {return false} + if _storage._serverQueriesPerCpuSec != rhs_storage._serverQueriesPerCpuSec {return false} + if _storage._clientQueriesPerCpuSec != rhs_storage._clientQueriesPerCpuSec {return false} + if _storage._startTime != rhs_storage._startTime {return false} + if _storage._endTime != rhs_storage._endTime {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ScenarioResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ScenarioResult" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "scenario"), + 2: .same(proto: "latencies"), + 3: .standard(proto: "client_stats"), + 4: .standard(proto: "server_stats"), + 5: .standard(proto: "server_cores"), + 6: .same(proto: "summary"), + 7: .standard(proto: "client_success"), + 8: .standard(proto: "server_success"), + 9: .standard(proto: "request_results"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._scenario) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._latencies) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.clientStats) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.serverStats) }() + case 5: try { try decoder.decodeRepeatedInt32Field(value: &self.serverCores) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._summary) }() + case 7: try { try decoder.decodeRepeatedBoolField(value: &self.clientSuccess) }() + case 8: try { try decoder.decodeRepeatedBoolField(value: &self.serverSuccess) }() + case 9: try { try decoder.decodeRepeatedMessageField(value: &self.requestResults) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._scenario { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._latencies { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if !self.clientStats.isEmpty { + try visitor.visitRepeatedMessageField(value: self.clientStats, fieldNumber: 3) + } + if !self.serverStats.isEmpty { + try visitor.visitRepeatedMessageField(value: self.serverStats, fieldNumber: 4) + } + if !self.serverCores.isEmpty { + try visitor.visitPackedInt32Field(value: self.serverCores, fieldNumber: 5) + } + try { if let v = self._summary { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + if !self.clientSuccess.isEmpty { + try visitor.visitPackedBoolField(value: self.clientSuccess, fieldNumber: 7) + } + if !self.serverSuccess.isEmpty { + try visitor.visitPackedBoolField(value: self.serverSuccess, fieldNumber: 8) + } + if !self.requestResults.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requestResults, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ScenarioResult, rhs: Grpc_Testing_ScenarioResult) -> Bool { + if lhs._scenario != rhs._scenario {return false} + if lhs._latencies != rhs._latencies {return false} + if lhs.clientStats != rhs.clientStats {return false} + if lhs.serverStats != rhs.serverStats {return false} + if lhs.serverCores != rhs.serverCores {return false} + if lhs._summary != rhs._summary {return false} + if lhs.clientSuccess != rhs.clientSuccess {return false} + if lhs.serverSuccess != rhs.serverSuccess {return false} + if lhs.requestResults != rhs.requestResults {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/performance-worker/Generated/grpc_core_stats.pb.swift b/Sources/performance-worker/Generated/grpc_core_stats.pb.swift new file mode 100644 index 000000000..9f7d794b8 --- /dev/null +++ b/Sources/performance-worker/Generated/grpc_core_stats.pb.swift @@ -0,0 +1,312 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/core/stats.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2017 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Grpc_Core_Bucket { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var start: Double = 0 + + var count: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Core_Histogram { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var buckets: [Grpc_Core_Bucket] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Core_Metric { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var value: Grpc_Core_Metric.OneOf_Value? = nil + + var count: UInt64 { + get { + if case .count(let v)? = value {return v} + return 0 + } + set {value = .count(newValue)} + } + + var histogram: Grpc_Core_Histogram { + get { + if case .histogram(let v)? = value {return v} + return Grpc_Core_Histogram() + } + set {value = .histogram(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Value: Equatable { + case count(UInt64) + case histogram(Grpc_Core_Histogram) + + #if !swift(>=4.1) + static func ==(lhs: Grpc_Core_Metric.OneOf_Value, rhs: Grpc_Core_Metric.OneOf_Value) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.count, .count): return { + guard case .count(let l) = lhs, case .count(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.histogram, .histogram): return { + guard case .histogram(let l) = lhs, case .histogram(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + +struct Grpc_Core_Stats { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var metrics: [Grpc_Core_Metric] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Grpc_Core_Bucket: @unchecked Sendable {} +extension Grpc_Core_Histogram: @unchecked Sendable {} +extension Grpc_Core_Metric: @unchecked Sendable {} +extension Grpc_Core_Metric.OneOf_Value: @unchecked Sendable {} +extension Grpc_Core_Stats: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "grpc.core" + +extension Grpc_Core_Bucket: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Bucket" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "start"), + 2: .same(proto: "count"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &self.start) }() + case 2: try { try decoder.decodeSingularUInt64Field(value: &self.count) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.start != 0 { + try visitor.visitSingularDoubleField(value: self.start, fieldNumber: 1) + } + if self.count != 0 { + try visitor.visitSingularUInt64Field(value: self.count, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Core_Bucket, rhs: Grpc_Core_Bucket) -> Bool { + if lhs.start != rhs.start {return false} + if lhs.count != rhs.count {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Core_Histogram: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Histogram" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "buckets"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.buckets) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.buckets.isEmpty { + try visitor.visitRepeatedMessageField(value: self.buckets, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Core_Histogram, rhs: Grpc_Core_Histogram) -> Bool { + if lhs.buckets != rhs.buckets {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Core_Metric: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Metric" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 10: .same(proto: "count"), + 11: .same(proto: "histogram"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 10: try { + var v: UInt64? + try decoder.decodeSingularUInt64Field(value: &v) + if let v = v { + if self.value != nil {try decoder.handleConflictingOneOf()} + self.value = .count(v) + } + }() + case 11: try { + var v: Grpc_Core_Histogram? + var hadOneofValue = false + if let current = self.value { + hadOneofValue = true + if case .histogram(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.value = .histogram(v) + } + }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + switch self.value { + case .count?: try { + guard case .count(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 10) + }() + case .histogram?: try { + guard case .histogram(let v)? = self.value else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Core_Metric, rhs: Grpc_Core_Metric) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Core_Stats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Stats" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "metrics"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.metrics) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.metrics.isEmpty { + try visitor.visitRepeatedMessageField(value: self.metrics, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Core_Stats, rhs: Grpc_Core_Stats) -> Bool { + if lhs.metrics != rhs.metrics {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/performance-worker/Generated/messages.pb.swift b/Sources/performance-worker/Generated/messages.pb.swift new file mode 100644 index 000000000..e1239674f --- /dev/null +++ b/Sources/performance-worker/Generated/messages.pb.swift @@ -0,0 +1,2200 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/messages.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2015-2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Message definitions to be used by integration test service definitions. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// The type of payload that should be returned. +enum Grpc_Testing_PayloadType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Compressable text format. + case compressable // = 0 + case UNRECOGNIZED(Int) + + init() { + self = .compressable + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .compressable + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .compressable: return 0 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Grpc_Testing_PayloadType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_PayloadType] = [ + .compressable, + ] +} + +#endif // swift(>=4.2) + +/// The type of route that a client took to reach a server w.r.t. gRPCLB. +/// The server must fill in "fallback" if it detects that the RPC reached +/// the server via the "gRPCLB fallback" path, and "backend" if it detects +/// that the RPC reached the server via "gRPCLB backend" path (i.e. if it got +/// the address of this server from the gRPCLB server BalanceLoad RPC). Exactly +/// how this detection is done is context and server dependent. +enum Grpc_Testing_GrpclbRouteType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Server didn't detect the route that a client took to reach it. + case unknown // = 0 + + /// Indicates that a client reached a server via gRPCLB fallback. + case fallback // = 1 + + /// Indicates that a client reached a server as a gRPCLB-given backend. + case backend // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .fallback + case 2: self = .backend + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .fallback: return 1 + case .backend: return 2 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Grpc_Testing_GrpclbRouteType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_GrpclbRouteType] = [ + .unknown, + .fallback, + .backend, + ] +} + +#endif // swift(>=4.2) + +/// TODO(dgq): Go back to using well-known types once +/// https://github.com/grpc/grpc/issues/6980 has been fixed. +/// import "google/protobuf/wrappers.proto"; +struct Grpc_Testing_BoolValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The bool value. + var value: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// A block of data, to simply increase gRPC message size. +struct Grpc_Testing_Payload { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The type of data in body. + var type: Grpc_Testing_PayloadType = .compressable + + /// Primary contents of payload. + var body: Data = Data() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// A protobuf representation for grpc status. This is used by test +/// clients to specify a status that the server should attempt to return. +struct Grpc_Testing_EchoStatus { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var code: Int32 = 0 + + var message: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Unary request. +struct Grpc_Testing_SimpleRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Desired payload type in the response from the server. + /// If response_type is RANDOM, server randomly chooses one from other formats. + var responseType: Grpc_Testing_PayloadType = .compressable + + /// Desired payload size in the response from the server. + var responseSize: Int32 = 0 + + /// Optional input payload sent along with the request. + var payload: Grpc_Testing_Payload { + get {return _payload ?? Grpc_Testing_Payload()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + mutating func clearPayload() {self._payload = nil} + + /// Whether SimpleResponse should include username. + var fillUsername: Bool = false + + /// Whether SimpleResponse should include OAuth scope. + var fillOauthScope: Bool = false + + /// Whether to request the server to compress the response. This field is + /// "nullable" in order to interoperate seamlessly with clients not able to + /// implement the full compression tests by introspecting the call to verify + /// the response's compression status. + var responseCompressed: Grpc_Testing_BoolValue { + get {return _responseCompressed ?? Grpc_Testing_BoolValue()} + set {_responseCompressed = newValue} + } + /// Returns true if `responseCompressed` has been explicitly set. + var hasResponseCompressed: Bool {return self._responseCompressed != nil} + /// Clears the value of `responseCompressed`. Subsequent reads from it will return its default value. + mutating func clearResponseCompressed() {self._responseCompressed = nil} + + /// Whether server should return a given status + var responseStatus: Grpc_Testing_EchoStatus { + get {return _responseStatus ?? Grpc_Testing_EchoStatus()} + set {_responseStatus = newValue} + } + /// Returns true if `responseStatus` has been explicitly set. + var hasResponseStatus: Bool {return self._responseStatus != nil} + /// Clears the value of `responseStatus`. Subsequent reads from it will return its default value. + mutating func clearResponseStatus() {self._responseStatus = nil} + + /// Whether the server should expect this request to be compressed. + var expectCompressed: Grpc_Testing_BoolValue { + get {return _expectCompressed ?? Grpc_Testing_BoolValue()} + set {_expectCompressed = newValue} + } + /// Returns true if `expectCompressed` has been explicitly set. + var hasExpectCompressed: Bool {return self._expectCompressed != nil} + /// Clears the value of `expectCompressed`. Subsequent reads from it will return its default value. + mutating func clearExpectCompressed() {self._expectCompressed = nil} + + /// Whether SimpleResponse should include server_id. + var fillServerID: Bool = false + + /// Whether SimpleResponse should include grpclb_route_type. + var fillGrpclbRouteType: Bool = false + + /// If set the server should record this metrics report data for the current RPC. + var orcaPerQueryReport: Grpc_Testing_TestOrcaReport { + get {return _orcaPerQueryReport ?? Grpc_Testing_TestOrcaReport()} + set {_orcaPerQueryReport = newValue} + } + /// Returns true if `orcaPerQueryReport` has been explicitly set. + var hasOrcaPerQueryReport: Bool {return self._orcaPerQueryReport != nil} + /// Clears the value of `orcaPerQueryReport`. Subsequent reads from it will return its default value. + mutating func clearOrcaPerQueryReport() {self._orcaPerQueryReport = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _payload: Grpc_Testing_Payload? = nil + fileprivate var _responseCompressed: Grpc_Testing_BoolValue? = nil + fileprivate var _responseStatus: Grpc_Testing_EchoStatus? = nil + fileprivate var _expectCompressed: Grpc_Testing_BoolValue? = nil + fileprivate var _orcaPerQueryReport: Grpc_Testing_TestOrcaReport? = nil +} + +/// Unary response, as configured by the request. +struct Grpc_Testing_SimpleResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Payload to increase message size. + var payload: Grpc_Testing_Payload { + get {return _payload ?? Grpc_Testing_Payload()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + mutating func clearPayload() {self._payload = nil} + + /// The user the request came from, for verifying authentication was + /// successful when the client expected it. + var username: String = String() + + /// OAuth scope. + var oauthScope: String = String() + + /// Server ID. This must be unique among different server instances, + /// but the same across all RPC's made to a particular server instance. + var serverID: String = String() + + /// gRPCLB Path. + var grpclbRouteType: Grpc_Testing_GrpclbRouteType = .unknown + + /// Server hostname. + var hostname: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _payload: Grpc_Testing_Payload? = nil +} + +/// Client-streaming request. +struct Grpc_Testing_StreamingInputCallRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Optional input payload sent along with the request. + var payload: Grpc_Testing_Payload { + get {return _payload ?? Grpc_Testing_Payload()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + mutating func clearPayload() {self._payload = nil} + + /// Whether the server should expect this request to be compressed. This field + /// is "nullable" in order to interoperate seamlessly with servers not able to + /// implement the full compression tests by introspecting the call to verify + /// the request's compression status. + var expectCompressed: Grpc_Testing_BoolValue { + get {return _expectCompressed ?? Grpc_Testing_BoolValue()} + set {_expectCompressed = newValue} + } + /// Returns true if `expectCompressed` has been explicitly set. + var hasExpectCompressed: Bool {return self._expectCompressed != nil} + /// Clears the value of `expectCompressed`. Subsequent reads from it will return its default value. + mutating func clearExpectCompressed() {self._expectCompressed = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _payload: Grpc_Testing_Payload? = nil + fileprivate var _expectCompressed: Grpc_Testing_BoolValue? = nil +} + +/// Client-streaming response. +struct Grpc_Testing_StreamingInputCallResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Aggregated size of payloads received from the client. + var aggregatedPayloadSize: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Configuration for a particular response. +struct Grpc_Testing_ResponseParameters { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Desired payload sizes in responses from the server. + var size: Int32 = 0 + + /// Desired interval between consecutive responses in the response stream in + /// microseconds. + var intervalUs: Int32 = 0 + + /// Whether to request the server to compress the response. This field is + /// "nullable" in order to interoperate seamlessly with clients not able to + /// implement the full compression tests by introspecting the call to verify + /// the response's compression status. + var compressed: Grpc_Testing_BoolValue { + get {return _compressed ?? Grpc_Testing_BoolValue()} + set {_compressed = newValue} + } + /// Returns true if `compressed` has been explicitly set. + var hasCompressed: Bool {return self._compressed != nil} + /// Clears the value of `compressed`. Subsequent reads from it will return its default value. + mutating func clearCompressed() {self._compressed = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _compressed: Grpc_Testing_BoolValue? = nil +} + +/// Server-streaming request. +struct Grpc_Testing_StreamingOutputCallRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Desired payload type in the response from the server. + /// If response_type is RANDOM, the payload from each response in the stream + /// might be of different types. This is to simulate a mixed type of payload + /// stream. + var responseType: Grpc_Testing_PayloadType = .compressable + + /// Configuration for each expected response message. + var responseParameters: [Grpc_Testing_ResponseParameters] = [] + + /// Optional input payload sent along with the request. + var payload: Grpc_Testing_Payload { + get {return _payload ?? Grpc_Testing_Payload()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + mutating func clearPayload() {self._payload = nil} + + /// Whether server should return a given status + var responseStatus: Grpc_Testing_EchoStatus { + get {return _responseStatus ?? Grpc_Testing_EchoStatus()} + set {_responseStatus = newValue} + } + /// Returns true if `responseStatus` has been explicitly set. + var hasResponseStatus: Bool {return self._responseStatus != nil} + /// Clears the value of `responseStatus`. Subsequent reads from it will return its default value. + mutating func clearResponseStatus() {self._responseStatus = nil} + + /// If set the server should update this metrics report data at the OOB server. + var orcaOobReport: Grpc_Testing_TestOrcaReport { + get {return _orcaOobReport ?? Grpc_Testing_TestOrcaReport()} + set {_orcaOobReport = newValue} + } + /// Returns true if `orcaOobReport` has been explicitly set. + var hasOrcaOobReport: Bool {return self._orcaOobReport != nil} + /// Clears the value of `orcaOobReport`. Subsequent reads from it will return its default value. + mutating func clearOrcaOobReport() {self._orcaOobReport = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _payload: Grpc_Testing_Payload? = nil + fileprivate var _responseStatus: Grpc_Testing_EchoStatus? = nil + fileprivate var _orcaOobReport: Grpc_Testing_TestOrcaReport? = nil +} + +/// Server-streaming response, as configured by the request and parameters. +struct Grpc_Testing_StreamingOutputCallResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Payload to increase response size. + var payload: Grpc_Testing_Payload { + get {return _payload ?? Grpc_Testing_Payload()} + set {_payload = newValue} + } + /// Returns true if `payload` has been explicitly set. + var hasPayload: Bool {return self._payload != nil} + /// Clears the value of `payload`. Subsequent reads from it will return its default value. + mutating func clearPayload() {self._payload = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _payload: Grpc_Testing_Payload? = nil +} + +/// For reconnect interop test only. +/// Client tells server what reconnection parameters it used. +struct Grpc_Testing_ReconnectParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var maxReconnectBackoffMs: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// For reconnect interop test only. +/// Server tells client whether its reconnects are following the spec and the +/// reconnect backoffs it saw. +struct Grpc_Testing_ReconnectInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var passed: Bool = false + + var backoffMs: [Int32] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_LoadBalancerStatsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Request stats for the next num_rpcs sent by client. + var numRpcs: Int32 = 0 + + /// If num_rpcs have not completed within timeout_sec, return partial results. + var timeoutSec: Int32 = 0 + + /// Response header + trailer metadata entries we want the values of. + /// Matching of the keys is case-insensitive as per rfc7540#section-8.1.2 + /// * (asterisk) is a special value that will return all metadata entries + var metadataKeys: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_LoadBalancerStatsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The number of completed RPCs for each peer. + var rpcsByPeer: Dictionary = [:] + + /// The number of RPCs that failed to record a remote peer. + var numFailures: Int32 = 0 + + var rpcsByMethod: Dictionary = [:] + + /// All the metadata of all RPCs for each peer. + var metadatasByPeer: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum MetadataType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case initial // = 1 + case trailing // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .initial + case 2: self = .trailing + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .initial: return 1 + case .trailing: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + + struct MetadataEntry { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Key, exactly as received from the server. Case may be different from what + /// was requested in the LoadBalancerStatsRequest) + var key: String = String() + + /// Value, exactly as received from the server. + var value: String = String() + + /// Metadata type + var type: Grpc_Testing_LoadBalancerStatsResponse.MetadataType = .unknown + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct RpcMetadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// metadata values for each rpc for the keys specified in + /// LoadBalancerStatsRequest.metadata_keys. + var metadata: [Grpc_Testing_LoadBalancerStatsResponse.MetadataEntry] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct MetadataByPeer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// List of RpcMetadata in for each RPC with a given peer + var rpcMetadata: [Grpc_Testing_LoadBalancerStatsResponse.RpcMetadata] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct RpcsByPeer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The number of completed RPCs for each peer. + var rpcsByPeer: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} +} + +#if swift(>=4.2) + +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_LoadBalancerStatsResponse.MetadataType] = [ + .unknown, + .initial, + .trailing, + ] +} + +#endif // swift(>=4.2) + +/// Request for retrieving a test client's accumulated stats. +struct Grpc_Testing_LoadBalancerAccumulatedStatsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Accumulated stats for RPCs sent by a test client. +struct Grpc_Testing_LoadBalancerAccumulatedStatsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The total number of RPCs have ever issued for each type. + /// Deprecated: use stats_per_method.rpcs_started instead. + var numRpcsStartedByMethod: Dictionary = [:] + + /// The total number of RPCs have ever completed successfully for each type. + /// Deprecated: use stats_per_method.result instead. + var numRpcsSucceededByMethod: Dictionary = [:] + + /// The total number of RPCs have ever failed for each type. + /// Deprecated: use stats_per_method.result instead. + var numRpcsFailedByMethod: Dictionary = [:] + + /// Per-method RPC statistics. The key is the RpcType in string form; e.g. + /// 'EMPTY_CALL' or 'UNARY_CALL' + var statsPerMethod: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct MethodStats { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The number of RPCs that were started for this method. + var rpcsStarted: Int32 = 0 + + /// The number of RPCs that completed with each status for this method. The + /// key is the integral value of a google.rpc.Code; the value is the count. + var result: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} +} + +/// Configurations for a test client. +struct Grpc_Testing_ClientConfigureRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The types of RPCs the client sends. + var types: [Grpc_Testing_ClientConfigureRequest.RpcType] = [] + + /// The collection of custom metadata to be attached to RPCs sent by the client. + var metadata: [Grpc_Testing_ClientConfigureRequest.Metadata] = [] + + /// The deadline to use, in seconds, for all RPCs. If unset or zero, the + /// client will use the default from the command-line. + var timeoutSec: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Type of RPCs to send. + enum RpcType: SwiftProtobuf.Enum { + typealias RawValue = Int + case emptyCall // = 0 + case unaryCall // = 1 + case UNRECOGNIZED(Int) + + init() { + self = .emptyCall + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .emptyCall + case 1: self = .unaryCall + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .emptyCall: return 0 + case .unaryCall: return 1 + case .UNRECOGNIZED(let i): return i + } + } + + } + + /// Metadata to be attached for the given type of RPCs. + struct Metadata { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var type: Grpc_Testing_ClientConfigureRequest.RpcType = .emptyCall + + var key: String = String() + + var value: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} +} + +#if swift(>=4.2) + +extension Grpc_Testing_ClientConfigureRequest.RpcType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_ClientConfigureRequest.RpcType] = [ + .emptyCall, + .unaryCall, + ] +} + +#endif // swift(>=4.2) + +/// Response for updating a test client's configuration. +struct Grpc_Testing_ClientConfigureResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_MemorySize { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var rss: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Metrics data the server will update and send to the client. It mirrors orca load report +/// https://github.com/cncf/xds/blob/eded343319d09f30032952beda9840bbd3dcf7ac/xds/data/orca/v3/orca_load_report.proto#L15, +/// but avoids orca dependency. Used by both per-query and out-of-band reporting tests. +struct Grpc_Testing_TestOrcaReport { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var cpuUtilization: Double = 0 + + var memoryUtilization: Double = 0 + + var requestCost: Dictionary = [:] + + var utilization: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Status that will be return to callers of the Hook method +struct Grpc_Testing_SetReturnStatusRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var grpcCodeToReturn: Int32 = 0 + + var grpcStatusDescription: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_HookRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var command: Grpc_Testing_HookRequest.HookRequestCommand = .unspecified + + var grpcCodeToReturn: Int32 = 0 + + var grpcStatusDescription: String = String() + + /// Server port to listen to + var serverPort: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum HookRequestCommand: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Default value + case unspecified // = 0 + + /// Start the HTTP endpoint + case start // = 1 + + /// Stop + case stop // = 2 + + /// Return from HTTP GET/POST + case `return` // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .unspecified + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unspecified + case 1: self = .start + case 2: self = .stop + case 3: self = .return + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unspecified: return 0 + case .start: return 1 + case .stop: return 2 + case .return: return 3 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Grpc_Testing_HookRequest.HookRequestCommand: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static let allCases: [Grpc_Testing_HookRequest.HookRequestCommand] = [ + .unspecified, + .start, + .stop, + .return, + ] +} + +#endif // swift(>=4.2) + +struct Grpc_Testing_HookResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Grpc_Testing_PayloadType: @unchecked Sendable {} +extension Grpc_Testing_GrpclbRouteType: @unchecked Sendable {} +extension Grpc_Testing_BoolValue: @unchecked Sendable {} +extension Grpc_Testing_Payload: @unchecked Sendable {} +extension Grpc_Testing_EchoStatus: @unchecked Sendable {} +extension Grpc_Testing_SimpleRequest: @unchecked Sendable {} +extension Grpc_Testing_SimpleResponse: @unchecked Sendable {} +extension Grpc_Testing_StreamingInputCallRequest: @unchecked Sendable {} +extension Grpc_Testing_StreamingInputCallResponse: @unchecked Sendable {} +extension Grpc_Testing_ResponseParameters: @unchecked Sendable {} +extension Grpc_Testing_StreamingOutputCallRequest: @unchecked Sendable {} +extension Grpc_Testing_StreamingOutputCallResponse: @unchecked Sendable {} +extension Grpc_Testing_ReconnectParams: @unchecked Sendable {} +extension Grpc_Testing_ReconnectInfo: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsRequest: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsResponse: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataType: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataEntry: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsResponse.RpcMetadata: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataByPeer: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerAccumulatedStatsRequest: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: @unchecked Sendable {} +extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats: @unchecked Sendable {} +extension Grpc_Testing_ClientConfigureRequest: @unchecked Sendable {} +extension Grpc_Testing_ClientConfigureRequest.RpcType: @unchecked Sendable {} +extension Grpc_Testing_ClientConfigureRequest.Metadata: @unchecked Sendable {} +extension Grpc_Testing_ClientConfigureResponse: @unchecked Sendable {} +extension Grpc_Testing_MemorySize: @unchecked Sendable {} +extension Grpc_Testing_TestOrcaReport: @unchecked Sendable {} +extension Grpc_Testing_SetReturnStatusRequest: @unchecked Sendable {} +extension Grpc_Testing_HookRequest: @unchecked Sendable {} +extension Grpc_Testing_HookRequest.HookRequestCommand: @unchecked Sendable {} +extension Grpc_Testing_HookResponse: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "grpc.testing" + +extension Grpc_Testing_PayloadType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "COMPRESSABLE"), + ] +} + +extension Grpc_Testing_GrpclbRouteType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "GRPCLB_ROUTE_TYPE_UNKNOWN"), + 1: .same(proto: "GRPCLB_ROUTE_TYPE_FALLBACK"), + 2: .same(proto: "GRPCLB_ROUTE_TYPE_BACKEND"), + ] +} + +extension Grpc_Testing_BoolValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BoolValue" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self.value) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.value != false { + try visitor.visitSingularBoolField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_BoolValue, rhs: Grpc_Testing_BoolValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_Payload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Payload" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "body"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.body) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.type != .compressable { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1) + } + if !self.body.isEmpty { + try visitor.visitSingularBytesField(value: self.body, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_Payload, rhs: Grpc_Testing_Payload) -> Bool { + if lhs.type != rhs.type {return false} + if lhs.body != rhs.body {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_EchoStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EchoStatus" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "code"), + 2: .same(proto: "message"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.code) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.message) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.code != 0 { + try visitor.visitSingularInt32Field(value: self.code, fieldNumber: 1) + } + if !self.message.isEmpty { + try visitor.visitSingularStringField(value: self.message, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_EchoStatus, rhs: Grpc_Testing_EchoStatus) -> Bool { + if lhs.code != rhs.code {return false} + if lhs.message != rhs.message {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_SimpleRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SimpleRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "response_type"), + 2: .standard(proto: "response_size"), + 3: .same(proto: "payload"), + 4: .standard(proto: "fill_username"), + 5: .standard(proto: "fill_oauth_scope"), + 6: .standard(proto: "response_compressed"), + 7: .standard(proto: "response_status"), + 8: .standard(proto: "expect_compressed"), + 9: .standard(proto: "fill_server_id"), + 10: .standard(proto: "fill_grpclb_route_type"), + 11: .standard(proto: "orca_per_query_report"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.responseType) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.responseSize) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._payload) }() + case 4: try { try decoder.decodeSingularBoolField(value: &self.fillUsername) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self.fillOauthScope) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._responseCompressed) }() + case 7: try { try decoder.decodeSingularMessageField(value: &self._responseStatus) }() + case 8: try { try decoder.decodeSingularMessageField(value: &self._expectCompressed) }() + case 9: try { try decoder.decodeSingularBoolField(value: &self.fillServerID) }() + case 10: try { try decoder.decodeSingularBoolField(value: &self.fillGrpclbRouteType) }() + case 11: try { try decoder.decodeSingularMessageField(value: &self._orcaPerQueryReport) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if self.responseType != .compressable { + try visitor.visitSingularEnumField(value: self.responseType, fieldNumber: 1) + } + if self.responseSize != 0 { + try visitor.visitSingularInt32Field(value: self.responseSize, fieldNumber: 2) + } + try { if let v = self._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + if self.fillUsername != false { + try visitor.visitSingularBoolField(value: self.fillUsername, fieldNumber: 4) + } + if self.fillOauthScope != false { + try visitor.visitSingularBoolField(value: self.fillOauthScope, fieldNumber: 5) + } + try { if let v = self._responseCompressed { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = self._responseStatus { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = self._expectCompressed { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + if self.fillServerID != false { + try visitor.visitSingularBoolField(value: self.fillServerID, fieldNumber: 9) + } + if self.fillGrpclbRouteType != false { + try visitor.visitSingularBoolField(value: self.fillGrpclbRouteType, fieldNumber: 10) + } + try { if let v = self._orcaPerQueryReport { + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_SimpleRequest, rhs: Grpc_Testing_SimpleRequest) -> Bool { + if lhs.responseType != rhs.responseType {return false} + if lhs.responseSize != rhs.responseSize {return false} + if lhs._payload != rhs._payload {return false} + if lhs.fillUsername != rhs.fillUsername {return false} + if lhs.fillOauthScope != rhs.fillOauthScope {return false} + if lhs._responseCompressed != rhs._responseCompressed {return false} + if lhs._responseStatus != rhs._responseStatus {return false} + if lhs._expectCompressed != rhs._expectCompressed {return false} + if lhs.fillServerID != rhs.fillServerID {return false} + if lhs.fillGrpclbRouteType != rhs.fillGrpclbRouteType {return false} + if lhs._orcaPerQueryReport != rhs._orcaPerQueryReport {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_SimpleResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SimpleResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "payload"), + 2: .same(proto: "username"), + 3: .standard(proto: "oauth_scope"), + 4: .standard(proto: "server_id"), + 5: .standard(proto: "grpclb_route_type"), + 6: .same(proto: "hostname"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._payload) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.username) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.oauthScope) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.serverID) }() + case 5: try { try decoder.decodeSingularEnumField(value: &self.grpclbRouteType) }() + case 6: try { try decoder.decodeSingularStringField(value: &self.hostname) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.username.isEmpty { + try visitor.visitSingularStringField(value: self.username, fieldNumber: 2) + } + if !self.oauthScope.isEmpty { + try visitor.visitSingularStringField(value: self.oauthScope, fieldNumber: 3) + } + if !self.serverID.isEmpty { + try visitor.visitSingularStringField(value: self.serverID, fieldNumber: 4) + } + if self.grpclbRouteType != .unknown { + try visitor.visitSingularEnumField(value: self.grpclbRouteType, fieldNumber: 5) + } + if !self.hostname.isEmpty { + try visitor.visitSingularStringField(value: self.hostname, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_SimpleResponse, rhs: Grpc_Testing_SimpleResponse) -> Bool { + if lhs._payload != rhs._payload {return false} + if lhs.username != rhs.username {return false} + if lhs.oauthScope != rhs.oauthScope {return false} + if lhs.serverID != rhs.serverID {return false} + if lhs.grpclbRouteType != rhs.grpclbRouteType {return false} + if lhs.hostname != rhs.hostname {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_StreamingInputCallRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamingInputCallRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "payload"), + 2: .standard(proto: "expect_compressed"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._payload) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._expectCompressed) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._expectCompressed { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_StreamingInputCallRequest, rhs: Grpc_Testing_StreamingInputCallRequest) -> Bool { + if lhs._payload != rhs._payload {return false} + if lhs._expectCompressed != rhs._expectCompressed {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_StreamingInputCallResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamingInputCallResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "aggregated_payload_size"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.aggregatedPayloadSize) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.aggregatedPayloadSize != 0 { + try visitor.visitSingularInt32Field(value: self.aggregatedPayloadSize, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_StreamingInputCallResponse, rhs: Grpc_Testing_StreamingInputCallResponse) -> Bool { + if lhs.aggregatedPayloadSize != rhs.aggregatedPayloadSize {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ResponseParameters: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResponseParameters" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "size"), + 2: .standard(proto: "interval_us"), + 3: .same(proto: "compressed"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.size) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.intervalUs) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._compressed) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if self.size != 0 { + try visitor.visitSingularInt32Field(value: self.size, fieldNumber: 1) + } + if self.intervalUs != 0 { + try visitor.visitSingularInt32Field(value: self.intervalUs, fieldNumber: 2) + } + try { if let v = self._compressed { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ResponseParameters, rhs: Grpc_Testing_ResponseParameters) -> Bool { + if lhs.size != rhs.size {return false} + if lhs.intervalUs != rhs.intervalUs {return false} + if lhs._compressed != rhs._compressed {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_StreamingOutputCallRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamingOutputCallRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "response_type"), + 2: .standard(proto: "response_parameters"), + 3: .same(proto: "payload"), + 7: .standard(proto: "response_status"), + 8: .standard(proto: "orca_oob_report"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.responseType) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.responseParameters) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._payload) }() + case 7: try { try decoder.decodeSingularMessageField(value: &self._responseStatus) }() + case 8: try { try decoder.decodeSingularMessageField(value: &self._orcaOobReport) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if self.responseType != .compressable { + try visitor.visitSingularEnumField(value: self.responseType, fieldNumber: 1) + } + if !self.responseParameters.isEmpty { + try visitor.visitRepeatedMessageField(value: self.responseParameters, fieldNumber: 2) + } + try { if let v = self._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = self._responseStatus { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = self._orcaOobReport { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_StreamingOutputCallRequest, rhs: Grpc_Testing_StreamingOutputCallRequest) -> Bool { + if lhs.responseType != rhs.responseType {return false} + if lhs.responseParameters != rhs.responseParameters {return false} + if lhs._payload != rhs._payload {return false} + if lhs._responseStatus != rhs._responseStatus {return false} + if lhs._orcaOobReport != rhs._orcaOobReport {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_StreamingOutputCallResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamingOutputCallResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "payload"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._payload) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._payload { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_StreamingOutputCallResponse, rhs: Grpc_Testing_StreamingOutputCallResponse) -> Bool { + if lhs._payload != rhs._payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ReconnectParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReconnectParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "max_reconnect_backoff_ms"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.maxReconnectBackoffMs) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.maxReconnectBackoffMs != 0 { + try visitor.visitSingularInt32Field(value: self.maxReconnectBackoffMs, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ReconnectParams, rhs: Grpc_Testing_ReconnectParams) -> Bool { + if lhs.maxReconnectBackoffMs != rhs.maxReconnectBackoffMs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ReconnectInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReconnectInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "passed"), + 2: .standard(proto: "backoff_ms"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self.passed) }() + case 2: try { try decoder.decodeRepeatedInt32Field(value: &self.backoffMs) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.passed != false { + try visitor.visitSingularBoolField(value: self.passed, fieldNumber: 1) + } + if !self.backoffMs.isEmpty { + try visitor.visitPackedInt32Field(value: self.backoffMs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ReconnectInfo, rhs: Grpc_Testing_ReconnectInfo) -> Bool { + if lhs.passed != rhs.passed {return false} + if lhs.backoffMs != rhs.backoffMs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LoadBalancerStatsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "num_rpcs"), + 2: .standard(proto: "timeout_sec"), + 3: .standard(proto: "metadata_keys"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.numRpcs) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.timeoutSec) }() + case 3: try { try decoder.decodeRepeatedStringField(value: &self.metadataKeys) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.numRpcs != 0 { + try visitor.visitSingularInt32Field(value: self.numRpcs, fieldNumber: 1) + } + if self.timeoutSec != 0 { + try visitor.visitSingularInt32Field(value: self.timeoutSec, fieldNumber: 2) + } + if !self.metadataKeys.isEmpty { + try visitor.visitRepeatedStringField(value: self.metadataKeys, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerStatsRequest, rhs: Grpc_Testing_LoadBalancerStatsRequest) -> Bool { + if lhs.numRpcs != rhs.numRpcs {return false} + if lhs.timeoutSec != rhs.timeoutSec {return false} + if lhs.metadataKeys != rhs.metadataKeys {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LoadBalancerStatsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "rpcs_by_peer"), + 2: .standard(proto: "num_failures"), + 3: .standard(proto: "rpcs_by_method"), + 4: .standard(proto: "metadatas_by_peer"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.rpcsByPeer) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.numFailures) }() + case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.rpcsByMethod) }() + case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.metadatasByPeer) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rpcsByPeer.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.rpcsByPeer, fieldNumber: 1) + } + if self.numFailures != 0 { + try visitor.visitSingularInt32Field(value: self.numFailures, fieldNumber: 2) + } + if !self.rpcsByMethod.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.rpcsByMethod, fieldNumber: 3) + } + if !self.metadatasByPeer.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.metadatasByPeer, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse, rhs: Grpc_Testing_LoadBalancerStatsResponse) -> Bool { + if lhs.rpcsByPeer != rhs.rpcsByPeer {return false} + if lhs.numFailures != rhs.numFailures {return false} + if lhs.rpcsByMethod != rhs.rpcsByMethod {return false} + if lhs.metadatasByPeer != rhs.metadatasByPeer {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "INITIAL"), + 2: .same(proto: "TRAILING"), + ] +} + +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Grpc_Testing_LoadBalancerStatsResponse.protoMessageName + ".MetadataEntry" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "key"), + 2: .same(proto: "value"), + 3: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.key) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.value) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self.type) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.key.isEmpty { + try visitor.visitSingularStringField(value: self.key, fieldNumber: 1) + } + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 2) + } + if self.type != .unknown { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse.MetadataEntry, rhs: Grpc_Testing_LoadBalancerStatsResponse.MetadataEntry) -> Bool { + if lhs.key != rhs.key {return false} + if lhs.value != rhs.value {return false} + if lhs.type != rhs.type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerStatsResponse.RpcMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Grpc_Testing_LoadBalancerStatsResponse.protoMessageName + ".RpcMetadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "metadata"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.metadata) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.metadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.metadata, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse.RpcMetadata, rhs: Grpc_Testing_LoadBalancerStatsResponse.RpcMetadata) -> Bool { + if lhs.metadata != rhs.metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerStatsResponse.MetadataByPeer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Grpc_Testing_LoadBalancerStatsResponse.protoMessageName + ".MetadataByPeer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "rpc_metadata"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.rpcMetadata) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rpcMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.rpcMetadata, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse.MetadataByPeer, rhs: Grpc_Testing_LoadBalancerStatsResponse.MetadataByPeer) -> Bool { + if lhs.rpcMetadata != rhs.rpcMetadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Grpc_Testing_LoadBalancerStatsResponse.protoMessageName + ".RpcsByPeer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "rpcs_by_peer"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.rpcsByPeer) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rpcsByPeer.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.rpcsByPeer, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer, rhs: Grpc_Testing_LoadBalancerStatsResponse.RpcsByPeer) -> Bool { + if lhs.rpcsByPeer != rhs.rpcsByPeer {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerAccumulatedStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LoadBalancerAccumulatedStatsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerAccumulatedStatsRequest, rhs: Grpc_Testing_LoadBalancerAccumulatedStatsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LoadBalancerAccumulatedStatsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "num_rpcs_started_by_method"), + 2: .standard(proto: "num_rpcs_succeeded_by_method"), + 3: .standard(proto: "num_rpcs_failed_by_method"), + 4: .standard(proto: "stats_per_method"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.numRpcsStartedByMethod) }() + case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.numRpcsSucceededByMethod) }() + case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.numRpcsFailedByMethod) }() + case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.statsPerMethod) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.numRpcsStartedByMethod.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.numRpcsStartedByMethod, fieldNumber: 1) + } + if !self.numRpcsSucceededByMethod.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.numRpcsSucceededByMethod, fieldNumber: 2) + } + if !self.numRpcsFailedByMethod.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.numRpcsFailedByMethod, fieldNumber: 3) + } + if !self.statsPerMethod.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.statsPerMethod, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse, rhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse) -> Bool { + if lhs.numRpcsStartedByMethod != rhs.numRpcsStartedByMethod {return false} + if lhs.numRpcsSucceededByMethod != rhs.numRpcsSucceededByMethod {return false} + if lhs.numRpcsFailedByMethod != rhs.numRpcsFailedByMethod {return false} + if lhs.statsPerMethod != rhs.statsPerMethod {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Grpc_Testing_LoadBalancerAccumulatedStatsResponse.protoMessageName + ".MethodStats" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "rpcs_started"), + 2: .same(proto: "result"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.rpcsStarted) }() + case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.result) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.rpcsStarted != 0 { + try visitor.visitSingularInt32Field(value: self.rpcsStarted, fieldNumber: 1) + } + if !self.result.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.result, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats, rhs: Grpc_Testing_LoadBalancerAccumulatedStatsResponse.MethodStats) -> Bool { + if lhs.rpcsStarted != rhs.rpcsStarted {return false} + if lhs.result != rhs.result {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientConfigureRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClientConfigureRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "types"), + 2: .same(proto: "metadata"), + 3: .standard(proto: "timeout_sec"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedEnumField(value: &self.types) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.metadata) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self.timeoutSec) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.types.isEmpty { + try visitor.visitPackedEnumField(value: self.types, fieldNumber: 1) + } + if !self.metadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.metadata, fieldNumber: 2) + } + if self.timeoutSec != 0 { + try visitor.visitSingularInt32Field(value: self.timeoutSec, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientConfigureRequest, rhs: Grpc_Testing_ClientConfigureRequest) -> Bool { + if lhs.types != rhs.types {return false} + if lhs.metadata != rhs.metadata {return false} + if lhs.timeoutSec != rhs.timeoutSec {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientConfigureRequest.RpcType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "EMPTY_CALL"), + 1: .same(proto: "UNARY_CALL"), + ] +} + +extension Grpc_Testing_ClientConfigureRequest.Metadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Grpc_Testing_ClientConfigureRequest.protoMessageName + ".Metadata" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + 2: .same(proto: "key"), + 3: .same(proto: "value"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.type) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.key) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.value) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.type != .emptyCall { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1) + } + if !self.key.isEmpty { + try visitor.visitSingularStringField(value: self.key, fieldNumber: 2) + } + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientConfigureRequest.Metadata, rhs: Grpc_Testing_ClientConfigureRequest.Metadata) -> Bool { + if lhs.type != rhs.type {return false} + if lhs.key != rhs.key {return false} + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientConfigureResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClientConfigureResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientConfigureResponse, rhs: Grpc_Testing_ClientConfigureResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_MemorySize: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MemorySize" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "rss"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self.rss) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.rss != 0 { + try visitor.visitSingularInt64Field(value: self.rss, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_MemorySize, rhs: Grpc_Testing_MemorySize) -> Bool { + if lhs.rss != rhs.rss {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_TestOrcaReport: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TestOrcaReport" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "cpu_utilization"), + 2: .standard(proto: "memory_utilization"), + 3: .standard(proto: "request_cost"), + 4: .same(proto: "utilization"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &self.cpuUtilization) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.memoryUtilization) }() + case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.requestCost) }() + case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.utilization) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.cpuUtilization != 0 { + try visitor.visitSingularDoubleField(value: self.cpuUtilization, fieldNumber: 1) + } + if self.memoryUtilization != 0 { + try visitor.visitSingularDoubleField(value: self.memoryUtilization, fieldNumber: 2) + } + if !self.requestCost.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.requestCost, fieldNumber: 3) + } + if !self.utilization.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.utilization, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_TestOrcaReport, rhs: Grpc_Testing_TestOrcaReport) -> Bool { + if lhs.cpuUtilization != rhs.cpuUtilization {return false} + if lhs.memoryUtilization != rhs.memoryUtilization {return false} + if lhs.requestCost != rhs.requestCost {return false} + if lhs.utilization != rhs.utilization {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_SetReturnStatusRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SetReturnStatusRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "grpc_code_to_return"), + 2: .standard(proto: "grpc_status_description"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.grpcCodeToReturn) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.grpcStatusDescription) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.grpcCodeToReturn != 0 { + try visitor.visitSingularInt32Field(value: self.grpcCodeToReturn, fieldNumber: 1) + } + if !self.grpcStatusDescription.isEmpty { + try visitor.visitSingularStringField(value: self.grpcStatusDescription, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_SetReturnStatusRequest, rhs: Grpc_Testing_SetReturnStatusRequest) -> Bool { + if lhs.grpcCodeToReturn != rhs.grpcCodeToReturn {return false} + if lhs.grpcStatusDescription != rhs.grpcStatusDescription {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_HookRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HookRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "command"), + 2: .standard(proto: "grpc_code_to_return"), + 3: .standard(proto: "grpc_status_description"), + 4: .standard(proto: "server_port"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.command) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.grpcCodeToReturn) }() + case 3: try { try decoder.decodeSingularStringField(value: &self.grpcStatusDescription) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self.serverPort) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.command != .unspecified { + try visitor.visitSingularEnumField(value: self.command, fieldNumber: 1) + } + if self.grpcCodeToReturn != 0 { + try visitor.visitSingularInt32Field(value: self.grpcCodeToReturn, fieldNumber: 2) + } + if !self.grpcStatusDescription.isEmpty { + try visitor.visitSingularStringField(value: self.grpcStatusDescription, fieldNumber: 3) + } + if self.serverPort != 0 { + try visitor.visitSingularInt32Field(value: self.serverPort, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_HookRequest, rhs: Grpc_Testing_HookRequest) -> Bool { + if lhs.command != rhs.command {return false} + if lhs.grpcCodeToReturn != rhs.grpcCodeToReturn {return false} + if lhs.grpcStatusDescription != rhs.grpcStatusDescription {return false} + if lhs.serverPort != rhs.serverPort {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_HookRequest.HookRequestCommand: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNSPECIFIED"), + 1: .same(proto: "START"), + 2: .same(proto: "STOP"), + 3: .same(proto: "RETURN"), + ] +} + +extension Grpc_Testing_HookResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HookResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_HookResponse, rhs: Grpc_Testing_HookResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/performance-worker/Generated/payloads.pb.swift b/Sources/performance-worker/Generated/payloads.pb.swift new file mode 100644 index 000000000..4b04eec01 --- /dev/null +++ b/Sources/performance-worker/Generated/payloads.pb.swift @@ -0,0 +1,335 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/payloads.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Grpc_Testing_ByteBufferParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var reqSize: Int32 = 0 + + var respSize: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_SimpleProtoParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var reqSize: Int32 = 0 + + var respSize: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// TODO (vpai): Fill this in once the details of complex, representative +/// protos are decided +struct Grpc_Testing_ComplexProtoParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_PayloadConfig { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var payload: Grpc_Testing_PayloadConfig.OneOf_Payload? = nil + + var bytebufParams: Grpc_Testing_ByteBufferParams { + get { + if case .bytebufParams(let v)? = payload {return v} + return Grpc_Testing_ByteBufferParams() + } + set {payload = .bytebufParams(newValue)} + } + + var simpleParams: Grpc_Testing_SimpleProtoParams { + get { + if case .simpleParams(let v)? = payload {return v} + return Grpc_Testing_SimpleProtoParams() + } + set {payload = .simpleParams(newValue)} + } + + var complexParams: Grpc_Testing_ComplexProtoParams { + get { + if case .complexParams(let v)? = payload {return v} + return Grpc_Testing_ComplexProtoParams() + } + set {payload = .complexParams(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Payload: Equatable { + case bytebufParams(Grpc_Testing_ByteBufferParams) + case simpleParams(Grpc_Testing_SimpleProtoParams) + case complexParams(Grpc_Testing_ComplexProtoParams) + + #if !swift(>=4.1) + static func ==(lhs: Grpc_Testing_PayloadConfig.OneOf_Payload, rhs: Grpc_Testing_PayloadConfig.OneOf_Payload) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.bytebufParams, .bytebufParams): return { + guard case .bytebufParams(let l) = lhs, case .bytebufParams(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.simpleParams, .simpleParams): return { + guard case .simpleParams(let l) = lhs, case .simpleParams(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.complexParams, .complexParams): return { + guard case .complexParams(let l) = lhs, case .complexParams(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Grpc_Testing_ByteBufferParams: @unchecked Sendable {} +extension Grpc_Testing_SimpleProtoParams: @unchecked Sendable {} +extension Grpc_Testing_ComplexProtoParams: @unchecked Sendable {} +extension Grpc_Testing_PayloadConfig: @unchecked Sendable {} +extension Grpc_Testing_PayloadConfig.OneOf_Payload: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "grpc.testing" + +extension Grpc_Testing_ByteBufferParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ByteBufferParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "req_size"), + 2: .standard(proto: "resp_size"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.reqSize != 0 { + try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1) + } + if self.respSize != 0 { + try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ByteBufferParams, rhs: Grpc_Testing_ByteBufferParams) -> Bool { + if lhs.reqSize != rhs.reqSize {return false} + if lhs.respSize != rhs.respSize {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_SimpleProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SimpleProtoParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "req_size"), + 2: .standard(proto: "resp_size"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.reqSize) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.respSize) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.reqSize != 0 { + try visitor.visitSingularInt32Field(value: self.reqSize, fieldNumber: 1) + } + if self.respSize != 0 { + try visitor.visitSingularInt32Field(value: self.respSize, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_SimpleProtoParams, rhs: Grpc_Testing_SimpleProtoParams) -> Bool { + if lhs.reqSize != rhs.reqSize {return false} + if lhs.respSize != rhs.respSize {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ComplexProtoParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ComplexProtoParams" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ComplexProtoParams, rhs: Grpc_Testing_ComplexProtoParams) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_PayloadConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PayloadConfig" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "bytebuf_params"), + 2: .standard(proto: "simple_params"), + 3: .standard(proto: "complex_params"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { + var v: Grpc_Testing_ByteBufferParams? + var hadOneofValue = false + if let current = self.payload { + hadOneofValue = true + if case .bytebufParams(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.payload = .bytebufParams(v) + } + }() + case 2: try { + var v: Grpc_Testing_SimpleProtoParams? + var hadOneofValue = false + if let current = self.payload { + hadOneofValue = true + if case .simpleParams(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.payload = .simpleParams(v) + } + }() + case 3: try { + var v: Grpc_Testing_ComplexProtoParams? + var hadOneofValue = false + if let current = self.payload { + hadOneofValue = true + if case .complexParams(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.payload = .complexParams(v) + } + }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + switch self.payload { + case .bytebufParams?: try { + guard case .bytebufParams(let v)? = self.payload else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + }() + case .simpleParams?: try { + guard case .simpleParams(let v)? = self.payload else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + }() + case .complexParams?: try { + guard case .complexParams(let v)? = self.payload else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_PayloadConfig, rhs: Grpc_Testing_PayloadConfig) -> Bool { + if lhs.payload != rhs.payload {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/performance-worker/Generated/stats.pb.swift b/Sources/performance-worker/Generated/stats.pb.swift new file mode 100644 index 000000000..7e61ab4fa --- /dev/null +++ b/Sources/performance-worker/Generated/stats.pb.swift @@ -0,0 +1,470 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/stats.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Grpc_Testing_ServerStats { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// wall clock time change in seconds since last reset + var timeElapsed: Double = 0 + + /// change in user time (in seconds) used by the server since last reset + var timeUser: Double = 0 + + /// change in server time (in seconds) used by the server process and all + /// threads since last reset + var timeSystem: Double = 0 + + /// change in total cpu time of the server (data from proc/stat) + var totalCpuTime: UInt64 = 0 + + /// change in idle time of the server (data from proc/stat) + var idleCpuTime: UInt64 = 0 + + /// Number of polls called inside completion queue + var cqPollCount: UInt64 = 0 + + /// Core library stats + var coreStats: Grpc_Core_Stats { + get {return _coreStats ?? Grpc_Core_Stats()} + set {_coreStats = newValue} + } + /// Returns true if `coreStats` has been explicitly set. + var hasCoreStats: Bool {return self._coreStats != nil} + /// Clears the value of `coreStats`. Subsequent reads from it will return its default value. + mutating func clearCoreStats() {self._coreStats = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _coreStats: Grpc_Core_Stats? = nil +} + +/// Histogram params based on grpc/support/histogram.c +struct Grpc_Testing_HistogramParams { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// first bucket is [0, 1 + resolution) + var resolution: Double = 0 + + /// use enough buckets to allow this value + var maxPossible: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Histogram data based on grpc/support/histogram.c +struct Grpc_Testing_HistogramData { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var bucket: [UInt32] = [] + + var minSeen: Double = 0 + + var maxSeen: Double = 0 + + var sum: Double = 0 + + var sumOfSquares: Double = 0 + + var count: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_RequestResultCount { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var statusCode: Int32 = 0 + + var count: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Grpc_Testing_ClientStats { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Latency histogram. Data points are in nanoseconds. + var latencies: Grpc_Testing_HistogramData { + get {return _latencies ?? Grpc_Testing_HistogramData()} + set {_latencies = newValue} + } + /// Returns true if `latencies` has been explicitly set. + var hasLatencies: Bool {return self._latencies != nil} + /// Clears the value of `latencies`. Subsequent reads from it will return its default value. + mutating func clearLatencies() {self._latencies = nil} + + /// See ServerStats for details. + var timeElapsed: Double = 0 + + var timeUser: Double = 0 + + var timeSystem: Double = 0 + + /// Number of failed requests (one row per status code seen) + var requestResults: [Grpc_Testing_RequestResultCount] = [] + + /// Number of polls called inside completion queue + var cqPollCount: UInt64 = 0 + + /// Core library stats + var coreStats: Grpc_Core_Stats { + get {return _coreStats ?? Grpc_Core_Stats()} + set {_coreStats = newValue} + } + /// Returns true if `coreStats` has been explicitly set. + var hasCoreStats: Bool {return self._coreStats != nil} + /// Clears the value of `coreStats`. Subsequent reads from it will return its default value. + mutating func clearCoreStats() {self._coreStats = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _latencies: Grpc_Testing_HistogramData? = nil + fileprivate var _coreStats: Grpc_Core_Stats? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Grpc_Testing_ServerStats: @unchecked Sendable {} +extension Grpc_Testing_HistogramParams: @unchecked Sendable {} +extension Grpc_Testing_HistogramData: @unchecked Sendable {} +extension Grpc_Testing_RequestResultCount: @unchecked Sendable {} +extension Grpc_Testing_ClientStats: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "grpc.testing" + +extension Grpc_Testing_ServerStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ServerStats" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "time_elapsed"), + 2: .standard(proto: "time_user"), + 3: .standard(proto: "time_system"), + 4: .standard(proto: "total_cpu_time"), + 5: .standard(proto: "idle_cpu_time"), + 6: .standard(proto: "cq_poll_count"), + 7: .standard(proto: "core_stats"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &self.timeElapsed) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.timeUser) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.timeSystem) }() + case 4: try { try decoder.decodeSingularUInt64Field(value: &self.totalCpuTime) }() + case 5: try { try decoder.decodeSingularUInt64Field(value: &self.idleCpuTime) }() + case 6: try { try decoder.decodeSingularUInt64Field(value: &self.cqPollCount) }() + case 7: try { try decoder.decodeSingularMessageField(value: &self._coreStats) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + if self.timeElapsed != 0 { + try visitor.visitSingularDoubleField(value: self.timeElapsed, fieldNumber: 1) + } + if self.timeUser != 0 { + try visitor.visitSingularDoubleField(value: self.timeUser, fieldNumber: 2) + } + if self.timeSystem != 0 { + try visitor.visitSingularDoubleField(value: self.timeSystem, fieldNumber: 3) + } + if self.totalCpuTime != 0 { + try visitor.visitSingularUInt64Field(value: self.totalCpuTime, fieldNumber: 4) + } + if self.idleCpuTime != 0 { + try visitor.visitSingularUInt64Field(value: self.idleCpuTime, fieldNumber: 5) + } + if self.cqPollCount != 0 { + try visitor.visitSingularUInt64Field(value: self.cqPollCount, fieldNumber: 6) + } + try { if let v = self._coreStats { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ServerStats, rhs: Grpc_Testing_ServerStats) -> Bool { + if lhs.timeElapsed != rhs.timeElapsed {return false} + if lhs.timeUser != rhs.timeUser {return false} + if lhs.timeSystem != rhs.timeSystem {return false} + if lhs.totalCpuTime != rhs.totalCpuTime {return false} + if lhs.idleCpuTime != rhs.idleCpuTime {return false} + if lhs.cqPollCount != rhs.cqPollCount {return false} + if lhs._coreStats != rhs._coreStats {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_HistogramParams: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HistogramParams" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "resolution"), + 2: .standard(proto: "max_possible"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &self.resolution) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.maxPossible) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.resolution != 0 { + try visitor.visitSingularDoubleField(value: self.resolution, fieldNumber: 1) + } + if self.maxPossible != 0 { + try visitor.visitSingularDoubleField(value: self.maxPossible, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_HistogramParams, rhs: Grpc_Testing_HistogramParams) -> Bool { + if lhs.resolution != rhs.resolution {return false} + if lhs.maxPossible != rhs.maxPossible {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_HistogramData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HistogramData" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "bucket"), + 2: .standard(proto: "min_seen"), + 3: .standard(proto: "max_seen"), + 4: .same(proto: "sum"), + 5: .standard(proto: "sum_of_squares"), + 6: .same(proto: "count"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedUInt32Field(value: &self.bucket) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.minSeen) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.maxSeen) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.sum) }() + case 5: try { try decoder.decodeSingularDoubleField(value: &self.sumOfSquares) }() + case 6: try { try decoder.decodeSingularDoubleField(value: &self.count) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.bucket.isEmpty { + try visitor.visitPackedUInt32Field(value: self.bucket, fieldNumber: 1) + } + if self.minSeen != 0 { + try visitor.visitSingularDoubleField(value: self.minSeen, fieldNumber: 2) + } + if self.maxSeen != 0 { + try visitor.visitSingularDoubleField(value: self.maxSeen, fieldNumber: 3) + } + if self.sum != 0 { + try visitor.visitSingularDoubleField(value: self.sum, fieldNumber: 4) + } + if self.sumOfSquares != 0 { + try visitor.visitSingularDoubleField(value: self.sumOfSquares, fieldNumber: 5) + } + if self.count != 0 { + try visitor.visitSingularDoubleField(value: self.count, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_HistogramData, rhs: Grpc_Testing_HistogramData) -> Bool { + if lhs.bucket != rhs.bucket {return false} + if lhs.minSeen != rhs.minSeen {return false} + if lhs.maxSeen != rhs.maxSeen {return false} + if lhs.sum != rhs.sum {return false} + if lhs.sumOfSquares != rhs.sumOfSquares {return false} + if lhs.count != rhs.count {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_RequestResultCount: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RequestResultCount" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "status_code"), + 2: .same(proto: "count"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.statusCode) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.count) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.statusCode != 0 { + try visitor.visitSingularInt32Field(value: self.statusCode, fieldNumber: 1) + } + if self.count != 0 { + try visitor.visitSingularInt64Field(value: self.count, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_RequestResultCount, rhs: Grpc_Testing_RequestResultCount) -> Bool { + if lhs.statusCode != rhs.statusCode {return false} + if lhs.count != rhs.count {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Grpc_Testing_ClientStats: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClientStats" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "latencies"), + 2: .standard(proto: "time_elapsed"), + 3: .standard(proto: "time_user"), + 4: .standard(proto: "time_system"), + 5: .standard(proto: "request_results"), + 6: .standard(proto: "cq_poll_count"), + 7: .standard(proto: "core_stats"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._latencies) }() + case 2: try { try decoder.decodeSingularDoubleField(value: &self.timeElapsed) }() + case 3: try { try decoder.decodeSingularDoubleField(value: &self.timeUser) }() + case 4: try { try decoder.decodeSingularDoubleField(value: &self.timeSystem) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.requestResults) }() + case 6: try { try decoder.decodeSingularUInt64Field(value: &self.cqPollCount) }() + case 7: try { try decoder.decodeSingularMessageField(value: &self._coreStats) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._latencies { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.timeElapsed != 0 { + try visitor.visitSingularDoubleField(value: self.timeElapsed, fieldNumber: 2) + } + if self.timeUser != 0 { + try visitor.visitSingularDoubleField(value: self.timeUser, fieldNumber: 3) + } + if self.timeSystem != 0 { + try visitor.visitSingularDoubleField(value: self.timeSystem, fieldNumber: 4) + } + if !self.requestResults.isEmpty { + try visitor.visitRepeatedMessageField(value: self.requestResults, fieldNumber: 5) + } + if self.cqPollCount != 0 { + try visitor.visitSingularUInt64Field(value: self.cqPollCount, fieldNumber: 6) + } + try { if let v = self._coreStats { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Grpc_Testing_ClientStats, rhs: Grpc_Testing_ClientStats) -> Bool { + if lhs._latencies != rhs._latencies {return false} + if lhs.timeElapsed != rhs.timeElapsed {return false} + if lhs.timeUser != rhs.timeUser {return false} + if lhs.timeSystem != rhs.timeSystem {return false} + if lhs.requestResults != rhs.requestResults {return false} + if lhs.cqPollCount != rhs.cqPollCount {return false} + if lhs._coreStats != rhs._coreStats {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/performance-worker/Generated/worker_service.grpc.swift b/Sources/performance-worker/Generated/worker_service.grpc.swift new file mode 100644 index 000000000..012a2aeae --- /dev/null +++ b/Sources/performance-worker/Generated/worker_service.grpc.swift @@ -0,0 +1,362 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// An integration test service that covers all the method signature permutations +/// of unary/streaming requests/responses. + +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the gRPC Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/worker_service.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/grpc/grpc-swift + +import GRPCCore +import GRPCProtobuf + +internal enum Grpc_Testing_WorkerService { + internal enum Method { + internal enum RunServer { + internal typealias Input = Grpc_Testing_ServerArgs + internal typealias Output = Grpc_Testing_ServerStatus + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.WorkerService", + method: "RunServer" + ) + } + internal enum RunClient { + internal typealias Input = Grpc_Testing_ClientArgs + internal typealias Output = Grpc_Testing_ClientStatus + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.WorkerService", + method: "RunClient" + ) + } + internal enum CoreCount { + internal typealias Input = Grpc_Testing_CoreRequest + internal typealias Output = Grpc_Testing_CoreResponse + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.WorkerService", + method: "CoreCount" + ) + } + internal enum QuitWorker { + internal typealias Input = Grpc_Testing_Void + internal typealias Output = Grpc_Testing_Void + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.WorkerService", + method: "QuitWorker" + ) + } + internal static let descriptors: [MethodDescriptor] = [ + RunServer.descriptor, + RunClient.descriptor, + CoreCount.descriptor, + QuitWorker.descriptor + ] + } + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias StreamingServiceProtocol = Grpc_Testing_WorkerServiceStreamingServiceProtocol + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias ServiceProtocol = Grpc_Testing_WorkerServiceServiceProtocol + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias ClientProtocol = Grpc_Testing_WorkerServiceClientProtocol + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias Client = Grpc_Testing_WorkerServiceClient +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal protocol Grpc_Testing_WorkerServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + func runServer(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + func runClient(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Just return the core count - unary call + func coreCount(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Quit this worker + func quitWorker(request: ServerRequest.Stream) async throws -> ServerResponse.Stream +} + +/// Conformance to `GRPCCore.RegistrableRPCService`. +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +extension Grpc_Testing_WorkerService.StreamingServiceProtocol { + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal func registerMethods(with router: inout GRPCCore.RPCRouter) { + router.registerHandler( + forMethod: Grpc_Testing_WorkerService.Method.RunServer.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.runServer(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_WorkerService.Method.RunClient.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.runClient(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_WorkerService.Method.CoreCount.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.coreCount(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_WorkerService.Method.QuitWorker.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.quitWorker(request: request) + } + ) + } +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal protocol Grpc_Testing_WorkerServiceServiceProtocol: Grpc_Testing_WorkerService.StreamingServiceProtocol { + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + func runServer(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + func runClient(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Just return the core count - unary call + func coreCount(request: ServerRequest.Single) async throws -> ServerResponse.Single + + /// Quit this worker + func quitWorker(request: ServerRequest.Single) async throws -> ServerResponse.Single +} + +/// Partial conformance to `Grpc_Testing_WorkerServiceStreamingServiceProtocol`. +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +extension Grpc_Testing_WorkerService.ServiceProtocol { + internal func coreCount(request: ServerRequest.Stream) async throws -> ServerResponse.Stream { + let response = try await self.coreCount(request: ServerRequest.Single(stream: request)) + return ServerResponse.Stream(single: response) + } + + internal func quitWorker(request: ServerRequest.Stream) async throws -> ServerResponse.Stream { + let response = try await self.quitWorker(request: ServerRequest.Single(stream: request)) + return ServerResponse.Stream(single: response) + } +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal protocol Grpc_Testing_WorkerServiceClientProtocol: Sendable { + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + func runServer( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable + + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + func runClient( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable + + /// Just return the core count - unary call + func coreCount( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable + + /// Quit this worker + func quitWorker( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +extension Grpc_Testing_WorkerService.ClientProtocol { + internal func runServer( + request: ClientRequest.Stream, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.runServer( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func runClient( + request: ClientRequest.Stream, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.runClient( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func coreCount( + request: ClientRequest.Single, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.coreCount( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func quitWorker( + request: ClientRequest.Single, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.quitWorker( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal struct Grpc_Testing_WorkerServiceClient: Grpc_Testing_WorkerService.ClientProtocol { + private let client: GRPCCore.GRPCClient + + internal init(client: GRPCCore.GRPCClient) { + self.client = client + } + + /// Start server with specified workload. + /// First request sent specifies the ServerConfig followed by ServerStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test server + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + internal func runServer( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.bidirectionalStreaming( + request: request, + descriptor: Grpc_Testing_WorkerService.Method.RunServer.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Start client with specified workload. + /// First request sent specifies the ClientConfig followed by ClientStatus + /// response. After that, a "Mark" can be sent anytime to request the latest + /// stats. Closing the stream will initiate shutdown of the test client + /// and once the shutdown has finished, the OK status is sent to terminate + /// this RPC. + internal func runClient( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.bidirectionalStreaming( + request: request, + descriptor: Grpc_Testing_WorkerService.Method.RunClient.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Just return the core count - unary call + internal func coreCount( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.unary( + request: request, + descriptor: Grpc_Testing_WorkerService.Method.CoreCount.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Quit this worker + internal func quitWorker( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.unary( + request: request, + descriptor: Grpc_Testing_WorkerService.Method.QuitWorker.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } +} \ No newline at end of file diff --git a/Sources/performance-worker/Generated/worker_service.pb.swift b/Sources/performance-worker/Generated/worker_service.pb.swift new file mode 100644 index 000000000..6cacd66fa --- /dev/null +++ b/Sources/performance-worker/Generated/worker_service.pb.swift @@ -0,0 +1,38 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/worker_service.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// An integration test service that covers all the method signature permutations +/// of unary/streaming requests/responses. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} From b3f148334b2e4ea49a60c2a969a40a5cbe83ab27 Mon Sep 17 00:00:00 2001 From: Stefana Dranca Date: Wed, 13 Mar 2024 10:50:04 +0000 Subject: [PATCH 2/6] added main to executable target --- Sources/performance-worker/main.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Sources/performance-worker/main.swift diff --git a/Sources/performance-worker/main.swift b/Sources/performance-worker/main.swift new file mode 100644 index 000000000..0dddaca9f --- /dev/null +++ b/Sources/performance-worker/main.swift @@ -0,0 +1,18 @@ +/* + * Copyright 2024, gRPC Authors All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +func main(args: [String]) throws { +} From 642c89453a7dc5ab52c03687e322b1ce8e909a70 Mon Sep 17 00:00:00 2001 From: Stefana Dranca Date: Wed, 13 Mar 2024 10:53:59 +0000 Subject: [PATCH 3/6] fixed formatting --- .../Generated/control.pb.swift | 8 ++--- .../Generated/worker_service.grpc.swift | 36 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Sources/performance-worker/Generated/control.pb.swift b/Sources/performance-worker/Generated/control.pb.swift index 29c5cda47..3f3fb66c7 100644 --- a/Sources/performance-worker/Generated/control.pb.swift +++ b/Sources/performance-worker/Generated/control.pb.swift @@ -833,8 +833,8 @@ struct Grpc_Testing_ScenarioResultSummary { // methods supported on all messages. /// Total number of operations per second over all clients. What is counted as 1 'operation' depends on the benchmark scenarios: - /// For unary benchmarks, an operation is processing of a single unary RPC. - /// For streaming benchmarks, an operation is processing of a single ping pong of request and response. + /// For unary benchmarks, an operation is processing of a single unary RPC. + /// For streaming benchmarks, an operation is processing of a single ping pong of request and response. var qps: Double { get {return _storage._qps} set {_uniqueStorage()._qps = newValue} @@ -847,8 +847,8 @@ struct Grpc_Testing_ScenarioResultSummary { } /// The total server cpu load based on system time across all server processes, expressed as percentage of a single cpu core. - /// For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server - /// processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. + /// For example, 85 implies 85% of a cpu core, 125 implies 125% of a cpu core. Since we are accumulating the cpu load across all the server + /// processes, the value could > 100 when there are multiple servers or a single server using multiple threads and cores. /// Same explanation for the total client cpu load below. var serverSystemTime: Double { get {return _storage._serverSystemTime} diff --git a/Sources/performance-worker/Generated/worker_service.grpc.swift b/Sources/performance-worker/Generated/worker_service.grpc.swift index 012a2aeae..be1ec58fc 100644 --- a/Sources/performance-worker/Generated/worker_service.grpc.swift +++ b/Sources/performance-worker/Generated/worker_service.grpc.swift @@ -87,7 +87,7 @@ internal protocol Grpc_Testing_WorkerServiceStreamingServiceProtocol: GRPCCore.R /// and once the shutdown has finished, the OK status is sent to terminate /// this RPC. func runServer(request: ServerRequest.Stream) async throws -> ServerResponse.Stream - + /// Start client with specified workload. /// First request sent specifies the ClientConfig followed by ClientStatus /// response. After that, a "Mark" can be sent anytime to request the latest @@ -95,10 +95,10 @@ internal protocol Grpc_Testing_WorkerServiceStreamingServiceProtocol: GRPCCore.R /// and once the shutdown has finished, the OK status is sent to terminate /// this RPC. func runClient(request: ServerRequest.Stream) async throws -> ServerResponse.Stream - + /// Just return the core count - unary call func coreCount(request: ServerRequest.Stream) async throws -> ServerResponse.Stream - + /// Quit this worker func quitWorker(request: ServerRequest.Stream) async throws -> ServerResponse.Stream } @@ -152,7 +152,7 @@ internal protocol Grpc_Testing_WorkerServiceServiceProtocol: Grpc_Testing_Worker /// and once the shutdown has finished, the OK status is sent to terminate /// this RPC. func runServer(request: ServerRequest.Stream) async throws -> ServerResponse.Stream - + /// Start client with specified workload. /// First request sent specifies the ClientConfig followed by ClientStatus /// response. After that, a "Mark" can be sent anytime to request the latest @@ -160,10 +160,10 @@ internal protocol Grpc_Testing_WorkerServiceServiceProtocol: Grpc_Testing_Worker /// and once the shutdown has finished, the OK status is sent to terminate /// this RPC. func runClient(request: ServerRequest.Stream) async throws -> ServerResponse.Stream - + /// Just return the core count - unary call func coreCount(request: ServerRequest.Single) async throws -> ServerResponse.Single - + /// Quit this worker func quitWorker(request: ServerRequest.Single) async throws -> ServerResponse.Single } @@ -175,7 +175,7 @@ extension Grpc_Testing_WorkerService.ServiceProtocol { let response = try await self.coreCount(request: ServerRequest.Single(stream: request)) return ServerResponse.Stream(single: response) } - + internal func quitWorker(request: ServerRequest.Stream) async throws -> ServerResponse.Stream { let response = try await self.quitWorker(request: ServerRequest.Single(stream: request)) return ServerResponse.Stream(single: response) @@ -196,7 +196,7 @@ internal protocol Grpc_Testing_WorkerServiceClientProtocol: Sendable { deserializer: some MessageDeserializer, _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R ) async throws -> R where R: Sendable - + /// Start client with specified workload. /// First request sent specifies the ClientConfig followed by ClientStatus /// response. After that, a "Mark" can be sent anytime to request the latest @@ -209,7 +209,7 @@ internal protocol Grpc_Testing_WorkerServiceClientProtocol: Sendable { deserializer: some MessageDeserializer, _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R ) async throws -> R where R: Sendable - + /// Just return the core count - unary call func coreCount( request: ClientRequest.Single, @@ -217,7 +217,7 @@ internal protocol Grpc_Testing_WorkerServiceClientProtocol: Sendable { deserializer: some MessageDeserializer, _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R ) async throws -> R where R: Sendable - + /// Quit this worker func quitWorker( request: ClientRequest.Single, @@ -240,7 +240,7 @@ extension Grpc_Testing_WorkerService.ClientProtocol { body ) } - + internal func runClient( request: ClientRequest.Stream, _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R @@ -252,7 +252,7 @@ extension Grpc_Testing_WorkerService.ClientProtocol { body ) } - + internal func coreCount( request: ClientRequest.Single, _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R @@ -264,7 +264,7 @@ extension Grpc_Testing_WorkerService.ClientProtocol { body ) } - + internal func quitWorker( request: ClientRequest.Single, _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R @@ -281,11 +281,11 @@ extension Grpc_Testing_WorkerService.ClientProtocol { @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) internal struct Grpc_Testing_WorkerServiceClient: Grpc_Testing_WorkerService.ClientProtocol { private let client: GRPCCore.GRPCClient - + internal init(client: GRPCCore.GRPCClient) { self.client = client } - + /// Start server with specified workload. /// First request sent specifies the ServerConfig followed by ServerStatus /// response. After that, a "Mark" can be sent anytime to request the latest @@ -306,7 +306,7 @@ internal struct Grpc_Testing_WorkerServiceClient: Grpc_Testing_WorkerService.Cli handler: body ) } - + /// Start client with specified workload. /// First request sent specifies the ClientConfig followed by ClientStatus /// response. After that, a "Mark" can be sent anytime to request the latest @@ -327,7 +327,7 @@ internal struct Grpc_Testing_WorkerServiceClient: Grpc_Testing_WorkerService.Cli handler: body ) } - + /// Just return the core count - unary call internal func coreCount( request: ClientRequest.Single, @@ -343,7 +343,7 @@ internal struct Grpc_Testing_WorkerServiceClient: Grpc_Testing_WorkerService.Cli handler: body ) } - + /// Quit this worker internal func quitWorker( request: ClientRequest.Single, From e4841b0833f03d892a90200fbd4384cd6e5c8e2b Mon Sep 17 00:00:00 2001 From: Stefana Dranca Date: Wed, 13 Mar 2024 14:11:34 +0000 Subject: [PATCH 4/6] added missing generated code files --- Protos/generate.sh | 2 +- .../Generated/benchmark_service.grpc.swift | 410 ++++++++++++++++++ .../Generated/benchmark_service.pb.swift | 38 ++ 3 files changed, 449 insertions(+), 1 deletion(-) create mode 100644 Sources/performance-worker/Generated/benchmark_service.grpc.swift create mode 100644 Sources/performance-worker/Generated/benchmark_service.pb.swift diff --git a/Protos/generate.sh b/Protos/generate.sh index 846325ed0..aacbb7850 100755 --- a/Protos/generate.sh +++ b/Protos/generate.sh @@ -206,8 +206,8 @@ function generate_qps_code { "$here/upstream/grpc/testing/payloads.proto" "$here/upstream/grpc/testing/control.proto" "$here/upstream/grpc/testing/messages.proto" - "$here/upstream/grpc/testing/messages.proto" "$here/upstream/grpc/testing/stats.proto" + "$here/upstream/grpc/testing/benchmark_service.proto" "$here/upstream/grpc/testing/worker_service.proto" ) diff --git a/Sources/performance-worker/Generated/benchmark_service.grpc.swift b/Sources/performance-worker/Generated/benchmark_service.grpc.swift new file mode 100644 index 000000000..6dfe17fa0 --- /dev/null +++ b/Sources/performance-worker/Generated/benchmark_service.grpc.swift @@ -0,0 +1,410 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// An integration test service that covers all the method signature permutations +/// of unary/streaming requests/responses. + +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the gRPC Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/benchmark_service.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/grpc/grpc-swift + +import GRPCCore +import GRPCProtobuf + +internal enum Grpc_Testing_BenchmarkService { + internal enum Method { + internal enum UnaryCall { + internal typealias Input = Grpc_Testing_SimpleRequest + internal typealias Output = Grpc_Testing_SimpleResponse + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.BenchmarkService", + method: "UnaryCall" + ) + } + internal enum StreamingCall { + internal typealias Input = Grpc_Testing_SimpleRequest + internal typealias Output = Grpc_Testing_SimpleResponse + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.BenchmarkService", + method: "StreamingCall" + ) + } + internal enum StreamingFromClient { + internal typealias Input = Grpc_Testing_SimpleRequest + internal typealias Output = Grpc_Testing_SimpleResponse + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.BenchmarkService", + method: "StreamingFromClient" + ) + } + internal enum StreamingFromServer { + internal typealias Input = Grpc_Testing_SimpleRequest + internal typealias Output = Grpc_Testing_SimpleResponse + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.BenchmarkService", + method: "StreamingFromServer" + ) + } + internal enum StreamingBothWays { + internal typealias Input = Grpc_Testing_SimpleRequest + internal typealias Output = Grpc_Testing_SimpleResponse + internal static let descriptor = MethodDescriptor( + service: "grpc.testing.BenchmarkService", + method: "StreamingBothWays" + ) + } + internal static let descriptors: [MethodDescriptor] = [ + UnaryCall.descriptor, + StreamingCall.descriptor, + StreamingFromClient.descriptor, + StreamingFromServer.descriptor, + StreamingBothWays.descriptor + ] + } + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias StreamingServiceProtocol = Grpc_Testing_BenchmarkServiceStreamingServiceProtocol + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias ServiceProtocol = Grpc_Testing_BenchmarkServiceServiceProtocol + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias ClientProtocol = Grpc_Testing_BenchmarkServiceClientProtocol + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal typealias Client = Grpc_Testing_BenchmarkServiceClient +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal protocol Grpc_Testing_BenchmarkServiceStreamingServiceProtocol: GRPCCore.RegistrableRPCService { + /// One request followed by one response. + /// The server returns the client payload as-is. + func unaryCall(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response + func streamingCall(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + func streamingFromClient(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + func streamingFromServer(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + func streamingBothWays(request: ServerRequest.Stream) async throws -> ServerResponse.Stream +} + +/// Conformance to `GRPCCore.RegistrableRPCService`. +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +extension Grpc_Testing_BenchmarkService.StreamingServiceProtocol { + @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) + internal func registerMethods(with router: inout GRPCCore.RPCRouter) { + router.registerHandler( + forMethod: Grpc_Testing_BenchmarkService.Method.UnaryCall.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.unaryCall(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_BenchmarkService.Method.StreamingCall.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.streamingCall(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_BenchmarkService.Method.StreamingFromClient.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.streamingFromClient(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_BenchmarkService.Method.StreamingFromServer.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.streamingFromServer(request: request) + } + ) + router.registerHandler( + forMethod: Grpc_Testing_BenchmarkService.Method.StreamingBothWays.descriptor, + deserializer: ProtobufDeserializer(), + serializer: ProtobufSerializer(), + handler: { request in + try await self.streamingBothWays(request: request) + } + ) + } +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal protocol Grpc_Testing_BenchmarkServiceServiceProtocol: Grpc_Testing_BenchmarkService.StreamingServiceProtocol { + /// One request followed by one response. + /// The server returns the client payload as-is. + func unaryCall(request: ServerRequest.Single) async throws -> ServerResponse.Single + + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response + func streamingCall(request: ServerRequest.Stream) async throws -> ServerResponse.Stream + + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + func streamingFromClient(request: ServerRequest.Stream) async throws -> ServerResponse.Single + + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + func streamingFromServer(request: ServerRequest.Single) async throws -> ServerResponse.Stream + + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + func streamingBothWays(request: ServerRequest.Stream) async throws -> ServerResponse.Stream +} + +/// Partial conformance to `Grpc_Testing_BenchmarkServiceStreamingServiceProtocol`. +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +extension Grpc_Testing_BenchmarkService.ServiceProtocol { + internal func unaryCall(request: ServerRequest.Stream) async throws -> ServerResponse.Stream { + let response = try await self.unaryCall(request: ServerRequest.Single(stream: request)) + return ServerResponse.Stream(single: response) + } + + internal func streamingFromClient(request: ServerRequest.Stream) async throws -> ServerResponse.Stream { + let response = try await self.streamingFromClient(request: request) + return ServerResponse.Stream(single: response) + } + + internal func streamingFromServer(request: ServerRequest.Stream) async throws -> ServerResponse.Stream { + let response = try await self.streamingFromServer(request: ServerRequest.Single(stream: request)) + return response + } +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal protocol Grpc_Testing_BenchmarkServiceClientProtocol: Sendable { + /// One request followed by one response. + /// The server returns the client payload as-is. + func unaryCall( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable + + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response + func streamingCall( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable + + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + func streamingFromClient( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable + + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + func streamingFromServer( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable + + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + func streamingBothWays( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +extension Grpc_Testing_BenchmarkService.ClientProtocol { + internal func unaryCall( + request: ClientRequest.Single, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.unaryCall( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func streamingCall( + request: ClientRequest.Stream, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.streamingCall( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func streamingFromClient( + request: ClientRequest.Stream, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.streamingFromClient( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func streamingFromServer( + request: ClientRequest.Single, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.streamingFromServer( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } + + internal func streamingBothWays( + request: ClientRequest.Stream, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.streamingBothWays( + request: request, + serializer: ProtobufSerializer(), + deserializer: ProtobufDeserializer(), + body + ) + } +} + +@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) +internal struct Grpc_Testing_BenchmarkServiceClient: Grpc_Testing_BenchmarkService.ClientProtocol { + private let client: GRPCCore.GRPCClient + + internal init(client: GRPCCore.GRPCClient) { + self.client = client + } + + /// One request followed by one response. + /// The server returns the client payload as-is. + internal func unaryCall( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.unary( + request: request, + descriptor: Grpc_Testing_BenchmarkService.Method.UnaryCall.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Repeated sequence of one request followed by one response. + /// Should be called streaming ping-pong + /// The server returns the client payload as-is on each response + internal func streamingCall( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.bidirectionalStreaming( + request: request, + descriptor: Grpc_Testing_BenchmarkService.Method.StreamingCall.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Single-sided unbounded streaming from client to server + /// The server returns the client payload as-is once the client does WritesDone + internal func streamingFromClient( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.clientStreaming( + request: request, + descriptor: Grpc_Testing_BenchmarkService.Method.StreamingFromClient.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Single-sided unbounded streaming from server to client + /// The server repeatedly returns the client payload as-is + internal func streamingFromServer( + request: ClientRequest.Single, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.serverStreaming( + request: request, + descriptor: Grpc_Testing_BenchmarkService.Method.StreamingFromServer.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } + + /// Two-sided unbounded streaming between server to client + /// Both sides send the content of their own choice to the other + internal func streamingBothWays( + request: ClientRequest.Stream, + serializer: some MessageSerializer, + deserializer: some MessageDeserializer, + _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R + ) async throws -> R where R: Sendable { + try await self.client.bidirectionalStreaming( + request: request, + descriptor: Grpc_Testing_BenchmarkService.Method.StreamingBothWays.descriptor, + serializer: serializer, + deserializer: deserializer, + handler: body + ) + } +} \ No newline at end of file diff --git a/Sources/performance-worker/Generated/benchmark_service.pb.swift b/Sources/performance-worker/Generated/benchmark_service.pb.swift new file mode 100644 index 000000000..745e5b757 --- /dev/null +++ b/Sources/performance-worker/Generated/benchmark_service.pb.swift @@ -0,0 +1,38 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: grpc/testing/benchmark_service.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/// An integration test service that covers all the method signature permutations +/// of unary/streaming requests/responses. + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} From 7b7af664ed9c27d50f192fd1e96b308c15f9ecbe Mon Sep 17 00:00:00 2001 From: Stefana Dranca Date: Wed, 13 Mar 2024 14:37:34 +0000 Subject: [PATCH 5/6] changed naming style for generated code files --- Protos/fetch.sh | 3 +-- Protos/generate.sh | 11 +++++------ ...wift => grpc_testing_benchmark_service.grpc.swift} | 0 ....swift => grpc_testing_benchmark_service.pb.swift} | 0 ...control.pb.swift => grpc_testing_control.pb.swift} | 0 ...ssages.pb.swift => grpc_testing_messages.pb.swift} | 0 ...yloads.pb.swift => grpc_testing_payloads.pb.swift} | 0 .../{stats.pb.swift => grpc_testing_stats.pb.swift} | 0 ...c.swift => grpc_testing_worker_service.grpc.swift} | 0 ....pb.swift => grpc_testing_worker_service.pb.swift} | 0 10 files changed, 6 insertions(+), 8 deletions(-) rename Sources/performance-worker/Generated/{benchmark_service.grpc.swift => grpc_testing_benchmark_service.grpc.swift} (100%) rename Sources/performance-worker/Generated/{benchmark_service.pb.swift => grpc_testing_benchmark_service.pb.swift} (100%) rename Sources/performance-worker/Generated/{control.pb.swift => grpc_testing_control.pb.swift} (100%) rename Sources/performance-worker/Generated/{messages.pb.swift => grpc_testing_messages.pb.swift} (100%) rename Sources/performance-worker/Generated/{payloads.pb.swift => grpc_testing_payloads.pb.swift} (100%) rename Sources/performance-worker/Generated/{stats.pb.swift => grpc_testing_stats.pb.swift} (100%) rename Sources/performance-worker/Generated/{worker_service.grpc.swift => grpc_testing_worker_service.grpc.swift} (100%) rename Sources/performance-worker/Generated/{worker_service.pb.swift => grpc_testing_worker_service.pb.swift} (100%) diff --git a/Protos/fetch.sh b/Protos/fetch.sh index 7db76f360..ba24d1558 100755 --- a/Protos/fetch.sh +++ b/Protos/fetch.sh @@ -23,7 +23,7 @@ upstream="$here/upstream" checkouts="$(mktemp -d)" # Clone the grpc and google protos into the staging area. -git clone --depth 2 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto" +git clone --depth 1 https://github.com/grpc/grpc-proto "$checkouts/grpc-proto" git clone --depth 1 https://github.com/googleapis/googleapis.git "$checkouts/googleapis" # Remove the old protos. @@ -31,7 +31,6 @@ rm -rf "$upstream" # Create new directories to poulate. These are based on proto package name # rather than source repository name. -mkdir -p "$upstream/grpc" mkdir -p "$upstream/google" mkdir -p "$upstream/grpc/testing" mkdir -p "$upstream/grpc/core" diff --git a/Protos/generate.sh b/Protos/generate.sh index aacbb7850..854bb2f1e 100755 --- a/Protos/generate.sh +++ b/Protos/generate.sh @@ -201,7 +201,7 @@ function generate_service_messages_interop_tests { done } -function generate_qps_code { +function generate_worker_service { local protos=( "$here/upstream/grpc/testing/payloads.proto" "$here/upstream/grpc/testing/control.proto" @@ -210,14 +210,13 @@ function generate_qps_code { "$here/upstream/grpc/testing/benchmark_service.proto" "$here/upstream/grpc/testing/worker_service.proto" ) - local output="$root/Sources/performance-worker/Generated" generate_message "$here/upstream/grpc/core/stats.proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=PathToUnderscores" for proto in "${protos[@]}"; do - generate_message "$proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=DropPath" - generate_grpc "$proto" "$here/upstream/" "$output" "Visibility=Internal" "Server=true" "_V2=true" "FileNaming=DropPath" + generate_message "$proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=PathToUnderscores" + generate_grpc "$proto" "$here/upstream" "$output" "Visibility=Internal" "Server=true" "_V2=true" "FileNaming=PathToUnderscores" done } @@ -241,5 +240,5 @@ generate_service_messages_interop_tests generate_normalization_for_tests generate_rpc_code_for_tests -# QPS Tests -generate_qps_code +# Performance worker service +generate_worker_service diff --git a/Sources/performance-worker/Generated/benchmark_service.grpc.swift b/Sources/performance-worker/Generated/grpc_testing_benchmark_service.grpc.swift similarity index 100% rename from Sources/performance-worker/Generated/benchmark_service.grpc.swift rename to Sources/performance-worker/Generated/grpc_testing_benchmark_service.grpc.swift diff --git a/Sources/performance-worker/Generated/benchmark_service.pb.swift b/Sources/performance-worker/Generated/grpc_testing_benchmark_service.pb.swift similarity index 100% rename from Sources/performance-worker/Generated/benchmark_service.pb.swift rename to Sources/performance-worker/Generated/grpc_testing_benchmark_service.pb.swift diff --git a/Sources/performance-worker/Generated/control.pb.swift b/Sources/performance-worker/Generated/grpc_testing_control.pb.swift similarity index 100% rename from Sources/performance-worker/Generated/control.pb.swift rename to Sources/performance-worker/Generated/grpc_testing_control.pb.swift diff --git a/Sources/performance-worker/Generated/messages.pb.swift b/Sources/performance-worker/Generated/grpc_testing_messages.pb.swift similarity index 100% rename from Sources/performance-worker/Generated/messages.pb.swift rename to Sources/performance-worker/Generated/grpc_testing_messages.pb.swift diff --git a/Sources/performance-worker/Generated/payloads.pb.swift b/Sources/performance-worker/Generated/grpc_testing_payloads.pb.swift similarity index 100% rename from Sources/performance-worker/Generated/payloads.pb.swift rename to Sources/performance-worker/Generated/grpc_testing_payloads.pb.swift diff --git a/Sources/performance-worker/Generated/stats.pb.swift b/Sources/performance-worker/Generated/grpc_testing_stats.pb.swift similarity index 100% rename from Sources/performance-worker/Generated/stats.pb.swift rename to Sources/performance-worker/Generated/grpc_testing_stats.pb.swift diff --git a/Sources/performance-worker/Generated/worker_service.grpc.swift b/Sources/performance-worker/Generated/grpc_testing_worker_service.grpc.swift similarity index 100% rename from Sources/performance-worker/Generated/worker_service.grpc.swift rename to Sources/performance-worker/Generated/grpc_testing_worker_service.grpc.swift diff --git a/Sources/performance-worker/Generated/worker_service.pb.swift b/Sources/performance-worker/Generated/grpc_testing_worker_service.pb.swift similarity index 100% rename from Sources/performance-worker/Generated/worker_service.pb.swift rename to Sources/performance-worker/Generated/grpc_testing_worker_service.pb.swift From 0028c8d634a45a4393d942741f14a4d676241576 Mon Sep 17 00:00:00 2001 From: Stefana Dranca Date: Wed, 13 Mar 2024 15:06:31 +0000 Subject: [PATCH 6/6] generate only the service code for the worker service --- Protos/generate.sh | 6 +- .../grpc_testing_worker_service.grpc.swift | 183 ------------------ 2 files changed, 5 insertions(+), 184 deletions(-) diff --git a/Protos/generate.sh b/Protos/generate.sh index 854bb2f1e..86f91b557 100755 --- a/Protos/generate.sh +++ b/Protos/generate.sh @@ -216,7 +216,11 @@ function generate_worker_service { for proto in "${protos[@]}"; do generate_message "$proto" "$here/upstream" "$output" "Visibility=Internal" "FileNaming=PathToUnderscores" - generate_grpc "$proto" "$here/upstream" "$output" "Visibility=Internal" "Server=true" "_V2=true" "FileNaming=PathToUnderscores" + if [ "$proto" == "$here/upstream/grpc/testing/worker_service.proto" ]; then + generate_grpc "$proto" "$here/upstream" "$output" "Visibility=Internal" "Client=false" "_V2=true" "FileNaming=PathToUnderscores" + else + generate_grpc "$proto" "$here/upstream" "$output" "Visibility=Internal" "_V2=true" "FileNaming=PathToUnderscores" + fi done } diff --git a/Sources/performance-worker/Generated/grpc_testing_worker_service.grpc.swift b/Sources/performance-worker/Generated/grpc_testing_worker_service.grpc.swift index be1ec58fc..0796543c2 100644 --- a/Sources/performance-worker/Generated/grpc_testing_worker_service.grpc.swift +++ b/Sources/performance-worker/Generated/grpc_testing_worker_service.grpc.swift @@ -72,10 +72,6 @@ internal enum Grpc_Testing_WorkerService { internal typealias StreamingServiceProtocol = Grpc_Testing_WorkerServiceStreamingServiceProtocol @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) internal typealias ServiceProtocol = Grpc_Testing_WorkerServiceServiceProtocol - @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) - internal typealias ClientProtocol = Grpc_Testing_WorkerServiceClientProtocol - @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) - internal typealias Client = Grpc_Testing_WorkerServiceClient } @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) @@ -180,183 +176,4 @@ extension Grpc_Testing_WorkerService.ServiceProtocol { let response = try await self.quitWorker(request: ServerRequest.Single(stream: request)) return ServerResponse.Stream(single: response) } -} - -@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) -internal protocol Grpc_Testing_WorkerServiceClientProtocol: Sendable { - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - func runServer( - request: ClientRequest.Stream, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R - ) async throws -> R where R: Sendable - - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - func runClient( - request: ClientRequest.Stream, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R - ) async throws -> R where R: Sendable - - /// Just return the core count - unary call - func coreCount( - request: ClientRequest.Single, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R - ) async throws -> R where R: Sendable - - /// Quit this worker - func quitWorker( - request: ClientRequest.Single, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R - ) async throws -> R where R: Sendable -} - -@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) -extension Grpc_Testing_WorkerService.ClientProtocol { - internal func runServer( - request: ClientRequest.Stream, - _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R - ) async throws -> R where R: Sendable { - try await self.runServer( - request: request, - serializer: ProtobufSerializer(), - deserializer: ProtobufDeserializer(), - body - ) - } - - internal func runClient( - request: ClientRequest.Stream, - _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R - ) async throws -> R where R: Sendable { - try await self.runClient( - request: request, - serializer: ProtobufSerializer(), - deserializer: ProtobufDeserializer(), - body - ) - } - - internal func coreCount( - request: ClientRequest.Single, - _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R - ) async throws -> R where R: Sendable { - try await self.coreCount( - request: request, - serializer: ProtobufSerializer(), - deserializer: ProtobufDeserializer(), - body - ) - } - - internal func quitWorker( - request: ClientRequest.Single, - _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R - ) async throws -> R where R: Sendable { - try await self.quitWorker( - request: request, - serializer: ProtobufSerializer(), - deserializer: ProtobufDeserializer(), - body - ) - } -} - -@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) -internal struct Grpc_Testing_WorkerServiceClient: Grpc_Testing_WorkerService.ClientProtocol { - private let client: GRPCCore.GRPCClient - - internal init(client: GRPCCore.GRPCClient) { - self.client = client - } - - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - internal func runServer( - request: ClientRequest.Stream, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R - ) async throws -> R where R: Sendable { - try await self.client.bidirectionalStreaming( - request: request, - descriptor: Grpc_Testing_WorkerService.Method.RunServer.descriptor, - serializer: serializer, - deserializer: deserializer, - handler: body - ) - } - - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - internal func runClient( - request: ClientRequest.Stream, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Stream) async throws -> R - ) async throws -> R where R: Sendable { - try await self.client.bidirectionalStreaming( - request: request, - descriptor: Grpc_Testing_WorkerService.Method.RunClient.descriptor, - serializer: serializer, - deserializer: deserializer, - handler: body - ) - } - - /// Just return the core count - unary call - internal func coreCount( - request: ClientRequest.Single, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R - ) async throws -> R where R: Sendable { - try await self.client.unary( - request: request, - descriptor: Grpc_Testing_WorkerService.Method.CoreCount.descriptor, - serializer: serializer, - deserializer: deserializer, - handler: body - ) - } - - /// Quit this worker - internal func quitWorker( - request: ClientRequest.Single, - serializer: some MessageSerializer, - deserializer: some MessageDeserializer, - _ body: @Sendable @escaping (ClientResponse.Single) async throws -> R - ) async throws -> R where R: Sendable { - try await self.client.unary( - request: request, - descriptor: Grpc_Testing_WorkerService.Method.QuitWorker.descriptor, - serializer: serializer, - deserializer: deserializer, - handler: body - ) - } } \ No newline at end of file