From 2821787f17267241409881624cbcccb0a878ed7b Mon Sep 17 00:00:00 2001 From: lb034582341 <128827887+lb034582341@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:06:59 +0200 Subject: [PATCH] Protobuf 3 support (#615) Signed-off-by: Ludovic Barman --- .github/workflows/ci.yml | 3 + Cargo.toml | 2 + benchmark/Cargo.toml | 7 +- benchmark/src/bench.rs | 9 +- benchmark/src/client.rs | 142 +- benchmark/src/server.rs | 64 +- benchmark/src/util.rs | 18 +- benchmark/src/worker.rs | 32 +- health/Cargo.toml | 2 + health/src/lib.rs | 8 +- health/src/proto.rs | 12 + health/src/proto/protobuf_v3/health.rs | 381 ++ health/src/proto/protobuf_v3/health_grpc.rs | 144 + health/src/proto/protobuf_v3/mod.rs | 3 + health/src/service.rs | 14 +- health/tests/health_check.rs | 36 +- interop/Cargo.toml | 14 +- interop/src/client.rs | 103 +- interop/src/server.rs | 72 +- proto/Cargo.toml | 2 + proto/src/lib.rs | 2 +- proto/src/proto.rs | 5 +- .../proto/protobuf_v3/example/helloworld.rs | 310 ++ .../protobuf_v3/example/helloworld_grpc.rs | 71 + proto/src/proto/protobuf_v3/example/mod.rs | 4 + .../proto/protobuf_v3/example/route_guide.rs | 822 ++++ .../protobuf_v3/example/route_guide_grpc.rs | 137 + proto/src/proto/protobuf_v3/google/rpc/mod.rs | 3 + .../proto/protobuf_v3/google/rpc/status.rs | 223 + .../src/proto/protobuf_v3/testing/control.rs | 4372 +++++++++++++++++ proto/src/proto/protobuf_v3/testing/empty.rs | 162 + .../src/proto/protobuf_v3/testing/messages.rs | 1960 ++++++++ proto/src/proto/protobuf_v3/testing/mod.rs | 9 + .../src/proto/protobuf_v3/testing/payloads.rs | 801 +++ .../src/proto/protobuf_v3/testing/services.rs | 78 + .../protobuf_v3/testing/services_grpc.rs | 341 ++ proto/src/proto/protobuf_v3/testing/stats.rs | 1004 ++++ proto/src/proto/protobuf_v3/testing/test.rs | 79 + .../proto/protobuf_v3/testing/test_grpc.rs | 387 ++ proto/src/util.rs | 14 +- src/codec.rs | 22 +- src/error.rs | 5 +- src/lib.rs | 2 +- tests-and-examples/Cargo.toml | 10 +- .../examples/hello_world/client.rs | 4 +- .../examples/hello_world/server.rs | 4 +- .../examples/load_balancing/client.rs | 4 +- .../examples/load_balancing/server.rs | 4 +- .../examples/route_guide/client.rs | 58 +- .../examples/route_guide/server.rs | 23 +- .../examples/route_guide/util.rs | 31 +- .../tests/cases/auth_context.rs | 17 +- tests-and-examples/tests/cases/credential.rs | 21 +- tests-and-examples/tests/cases/kick.rs | 30 +- tests-and-examples/tests/cases/metadata.rs | 13 +- tests-and-examples/tests/cases/misc.rs | 9 +- tests-and-examples/tests/cases/stream.rs | 18 +- xtask/Cargo.toml | 1 + xtask/src/main.rs | 162 +- 59 files changed, 11987 insertions(+), 303 deletions(-) create mode 100644 health/src/proto/protobuf_v3/health.rs create mode 100644 health/src/proto/protobuf_v3/health_grpc.rs create mode 100644 health/src/proto/protobuf_v3/mod.rs create mode 100644 proto/src/proto/protobuf_v3/example/helloworld.rs create mode 100644 proto/src/proto/protobuf_v3/example/helloworld_grpc.rs create mode 100644 proto/src/proto/protobuf_v3/example/mod.rs create mode 100644 proto/src/proto/protobuf_v3/example/route_guide.rs create mode 100644 proto/src/proto/protobuf_v3/example/route_guide_grpc.rs create mode 100644 proto/src/proto/protobuf_v3/google/rpc/mod.rs create mode 100644 proto/src/proto/protobuf_v3/google/rpc/status.rs create mode 100644 proto/src/proto/protobuf_v3/testing/control.rs create mode 100644 proto/src/proto/protobuf_v3/testing/empty.rs create mode 100644 proto/src/proto/protobuf_v3/testing/messages.rs create mode 100644 proto/src/proto/protobuf_v3/testing/mod.rs create mode 100644 proto/src/proto/protobuf_v3/testing/payloads.rs create mode 100644 proto/src/proto/protobuf_v3/testing/services.rs create mode 100644 proto/src/proto/protobuf_v3/testing/services_grpc.rs create mode 100644 proto/src/proto/protobuf_v3/testing/stats.rs create mode 100644 proto/src/proto/protobuf_v3/testing/test.rs create mode 100644 proto/src/proto/protobuf_v3/testing/test_grpc.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 444a20501..8adc32eae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,7 @@ jobs: - run: cargo xtask bindgen - run: cargo build --no-default-features - run: cargo build --no-default-features --features protobuf-codec + - run: cargo build --no-default-features --features protobufv3-codec - run: cargo build --no-default-features --features prost-codec - run: cd proto && cargo build --no-default-features --features prost-codec - run: cargo build @@ -80,6 +81,7 @@ jobs: - run: cargo xtask submodule - run: cargo build --no-default-features - run: cargo build --no-default-features --features protobuf-codec + - run: cargo build --no-default-features --features protobufv3-codec - run: cargo build --no-default-features --features prost-codec - run: cargo build - run: cargo test --all @@ -98,6 +100,7 @@ jobs: - run: cargo xtask bindgen - run: cargo build --no-default-features - run: cargo build --no-default-features --features "protobuf-codec" + - run: cargo build --no-default-features --features "protobufv3-codec" - run: cargo build --no-default-features --features "prost-codec" - run: cargo build - run: cargo test --all diff --git a/Cargo.toml b/Cargo.toml index 1afe73be2..c58b8cf0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ libc = "0.2" futures-executor = "0.3" futures-util = { version = "0.3", default-features = false, features = ["std", "sink"] } protobuf = { version = "2.0", optional = true } +protobufv3 = { package = "protobuf", version = "3.2", optional = true } prost = { version = "0.11", optional = true } bytes = { version = "1.0", optional = true } log = "0.4" @@ -44,6 +45,7 @@ exclude = ["xtask"] default = ["protobuf-codec", "boringssl"] _secure = [] protobuf-codec = ["protobuf"] +protobufv3-codec = ["protobufv3"] prost-codec = ["prost", "bytes"] nightly = [] boringssl = ["grpcio-sys/boringssl", "_secure"] diff --git a/benchmark/Cargo.toml b/benchmark/Cargo.toml index 396efe450..c59a351a2 100644 --- a/benchmark/Cargo.toml +++ b/benchmark/Cargo.toml @@ -6,11 +6,12 @@ publish = false [features] default = ["protobuf-codec"] -protobuf-codec = ["grpcio/protobuf-codec", "grpcio-proto/protobuf-codec"] +protobuf-codec = ["grpcio/protobuf-codec", "grpcio-proto/protobuf-codec", "dep:protobuf"] +protobufv3-codec = ["grpcio/protobufv3-codec", "grpcio-proto/protobufv3-codec", "dep:protobufv3"] prost-codec = ["grpcio/prost-codec", "grpcio-proto/prost-codec"] [dependencies] -grpcio = { path = ".." } +grpcio = { path = "..", default-features = false, features = ["boringssl"] } grpcio-proto = { path = "../proto", default-features = false } futures-channel = "0.3" futures-executor = "0.3" @@ -28,6 +29,8 @@ slog-async = "2.1" slog-stdlog = "4.0" slog-scope = "4.0" slog-term = "2.2" +protobuf = { version = "2", optional = true } +protobufv3 = { package = "protobuf", version = "3.2", optional = true } [[bin]] name = "qps_worker" diff --git a/benchmark/src/bench.rs b/benchmark/src/bench.rs index 08f5d9952..545ce33ca 100644 --- a/benchmark/src/bench.rs +++ b/benchmark/src/bench.rs @@ -19,10 +19,11 @@ use grpc_proto::util; use grpcio::GrpcSlice; fn gen_resp(req: &SimpleRequest) -> SimpleResponse { - let payload = util::new_payload(req.get_response_size() as usize); - let mut resp = SimpleResponse::default(); - resp.set_payload(payload); - resp + let payload = util::new_payload(req.response_size as usize); + SimpleResponse { + payload: Some(payload).into(), + ..SimpleResponse::default() + } } #[derive(Clone)] diff --git a/benchmark/src/client.rs b/benchmark/src/client.rs index 6023b5e4d..b3d075a8f 100644 --- a/benchmark/src/client.rs +++ b/benchmark/src/client.rs @@ -15,8 +15,10 @@ use futures_util::{ use grpcio::{ CallOption, Channel, ChannelBuilder, Client as GrpcClient, EnvBuilder, Environment, WriteFlags, }; +use grpcio_proto::testing::control::SecurityParams; use grpcio_proto::testing::control::{ClientConfig, ClientType, RpcType}; use grpcio_proto::testing::messages::SimpleRequest; +use grpcio_proto::testing::payloads::PayloadConfig; use grpcio_proto::testing::services_grpc::BenchmarkServiceClient; use grpcio_proto::testing::stats::ClientStats; use grpcio_proto::util as proto_util; @@ -27,14 +29,23 @@ use rand_xorshift::XorShiftRng; use crate::bench; use crate::util::{self, CpuRecorder, Histogram}; +#[cfg(feature = "protobuf-codec")] fn gen_req(cfg: &ClientConfig) -> SimpleRequest { let mut req = SimpleRequest::default(); let payload_config = cfg.get_payload_config(); let simple_params = payload_config.get_simple_params(); - req.set_payload(proto_util::new_payload( - simple_params.get_req_size() as usize - )); - req.set_response_size(simple_params.get_resp_size()); + req.payload = Some(proto_util::new_payload(simple_params.req_size as usize)).into(); + req.response_size = simple_params.resp_size; + req +} + +#[cfg(feature = "protobufv3-codec")] +fn gen_req(cfg: &ClientConfig) -> SimpleRequest { + let mut req = SimpleRequest::default(); + let payload_config = &cfg.payload_config; + let simple_params = payload_config.simple_params(); + req.payload = Some(proto_util::new_payload(simple_params.req_size as usize)).into(); + req.response_size = simple_params.resp_size; req } @@ -138,7 +149,11 @@ struct GenericExecutor { impl GenericExecutor { fn new(ctx: ExecutorContext, channel: Channel, cfg: &ClientConfig) -> GenericExecutor { + #[cfg(feature = "protobuf-codec")] let cap = cfg.get_payload_config().get_bytebuf_params().get_req_size(); + #[cfg(feature = "protobufv3-codec")] + let cap = cfg.payload_config.bytebuf_params().req_size; + let req = vec![0; cap as usize]; GenericExecutor { ctx, @@ -297,6 +312,23 @@ impl RequestExecutor { } } +#[cfg(feature = "protobuf-codec")] +fn get_payload_cfg(cfg: &ClientConfig) -> &PayloadConfig { + cfg.get_payload_config() +} +#[cfg(feature = "protobufv3-codec")] +fn get_payload_cfg(cfg: &ClientConfig) -> &PayloadConfig { + &cfg.payload_config +} +#[cfg(feature = "protobuf-codec")] +fn get_rpc_type(cfg: &ClientConfig) -> RpcType { + cfg.get_rpc_type() +} +#[cfg(feature = "protobufv3-codec")] +fn get_rpc_type(cfg: &ClientConfig) -> RpcType { + cfg.rpc_type.enum_value().unwrap() +} + fn execute( ctx: ExecutorContext, ch: Channel, @@ -305,27 +337,27 @@ fn execute( ) { match client_type { ClientType::SYNC_CLIENT => { - if cfg.get_payload_config().has_bytebuf_params() { + if get_payload_cfg(cfg).has_bytebuf_params() { panic!("only async_client is supported for generic service."); } RequestExecutor::new(ctx, ch, cfg).execute_unary() } - ClientType::ASYNC_CLIENT => match cfg.get_rpc_type() { + ClientType::ASYNC_CLIENT => match get_rpc_type(cfg) { RpcType::UNARY => { - if cfg.get_payload_config().has_bytebuf_params() { + if get_payload_cfg(cfg).has_bytebuf_params() { panic!("only ping pong streaming is supported for generic service."); } RequestExecutor::new(ctx, ch, cfg).execute_unary_async() } RpcType::STREAMING => { - if cfg.get_payload_config().has_bytebuf_params() { + if get_payload_cfg(cfg).has_bytebuf_params() { GenericExecutor::new(ctx, ch, cfg).execute_stream() } else { RequestExecutor::new(ctx, ch, cfg).execute_stream_ping_pong() } } RpcType::STREAMING_FROM_CLIENT => { - if cfg.get_payload_config().has_bytebuf_params() { + if get_payload_cfg(cfg).has_bytebuf_params() { panic!("only ping pong streaming is supported for generic service."); } RequestExecutor::new(ctx, ch, cfg).execute_stream_from_client() @@ -344,39 +376,58 @@ pub struct Client { running_reqs: Option>>, } +#[cfg(feature = "protobuf-codec")] +fn get_security_params(cfg: &ClientConfig) -> Option<&SecurityParams> { + match cfg.has_security_params() { + true => Some(cfg.get_security_params()), + false => None, + } +} +#[cfg(feature = "protobufv3-codec")] +fn get_security_params(cfg: &ClientConfig) -> Option<&SecurityParams> { + cfg.security_params.0.as_deref() +} + impl Client { pub fn new(cfg: &ClientConfig) -> Client { let mut builder = EnvBuilder::new(); - let thd_cnt = cfg.get_async_client_threads() as usize; + let thd_cnt = cfg.async_client_threads as usize; if thd_cnt != 0 { builder = builder.cq_count(thd_cnt); } let env = Arc::new(builder.build()); - if cfg.get_core_limit() > 0 { + if cfg.core_limit > 0 { error!("client config core limit is set but ignored"); } let ch_env = env.clone(); - let channels = (0..cfg.get_client_channels()) - .zip(cfg.get_server_targets().iter().cycle()) + let channels = (0..cfg.client_channels) + .zip(cfg.server_targets.iter().cycle()) .map(|(_, addr)| { let mut builder = ChannelBuilder::new(ch_env.clone()); - for arg in cfg.get_channel_args() { - let key = CString::new(arg.get_name()).unwrap(); + for arg in &cfg.channel_args { + let key = CString::new(arg.name.clone()).unwrap(); + #[cfg(feature = "protobuf-codec")] if arg.has_str_value() { builder = builder.raw_cfg_string(key, CString::new(arg.get_str_value()).unwrap()); } else if arg.has_int_value() { builder = builder.raw_cfg_int(key, arg.get_int_value()); } + #[cfg(feature = "protobufv3-codec")] + if arg.has_str_value() { + builder = + builder.raw_cfg_string(key, CString::new(arg.str_value()).unwrap()); + } else if arg.has_int_value() { + builder = builder.raw_cfg_int(key, arg.int_value()); + } } // Check https://github.com/grpc/grpc/issues/31465. builder = builder.enable_retry(false); - if cfg.has_security_params() { - let params = cfg.get_security_params(); - if !params.get_server_host_override().is_empty() { - builder = builder - .override_ssl_target(params.get_server_host_override().to_owned()); + if let Some(params) = get_security_params(cfg) { + if !params.server_host_override.is_empty() { + builder = + builder.override_ssl_target(params.server_host_override.to_owned()); } builder = builder.set_credentials(proto_util::create_test_channel_credentials()); @@ -384,28 +435,49 @@ impl Client { builder.connect(addr) }); - let client_type = cfg.get_client_type(); - let load_params = cfg.get_load_params(); - let client_channels = cfg.get_client_channels() as usize; - let outstanding_rpcs_per_channel = cfg.get_outstanding_rpcs_per_channel() as usize; - - let recorder = CpuRecorder::new(); + #[cfg(feature = "protobuf-codec")] + let client_type = cfg.client_type; + #[cfg(feature = "protobuf-codec")] let his_param = cfg.get_histogram_params(); + #[cfg(feature = "protobuf-codec")] let his = Arc::new(Mutex::new(Histogram::new( his_param.get_resolution(), his_param.get_max_possible(), ))); + #[cfg(feature = "protobuf-codec")] + let has_poisson = cfg.get_load_params().has_poisson(); + + #[cfg(feature = "protobufv3-codec")] + let client_type = cfg.client_type.enum_value().unwrap(); + #[cfg(feature = "protobufv3-codec")] + let his_param = &cfg.histogram_params; + #[cfg(feature = "protobufv3-codec")] + let his = Arc::new(Mutex::new(Histogram::new( + his_param.resolution, + his_param.max_possible, + ))); + #[cfg(feature = "protobufv3-codec")] + let has_poisson = cfg.load_params.has_poisson(); + + let client_channels = cfg.client_channels as usize; + let outstanding_rpcs_per_channel = cfg.outstanding_rpcs_per_channel as usize; + + let recorder = CpuRecorder::new(); let keep_running = Arc::new(AtomicBool::new(true)); let mut running_reqs = Vec::with_capacity(client_channels * outstanding_rpcs_per_channel); for ch in channels { - for _ in 0..cfg.get_outstanding_rpcs_per_channel() { + for _ in 0..cfg.outstanding_rpcs_per_channel { let his = his.clone(); let ch = ch.clone(); - let rx = if load_params.has_poisson() { - let lambda = load_params.get_poisson().get_offered_load() - / client_channels as f64 - / outstanding_rpcs_per_channel as f64; + let rx = if has_poisson { + #[cfg(feature = "protobuf-codec")] + let offered_load = cfg.get_load_params().get_poisson().get_offered_load(); + #[cfg(feature = "protobufv3-codec")] + let offered_load = cfg.load_params.poisson().offered_load; + + let lambda = + offered_load / client_channels as f64 / outstanding_rpcs_per_channel as f64; let poisson = Poisson::new(lambda); let (ctx, rx) = ExecutorContext::new(his, keep_running.clone(), poisson); execute(ctx, ch, client_type, cfg); @@ -432,13 +504,13 @@ impl Client { let mut stats = ClientStats::default(); let sample = self.recorder.cpu_time(reset); - stats.set_time_elapsed(sample.real_time); - stats.set_time_user(sample.user_time); - stats.set_time_system(sample.sys_time); + stats.time_elapsed = sample.real_time; + stats.time_user = sample.user_time; + stats.time_system = sample.sys_time; { let mut his = self.histogram.lock().unwrap(); - stats.set_latencies(his.report(reset)); + stats.latencies = Some(his.report(reset)).into(); } stats diff --git a/benchmark/src/server.rs b/benchmark/src/server.rs index d5c64a061..ffb0d6b9b 100644 --- a/benchmark/src/server.rs +++ b/benchmark/src/server.rs @@ -26,18 +26,23 @@ pub struct Server { impl Server { #[allow(clippy::new_ret_no_self)] pub fn new(cfg: &ServerConfig) -> Result { + #[cfg(feature = "protobuf-codec")] + let server_type = cfg.server_type; + #[cfg(feature = "protobufv3-codec")] + let server_type = cfg.server_type.enum_value().unwrap(); + let mut builder = EnvBuilder::new(); - let thd_cnt = cfg.get_async_server_threads() as usize; + let thd_cnt = cfg.async_server_threads as usize; if thd_cnt != 0 { builder = builder.cq_count(thd_cnt); } let env = Arc::new(builder.build()); - if cfg.get_core_limit() > 0 { + if cfg.core_limit > 0 { warn!("server config core limit is set but ignored"); } let keep_running = Arc::new(AtomicBool::new(true)); let keep_running1 = keep_running.clone(); - let service = match cfg.get_server_type() { + let service = match server_type { ServerType::ASYNC_SERVER => { let b = Benchmark { keep_running }; create_benchmark_service(b) @@ -49,27 +54,39 @@ impl Server { _ => unimplemented!(), }; let mut builder = ServerBuilder::new(env.clone()).register_service(service); - if !cfg.get_channel_args().is_empty() { + if !cfg.channel_args.is_empty() { let mut ch_builder = ChannelBuilder::new(env); - for arg in cfg.get_channel_args() { - let key = CString::new(arg.get_name()).unwrap(); + for arg in &cfg.channel_args { + let key = CString::new(arg.name.clone()).unwrap(); if arg.has_str_value() { - ch_builder = - ch_builder.raw_cfg_string(key, CString::new(arg.get_str_value()).unwrap()); + #[cfg(feature = "protobuf-codec")] + let val = CString::new(arg.get_str_value()).unwrap(); + #[cfg(feature = "protobufv3-codec")] + let val = CString::new(arg.str_value()).unwrap(); + ch_builder = ch_builder.raw_cfg_string(key, val); } else if arg.has_int_value() { - ch_builder = ch_builder.raw_cfg_int(key, arg.get_int_value()); + #[cfg(feature = "protobuf-codec")] + let val = arg.get_int_value(); + #[cfg(feature = "protobufv3-codec")] + let val = arg.int_value(); + ch_builder = ch_builder.raw_cfg_int(key, val); } } builder = builder.channel_args(ch_builder.build_args()); } let mut s = builder.build().unwrap(); - let creds = if cfg.has_security_params() { + + #[cfg(feature = "protobuf-codec")] + let has_security_param = cfg.has_security_params(); + #[cfg(feature = "protobufv3-codec")] + let has_security_param = cfg.security_params.0.is_some(); + let creds = if has_security_param { proto_util::create_test_server_credentials() } else { ServerCredentials::insecure() }; let port = s - .add_listening_port(&format!("[::]:{}", cfg.get_port()), creds) + .add_listening_port(&format!("[::]:{}", cfg.port), creds) .unwrap(); s.start(); Ok(Server { @@ -82,14 +99,14 @@ impl Server { pub fn get_stats(&mut self, reset: bool) -> ServerStats { let sample = self.recorder.cpu_time(reset); - - let mut stats = ServerStats::default(); - stats.set_time_elapsed(sample.real_time); - stats.set_time_user(sample.user_time); - stats.set_time_system(sample.sys_time); - stats.set_total_cpu_time(sample.total_cpu); - stats.set_idle_cpu_time(sample.idle_cpu); - stats + ServerStats { + time_elapsed: sample.real_time, + time_user: sample.user_time, + time_system: sample.sys_time, + total_cpu_time: sample.total_cpu, + idle_cpu_time: sample.idle_cpu, + ..ServerStats::default() + } } pub fn shutdown(&mut self) -> ShutdownFuture { @@ -98,9 +115,10 @@ impl Server { } pub fn get_status(&self) -> ServerStatus { - let mut status = ServerStatus::default(); - status.set_port(self.port as i32); - status.set_cores(util::cpu_num_cores() as i32); - status + ServerStatus { + port: self.port as i32, + cores: util::cpu_num_cores() as i32, + ..ServerStatus::default() + } } } diff --git a/benchmark/src/util.rs b/benchmark/src/util.rs index 865d33cce..e346bc21b 100644 --- a/benchmark/src/util.rs +++ b/benchmark/src/util.rs @@ -194,18 +194,18 @@ impl Histogram { } pub fn report(&mut self, reset: bool) -> HistogramData { - let mut data = HistogramData::default(); - data.set_count(f64::from(self.count)); - data.set_sum(self.sum); - data.set_sum_of_squares(self.sum_of_squares); - data.set_min_seen(self.min); - data.set_max_seen(self.max); - data.set_bucket(self.buckets.clone()); - + let data = HistogramData { + count: f64::from(self.count), + sum: self.sum, + sum_of_squares: self.sum_of_squares, + min_seen: self.min, + max_seen: self.max, + bucket: self.buckets.clone(), + ..HistogramData::default() + }; if reset { self.clear(); } - data } diff --git a/benchmark/src/worker.rs b/benchmark/src/worker.rs index b2b74d250..d7a353761 100644 --- a/benchmark/src/worker.rs +++ b/benchmark/src/worker.rs @@ -39,17 +39,24 @@ impl WorkerService for Worker { None => return sink.close().await.map_err(Error::from), Some(arg) => arg, }; + #[cfg(feature = "protobuf-codec")] let cfg = arg.get_setup(); + #[cfg(feature = "protobufv3-codec")] + let cfg = arg.setup(); info!("receive server setup: {:?}", cfg); let mut server = Server::new(cfg)?; let status = server.get_status(); sink.send((status, WriteFlags::default())).await?; while let Some(arg) = stream.try_next().await? { + #[cfg(feature = "protobuf-codec")] let mark = arg.get_mark(); + #[cfg(feature = "protobufv3-codec")] + let mark = arg.mark(); + info!("receive server mark: {:?}", mark); - let stats = server.get_stats(mark.get_reset()); + let stats = server.get_stats(mark.reset); let mut status = server.get_status(); - status.set_stats(stats); + status.stats = Some(stats).into(); sink.send((status, WriteFlags::default())).await?; } server.shutdown().await?; @@ -72,17 +79,26 @@ impl WorkerService for Worker { None => return sink.close().await, Some(arg) => arg, }; + #[cfg(feature = "protobuf-codec")] let cfg = arg.get_setup(); + #[cfg(feature = "protobufv3-codec")] + let cfg = arg.setup(); info!("receive client setup: {:?}", cfg); let mut client = Client::new(cfg); sink.send((ClientStatus::default(), WriteFlags::default())) .await?; while let Some(arg) = stream.try_next().await? { + #[cfg(feature = "protobuf-codec")] let mark = arg.get_mark(); + #[cfg(feature = "protobufv3-codec")] + let mark = arg.mark(); + info!("receive client mark: {:?}", mark); - let stats = client.get_stats(mark.get_reset()); - let mut status = ClientStatus::default(); - status.set_stats(stats); + let stats = client.get_stats(mark.reset); + let status = ClientStatus { + stats: Some(stats).into(), + ..ClientStatus::default() + }; sink.send((status, WriteFlags::default())).await?; } client.shutdown().await; @@ -96,8 +112,10 @@ impl WorkerService for Worker { fn core_count(&mut self, ctx: RpcContext, _: CoreRequest, sink: UnarySink) { let cpu_count = util::cpu_num_cores(); - let mut resp = CoreResponse::default(); - resp.set_cores(cpu_count as i32); + let resp = CoreResponse { + cores: cpu_count as i32, + ..CoreResponse::default() + }; ctx.spawn( sink.success(resp) .map_err(|e| error!("failed to report cpu count: {:?}", e)) diff --git a/health/Cargo.toml b/health/Cargo.toml index 324c075b4..0ecacf01e 100644 --- a/health/Cargo.toml +++ b/health/Cargo.toml @@ -15,6 +15,7 @@ readme = "README.md" [features] default = ["protobuf-codec"] protobuf-codec = ["grpcio/protobuf-codec", "protobuf"] +protobufv3-codec = ["grpcio/protobufv3-codec", "protobufv3"] prost-codec = ["grpcio/prost-codec", "prost"] [dependencies] @@ -23,4 +24,5 @@ futures-util = { version = "0.3", default-features = false, features = ["std"] } grpcio = { path = "..", version = "0.12.1", default-features = false } prost = { version = "0.11", optional = true } protobuf = { version = "2", optional = true } +protobufv3 = { package = "protobuf", version = "3.2", optional = true } log = "0.4" diff --git a/health/src/lib.rs b/health/src/lib.rs index f1fb76711..7f18fd4f8 100644 --- a/health/src/lib.rs +++ b/health/src/lib.rs @@ -34,5 +34,11 @@ pub mod proto; mod service; -pub use self::proto::{create_health, HealthClient, ServingStatus}; +pub use self::proto::{create_health, HealthClient}; pub use self::service::HealthService; + +#[cfg(feature = "protobuf-codec")] +pub use self::proto::ServingStatus; + +#[cfg(feature = "protobufv3-codec")] +pub use self::proto::health_check_response::ServingStatus; diff --git a/health/src/proto.rs b/health/src/proto.rs index 00dc77da7..b6daec5b9 100644 --- a/health/src/proto.rs +++ b/health/src/proto.rs @@ -13,9 +13,21 @@ mod protobuf { pub mod health; pub mod health_grpc; } +#[cfg(feature = "protobufv3-codec")] +mod protobuf_v3 { + #[allow(deprecated)] + pub mod health; + pub mod health_grpc; +} #[cfg(feature = "protobuf-codec")] mod reexports { pub use super::protobuf::health::*; + pub use super::protobuf::health_grpc::*; +} +#[cfg(feature = "protobufv3-codec")] +mod reexports { + pub use super::protobuf_v3::health::*; + pub use super::protobuf_v3::health_grpc::*; } pub use self::reexports::*; diff --git a/health/src/proto/protobuf_v3/health.rs b/health/src/proto/protobuf_v3/health.rs new file mode 100644 index 000000000..73036bf1d --- /dev/null +++ b/health/src/proto/protobuf_v3/health.rs @@ -0,0 +1,381 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/health/v1/health.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.health.v1.HealthCheckRequest) +pub struct HealthCheckRequest { + // message fields + // @@protoc_insertion_point(field:grpc.health.v1.HealthCheckRequest.service) + pub service: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:grpc.health.v1.HealthCheckRequest.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HealthCheckRequest { + fn default() -> &'a HealthCheckRequest { + ::default_instance() + } +} + +impl HealthCheckRequest { + pub fn new() -> HealthCheckRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "service", + |m: &HealthCheckRequest| { &m.service }, + |m: &mut HealthCheckRequest| { &mut m.service }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "HealthCheckRequest", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for HealthCheckRequest { + const NAME: &'static str = "HealthCheckRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.service = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if !self.service.is_empty() { + my_size += ::protobufv3::rt::string_size(1, &self.service); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if !self.service.is_empty() { + os.write_string(1, &self.service)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> HealthCheckRequest { + HealthCheckRequest::new() + } + + fn clear(&mut self) { + self.service.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static HealthCheckRequest { + static instance: HealthCheckRequest = HealthCheckRequest { + service: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for HealthCheckRequest { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HealthCheckRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HealthCheckRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for HealthCheckRequest { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.health.v1.HealthCheckResponse) +pub struct HealthCheckResponse { + // message fields + // @@protoc_insertion_point(field:grpc.health.v1.HealthCheckResponse.status) + pub status: ::protobufv3::EnumOrUnknown, + // special fields + // @@protoc_insertion_point(special_field:grpc.health.v1.HealthCheckResponse.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HealthCheckResponse { + fn default() -> &'a HealthCheckResponse { + ::default_instance() + } +} + +impl HealthCheckResponse { + pub fn new() -> HealthCheckResponse { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "status", + |m: &HealthCheckResponse| { &m.status }, + |m: &mut HealthCheckResponse| { &mut m.status }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "HealthCheckResponse", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for HealthCheckResponse { + const NAME: &'static str = "HealthCheckResponse"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.status = is.read_enum_or_unknown()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.status != ::protobufv3::EnumOrUnknown::new(health_check_response::ServingStatus::Unknown) { + my_size += ::protobufv3::rt::int32_size(1, self.status.value()); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.status != ::protobufv3::EnumOrUnknown::new(health_check_response::ServingStatus::Unknown) { + os.write_enum(1, ::protobufv3::EnumOrUnknown::value(&self.status))?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> HealthCheckResponse { + HealthCheckResponse::new() + } + + fn clear(&mut self) { + self.status = ::protobufv3::EnumOrUnknown::new(health_check_response::ServingStatus::Unknown); + self.special_fields.clear(); + } + + fn default_instance() -> &'static HealthCheckResponse { + static instance: HealthCheckResponse = HealthCheckResponse { + status: ::protobufv3::EnumOrUnknown::from_i32(0), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for HealthCheckResponse { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HealthCheckResponse").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HealthCheckResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for HealthCheckResponse { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `HealthCheckResponse` +pub mod health_check_response { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:grpc.health.v1.HealthCheckResponse.ServingStatus) + pub enum ServingStatus { + // @@protoc_insertion_point(enum_value:grpc.health.v1.HealthCheckResponse.ServingStatus.Unknown) + Unknown = 0, + // @@protoc_insertion_point(enum_value:grpc.health.v1.HealthCheckResponse.ServingStatus.Serving) + Serving = 1, + // @@protoc_insertion_point(enum_value:grpc.health.v1.HealthCheckResponse.ServingStatus.NotServing) + NotServing = 2, + // @@protoc_insertion_point(enum_value:grpc.health.v1.HealthCheckResponse.ServingStatus.ServiceUnknown) + ServiceUnknown = 3, + } + + impl ::protobufv3::Enum for ServingStatus { + const NAME: &'static str = "ServingStatus"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ServingStatus::Unknown), + 1 => ::std::option::Option::Some(ServingStatus::Serving), + 2 => ::std::option::Option::Some(ServingStatus::NotServing), + 3 => ::std::option::Option::Some(ServingStatus::ServiceUnknown), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [ServingStatus] = &[ + ServingStatus::Unknown, + ServingStatus::Serving, + ServingStatus::NotServing, + ServingStatus::ServiceUnknown, + ]; + } + + impl ::protobufv3::EnumFull for ServingStatus { + fn enum_descriptor() -> ::protobufv3::reflect::EnumDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::EnumDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("HealthCheckResponse.ServingStatus").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobufv3::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } + } + + impl ::std::default::Default for ServingStatus { + fn default() -> Self { + ServingStatus::Unknown + } + } + + impl ServingStatus { + pub(in super) fn generated_enum_descriptor_data() -> ::protobufv3::reflect::GeneratedEnumDescriptorData { + ::protobufv3::reflect::GeneratedEnumDescriptorData::new::("HealthCheckResponse.ServingStatus") + } + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1bgrpc/health/v1/health.proto\x12\x0egrpc.health.v1\".\n\x12HealthCh\ + eckRequest\x12\x18\n\x07service\x18\x01\x20\x01(\tR\x07service\"\xb1\x01\ + \n\x13HealthCheckResponse\x12I\n\x06status\x18\x01\x20\x01(\x0e21.grpc.h\ + ealth.v1.HealthCheckResponse.ServingStatusR\x06status\"O\n\rServingStatu\ + s\x12\x0b\n\x07Unknown\x10\0\x12\x0b\n\x07Serving\x10\x01\x12\x0f\n\x0bN\ + OT_Serving\x10\x02\x12\x13\n\x0fServiceUnknown\x10\x032\xae\x01\n\x06He\ + alth\x12P\n\x05Check\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.h\ + ealth.v1.HealthCheckResponse\x12R\n\x05Watch\x12\".grpc.health.v1.Health\ + CheckRequest\x1a#.grpc.health.v1.HealthCheckResponse0\x01Ba\n\x11io.grpc\ + .health.v1B\x0bHealthProtoP\x01Z,google.golang.org/grpc/health/grpc_heal\ + th_v1\xaa\x02\x0eGrpc.Health.V1b\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(2); + messages.push(HealthCheckRequest::generated_message_descriptor_data()); + messages.push(HealthCheckResponse::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(health_check_response::ServingStatus::generated_enum_descriptor_data()); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} + +pub use super::health_grpc::*; diff --git a/health/src/proto/protobuf_v3/health_grpc.rs b/health/src/proto/protobuf_v3/health_grpc.rs new file mode 100644 index 000000000..4fb7ed44d --- /dev/null +++ b/health/src/proto/protobuf_v3/health_grpc.rs @@ -0,0 +1,144 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_HEALTH_CHECK: ::grpcio::Method< + super::health::HealthCheckRequest, + super::health::HealthCheckResponse, +> = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.health.v1.Health/Check", + req_mar: ::grpcio::Marshaller { + ser: ::grpcio::pb_ser, + de: ::grpcio::pb_de, + }, + resp_mar: ::grpcio::Marshaller { + ser: ::grpcio::pb_ser, + de: ::grpcio::pb_de, + }, +}; + +const METHOD_HEALTH_WATCH: ::grpcio::Method< + super::health::HealthCheckRequest, + super::health::HealthCheckResponse, +> = ::grpcio::Method { + ty: ::grpcio::MethodType::ServerStreaming, + name: "/grpc.health.v1.Health/Watch", + req_mar: ::grpcio::Marshaller { + ser: ::grpcio::pb_ser, + de: ::grpcio::pb_de, + }, + resp_mar: ::grpcio::Marshaller { + ser: ::grpcio::pb_ser, + de: ::grpcio::pb_de, + }, +}; + +#[derive(Clone)] +pub struct HealthClient { + pub client: ::grpcio::Client, +} + +impl HealthClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + HealthClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn check_opt( + &self, + req: &super::health::HealthCheckRequest, + opt: ::grpcio::CallOption, + ) -> ::grpcio::Result { + self.client.unary_call(&METHOD_HEALTH_CHECK, req, opt) + } + + pub fn check( + &self, + req: &super::health::HealthCheckRequest, + ) -> ::grpcio::Result { + self.check_opt(req, ::grpcio::CallOption::default()) + } + + pub fn check_async_opt( + &self, + req: &super::health::HealthCheckRequest, + opt: ::grpcio::CallOption, + ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_HEALTH_CHECK, req, opt) + } + + pub fn check_async( + &self, + req: &super::health::HealthCheckRequest, + ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.check_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn watch_opt( + &self, + req: &super::health::HealthCheckRequest, + opt: ::grpcio::CallOption, + ) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.client.server_streaming(&METHOD_HEALTH_WATCH, req, opt) + } + + pub fn watch( + &self, + req: &super::health::HealthCheckRequest, + ) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.watch_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) + where + F: ::std::future::Future + Send + 'static, + { + self.client.spawn(f) + } +} + +pub trait Health { + fn check( + &mut self, + ctx: ::grpcio::RpcContext, + _req: super::health::HealthCheckRequest, + sink: ::grpcio::UnarySink, + ) { + grpcio::unimplemented_call!(ctx, sink) + } + fn watch( + &mut self, + ctx: ::grpcio::RpcContext, + _req: super::health::HealthCheckRequest, + sink: ::grpcio::ServerStreamingSink, + ) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_health(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_HEALTH_CHECK, move |ctx, req, resp| { + instance.check(ctx, req, resp) + }); + let mut instance = s; + builder = builder.add_server_streaming_handler(&METHOD_HEALTH_WATCH, move |ctx, req, resp| { + instance.watch(ctx, req, resp) + }); + builder.build() +} diff --git a/health/src/proto/protobuf_v3/mod.rs b/health/src/proto/protobuf_v3/mod.rs new file mode 100644 index 000000000..7b076b3d6 --- /dev/null +++ b/health/src/proto/protobuf_v3/mod.rs @@ -0,0 +1,3 @@ +// @generated + +pub mod health; diff --git a/health/src/service.rs b/health/src/service.rs index cab94e067..26a72848f 100644 --- a/health/src/service.rs +++ b/health/src/service.rs @@ -1,6 +1,6 @@ // Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0. -use crate::proto::{Health, HealthCheckRequest, HealthCheckResponse, ServingStatus}; +use crate::proto::{Health, HealthCheckRequest, HealthCheckResponse}; use futures_util::{FutureExt as _, SinkExt as _, Stream, StreamExt as _}; use grpcio::{RpcContext, RpcStatus, RpcStatusCode, ServerStreamingSink, UnarySink, WriteFlags}; use log::info; @@ -14,13 +14,25 @@ use std::task::{Context, Poll, Waker}; #[cfg(feature = "protobuf-codec")] use protobuf::ProtobufEnum; +#[cfg(any(feature = "prost-codec", feature = "protobuf-codec"))] +use crate::proto::ServingStatus; + +#[cfg(feature = "protobufv3-codec")] +use crate::proto::health_check_response::ServingStatus; + const VERSION_STEP: usize = 8; const STATUS_MASK: usize = 7; +#[cfg(any(feature = "prost-codec", feature = "protobuf-codec"))] fn state_to_status(state: usize) -> ServingStatus { ServingStatus::from_i32((state & STATUS_MASK) as i32).unwrap() } +#[cfg(feature = "protobufv3-codec")] +fn state_to_status(state: usize) -> ServingStatus { + ::protobufv3::Enum::from_i32((state & STATUS_MASK) as i32).unwrap() +} + /// Struct that stores the state of a service and wake all subscribers when there /// is any updates. struct StatusCast { diff --git a/health/tests/health_check.rs b/health/tests/health_check.rs index a054dc408..231c6334f 100644 --- a/health/tests/health_check.rs +++ b/health/tests/health_check.rs @@ -10,14 +10,30 @@ use std::time::Duration; const TEST_SERVICE: &str = "grpc.test.TestService"; +#[cfg(feature = "protobuf-codec")] +use crate::proto::ServingStatus; + +#[cfg(feature = "protobufv3-codec")] +use grpcio_health::ServingStatus; + +#[cfg(any(feature = "protobuf-codec", feature = "prost-codec"))] +fn response_status_equals(resp: HealthCheckResponse, status: ServingStatus) -> bool { + resp.status == status.into() +} + +#[cfg(feature = "protobufv3-codec")] +fn response_status_equals(resp: HealthCheckResponse, status: ServingStatus) -> bool { + resp.status.enum_value().unwrap() == status +} + #[track_caller] fn assert_status(status: ServingStatus, client: &HealthClient, name: &str) { let req = HealthCheckRequest { service: name.to_string(), ..Default::default() }; - let resp = client.check(&req).unwrap(); - assert_eq!(resp.status, status) + let resp: HealthCheckResponse = client.check(&req).unwrap(); + assert!(response_status_equals(resp, status)); } #[track_caller] @@ -45,7 +61,7 @@ fn assert_code(code: RpcStatusCode, client: &HealthClient, name: &str) { #[track_caller] fn assert_next(status: ServingStatus, ss: &mut ClientSStreamReceiver) { let resp = block_on(ss.next()).unwrap().unwrap(); - assert_eq!(resp.status, status); + assert!(response_status_equals(resp, status)); } fn setup() -> (Server, HealthService, HealthClient) { @@ -124,12 +140,16 @@ fn test_health_watch() { service.set_serving_status(TEST_SERVICE, ServingStatus::Unknown); let mut seen = 0; loop { - let resp = block_on(statuses.next()).unwrap().unwrap(); - if resp.status != ServingStatus::Unknown { - seen += 1; - continue; + match block_on(statuses.next()).unwrap() { + Err(e) => panic!("unexpected error {:?}", e), + Ok(r) => { + if !response_status_equals(r, ServingStatus::Unknown) { + seen += 1; + continue; + } + break; + } } - break; } assert!(seen <= 1); } diff --git a/interop/Cargo.toml b/interop/Cargo.toml index 3219b06cf..846cbef0b 100644 --- a/interop/Cargo.toml +++ b/interop/Cargo.toml @@ -4,11 +4,17 @@ version = "0.1.0" edition = "2018" publish = false +[features] +default = ["protobuf-codec"] +protobuf-codec = ["protobuf", "grpcio/protobuf-codec", "grpcio-proto/protobuf-codec"] +protobufv3-codec = ["protobufv3", "grpcio/protobufv3-codec", "grpcio-proto/protobufv3-codec"] + [dependencies] -grpcio = { path = ".." } -grpcio-sys = { path = "../grpc-sys" } -grpcio-proto = { path = "../proto" } -protobuf = "2" +grpcio = { path = "..", default-features = false, features = ["boringssl"]} +grpcio-sys = { path = "../grpc-sys", default-features = false} +grpcio-proto = { path = "../proto", default-features = false} +protobuf = { version = "2", optional = true } +protobufv3 = { package = "protobuf", version = "3.2", optional = true } futures-executor = "0.3" futures-util = { version = "0.3", default-features = false, features = ["std"] } log = "0.4" diff --git a/interop/src/client.rs b/interop/src/client.rs index 4bfb2a1a6..68ae4abdb 100644 --- a/interop/src/client.rs +++ b/interop/src/client.rs @@ -46,11 +46,16 @@ impl Client { pub async fn large_unary(&self) -> grpcio::Result<()> { print!("testing large unary ... "); - let mut req = SimpleRequest::default(); - req.set_response_size(314_159); - req.set_payload(util::new_payload(271_828)); + let req = SimpleRequest { + response_size: 314_159, + payload: Some(util::new_payload(271_828)).into(), + ..SimpleRequest::default() + }; let resp = self.client.unary_call_async(&req)?.await?; + #[cfg(feature = "protobuf-codec")] assert_eq!(314_159, resp.get_payload().get_body().len()); + #[cfg(feature = "protobufv3-codec")] + assert_eq!(314_159, resp.payload.body.len()); println!("pass"); Ok(()) } @@ -60,29 +65,36 @@ impl Client { let payload_size = vec![27182usize, 8, 1828, 45904]; let (mut sender, receiver) = self.client.streaming_input_call()?; for size in payload_size { - let mut req = StreamingInputCallRequest::default(); - req.set_payload(util::new_payload(size)); + let req = StreamingInputCallRequest { + payload: Some(util::new_payload(size)).into(), + ..StreamingInputCallRequest::default() + }; sender.send((req, WriteFlags::default())).await?; } sender.close().await?; let resp = receiver.await?; - assert_eq!(74922, resp.get_aggregated_payload_size()); + assert_eq!(74922, resp.aggregated_payload_size); println!("pass"); Ok(()) } pub async fn server_streaming(&self) -> grpcio::Result<()> { print!("testing server streaming ... "); - let mut req = StreamingOutputCallRequest::default(); let sizes = vec![31415, 9, 2653, 58979]; - for size in &sizes { - req.mut_response_parameters() - .push(util::new_parameters(*size)); - } + let req = StreamingOutputCallRequest { + response_parameters: sizes + .iter() + .map(|size| util::new_parameters(*size)) + .collect(), + ..StreamingOutputCallRequest::default() + }; let mut resp = self.client.streaming_output_call(&req)?; let mut i = 0; while let Some(r) = resp.try_next().await? { + #[cfg(feature = "protobuf-codec")] assert_eq!(r.get_payload().get_body().len(), sizes[i] as usize); + #[cfg(feature = "protobufv3-codec")] + assert_eq!(r.payload.body.len(), sizes[i] as usize); i += 1; } assert_eq!(sizes.len(), i); @@ -95,13 +107,17 @@ impl Client { let (mut sender, mut receiver) = self.client.full_duplex_call()?; let cases = vec![(31415, 27182), (9, 8), (2653, 1828), (58979, 45904)]; for (resp_size, payload_size) in cases { - let mut req = StreamingOutputCallRequest::default(); - req.mut_response_parameters() - .push(util::new_parameters(resp_size)); - req.set_payload(util::new_payload(payload_size)); + let req = StreamingOutputCallRequest { + response_parameters: vec![util::new_parameters(resp_size)].into(), + payload: Some(util::new_payload(payload_size)).into(), + ..StreamingOutputCallRequest::default() + }; sender.send((req, WriteFlags::default())).await?; let resp = receiver.try_next().await?.unwrap(); + #[cfg(feature = "protobuf-codec")] assert_eq!(resp.get_payload().get_body().len(), resp_size as usize); + #[cfg(feature = "protobufv3-codec")] + assert_eq!(resp.payload.body.len(), resp_size as usize); } sender.close().await?; assert_eq!(receiver.try_next().await?, None); @@ -113,9 +129,11 @@ impl Client { print!("testing custom metadata ... "); // Step 1: test unary call - let mut req = SimpleRequest::default(); - req.set_response_size(314159); - req.set_payload(util::new_payload(271828)); + let req = SimpleRequest { + response_size: 314159, + payload: Some(util::new_payload(271828)).into(), + ..SimpleRequest::default() + }; let mut resp_call = self .client .unary_call_async_opt(&req, CallOption::default().headers(create_test_metadata()))?; @@ -128,10 +146,11 @@ impl Client { assert_eq!(v, b"test_initial_metadata_value"); // Step 2: test full duplex call - let mut req = StreamingOutputCallRequest::default(); - req.mut_response_parameters() - .push(util::new_parameters(314159)); - req.set_payload(util::new_payload(271828)); + let req = StreamingOutputCallRequest { + response_parameters: vec![util::new_parameters(314159)].into(), + payload: Some(util::new_payload(271828)).into(), + ..StreamingOutputCallRequest::default() + }; let (mut tx, mut rx) = self .client .full_duplex_call_opt(CallOption::default().headers(create_test_metadata()))?; @@ -177,13 +196,18 @@ impl Client { pub async fn cancel_after_first_response(&self) -> grpcio::Result<()> { print!("testing cancel_after_first_response ... "); let (mut sender, mut receiver) = self.client.full_duplex_call()?; - let mut req = StreamingOutputCallRequest::default(); - req.mut_response_parameters() - .push(util::new_parameters(31415)); - req.set_payload(util::new_payload(27182)); + let req = StreamingOutputCallRequest { + response_parameters: vec![util::new_parameters(31415)].into(), + payload: Some(util::new_payload(27182)).into(), + ..StreamingOutputCallRequest::default() + }; sender.send((req, WriteFlags::default())).await?; let resp = receiver.try_next().await?.unwrap(); + + #[cfg(feature = "protobuf-codec")] assert_eq!(resp.get_payload().get_body().len(), 31415); + #[cfg(feature = "protobufv3-codec")] + assert_eq!(resp.payload.body.len(), 31415); sender.cancel(); match receiver.try_next().await { Err(grpc::Error::RpcFailure(s)) => assert_eq!(s.code(), RpcStatusCode::CANCELLED), @@ -198,8 +222,10 @@ impl Client { print!("testing timeout_of_sleeping_server ... "); let opt = CallOption::default().timeout(Duration::from_millis(1)); let (mut sender, mut receiver) = self.client.full_duplex_call_opt(opt)?; - let mut req = StreamingOutputCallRequest::default(); - req.set_payload(util::new_payload(27182)); + let req = StreamingOutputCallRequest { + payload: Some(util::new_payload(27182)).into(), + ..StreamingOutputCallRequest::default() + }; let _ = sender.send((req, WriteFlags::default())).await; match receiver.try_next().await { Err(grpc::Error::RpcFailure(s)) => { @@ -215,11 +241,16 @@ impl Client { pub async fn status_code_and_message(&self) -> grpcio::Result<()> { print!("testing status_code_and_message ... "); let error_msg = "test status message"; - let mut status = EchoStatus::default(); - status.set_code(2); - status.set_message(error_msg.to_owned()); - let mut req = SimpleRequest::default(); - req.set_response_status(status.clone()); + let status = EchoStatus { + code: 2, + message: error_msg.to_owned(), + ..EchoStatus::default() + }; + + let req = SimpleRequest { + response_status: Some(status.clone()).into(), + ..SimpleRequest::default() + }; match self.client.unary_call_async(&req)?.await.unwrap_err() { grpc::Error::RpcFailure(s) => { assert_eq!(s.code(), RpcStatusCode::UNKNOWN); @@ -227,8 +258,10 @@ impl Client { } e => panic!("expected rpc failure: {:?}", e), } - let mut req = StreamingOutputCallRequest::default(); - req.set_response_status(status); + let req = StreamingOutputCallRequest { + response_status: Some(status).into(), + ..StreamingOutputCallRequest::default() + }; let (mut sender, mut receiver) = self.client.full_duplex_call()?; let _ = sender.send((req, WriteFlags::default())).await; match receiver.try_next().await { diff --git a/interop/src/server.rs b/interop/src/server.rs index c74d16e29..ee7b0acc9 100644 --- a/interop/src/server.rs +++ b/interop/src/server.rs @@ -56,6 +56,8 @@ impl TestService for InteropTestService { if !metadata.is_empty() { sink.set_headers(metadata); } + + #[cfg(feature = "protobuf-codec")] if req.has_response_status() { let code = req.get_response_status().get_code(); let msg = req.take_response_status().take_message(); @@ -67,9 +69,24 @@ impl TestService for InteropTestService { ctx.spawn(f); return; } - let resp_size = req.get_response_size(); - let mut resp = SimpleResponse::default(); - resp.set_payload(util::new_payload(resp_size as usize)); + + #[cfg(feature = "protobufv3-codec")] + if let Some(response_status) = &req.response_status.0 { + let code = response_status.code; + let msg = &response_status.message; + let status = RpcStatus::with_message(code, msg.to_string()); + let f = sink + .fail(status) + .map_err(|e| panic!("failed to send response: {:?}", e)) + .map(|_| ()); + ctx.spawn(f); + return; + } + let resp_size = req.response_size; + let resp = SimpleResponse { + payload: Some(util::new_payload(resp_size as usize)).into(), + ..SimpleResponse::default() + }; let f = sink .success(resp) .map_err(|e| panic!("failed to send response: {:?}", e)) @@ -80,13 +97,15 @@ impl TestService for InteropTestService { fn streaming_output_call( &mut self, ctx: RpcContext, - mut req: StreamingOutputCallRequest, + req: StreamingOutputCallRequest, mut sink: ServerStreamingSink, ) { let f = async move { - for param in req.take_response_parameters().into_iter() { - let mut resp = StreamingOutputCallResponse::default(); - resp.set_payload(util::new_payload(param.get_size() as usize)); + for param in req.response_parameters.into_iter() { + let resp = StreamingOutputCallResponse { + payload: Some(util::new_payload(param.size as usize)).into(), + ..StreamingOutputCallResponse::default() + }; sink.send((resp, WriteFlags::default())).await?; } sink.close().await?; @@ -96,7 +115,6 @@ impl TestService for InteropTestService { .map(|_| ()); ctx.spawn(f) } - fn streaming_input_call( &mut self, ctx: RpcContext, @@ -105,12 +123,19 @@ impl TestService for InteropTestService { ) { let f = async move { let mut s = 0; + #[cfg(feature = "protobuf-codec")] while let Some(req) = stream.try_next().await? { s += req.get_payload().get_body().len(); } + #[cfg(feature = "protobufv3-codec")] + while let Some(req) = stream.try_next().await? { + s += req.payload.body.len(); + } - let mut resp = StreamingInputCallResponse::default(); - resp.set_aggregated_payload_size(s as i32); + let resp = StreamingInputCallResponse { + aggregated_payload_size: s as i32, + ..StreamingInputCallResponse::default() + }; sink.success(resp).await } .map_err(|e| match e { @@ -132,18 +157,18 @@ impl TestService for InteropTestService { sink.set_headers(metadata); } let f = async move { - while let Some(mut req) = stream.try_next().await? { - if req.has_response_status() { - let code = req.get_response_status().get_code(); - let msg = req.take_response_status().take_message(); + while let Some(req) = stream.try_next().await? { + if let Some(response_status) = &req.response_status.clone().into_option() { + let code = response_status.code; + let msg = String::from(&response_status.message); let status = RpcStatus::with_message(code, msg); sink.fail(status).await?; return Ok(()); } let mut resp = StreamingOutputCallResponse::default(); - if let Some(param) = req.get_response_parameters().get(0) { - resp.set_payload(util::new_payload(param.get_size() as usize)); + if let Some(param) = req.response_parameters.get(0) { + resp.payload = Some(util::new_payload(param.size as usize)).into(); } // A workaround for timeout_on_sleeping_server test. // The request only has 27182 bytes of zeros in payload. @@ -151,11 +176,16 @@ impl TestService for InteropTestService { // Client timeout 1ms is too short for grpcio. The server // can response in 1ms. To make the test stable, the server // sleeps 1s explicitly. - if req.get_payload().get_body().len() == 27182 - && req.get_response_parameters().is_empty() - && !req.has_response_status() - { - Delay::new(Duration::from_secs(1)).await; + + if req.response_parameters.is_empty() && req.response_status.is_none() { + #[cfg(feature = "protobuf-codec")] + if req.get_payload().get_body().len() == 27182 { + Delay::new(Duration::from_secs(1)).await; + } + #[cfg(feature = "protobufv3-codec")] + if req.payload.body.len() == 27182 { + Delay::new(Duration::from_secs(1)).await; + } } sink.send((resp, WriteFlags::default())).await?; } diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 33c363ef1..0f943beeb 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -14,6 +14,7 @@ categories = ["network-programming"] [features] default = ["protobuf-codec"] protobuf-codec = ["grpcio/protobuf-codec", "protobuf"] +protobufv3-codec = ["grpcio/protobufv3-codec", "protobufv3"] prost-codec = ["prost-build", "prost-derive", "prost-types", "bytes", "lazy_static", "grpcio/prost-codec", "prost"] [dependencies] @@ -23,6 +24,7 @@ prost = { version = "0.11", optional = true } prost-derive = { version = "0.11", optional = true } prost-types = { version = "0.11", optional = true } protobuf = { version = "2", optional = true } +protobufv3 = { package = "protobuf", version = "3.2", optional = true } lazy_static = { version = "1.3", optional = true } [build-dependencies] diff --git a/proto/src/lib.rs b/proto/src/lib.rs index b49dff5b8..a79d04b77 100644 --- a/proto/src/lib.rs +++ b/proto/src/lib.rs @@ -2,7 +2,7 @@ mod proto; -#[cfg(feature = "protobuf-codec")] +#[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] pub use proto::protobuf::*; #[cfg(feature = "prost-codec")] diff --git a/proto/src/proto.rs b/proto/src/proto.rs index dcb1081a5..0e0f0d263 100644 --- a/proto/src/proto.rs +++ b/proto/src/proto.rs @@ -199,7 +199,10 @@ pub mod prost { } } } -#[cfg(feature = "protobuf-codec")] + +#[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] +#[cfg_attr(feature = "protobuf-codec", path = "proto/protobuf")] +#[cfg_attr(feature = "protobufv3-codec", path = "proto/protobuf_v3")] #[allow(deprecated)] pub mod protobuf { pub mod example { diff --git a/proto/src/proto/protobuf_v3/example/helloworld.rs b/proto/src/proto/protobuf_v3/example/helloworld.rs new file mode 100644 index 000000000..f5fd1867f --- /dev/null +++ b/proto/src/proto/protobuf_v3/example/helloworld.rs @@ -0,0 +1,310 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/example/helloworld.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:helloworld.HelloRequest) +pub struct HelloRequest { + // message fields + // @@protoc_insertion_point(field:helloworld.HelloRequest.name) + pub name: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:helloworld.HelloRequest.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HelloRequest { + fn default() -> &'a HelloRequest { + ::default_instance() + } +} + +impl HelloRequest { + pub fn new() -> HelloRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "name", + |m: &HelloRequest| { &m.name }, + |m: &mut HelloRequest| { &mut m.name }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "HelloRequest", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for HelloRequest { + const NAME: &'static str = "HelloRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobufv3::rt::string_size(1, &self.name); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> HelloRequest { + HelloRequest::new() + } + + fn clear(&mut self) { + self.name.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static HelloRequest { + static instance: HelloRequest = HelloRequest { + name: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for HelloRequest { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HelloRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HelloRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for HelloRequest { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:helloworld.HelloReply) +pub struct HelloReply { + // message fields + // @@protoc_insertion_point(field:helloworld.HelloReply.message) + pub message: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:helloworld.HelloReply.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HelloReply { + fn default() -> &'a HelloReply { + ::default_instance() + } +} + +impl HelloReply { + pub fn new() -> HelloReply { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "message", + |m: &HelloReply| { &m.message }, + |m: &mut HelloReply| { &mut m.message }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "HelloReply", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for HelloReply { + const NAME: &'static str = "HelloReply"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.message = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if !self.message.is_empty() { + my_size += ::protobufv3::rt::string_size(1, &self.message); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if !self.message.is_empty() { + os.write_string(1, &self.message)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> HelloReply { + HelloReply::new() + } + + fn clear(&mut self) { + self.message.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static HelloReply { + static instance: HelloReply = HelloReply { + message: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for HelloReply { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HelloReply").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HelloReply { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for HelloReply { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1dgrpc/example/helloworld.proto\x12\nhelloworld\"\"\n\x0cHelloReques\ + t\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\"&\n\nHelloReply\x12\x18\ + \n\x07message\x18\x01\x20\x01(\tR\x07message2I\n\x07Greeter\x12>\n\x08Sa\ + yHello\x12\x18.helloworld.HelloRequest\x1a\x16.helloworld.HelloReply\"\0\ + B6\n\x1bio.grpc.examples.helloworldB\x0fHelloWorldProtoP\x01\xa2\x02\x03\ + HLWb\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(2); + messages.push(HelloRequest::generated_message_descriptor_data()); + messages.push(HelloReply::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} + +pub use super::helloworld_grpc::*; diff --git a/proto/src/proto/protobuf_v3/example/helloworld_grpc.rs b/proto/src/proto/protobuf_v3/example/helloworld_grpc.rs new file mode 100644 index 000000000..adeaba045 --- /dev/null +++ b/proto/src/proto/protobuf_v3/example/helloworld_grpc.rs @@ -0,0 +1,71 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_GREETER_SAY_HELLO: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/helloworld.Greeter/SayHello", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct GreeterClient { + pub client: ::grpcio::Client, +} + +impl GreeterClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + GreeterClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn say_hello_opt(&self, req: &super::helloworld::HelloRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_GREETER_SAY_HELLO, req, opt) + } + + pub fn say_hello(&self, req: &super::helloworld::HelloRequest) -> ::grpcio::Result { + self.say_hello_opt(req, ::grpcio::CallOption::default()) + } + + pub fn say_hello_async_opt(&self, req: &super::helloworld::HelloRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_GREETER_SAY_HELLO, req, opt) + } + + pub fn say_hello_async(&self, req: &super::helloworld::HelloRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.say_hello_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait Greeter { + fn say_hello(&mut self, ctx: ::grpcio::RpcContext, _req: super::helloworld::HelloRequest, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_greeter(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s; + builder = builder.add_unary_handler(&METHOD_GREETER_SAY_HELLO, move |ctx, req, resp| { + instance.say_hello(ctx, req, resp) + }); + builder.build() +} diff --git a/proto/src/proto/protobuf_v3/example/mod.rs b/proto/src/proto/protobuf_v3/example/mod.rs new file mode 100644 index 000000000..822513740 --- /dev/null +++ b/proto/src/proto/protobuf_v3/example/mod.rs @@ -0,0 +1,4 @@ +// @generated + +pub mod helloworld; +pub mod route_guide; diff --git a/proto/src/proto/protobuf_v3/example/route_guide.rs b/proto/src/proto/protobuf_v3/example/route_guide.rs new file mode 100644 index 000000000..1c9bea184 --- /dev/null +++ b/proto/src/proto/protobuf_v3/example/route_guide.rs @@ -0,0 +1,822 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/example/route_guide.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:routeguide.Point) +pub struct Point { + // message fields + // @@protoc_insertion_point(field:routeguide.Point.latitude) + pub latitude: i32, + // @@protoc_insertion_point(field:routeguide.Point.longitude) + pub longitude: i32, + // special fields + // @@protoc_insertion_point(special_field:routeguide.Point.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Point { + fn default() -> &'a Point { + ::default_instance() + } +} + +impl Point { + pub fn new() -> Point { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "latitude", + |m: &Point| { &m.latitude }, + |m: &mut Point| { &mut m.latitude }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "longitude", + |m: &Point| { &m.longitude }, + |m: &mut Point| { &mut m.longitude }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Point", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Point { + const NAME: &'static str = "Point"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.latitude = is.read_int32()?; + }, + 16 => { + self.longitude = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.latitude != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.latitude); + } + if self.longitude != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.longitude); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.latitude != 0 { + os.write_int32(1, self.latitude)?; + } + if self.longitude != 0 { + os.write_int32(2, self.longitude)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Point { + Point::new() + } + + fn clear(&mut self) { + self.latitude = 0; + self.longitude = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Point { + static instance: Point = Point { + latitude: 0, + longitude: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Point { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Point").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Point { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Point { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:routeguide.Rectangle) +pub struct Rectangle { + // message fields + // @@protoc_insertion_point(field:routeguide.Rectangle.lo) + pub lo: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:routeguide.Rectangle.hi) + pub hi: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:routeguide.Rectangle.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Rectangle { + fn default() -> &'a Rectangle { + ::default_instance() + } +} + +impl Rectangle { + pub fn new() -> Rectangle { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Point>( + "lo", + |m: &Rectangle| { &m.lo }, + |m: &mut Rectangle| { &mut m.lo }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Point>( + "hi", + |m: &Rectangle| { &m.hi }, + |m: &mut Rectangle| { &mut m.hi }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Rectangle", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Rectangle { + const NAME: &'static str = "Rectangle"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.lo)?; + }, + 18 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.hi)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.lo.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.hi.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.lo.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.hi.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Rectangle { + Rectangle::new() + } + + fn clear(&mut self) { + self.lo.clear(); + self.hi.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static Rectangle { + static instance: Rectangle = Rectangle { + lo: ::protobufv3::MessageField::none(), + hi: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Rectangle { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Rectangle").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Rectangle { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Rectangle { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:routeguide.Feature) +pub struct Feature { + // message fields + // @@protoc_insertion_point(field:routeguide.Feature.name) + pub name: ::std::string::String, + // @@protoc_insertion_point(field:routeguide.Feature.location) + pub location: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:routeguide.Feature.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Feature { + fn default() -> &'a Feature { + ::default_instance() + } +} + +impl Feature { + pub fn new() -> Feature { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "name", + |m: &Feature| { &m.name }, + |m: &mut Feature| { &mut m.name }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Point>( + "location", + |m: &Feature| { &m.location }, + |m: &mut Feature| { &mut m.location }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Feature", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Feature { + const NAME: &'static str = "Feature"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = is.read_string()?; + }, + 18 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.location)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobufv3::rt::string_size(1, &self.name); + } + if let Some(v) = self.location.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if let Some(v) = self.location.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Feature { + Feature::new() + } + + fn clear(&mut self) { + self.name.clear(); + self.location.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static Feature { + static instance: Feature = Feature { + name: ::std::string::String::new(), + location: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Feature { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Feature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Feature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Feature { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:routeguide.RouteNote) +pub struct RouteNote { + // message fields + // @@protoc_insertion_point(field:routeguide.RouteNote.location) + pub location: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:routeguide.RouteNote.message) + pub message: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:routeguide.RouteNote.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RouteNote { + fn default() -> &'a RouteNote { + ::default_instance() + } +} + +impl RouteNote { + pub fn new() -> RouteNote { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Point>( + "location", + |m: &RouteNote| { &m.location }, + |m: &mut RouteNote| { &mut m.location }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "message", + |m: &RouteNote| { &m.message }, + |m: &mut RouteNote| { &mut m.message }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "RouteNote", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for RouteNote { + const NAME: &'static str = "RouteNote"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.location)?; + }, + 18 => { + self.message = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.location.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if !self.message.is_empty() { + my_size += ::protobufv3::rt::string_size(2, &self.message); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.location.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if !self.message.is_empty() { + os.write_string(2, &self.message)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> RouteNote { + RouteNote::new() + } + + fn clear(&mut self) { + self.location.clear(); + self.message.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static RouteNote { + static instance: RouteNote = RouteNote { + location: ::protobufv3::MessageField::none(), + message: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for RouteNote { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RouteNote").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RouteNote { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for RouteNote { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:routeguide.RouteSummary) +pub struct RouteSummary { + // message fields + // @@protoc_insertion_point(field:routeguide.RouteSummary.point_count) + pub point_count: i32, + // @@protoc_insertion_point(field:routeguide.RouteSummary.feature_count) + pub feature_count: i32, + // @@protoc_insertion_point(field:routeguide.RouteSummary.distance) + pub distance: i32, + // @@protoc_insertion_point(field:routeguide.RouteSummary.elapsed_time) + pub elapsed_time: i32, + // special fields + // @@protoc_insertion_point(special_field:routeguide.RouteSummary.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RouteSummary { + fn default() -> &'a RouteSummary { + ::default_instance() + } +} + +impl RouteSummary { + pub fn new() -> RouteSummary { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "point_count", + |m: &RouteSummary| { &m.point_count }, + |m: &mut RouteSummary| { &mut m.point_count }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "feature_count", + |m: &RouteSummary| { &m.feature_count }, + |m: &mut RouteSummary| { &mut m.feature_count }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "distance", + |m: &RouteSummary| { &m.distance }, + |m: &mut RouteSummary| { &mut m.distance }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "elapsed_time", + |m: &RouteSummary| { &m.elapsed_time }, + |m: &mut RouteSummary| { &mut m.elapsed_time }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "RouteSummary", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for RouteSummary { + const NAME: &'static str = "RouteSummary"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.point_count = is.read_int32()?; + }, + 16 => { + self.feature_count = is.read_int32()?; + }, + 24 => { + self.distance = is.read_int32()?; + }, + 32 => { + self.elapsed_time = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.point_count != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.point_count); + } + if self.feature_count != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.feature_count); + } + if self.distance != 0 { + my_size += ::protobufv3::rt::int32_size(3, self.distance); + } + if self.elapsed_time != 0 { + my_size += ::protobufv3::rt::int32_size(4, self.elapsed_time); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.point_count != 0 { + os.write_int32(1, self.point_count)?; + } + if self.feature_count != 0 { + os.write_int32(2, self.feature_count)?; + } + if self.distance != 0 { + os.write_int32(3, self.distance)?; + } + if self.elapsed_time != 0 { + os.write_int32(4, self.elapsed_time)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> RouteSummary { + RouteSummary::new() + } + + fn clear(&mut self) { + self.point_count = 0; + self.feature_count = 0; + self.distance = 0; + self.elapsed_time = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RouteSummary { + static instance: RouteSummary = RouteSummary { + point_count: 0, + feature_count: 0, + distance: 0, + elapsed_time: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for RouteSummary { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RouteSummary").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RouteSummary { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for RouteSummary { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1egrpc/example/route_guide.proto\x12\nrouteguide\"A\n\x05Point\x12\ + \x1a\n\x08latitude\x18\x01\x20\x01(\x05R\x08latitude\x12\x1c\n\tlongitud\ + e\x18\x02\x20\x01(\x05R\tlongitude\"Q\n\tRectangle\x12!\n\x02lo\x18\x01\ + \x20\x01(\x0b2\x11.routeguide.PointR\x02lo\x12!\n\x02hi\x18\x02\x20\x01(\ + \x0b2\x11.routeguide.PointR\x02hi\"L\n\x07Feature\x12\x12\n\x04name\x18\ + \x01\x20\x01(\tR\x04name\x12-\n\x08location\x18\x02\x20\x01(\x0b2\x11.ro\ + uteguide.PointR\x08location\"T\n\tRouteNote\x12-\n\x08location\x18\x01\ + \x20\x01(\x0b2\x11.routeguide.PointR\x08location\x12\x18\n\x07message\ + \x18\x02\x20\x01(\tR\x07message\"\x93\x01\n\x0cRouteSummary\x12\x1f\n\ + \x0bpoint_count\x18\x01\x20\x01(\x05R\npointCount\x12#\n\rfeature_count\ + \x18\x02\x20\x01(\x05R\x0cfeatureCount\x12\x1a\n\x08distance\x18\x03\x20\ + \x01(\x05R\x08distance\x12!\n\x0celapsed_time\x18\x04\x20\x01(\x05R\x0be\ + lapsedTime2\x85\x02\n\nRouteGuide\x126\n\nGetFeature\x12\x11.routeguide.\ + Point\x1a\x13.routeguide.Feature\"\0\x12>\n\x0cListFeatures\x12\x15.rout\ + eguide.Rectangle\x1a\x13.routeguide.Feature\"\00\x01\x12>\n\x0bRecordRou\ + te\x12\x11.routeguide.Point\x1a\x18.routeguide.RouteSummary\"\0(\x01\x12\ + ?\n\tRouteChat\x12\x15.routeguide.RouteNote\x1a\x15.routeguide.RouteNote\ + \"\0(\x010\x01B6\n\x1bio.grpc.examples.routeguideB\x0fRouteGuideProtoP\ + \x01\xa2\x02\x03RTGb\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(5); + messages.push(Point::generated_message_descriptor_data()); + messages.push(Rectangle::generated_message_descriptor_data()); + messages.push(Feature::generated_message_descriptor_data()); + messages.push(RouteNote::generated_message_descriptor_data()); + messages.push(RouteSummary::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} + +pub use super::route_guide_grpc::*; diff --git a/proto/src/proto/protobuf_v3/example/route_guide_grpc.rs b/proto/src/proto/protobuf_v3/example/route_guide_grpc.rs new file mode 100644 index 000000000..87d54a107 --- /dev/null +++ b/proto/src/proto/protobuf_v3/example/route_guide_grpc.rs @@ -0,0 +1,137 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_ROUTE_GUIDE_GET_FEATURE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/routeguide.RouteGuide/GetFeature", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_ROUTE_GUIDE_LIST_FEATURES: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ServerStreaming, + name: "/routeguide.RouteGuide/ListFeatures", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_ROUTE_GUIDE_RECORD_ROUTE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ClientStreaming, + name: "/routeguide.RouteGuide/RecordRoute", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_ROUTE_GUIDE_ROUTE_CHAT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/routeguide.RouteGuide/RouteChat", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct RouteGuideClient { + pub client: ::grpcio::Client, +} + +impl RouteGuideClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + RouteGuideClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn get_feature_opt(&self, req: &super::route_guide::Point, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_ROUTE_GUIDE_GET_FEATURE, req, opt) + } + + pub fn get_feature(&self, req: &super::route_guide::Point) -> ::grpcio::Result { + self.get_feature_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_feature_async_opt(&self, req: &super::route_guide::Point, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_ROUTE_GUIDE_GET_FEATURE, req, opt) + } + + pub fn get_feature_async(&self, req: &super::route_guide::Point) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.get_feature_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_features_opt(&self, req: &super::route_guide::Rectangle, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.client.server_streaming(&METHOD_ROUTE_GUIDE_LIST_FEATURES, req, opt) + } + + pub fn list_features(&self, req: &super::route_guide::Rectangle) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.list_features_opt(req, ::grpcio::CallOption::default()) + } + + pub fn record_route_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver)> { + self.client.client_streaming(&METHOD_ROUTE_GUIDE_RECORD_ROUTE, opt) + } + + pub fn record_route(&self) -> ::grpcio::Result<(::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver)> { + self.record_route_opt(::grpcio::CallOption::default()) + } + + pub fn route_chat_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_ROUTE_GUIDE_ROUTE_CHAT, opt) + } + + pub fn route_chat(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.route_chat_opt(::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait RouteGuide { + fn get_feature(&mut self, ctx: ::grpcio::RpcContext, _req: super::route_guide::Point, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn list_features(&mut self, ctx: ::grpcio::RpcContext, _req: super::route_guide::Rectangle, sink: ::grpcio::ServerStreamingSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn record_route(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn route_chat(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_route_guide(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_ROUTE_GUIDE_GET_FEATURE, move |ctx, req, resp| { + instance.get_feature(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_server_streaming_handler(&METHOD_ROUTE_GUIDE_LIST_FEATURES, move |ctx, req, resp| { + instance.list_features(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_client_streaming_handler(&METHOD_ROUTE_GUIDE_RECORD_ROUTE, move |ctx, req, resp| { + instance.record_route(ctx, req, resp) + }); + let mut instance = s; + builder = builder.add_duplex_streaming_handler(&METHOD_ROUTE_GUIDE_ROUTE_CHAT, move |ctx, req, resp| { + instance.route_chat(ctx, req, resp) + }); + builder.build() +} diff --git a/proto/src/proto/protobuf_v3/google/rpc/mod.rs b/proto/src/proto/protobuf_v3/google/rpc/mod.rs new file mode 100644 index 000000000..45e4d2e12 --- /dev/null +++ b/proto/src/proto/protobuf_v3/google/rpc/mod.rs @@ -0,0 +1,3 @@ +// @generated + +pub mod status; diff --git a/proto/src/proto/protobuf_v3/google/rpc/status.rs b/proto/src/proto/protobuf_v3/google/rpc/status.rs new file mode 100644 index 000000000..e452321f5 --- /dev/null +++ b/proto/src/proto/protobuf_v3/google/rpc/status.rs @@ -0,0 +1,223 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `google/rpc/status.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:google.rpc.Status) +pub struct Status { + // message fields + // @@protoc_insertion_point(field:google.rpc.Status.code) + pub code: i32, + // @@protoc_insertion_point(field:google.rpc.Status.message) + pub message: ::std::string::String, + // @@protoc_insertion_point(field:google.rpc.Status.details) + pub details: ::std::vec::Vec<::protobufv3::well_known_types::any::Any>, + // special fields + // @@protoc_insertion_point(special_field:google.rpc.Status.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Status { + fn default() -> &'a Status { + ::default_instance() + } +} + +impl Status { + pub fn new() -> Status { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "code", + |m: &Status| { &m.code }, + |m: &mut Status| { &mut m.code }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "message", + |m: &Status| { &m.message }, + |m: &mut Status| { &mut m.message }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "details", + |m: &Status| { &m.details }, + |m: &mut Status| { &mut m.details }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Status", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Status { + const NAME: &'static str = "Status"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.code = is.read_int32()?; + }, + 18 => { + self.message = is.read_string()?; + }, + 26 => { + self.details.push(is.read_message()?); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.code != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.code); + } + if !self.message.is_empty() { + my_size += ::protobufv3::rt::string_size(2, &self.message); + } + for value in &self.details { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.code != 0 { + os.write_int32(1, self.code)?; + } + if !self.message.is_empty() { + os.write_string(2, &self.message)?; + } + for v in &self.details { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Status { + Status::new() + } + + fn clear(&mut self) { + self.code = 0; + self.message.clear(); + self.details.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static Status { + static instance: Status = Status { + code: 0, + message: ::std::string::String::new(), + details: ::std::vec::Vec::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Status { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Status").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Status { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Status { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x17google/rpc/status.proto\x12\ngoogle.rpc\x1a\x19google/protobuf/any\ + .proto\"f\n\x06Status\x12\x12\n\x04code\x18\x01\x20\x01(\x05R\x04code\ + \x12\x18\n\x07message\x18\x02\x20\x01(\tR\x07message\x12.\n\x07details\ + \x18\x03\x20\x03(\x0b2\x14.google.protobuf.AnyR\x07detailsB^\n\x0ecom.go\ + ogle.rpcB\x0bStatusProtoP\x01Z7google.golang.org/genproto/googleapis/rpc\ + /status;status\xa2\x02\x03RPCb\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(::protobufv3::well_known_types::any::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(1); + messages.push(Status::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/proto/src/proto/protobuf_v3/testing/control.rs b/proto/src/proto/protobuf_v3/testing/control.rs new file mode 100644 index 000000000..27225d4c4 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/control.rs @@ -0,0 +1,4372 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/control.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.PoissonParams) +pub struct PoissonParams { + // message fields + // @@protoc_insertion_point(field:grpc.testing.PoissonParams.offered_load) + pub offered_load: f64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.PoissonParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PoissonParams { + fn default() -> &'a PoissonParams { + ::default_instance() + } +} + +impl PoissonParams { + pub fn new() -> PoissonParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "offered_load", + |m: &PoissonParams| { &m.offered_load }, + |m: &mut PoissonParams| { &mut m.offered_load }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "PoissonParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for PoissonParams { + const NAME: &'static str = "PoissonParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 9 => { + self.offered_load = is.read_double()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.offered_load != 0. { + my_size += 1 + 8; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.offered_load != 0. { + os.write_double(1, self.offered_load)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> PoissonParams { + PoissonParams::new() + } + + fn clear(&mut self) { + self.offered_load = 0.; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PoissonParams { + static instance: PoissonParams = PoissonParams { + offered_load: 0., + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for PoissonParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PoissonParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PoissonParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for PoissonParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ClosedLoopParams) +pub struct ClosedLoopParams { + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ClosedLoopParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ClosedLoopParams { + fn default() -> &'a ClosedLoopParams { + ::default_instance() + } +} + +impl ClosedLoopParams { + pub fn new() -> ClosedLoopParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ClosedLoopParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ClosedLoopParams { + const NAME: &'static str = "ClosedLoopParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ClosedLoopParams { + ClosedLoopParams::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static ClosedLoopParams { + static instance: ClosedLoopParams = ClosedLoopParams { + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ClosedLoopParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ClosedLoopParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ClosedLoopParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ClosedLoopParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.LoadParams) +pub struct LoadParams { + // message oneof groups + pub load: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.LoadParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a LoadParams { + fn default() -> &'a LoadParams { + ::default_instance() + } +} + +impl LoadParams { + pub fn new() -> LoadParams { + ::std::default::Default::default() + } + + // .grpc.testing.ClosedLoopParams closed_loop = 1; + + pub fn closed_loop(&self) -> &ClosedLoopParams { + match self.load { + ::std::option::Option::Some(load_params::Load::ClosedLoop(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_closed_loop(&mut self) { + self.load = ::std::option::Option::None; + } + + pub fn has_closed_loop(&self) -> bool { + match self.load { + ::std::option::Option::Some(load_params::Load::ClosedLoop(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_closed_loop(&mut self, v: ClosedLoopParams) { + self.load = ::std::option::Option::Some(load_params::Load::ClosedLoop(v)) + } + + // Mutable pointer to the field. + pub fn mut_closed_loop(&mut self) -> &mut ClosedLoopParams { + if let ::std::option::Option::Some(load_params::Load::ClosedLoop(_)) = self.load { + } else { + self.load = ::std::option::Option::Some(load_params::Load::ClosedLoop(ClosedLoopParams::new())); + } + match self.load { + ::std::option::Option::Some(load_params::Load::ClosedLoop(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_closed_loop(&mut self) -> ClosedLoopParams { + if self.has_closed_loop() { + match self.load.take() { + ::std::option::Option::Some(load_params::Load::ClosedLoop(v)) => v, + _ => panic!(), + } + } else { + ClosedLoopParams::new() + } + } + + // .grpc.testing.PoissonParams poisson = 2; + + pub fn poisson(&self) -> &PoissonParams { + match self.load { + ::std::option::Option::Some(load_params::Load::Poisson(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_poisson(&mut self) { + self.load = ::std::option::Option::None; + } + + pub fn has_poisson(&self) -> bool { + match self.load { + ::std::option::Option::Some(load_params::Load::Poisson(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_poisson(&mut self, v: PoissonParams) { + self.load = ::std::option::Option::Some(load_params::Load::Poisson(v)) + } + + // Mutable pointer to the field. + pub fn mut_poisson(&mut self) -> &mut PoissonParams { + if let ::std::option::Option::Some(load_params::Load::Poisson(_)) = self.load { + } else { + self.load = ::std::option::Option::Some(load_params::Load::Poisson(PoissonParams::new())); + } + match self.load { + ::std::option::Option::Some(load_params::Load::Poisson(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_poisson(&mut self) -> PoissonParams { + if self.has_poisson() { + match self.load.take() { + ::std::option::Option::Some(load_params::Load::Poisson(v)) => v, + _ => panic!(), + } + } else { + PoissonParams::new() + } + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(1); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, ClosedLoopParams>( + "closed_loop", + LoadParams::has_closed_loop, + LoadParams::closed_loop, + LoadParams::mut_closed_loop, + LoadParams::set_closed_loop, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, PoissonParams>( + "poisson", + LoadParams::has_poisson, + LoadParams::poisson, + LoadParams::mut_poisson, + LoadParams::set_poisson, + )); + oneofs.push(load_params::Load::generated_oneof_descriptor_data()); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "LoadParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for LoadParams { + const NAME: &'static str = "LoadParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.load = ::std::option::Option::Some(load_params::Load::ClosedLoop(is.read_message()?)); + }, + 18 => { + self.load = ::std::option::Option::Some(load_params::Load::Poisson(is.read_message()?)); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.load { + match v { + &load_params::Load::ClosedLoop(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + &load_params::Load::Poisson(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + }; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let ::std::option::Option::Some(ref v) = self.load { + match v { + &load_params::Load::ClosedLoop(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + }, + &load_params::Load::Poisson(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + }, + }; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> LoadParams { + LoadParams::new() + } + + fn clear(&mut self) { + self.load = ::std::option::Option::None; + self.load = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static LoadParams { + static instance: LoadParams = LoadParams { + load: ::std::option::Option::None, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for LoadParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("LoadParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for LoadParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for LoadParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `LoadParams` +pub mod load_params { + + #[derive(Clone,PartialEq,Debug)] + #[non_exhaustive] + // @@protoc_insertion_point(oneof:grpc.testing.LoadParams.load) + pub enum Load { + // @@protoc_insertion_point(oneof_field:grpc.testing.LoadParams.closed_loop) + ClosedLoop(super::ClosedLoopParams), + // @@protoc_insertion_point(oneof_field:grpc.testing.LoadParams.poisson) + Poisson(super::PoissonParams), + } + + impl ::protobufv3::Oneof for Load { + } + + impl ::protobufv3::OneofFull for Load { + fn descriptor() -> ::protobufv3::reflect::OneofDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::OneofDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| ::descriptor().oneof_by_name("load").unwrap()).clone() + } + } + + impl Load { + pub(in super) fn generated_oneof_descriptor_data() -> ::protobufv3::reflect::GeneratedOneofDescriptorData { + ::protobufv3::reflect::GeneratedOneofDescriptorData::new::("load") + } + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.SecurityParams) +pub struct SecurityParams { + // message fields + // @@protoc_insertion_point(field:grpc.testing.SecurityParams.use_test_ca) + pub use_test_ca: bool, + // @@protoc_insertion_point(field:grpc.testing.SecurityParams.server_host_override) + pub server_host_override: ::std::string::String, + // @@protoc_insertion_point(field:grpc.testing.SecurityParams.cred_type) + pub cred_type: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.SecurityParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SecurityParams { + fn default() -> &'a SecurityParams { + ::default_instance() + } +} + +impl SecurityParams { + pub fn new() -> SecurityParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "use_test_ca", + |m: &SecurityParams| { &m.use_test_ca }, + |m: &mut SecurityParams| { &mut m.use_test_ca }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_host_override", + |m: &SecurityParams| { &m.server_host_override }, + |m: &mut SecurityParams| { &mut m.server_host_override }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "cred_type", + |m: &SecurityParams| { &m.cred_type }, + |m: &mut SecurityParams| { &mut m.cred_type }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "SecurityParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for SecurityParams { + const NAME: &'static str = "SecurityParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.use_test_ca = is.read_bool()?; + }, + 18 => { + self.server_host_override = is.read_string()?; + }, + 26 => { + self.cred_type = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.use_test_ca != false { + my_size += 1 + 1; + } + if !self.server_host_override.is_empty() { + my_size += ::protobufv3::rt::string_size(2, &self.server_host_override); + } + if !self.cred_type.is_empty() { + my_size += ::protobufv3::rt::string_size(3, &self.cred_type); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.use_test_ca != false { + os.write_bool(1, self.use_test_ca)?; + } + if !self.server_host_override.is_empty() { + os.write_string(2, &self.server_host_override)?; + } + if !self.cred_type.is_empty() { + os.write_string(3, &self.cred_type)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> SecurityParams { + SecurityParams::new() + } + + fn clear(&mut self) { + self.use_test_ca = false; + self.server_host_override.clear(); + self.cred_type.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static SecurityParams { + static instance: SecurityParams = SecurityParams { + use_test_ca: false, + server_host_override: ::std::string::String::new(), + cred_type: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for SecurityParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SecurityParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SecurityParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for SecurityParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ChannelArg) +pub struct ChannelArg { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ChannelArg.name) + pub name: ::std::string::String, + // message oneof groups + pub value: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ChannelArg.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ChannelArg { + fn default() -> &'a ChannelArg { + ::default_instance() + } +} + +impl ChannelArg { + pub fn new() -> ChannelArg { + ::std::default::Default::default() + } + + // string str_value = 2; + + pub fn str_value(&self) -> &str { + match self.value { + ::std::option::Option::Some(channel_arg::Value::StrValue(ref v)) => v, + _ => "", + } + } + + pub fn clear_str_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_str_value(&self) -> bool { + match self.value { + ::std::option::Option::Some(channel_arg::Value::StrValue(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_str_value(&mut self, v: ::std::string::String) { + self.value = ::std::option::Option::Some(channel_arg::Value::StrValue(v)) + } + + // Mutable pointer to the field. + pub fn mut_str_value(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(channel_arg::Value::StrValue(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(channel_arg::Value::StrValue(::std::string::String::new())); + } + match self.value { + ::std::option::Option::Some(channel_arg::Value::StrValue(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_str_value(&mut self) -> ::std::string::String { + if self.has_str_value() { + match self.value.take() { + ::std::option::Option::Some(channel_arg::Value::StrValue(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } + + // int32 int_value = 3; + + pub fn int_value(&self) -> i32 { + match self.value { + ::std::option::Option::Some(channel_arg::Value::IntValue(v)) => v, + _ => 0, + } + } + + pub fn clear_int_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_int_value(&self) -> bool { + match self.value { + ::std::option::Option::Some(channel_arg::Value::IntValue(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_int_value(&mut self, v: i32) { + self.value = ::std::option::Option::Some(channel_arg::Value::IntValue(v)) + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(1); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "name", + |m: &ChannelArg| { &m.name }, + |m: &mut ChannelArg| { &mut m.name }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_deref_has_get_set_simpler_accessor::<_, _>( + "str_value", + ChannelArg::has_str_value, + ChannelArg::str_value, + ChannelArg::set_str_value, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_copy_has_get_set_simpler_accessors::<_, _>( + "int_value", + ChannelArg::has_int_value, + ChannelArg::int_value, + ChannelArg::set_int_value, + )); + oneofs.push(channel_arg::Value::generated_oneof_descriptor_data()); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ChannelArg", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ChannelArg { + const NAME: &'static str = "ChannelArg"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = is.read_string()?; + }, + 18 => { + self.value = ::std::option::Option::Some(channel_arg::Value::StrValue(is.read_string()?)); + }, + 24 => { + self.value = ::std::option::Option::Some(channel_arg::Value::IntValue(is.read_int32()?)); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobufv3::rt::string_size(1, &self.name); + } + if let ::std::option::Option::Some(ref v) = self.value { + match v { + &channel_arg::Value::StrValue(ref v) => { + my_size += ::protobufv3::rt::string_size(2, &v); + }, + &channel_arg::Value::IntValue(v) => { + my_size += ::protobufv3::rt::int32_size(3, v); + }, + }; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if let ::std::option::Option::Some(ref v) = self.value { + match v { + &channel_arg::Value::StrValue(ref v) => { + os.write_string(2, v)?; + }, + &channel_arg::Value::IntValue(v) => { + os.write_int32(3, v)?; + }, + }; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ChannelArg { + ChannelArg::new() + } + + fn clear(&mut self) { + self.name.clear(); + self.value = ::std::option::Option::None; + self.value = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ChannelArg { + static instance: ChannelArg = ChannelArg { + name: ::std::string::String::new(), + value: ::std::option::Option::None, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ChannelArg { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ChannelArg").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ChannelArg { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ChannelArg { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `ChannelArg` +pub mod channel_arg { + + #[derive(Clone,PartialEq,Debug)] + #[non_exhaustive] + // @@protoc_insertion_point(oneof:grpc.testing.ChannelArg.value) + pub enum Value { + // @@protoc_insertion_point(oneof_field:grpc.testing.ChannelArg.str_value) + StrValue(::std::string::String), + // @@protoc_insertion_point(oneof_field:grpc.testing.ChannelArg.int_value) + IntValue(i32), + } + + impl ::protobufv3::Oneof for Value { + } + + impl ::protobufv3::OneofFull for Value { + fn descriptor() -> ::protobufv3::reflect::OneofDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::OneofDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| ::descriptor().oneof_by_name("value").unwrap()).clone() + } + } + + impl Value { + pub(in super) fn generated_oneof_descriptor_data() -> ::protobufv3::reflect::GeneratedOneofDescriptorData { + ::protobufv3::reflect::GeneratedOneofDescriptorData::new::("value") + } + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ClientConfig) +pub struct ClientConfig { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.server_targets) + pub server_targets: ::std::vec::Vec<::std::string::String>, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.client_type) + pub client_type: ::protobufv3::EnumOrUnknown, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.security_params) + pub security_params: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.outstanding_rpcs_per_channel) + pub outstanding_rpcs_per_channel: i32, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.client_channels) + pub client_channels: i32, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.async_client_threads) + pub async_client_threads: i32, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.rpc_type) + pub rpc_type: ::protobufv3::EnumOrUnknown, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.load_params) + pub load_params: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.payload_config) + pub payload_config: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.histogram_params) + pub histogram_params: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.core_list) + pub core_list: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.core_limit) + pub core_limit: i32, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.other_client_api) + pub other_client_api: ::std::string::String, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.channel_args) + pub channel_args: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.threads_per_cq) + pub threads_per_cq: i32, + // @@protoc_insertion_point(field:grpc.testing.ClientConfig.messages_per_stream) + pub messages_per_stream: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ClientConfig.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ClientConfig { + fn default() -> &'a ClientConfig { + ::default_instance() + } +} + +impl ClientConfig { + pub fn new() -> ClientConfig { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(16); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "server_targets", + |m: &ClientConfig| { &m.server_targets }, + |m: &mut ClientConfig| { &mut m.server_targets }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "client_type", + |m: &ClientConfig| { &m.client_type }, + |m: &mut ClientConfig| { &mut m.client_type }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, SecurityParams>( + "security_params", + |m: &ClientConfig| { &m.security_params }, + |m: &mut ClientConfig| { &mut m.security_params }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "outstanding_rpcs_per_channel", + |m: &ClientConfig| { &m.outstanding_rpcs_per_channel }, + |m: &mut ClientConfig| { &mut m.outstanding_rpcs_per_channel }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "client_channels", + |m: &ClientConfig| { &m.client_channels }, + |m: &mut ClientConfig| { &mut m.client_channels }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "async_client_threads", + |m: &ClientConfig| { &m.async_client_threads }, + |m: &mut ClientConfig| { &mut m.async_client_threads }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "rpc_type", + |m: &ClientConfig| { &m.rpc_type }, + |m: &mut ClientConfig| { &mut m.rpc_type }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, LoadParams>( + "load_params", + |m: &ClientConfig| { &m.load_params }, + |m: &mut ClientConfig| { &mut m.load_params }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, super::payloads::PayloadConfig>( + "payload_config", + |m: &ClientConfig| { &m.payload_config }, + |m: &mut ClientConfig| { &mut m.payload_config }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, super::stats::HistogramParams>( + "histogram_params", + |m: &ClientConfig| { &m.histogram_params }, + |m: &mut ClientConfig| { &mut m.histogram_params }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "core_list", + |m: &ClientConfig| { &m.core_list }, + |m: &mut ClientConfig| { &mut m.core_list }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "core_limit", + |m: &ClientConfig| { &m.core_limit }, + |m: &mut ClientConfig| { &mut m.core_limit }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "other_client_api", + |m: &ClientConfig| { &m.other_client_api }, + |m: &mut ClientConfig| { &mut m.other_client_api }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "channel_args", + |m: &ClientConfig| { &m.channel_args }, + |m: &mut ClientConfig| { &mut m.channel_args }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "threads_per_cq", + |m: &ClientConfig| { &m.threads_per_cq }, + |m: &mut ClientConfig| { &mut m.threads_per_cq }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "messages_per_stream", + |m: &ClientConfig| { &m.messages_per_stream }, + |m: &mut ClientConfig| { &mut m.messages_per_stream }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ClientConfig", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ClientConfig { + const NAME: &'static str = "ClientConfig"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.server_targets.push(is.read_string()?); + }, + 16 => { + self.client_type = is.read_enum_or_unknown()?; + }, + 26 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.security_params)?; + }, + 32 => { + self.outstanding_rpcs_per_channel = is.read_int32()?; + }, + 40 => { + self.client_channels = is.read_int32()?; + }, + 56 => { + self.async_client_threads = is.read_int32()?; + }, + 64 => { + self.rpc_type = is.read_enum_or_unknown()?; + }, + 82 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.load_params)?; + }, + 90 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload_config)?; + }, + 98 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.histogram_params)?; + }, + 106 => { + is.read_repeated_packed_int32_into(&mut self.core_list)?; + }, + 104 => { + self.core_list.push(is.read_int32()?); + }, + 112 => { + self.core_limit = is.read_int32()?; + }, + 122 => { + self.other_client_api = is.read_string()?; + }, + 130 => { + self.channel_args.push(is.read_message()?); + }, + 136 => { + self.threads_per_cq = is.read_int32()?; + }, + 144 => { + self.messages_per_stream = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.server_targets { + my_size += ::protobufv3::rt::string_size(1, &value); + }; + if self.client_type != ::protobufv3::EnumOrUnknown::new(ClientType::SYNC_CLIENT) { + my_size += ::protobufv3::rt::int32_size(2, self.client_type.value()); + } + if let Some(v) = self.security_params.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.outstanding_rpcs_per_channel != 0 { + my_size += ::protobufv3::rt::int32_size(4, self.outstanding_rpcs_per_channel); + } + if self.client_channels != 0 { + my_size += ::protobufv3::rt::int32_size(5, self.client_channels); + } + if self.async_client_threads != 0 { + my_size += ::protobufv3::rt::int32_size(7, self.async_client_threads); + } + if self.rpc_type != ::protobufv3::EnumOrUnknown::new(RpcType::UNARY) { + my_size += ::protobufv3::rt::int32_size(8, self.rpc_type.value()); + } + if let Some(v) = self.load_params.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.payload_config.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.histogram_params.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + for value in &self.core_list { + my_size += ::protobufv3::rt::int32_size(13, *value); + }; + if self.core_limit != 0 { + my_size += ::protobufv3::rt::int32_size(14, self.core_limit); + } + if !self.other_client_api.is_empty() { + my_size += ::protobufv3::rt::string_size(15, &self.other_client_api); + } + for value in &self.channel_args { + let len = value.compute_size(); + my_size += 2 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + if self.threads_per_cq != 0 { + my_size += ::protobufv3::rt::int32_size(17, self.threads_per_cq); + } + if self.messages_per_stream != 0 { + my_size += ::protobufv3::rt::int32_size(18, self.messages_per_stream); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + for v in &self.server_targets { + os.write_string(1, &v)?; + }; + if self.client_type != ::protobufv3::EnumOrUnknown::new(ClientType::SYNC_CLIENT) { + os.write_enum(2, ::protobufv3::EnumOrUnknown::value(&self.client_type))?; + } + if let Some(v) = self.security_params.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + } + if self.outstanding_rpcs_per_channel != 0 { + os.write_int32(4, self.outstanding_rpcs_per_channel)?; + } + if self.client_channels != 0 { + os.write_int32(5, self.client_channels)?; + } + if self.async_client_threads != 0 { + os.write_int32(7, self.async_client_threads)?; + } + if self.rpc_type != ::protobufv3::EnumOrUnknown::new(RpcType::UNARY) { + os.write_enum(8, ::protobufv3::EnumOrUnknown::value(&self.rpc_type))?; + } + if let Some(v) = self.load_params.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(10, v, os)?; + } + if let Some(v) = self.payload_config.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(11, v, os)?; + } + if let Some(v) = self.histogram_params.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(12, v, os)?; + } + for v in &self.core_list { + os.write_int32(13, *v)?; + }; + if self.core_limit != 0 { + os.write_int32(14, self.core_limit)?; + } + if !self.other_client_api.is_empty() { + os.write_string(15, &self.other_client_api)?; + } + for v in &self.channel_args { + ::protobufv3::rt::write_message_field_with_cached_size(16, v, os)?; + }; + if self.threads_per_cq != 0 { + os.write_int32(17, self.threads_per_cq)?; + } + if self.messages_per_stream != 0 { + os.write_int32(18, self.messages_per_stream)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ClientConfig { + ClientConfig::new() + } + + fn clear(&mut self) { + self.server_targets.clear(); + self.client_type = ::protobufv3::EnumOrUnknown::new(ClientType::SYNC_CLIENT); + self.security_params.clear(); + self.outstanding_rpcs_per_channel = 0; + self.client_channels = 0; + self.async_client_threads = 0; + self.rpc_type = ::protobufv3::EnumOrUnknown::new(RpcType::UNARY); + self.load_params.clear(); + self.payload_config.clear(); + self.histogram_params.clear(); + self.core_list.clear(); + self.core_limit = 0; + self.other_client_api.clear(); + self.channel_args.clear(); + self.threads_per_cq = 0; + self.messages_per_stream = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ClientConfig { + static instance: ClientConfig = ClientConfig { + server_targets: ::std::vec::Vec::new(), + client_type: ::protobufv3::EnumOrUnknown::from_i32(0), + security_params: ::protobufv3::MessageField::none(), + outstanding_rpcs_per_channel: 0, + client_channels: 0, + async_client_threads: 0, + rpc_type: ::protobufv3::EnumOrUnknown::from_i32(0), + load_params: ::protobufv3::MessageField::none(), + payload_config: ::protobufv3::MessageField::none(), + histogram_params: ::protobufv3::MessageField::none(), + core_list: ::std::vec::Vec::new(), + core_limit: 0, + other_client_api: ::std::string::String::new(), + channel_args: ::std::vec::Vec::new(), + threads_per_cq: 0, + messages_per_stream: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ClientConfig { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ClientConfig").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ClientConfig { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ClientConfig { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ClientStatus) +pub struct ClientStatus { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ClientStatus.stats) + pub stats: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ClientStatus.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ClientStatus { + fn default() -> &'a ClientStatus { + ::default_instance() + } +} + +impl ClientStatus { + pub fn new() -> ClientStatus { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, super::stats::ClientStats>( + "stats", + |m: &ClientStatus| { &m.stats }, + |m: &mut ClientStatus| { &mut m.stats }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ClientStatus", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ClientStatus { + const NAME: &'static str = "ClientStatus"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.stats)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.stats.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ClientStatus { + ClientStatus::new() + } + + fn clear(&mut self) { + self.stats.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static ClientStatus { + static instance: ClientStatus = ClientStatus { + stats: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ClientStatus { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ClientStatus").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ClientStatus { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ClientStatus { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.Mark) +pub struct Mark { + // message fields + // @@protoc_insertion_point(field:grpc.testing.Mark.reset) + pub reset: bool, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.Mark.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Mark { + fn default() -> &'a Mark { + ::default_instance() + } +} + +impl Mark { + pub fn new() -> Mark { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "reset", + |m: &Mark| { &m.reset }, + |m: &mut Mark| { &mut m.reset }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Mark", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Mark { + const NAME: &'static str = "Mark"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.reset = is.read_bool()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.reset != false { + my_size += 1 + 1; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.reset != false { + os.write_bool(1, self.reset)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Mark { + Mark::new() + } + + fn clear(&mut self) { + self.reset = false; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Mark { + static instance: Mark = Mark { + reset: false, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Mark { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Mark").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Mark { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Mark { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ClientArgs) +pub struct ClientArgs { + // message oneof groups + pub argtype: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ClientArgs.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ClientArgs { + fn default() -> &'a ClientArgs { + ::default_instance() + } +} + +impl ClientArgs { + pub fn new() -> ClientArgs { + ::std::default::Default::default() + } + + // .grpc.testing.ClientConfig setup = 1; + + pub fn setup(&self) -> &ClientConfig { + match self.argtype { + ::std::option::Option::Some(client_args::Argtype::Setup(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_setup(&mut self) { + self.argtype = ::std::option::Option::None; + } + + pub fn has_setup(&self) -> bool { + match self.argtype { + ::std::option::Option::Some(client_args::Argtype::Setup(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_setup(&mut self, v: ClientConfig) { + self.argtype = ::std::option::Option::Some(client_args::Argtype::Setup(v)) + } + + // Mutable pointer to the field. + pub fn mut_setup(&mut self) -> &mut ClientConfig { + if let ::std::option::Option::Some(client_args::Argtype::Setup(_)) = self.argtype { + } else { + self.argtype = ::std::option::Option::Some(client_args::Argtype::Setup(ClientConfig::new())); + } + match self.argtype { + ::std::option::Option::Some(client_args::Argtype::Setup(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_setup(&mut self) -> ClientConfig { + if self.has_setup() { + match self.argtype.take() { + ::std::option::Option::Some(client_args::Argtype::Setup(v)) => v, + _ => panic!(), + } + } else { + ClientConfig::new() + } + } + + // .grpc.testing.Mark mark = 2; + + pub fn mark(&self) -> &Mark { + match self.argtype { + ::std::option::Option::Some(client_args::Argtype::Mark(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_mark(&mut self) { + self.argtype = ::std::option::Option::None; + } + + pub fn has_mark(&self) -> bool { + match self.argtype { + ::std::option::Option::Some(client_args::Argtype::Mark(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_mark(&mut self, v: Mark) { + self.argtype = ::std::option::Option::Some(client_args::Argtype::Mark(v)) + } + + // Mutable pointer to the field. + pub fn mut_mark(&mut self) -> &mut Mark { + if let ::std::option::Option::Some(client_args::Argtype::Mark(_)) = self.argtype { + } else { + self.argtype = ::std::option::Option::Some(client_args::Argtype::Mark(Mark::new())); + } + match self.argtype { + ::std::option::Option::Some(client_args::Argtype::Mark(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_mark(&mut self) -> Mark { + if self.has_mark() { + match self.argtype.take() { + ::std::option::Option::Some(client_args::Argtype::Mark(v)) => v, + _ => panic!(), + } + } else { + Mark::new() + } + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(1); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, ClientConfig>( + "setup", + ClientArgs::has_setup, + ClientArgs::setup, + ClientArgs::mut_setup, + ClientArgs::set_setup, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, Mark>( + "mark", + ClientArgs::has_mark, + ClientArgs::mark, + ClientArgs::mut_mark, + ClientArgs::set_mark, + )); + oneofs.push(client_args::Argtype::generated_oneof_descriptor_data()); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ClientArgs", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ClientArgs { + const NAME: &'static str = "ClientArgs"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.argtype = ::std::option::Option::Some(client_args::Argtype::Setup(is.read_message()?)); + }, + 18 => { + self.argtype = ::std::option::Option::Some(client_args::Argtype::Mark(is.read_message()?)); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.argtype { + match v { + &client_args::Argtype::Setup(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + &client_args::Argtype::Mark(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + }; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let ::std::option::Option::Some(ref v) = self.argtype { + match v { + &client_args::Argtype::Setup(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + }, + &client_args::Argtype::Mark(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + }, + }; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ClientArgs { + ClientArgs::new() + } + + fn clear(&mut self) { + self.argtype = ::std::option::Option::None; + self.argtype = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ClientArgs { + static instance: ClientArgs = ClientArgs { + argtype: ::std::option::Option::None, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ClientArgs { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ClientArgs").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ClientArgs { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ClientArgs { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `ClientArgs` +pub mod client_args { + + #[derive(Clone,PartialEq,Debug)] + #[non_exhaustive] + // @@protoc_insertion_point(oneof:grpc.testing.ClientArgs.argtype) + pub enum Argtype { + // @@protoc_insertion_point(oneof_field:grpc.testing.ClientArgs.setup) + Setup(super::ClientConfig), + // @@protoc_insertion_point(oneof_field:grpc.testing.ClientArgs.mark) + Mark(super::Mark), + } + + impl ::protobufv3::Oneof for Argtype { + } + + impl ::protobufv3::OneofFull for Argtype { + fn descriptor() -> ::protobufv3::reflect::OneofDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::OneofDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| ::descriptor().oneof_by_name("argtype").unwrap()).clone() + } + } + + impl Argtype { + pub(in super) fn generated_oneof_descriptor_data() -> ::protobufv3::reflect::GeneratedOneofDescriptorData { + ::protobufv3::reflect::GeneratedOneofDescriptorData::new::("argtype") + } + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ServerConfig) +pub struct ServerConfig { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.server_type) + pub server_type: ::protobufv3::EnumOrUnknown, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.security_params) + pub security_params: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.port) + pub port: i32, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.async_server_threads) + pub async_server_threads: i32, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.core_limit) + pub core_limit: i32, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.payload_config) + pub payload_config: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.core_list) + pub core_list: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.other_server_api) + pub other_server_api: ::std::string::String, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.threads_per_cq) + pub threads_per_cq: i32, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.resource_quota_size) + pub resource_quota_size: i32, + // @@protoc_insertion_point(field:grpc.testing.ServerConfig.channel_args) + pub channel_args: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ServerConfig.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ServerConfig { + fn default() -> &'a ServerConfig { + ::default_instance() + } +} + +impl ServerConfig { + pub fn new() -> ServerConfig { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(11); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_type", + |m: &ServerConfig| { &m.server_type }, + |m: &mut ServerConfig| { &mut m.server_type }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, SecurityParams>( + "security_params", + |m: &ServerConfig| { &m.security_params }, + |m: &mut ServerConfig| { &mut m.security_params }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "port", + |m: &ServerConfig| { &m.port }, + |m: &mut ServerConfig| { &mut m.port }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "async_server_threads", + |m: &ServerConfig| { &m.async_server_threads }, + |m: &mut ServerConfig| { &mut m.async_server_threads }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "core_limit", + |m: &ServerConfig| { &m.core_limit }, + |m: &mut ServerConfig| { &mut m.core_limit }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, super::payloads::PayloadConfig>( + "payload_config", + |m: &ServerConfig| { &m.payload_config }, + |m: &mut ServerConfig| { &mut m.payload_config }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "core_list", + |m: &ServerConfig| { &m.core_list }, + |m: &mut ServerConfig| { &mut m.core_list }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "other_server_api", + |m: &ServerConfig| { &m.other_server_api }, + |m: &mut ServerConfig| { &mut m.other_server_api }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "threads_per_cq", + |m: &ServerConfig| { &m.threads_per_cq }, + |m: &mut ServerConfig| { &mut m.threads_per_cq }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "resource_quota_size", + |m: &ServerConfig| { &m.resource_quota_size }, + |m: &mut ServerConfig| { &mut m.resource_quota_size }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "channel_args", + |m: &ServerConfig| { &m.channel_args }, + |m: &mut ServerConfig| { &mut m.channel_args }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ServerConfig", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ServerConfig { + const NAME: &'static str = "ServerConfig"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.server_type = is.read_enum_or_unknown()?; + }, + 18 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.security_params)?; + }, + 32 => { + self.port = is.read_int32()?; + }, + 56 => { + self.async_server_threads = is.read_int32()?; + }, + 64 => { + self.core_limit = is.read_int32()?; + }, + 74 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload_config)?; + }, + 82 => { + is.read_repeated_packed_int32_into(&mut self.core_list)?; + }, + 80 => { + self.core_list.push(is.read_int32()?); + }, + 90 => { + self.other_server_api = is.read_string()?; + }, + 96 => { + self.threads_per_cq = is.read_int32()?; + }, + 8008 => { + self.resource_quota_size = is.read_int32()?; + }, + 8018 => { + self.channel_args.push(is.read_message()?); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.server_type != ::protobufv3::EnumOrUnknown::new(ServerType::SYNC_SERVER) { + my_size += ::protobufv3::rt::int32_size(1, self.server_type.value()); + } + if let Some(v) = self.security_params.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.port != 0 { + my_size += ::protobufv3::rt::int32_size(4, self.port); + } + if self.async_server_threads != 0 { + my_size += ::protobufv3::rt::int32_size(7, self.async_server_threads); + } + if self.core_limit != 0 { + my_size += ::protobufv3::rt::int32_size(8, self.core_limit); + } + if let Some(v) = self.payload_config.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + for value in &self.core_list { + my_size += ::protobufv3::rt::int32_size(10, *value); + }; + if !self.other_server_api.is_empty() { + my_size += ::protobufv3::rt::string_size(11, &self.other_server_api); + } + if self.threads_per_cq != 0 { + my_size += ::protobufv3::rt::int32_size(12, self.threads_per_cq); + } + if self.resource_quota_size != 0 { + my_size += ::protobufv3::rt::int32_size(1001, self.resource_quota_size); + } + for value in &self.channel_args { + let len = value.compute_size(); + my_size += 2 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.server_type != ::protobufv3::EnumOrUnknown::new(ServerType::SYNC_SERVER) { + os.write_enum(1, ::protobufv3::EnumOrUnknown::value(&self.server_type))?; + } + if let Some(v) = self.security_params.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + } + if self.port != 0 { + os.write_int32(4, self.port)?; + } + if self.async_server_threads != 0 { + os.write_int32(7, self.async_server_threads)?; + } + if self.core_limit != 0 { + os.write_int32(8, self.core_limit)?; + } + if let Some(v) = self.payload_config.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(9, v, os)?; + } + for v in &self.core_list { + os.write_int32(10, *v)?; + }; + if !self.other_server_api.is_empty() { + os.write_string(11, &self.other_server_api)?; + } + if self.threads_per_cq != 0 { + os.write_int32(12, self.threads_per_cq)?; + } + if self.resource_quota_size != 0 { + os.write_int32(1001, self.resource_quota_size)?; + } + for v in &self.channel_args { + ::protobufv3::rt::write_message_field_with_cached_size(1002, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ServerConfig { + ServerConfig::new() + } + + fn clear(&mut self) { + self.server_type = ::protobufv3::EnumOrUnknown::new(ServerType::SYNC_SERVER); + self.security_params.clear(); + self.port = 0; + self.async_server_threads = 0; + self.core_limit = 0; + self.payload_config.clear(); + self.core_list.clear(); + self.other_server_api.clear(); + self.threads_per_cq = 0; + self.resource_quota_size = 0; + self.channel_args.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static ServerConfig { + static instance: ServerConfig = ServerConfig { + server_type: ::protobufv3::EnumOrUnknown::from_i32(0), + security_params: ::protobufv3::MessageField::none(), + port: 0, + async_server_threads: 0, + core_limit: 0, + payload_config: ::protobufv3::MessageField::none(), + core_list: ::std::vec::Vec::new(), + other_server_api: ::std::string::String::new(), + threads_per_cq: 0, + resource_quota_size: 0, + channel_args: ::std::vec::Vec::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ServerConfig { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ServerConfig").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ServerConfig { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ServerConfig { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ServerArgs) +pub struct ServerArgs { + // message oneof groups + pub argtype: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ServerArgs.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ServerArgs { + fn default() -> &'a ServerArgs { + ::default_instance() + } +} + +impl ServerArgs { + pub fn new() -> ServerArgs { + ::std::default::Default::default() + } + + // .grpc.testing.ServerConfig setup = 1; + + pub fn setup(&self) -> &ServerConfig { + match self.argtype { + ::std::option::Option::Some(server_args::Argtype::Setup(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_setup(&mut self) { + self.argtype = ::std::option::Option::None; + } + + pub fn has_setup(&self) -> bool { + match self.argtype { + ::std::option::Option::Some(server_args::Argtype::Setup(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_setup(&mut self, v: ServerConfig) { + self.argtype = ::std::option::Option::Some(server_args::Argtype::Setup(v)) + } + + // Mutable pointer to the field. + pub fn mut_setup(&mut self) -> &mut ServerConfig { + if let ::std::option::Option::Some(server_args::Argtype::Setup(_)) = self.argtype { + } else { + self.argtype = ::std::option::Option::Some(server_args::Argtype::Setup(ServerConfig::new())); + } + match self.argtype { + ::std::option::Option::Some(server_args::Argtype::Setup(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_setup(&mut self) -> ServerConfig { + if self.has_setup() { + match self.argtype.take() { + ::std::option::Option::Some(server_args::Argtype::Setup(v)) => v, + _ => panic!(), + } + } else { + ServerConfig::new() + } + } + + // .grpc.testing.Mark mark = 2; + + pub fn mark(&self) -> &Mark { + match self.argtype { + ::std::option::Option::Some(server_args::Argtype::Mark(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_mark(&mut self) { + self.argtype = ::std::option::Option::None; + } + + pub fn has_mark(&self) -> bool { + match self.argtype { + ::std::option::Option::Some(server_args::Argtype::Mark(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_mark(&mut self, v: Mark) { + self.argtype = ::std::option::Option::Some(server_args::Argtype::Mark(v)) + } + + // Mutable pointer to the field. + pub fn mut_mark(&mut self) -> &mut Mark { + if let ::std::option::Option::Some(server_args::Argtype::Mark(_)) = self.argtype { + } else { + self.argtype = ::std::option::Option::Some(server_args::Argtype::Mark(Mark::new())); + } + match self.argtype { + ::std::option::Option::Some(server_args::Argtype::Mark(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_mark(&mut self) -> Mark { + if self.has_mark() { + match self.argtype.take() { + ::std::option::Option::Some(server_args::Argtype::Mark(v)) => v, + _ => panic!(), + } + } else { + Mark::new() + } + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(1); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, ServerConfig>( + "setup", + ServerArgs::has_setup, + ServerArgs::setup, + ServerArgs::mut_setup, + ServerArgs::set_setup, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, Mark>( + "mark", + ServerArgs::has_mark, + ServerArgs::mark, + ServerArgs::mut_mark, + ServerArgs::set_mark, + )); + oneofs.push(server_args::Argtype::generated_oneof_descriptor_data()); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ServerArgs", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ServerArgs { + const NAME: &'static str = "ServerArgs"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.argtype = ::std::option::Option::Some(server_args::Argtype::Setup(is.read_message()?)); + }, + 18 => { + self.argtype = ::std::option::Option::Some(server_args::Argtype::Mark(is.read_message()?)); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.argtype { + match v { + &server_args::Argtype::Setup(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + &server_args::Argtype::Mark(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + }; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let ::std::option::Option::Some(ref v) = self.argtype { + match v { + &server_args::Argtype::Setup(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + }, + &server_args::Argtype::Mark(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + }, + }; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ServerArgs { + ServerArgs::new() + } + + fn clear(&mut self) { + self.argtype = ::std::option::Option::None; + self.argtype = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ServerArgs { + static instance: ServerArgs = ServerArgs { + argtype: ::std::option::Option::None, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ServerArgs { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ServerArgs").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ServerArgs { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ServerArgs { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `ServerArgs` +pub mod server_args { + + #[derive(Clone,PartialEq,Debug)] + #[non_exhaustive] + // @@protoc_insertion_point(oneof:grpc.testing.ServerArgs.argtype) + pub enum Argtype { + // @@protoc_insertion_point(oneof_field:grpc.testing.ServerArgs.setup) + Setup(super::ServerConfig), + // @@protoc_insertion_point(oneof_field:grpc.testing.ServerArgs.mark) + Mark(super::Mark), + } + + impl ::protobufv3::Oneof for Argtype { + } + + impl ::protobufv3::OneofFull for Argtype { + fn descriptor() -> ::protobufv3::reflect::OneofDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::OneofDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| ::descriptor().oneof_by_name("argtype").unwrap()).clone() + } + } + + impl Argtype { + pub(in super) fn generated_oneof_descriptor_data() -> ::protobufv3::reflect::GeneratedOneofDescriptorData { + ::protobufv3::reflect::GeneratedOneofDescriptorData::new::("argtype") + } + } +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ServerStatus) +pub struct ServerStatus { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ServerStatus.stats) + pub stats: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ServerStatus.port) + pub port: i32, + // @@protoc_insertion_point(field:grpc.testing.ServerStatus.cores) + pub cores: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ServerStatus.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ServerStatus { + fn default() -> &'a ServerStatus { + ::default_instance() + } +} + +impl ServerStatus { + pub fn new() -> ServerStatus { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, super::stats::ServerStats>( + "stats", + |m: &ServerStatus| { &m.stats }, + |m: &mut ServerStatus| { &mut m.stats }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "port", + |m: &ServerStatus| { &m.port }, + |m: &mut ServerStatus| { &mut m.port }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "cores", + |m: &ServerStatus| { &m.cores }, + |m: &mut ServerStatus| { &mut m.cores }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ServerStatus", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ServerStatus { + const NAME: &'static str = "ServerStatus"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.stats)?; + }, + 16 => { + self.port = is.read_int32()?; + }, + 24 => { + self.cores = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.port != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.port); + } + if self.cores != 0 { + my_size += ::protobufv3::rt::int32_size(3, self.cores); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.stats.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if self.port != 0 { + os.write_int32(2, self.port)?; + } + if self.cores != 0 { + os.write_int32(3, self.cores)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ServerStatus { + ServerStatus::new() + } + + fn clear(&mut self) { + self.stats.clear(); + self.port = 0; + self.cores = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ServerStatus { + static instance: ServerStatus = ServerStatus { + stats: ::protobufv3::MessageField::none(), + port: 0, + cores: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ServerStatus { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ServerStatus").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ServerStatus { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ServerStatus { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.CoreRequest) +pub struct CoreRequest { + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.CoreRequest.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CoreRequest { + fn default() -> &'a CoreRequest { + ::default_instance() + } +} + +impl CoreRequest { + pub fn new() -> CoreRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "CoreRequest", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for CoreRequest { + const NAME: &'static str = "CoreRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> CoreRequest { + CoreRequest::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static CoreRequest { + static instance: CoreRequest = CoreRequest { + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for CoreRequest { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CoreRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CoreRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for CoreRequest { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.CoreResponse) +pub struct CoreResponse { + // message fields + // @@protoc_insertion_point(field:grpc.testing.CoreResponse.cores) + pub cores: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.CoreResponse.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a CoreResponse { + fn default() -> &'a CoreResponse { + ::default_instance() + } +} + +impl CoreResponse { + pub fn new() -> CoreResponse { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "cores", + |m: &CoreResponse| { &m.cores }, + |m: &mut CoreResponse| { &mut m.cores }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "CoreResponse", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for CoreResponse { + const NAME: &'static str = "CoreResponse"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.cores = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.cores != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.cores); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.cores != 0 { + os.write_int32(1, self.cores)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> CoreResponse { + CoreResponse::new() + } + + fn clear(&mut self) { + self.cores = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static CoreResponse { + static instance: CoreResponse = CoreResponse { + cores: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for CoreResponse { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("CoreResponse").unwrap()).clone() + } +} + +impl ::std::fmt::Display for CoreResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for CoreResponse { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.Void) +pub struct Void { + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.Void.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Void { + fn default() -> &'a Void { + ::default_instance() + } +} + +impl Void { + pub fn new() -> Void { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Void", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Void { + const NAME: &'static str = "Void"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Void { + Void::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static Void { + static instance: Void = Void { + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Void { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Void").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Void { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Void { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.Scenario) +pub struct Scenario { + // message fields + // @@protoc_insertion_point(field:grpc.testing.Scenario.name) + pub name: ::std::string::String, + // @@protoc_insertion_point(field:grpc.testing.Scenario.client_config) + pub client_config: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.Scenario.num_clients) + pub num_clients: i32, + // @@protoc_insertion_point(field:grpc.testing.Scenario.server_config) + pub server_config: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.Scenario.num_servers) + pub num_servers: i32, + // @@protoc_insertion_point(field:grpc.testing.Scenario.warmup_seconds) + pub warmup_seconds: i32, + // @@protoc_insertion_point(field:grpc.testing.Scenario.benchmark_seconds) + pub benchmark_seconds: i32, + // @@protoc_insertion_point(field:grpc.testing.Scenario.spawn_local_worker_count) + pub spawn_local_worker_count: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.Scenario.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Scenario { + fn default() -> &'a Scenario { + ::default_instance() + } +} + +impl Scenario { + pub fn new() -> Scenario { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "name", + |m: &Scenario| { &m.name }, + |m: &mut Scenario| { &mut m.name }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, ClientConfig>( + "client_config", + |m: &Scenario| { &m.client_config }, + |m: &mut Scenario| { &mut m.client_config }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "num_clients", + |m: &Scenario| { &m.num_clients }, + |m: &mut Scenario| { &mut m.num_clients }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, ServerConfig>( + "server_config", + |m: &Scenario| { &m.server_config }, + |m: &mut Scenario| { &mut m.server_config }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "num_servers", + |m: &Scenario| { &m.num_servers }, + |m: &mut Scenario| { &mut m.num_servers }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "warmup_seconds", + |m: &Scenario| { &m.warmup_seconds }, + |m: &mut Scenario| { &mut m.warmup_seconds }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "benchmark_seconds", + |m: &Scenario| { &m.benchmark_seconds }, + |m: &mut Scenario| { &mut m.benchmark_seconds }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "spawn_local_worker_count", + |m: &Scenario| { &m.spawn_local_worker_count }, + |m: &mut Scenario| { &mut m.spawn_local_worker_count }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Scenario", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Scenario { + const NAME: &'static str = "Scenario"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.name = is.read_string()?; + }, + 18 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.client_config)?; + }, + 24 => { + self.num_clients = is.read_int32()?; + }, + 34 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.server_config)?; + }, + 40 => { + self.num_servers = is.read_int32()?; + }, + 48 => { + self.warmup_seconds = is.read_int32()?; + }, + 56 => { + self.benchmark_seconds = is.read_int32()?; + }, + 64 => { + self.spawn_local_worker_count = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobufv3::rt::string_size(1, &self.name); + } + if let Some(v) = self.client_config.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.num_clients != 0 { + my_size += ::protobufv3::rt::int32_size(3, self.num_clients); + } + if let Some(v) = self.server_config.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.num_servers != 0 { + my_size += ::protobufv3::rt::int32_size(5, self.num_servers); + } + if self.warmup_seconds != 0 { + my_size += ::protobufv3::rt::int32_size(6, self.warmup_seconds); + } + if self.benchmark_seconds != 0 { + my_size += ::protobufv3::rt::int32_size(7, self.benchmark_seconds); + } + if self.spawn_local_worker_count != 0 { + my_size += ::protobufv3::rt::int32_size(8, self.spawn_local_worker_count); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if let Some(v) = self.client_config.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + } + if self.num_clients != 0 { + os.write_int32(3, self.num_clients)?; + } + if let Some(v) = self.server_config.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(4, v, os)?; + } + if self.num_servers != 0 { + os.write_int32(5, self.num_servers)?; + } + if self.warmup_seconds != 0 { + os.write_int32(6, self.warmup_seconds)?; + } + if self.benchmark_seconds != 0 { + os.write_int32(7, self.benchmark_seconds)?; + } + if self.spawn_local_worker_count != 0 { + os.write_int32(8, self.spawn_local_worker_count)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Scenario { + Scenario::new() + } + + fn clear(&mut self) { + self.name.clear(); + self.client_config.clear(); + self.num_clients = 0; + self.server_config.clear(); + self.num_servers = 0; + self.warmup_seconds = 0; + self.benchmark_seconds = 0; + self.spawn_local_worker_count = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Scenario { + static instance: Scenario = Scenario { + name: ::std::string::String::new(), + client_config: ::protobufv3::MessageField::none(), + num_clients: 0, + server_config: ::protobufv3::MessageField::none(), + num_servers: 0, + warmup_seconds: 0, + benchmark_seconds: 0, + spawn_local_worker_count: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Scenario { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Scenario").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Scenario { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Scenario { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.Scenarios) +pub struct Scenarios { + // message fields + // @@protoc_insertion_point(field:grpc.testing.Scenarios.scenarios) + pub scenarios: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.Scenarios.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Scenarios { + fn default() -> &'a Scenarios { + ::default_instance() + } +} + +impl Scenarios { + pub fn new() -> Scenarios { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "scenarios", + |m: &Scenarios| { &m.scenarios }, + |m: &mut Scenarios| { &mut m.scenarios }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Scenarios", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Scenarios { + const NAME: &'static str = "Scenarios"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.scenarios.push(is.read_message()?); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.scenarios { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + for v in &self.scenarios { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Scenarios { + Scenarios::new() + } + + fn clear(&mut self) { + self.scenarios.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static Scenarios { + static instance: Scenarios = Scenarios { + scenarios: ::std::vec::Vec::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Scenarios { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Scenarios").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Scenarios { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Scenarios { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ScenarioResultSummary) +pub struct ScenarioResultSummary { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.qps) + pub qps: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.qps_per_server_core) + pub qps_per_server_core: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.server_system_time) + pub server_system_time: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.server_user_time) + pub server_user_time: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.client_system_time) + pub client_system_time: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.client_user_time) + pub client_user_time: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.latency_50) + pub latency_50: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.latency_90) + pub latency_90: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.latency_95) + pub latency_95: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.latency_99) + pub latency_99: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.latency_999) + pub latency_999: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.server_cpu_usage) + pub server_cpu_usage: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.successful_requests_per_second) + pub successful_requests_per_second: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.failed_requests_per_second) + pub failed_requests_per_second: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.client_polls_per_request) + pub client_polls_per_request: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.server_polls_per_request) + pub server_polls_per_request: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.server_queries_per_cpu_sec) + pub server_queries_per_cpu_sec: f64, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResultSummary.client_queries_per_cpu_sec) + pub client_queries_per_cpu_sec: f64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ScenarioResultSummary.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ScenarioResultSummary { + fn default() -> &'a ScenarioResultSummary { + ::default_instance() + } +} + +impl ScenarioResultSummary { + pub fn new() -> ScenarioResultSummary { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(18); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "qps", + |m: &ScenarioResultSummary| { &m.qps }, + |m: &mut ScenarioResultSummary| { &mut m.qps }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "qps_per_server_core", + |m: &ScenarioResultSummary| { &m.qps_per_server_core }, + |m: &mut ScenarioResultSummary| { &mut m.qps_per_server_core }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_system_time", + |m: &ScenarioResultSummary| { &m.server_system_time }, + |m: &mut ScenarioResultSummary| { &mut m.server_system_time }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_user_time", + |m: &ScenarioResultSummary| { &m.server_user_time }, + |m: &mut ScenarioResultSummary| { &mut m.server_user_time }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "client_system_time", + |m: &ScenarioResultSummary| { &m.client_system_time }, + |m: &mut ScenarioResultSummary| { &mut m.client_system_time }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "client_user_time", + |m: &ScenarioResultSummary| { &m.client_user_time }, + |m: &mut ScenarioResultSummary| { &mut m.client_user_time }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "latency_50", + |m: &ScenarioResultSummary| { &m.latency_50 }, + |m: &mut ScenarioResultSummary| { &mut m.latency_50 }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "latency_90", + |m: &ScenarioResultSummary| { &m.latency_90 }, + |m: &mut ScenarioResultSummary| { &mut m.latency_90 }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "latency_95", + |m: &ScenarioResultSummary| { &m.latency_95 }, + |m: &mut ScenarioResultSummary| { &mut m.latency_95 }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "latency_99", + |m: &ScenarioResultSummary| { &m.latency_99 }, + |m: &mut ScenarioResultSummary| { &mut m.latency_99 }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "latency_999", + |m: &ScenarioResultSummary| { &m.latency_999 }, + |m: &mut ScenarioResultSummary| { &mut m.latency_999 }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_cpu_usage", + |m: &ScenarioResultSummary| { &m.server_cpu_usage }, + |m: &mut ScenarioResultSummary| { &mut m.server_cpu_usage }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "successful_requests_per_second", + |m: &ScenarioResultSummary| { &m.successful_requests_per_second }, + |m: &mut ScenarioResultSummary| { &mut m.successful_requests_per_second }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "failed_requests_per_second", + |m: &ScenarioResultSummary| { &m.failed_requests_per_second }, + |m: &mut ScenarioResultSummary| { &mut m.failed_requests_per_second }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "client_polls_per_request", + |m: &ScenarioResultSummary| { &m.client_polls_per_request }, + |m: &mut ScenarioResultSummary| { &mut m.client_polls_per_request }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_polls_per_request", + |m: &ScenarioResultSummary| { &m.server_polls_per_request }, + |m: &mut ScenarioResultSummary| { &mut m.server_polls_per_request }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "server_queries_per_cpu_sec", + |m: &ScenarioResultSummary| { &m.server_queries_per_cpu_sec }, + |m: &mut ScenarioResultSummary| { &mut m.server_queries_per_cpu_sec }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "client_queries_per_cpu_sec", + |m: &ScenarioResultSummary| { &m.client_queries_per_cpu_sec }, + |m: &mut ScenarioResultSummary| { &mut m.client_queries_per_cpu_sec }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ScenarioResultSummary", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ScenarioResultSummary { + const NAME: &'static str = "ScenarioResultSummary"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 9 => { + self.qps = is.read_double()?; + }, + 17 => { + self.qps_per_server_core = is.read_double()?; + }, + 25 => { + self.server_system_time = is.read_double()?; + }, + 33 => { + self.server_user_time = is.read_double()?; + }, + 41 => { + self.client_system_time = is.read_double()?; + }, + 49 => { + self.client_user_time = is.read_double()?; + }, + 57 => { + self.latency_50 = is.read_double()?; + }, + 65 => { + self.latency_90 = is.read_double()?; + }, + 73 => { + self.latency_95 = is.read_double()?; + }, + 81 => { + self.latency_99 = is.read_double()?; + }, + 89 => { + self.latency_999 = is.read_double()?; + }, + 97 => { + self.server_cpu_usage = is.read_double()?; + }, + 105 => { + self.successful_requests_per_second = is.read_double()?; + }, + 113 => { + self.failed_requests_per_second = is.read_double()?; + }, + 121 => { + self.client_polls_per_request = is.read_double()?; + }, + 129 => { + self.server_polls_per_request = is.read_double()?; + }, + 137 => { + self.server_queries_per_cpu_sec = is.read_double()?; + }, + 145 => { + self.client_queries_per_cpu_sec = is.read_double()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.qps != 0. { + my_size += 1 + 8; + } + if self.qps_per_server_core != 0. { + my_size += 1 + 8; + } + if self.server_system_time != 0. { + my_size += 1 + 8; + } + if self.server_user_time != 0. { + my_size += 1 + 8; + } + if self.client_system_time != 0. { + my_size += 1 + 8; + } + if self.client_user_time != 0. { + my_size += 1 + 8; + } + if self.latency_50 != 0. { + my_size += 1 + 8; + } + if self.latency_90 != 0. { + my_size += 1 + 8; + } + if self.latency_95 != 0. { + my_size += 1 + 8; + } + if self.latency_99 != 0. { + my_size += 1 + 8; + } + if self.latency_999 != 0. { + my_size += 1 + 8; + } + if self.server_cpu_usage != 0. { + my_size += 1 + 8; + } + if self.successful_requests_per_second != 0. { + my_size += 1 + 8; + } + if self.failed_requests_per_second != 0. { + my_size += 1 + 8; + } + if self.client_polls_per_request != 0. { + my_size += 1 + 8; + } + if self.server_polls_per_request != 0. { + my_size += 2 + 8; + } + if self.server_queries_per_cpu_sec != 0. { + my_size += 2 + 8; + } + if self.client_queries_per_cpu_sec != 0. { + my_size += 2 + 8; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.qps != 0. { + os.write_double(1, self.qps)?; + } + if self.qps_per_server_core != 0. { + os.write_double(2, self.qps_per_server_core)?; + } + if self.server_system_time != 0. { + os.write_double(3, self.server_system_time)?; + } + if self.server_user_time != 0. { + os.write_double(4, self.server_user_time)?; + } + if self.client_system_time != 0. { + os.write_double(5, self.client_system_time)?; + } + if self.client_user_time != 0. { + os.write_double(6, self.client_user_time)?; + } + if self.latency_50 != 0. { + os.write_double(7, self.latency_50)?; + } + if self.latency_90 != 0. { + os.write_double(8, self.latency_90)?; + } + if self.latency_95 != 0. { + os.write_double(9, self.latency_95)?; + } + if self.latency_99 != 0. { + os.write_double(10, self.latency_99)?; + } + if self.latency_999 != 0. { + os.write_double(11, self.latency_999)?; + } + if self.server_cpu_usage != 0. { + os.write_double(12, self.server_cpu_usage)?; + } + if self.successful_requests_per_second != 0. { + os.write_double(13, self.successful_requests_per_second)?; + } + if self.failed_requests_per_second != 0. { + os.write_double(14, self.failed_requests_per_second)?; + } + if self.client_polls_per_request != 0. { + os.write_double(15, self.client_polls_per_request)?; + } + if self.server_polls_per_request != 0. { + os.write_double(16, self.server_polls_per_request)?; + } + if self.server_queries_per_cpu_sec != 0. { + os.write_double(17, self.server_queries_per_cpu_sec)?; + } + if self.client_queries_per_cpu_sec != 0. { + os.write_double(18, self.client_queries_per_cpu_sec)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ScenarioResultSummary { + ScenarioResultSummary::new() + } + + fn clear(&mut self) { + self.qps = 0.; + self.qps_per_server_core = 0.; + self.server_system_time = 0.; + self.server_user_time = 0.; + self.client_system_time = 0.; + self.client_user_time = 0.; + self.latency_50 = 0.; + self.latency_90 = 0.; + self.latency_95 = 0.; + self.latency_99 = 0.; + self.latency_999 = 0.; + self.server_cpu_usage = 0.; + self.successful_requests_per_second = 0.; + self.failed_requests_per_second = 0.; + self.client_polls_per_request = 0.; + self.server_polls_per_request = 0.; + self.server_queries_per_cpu_sec = 0.; + self.client_queries_per_cpu_sec = 0.; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ScenarioResultSummary { + static instance: ScenarioResultSummary = ScenarioResultSummary { + qps: 0., + qps_per_server_core: 0., + server_system_time: 0., + server_user_time: 0., + client_system_time: 0., + client_user_time: 0., + latency_50: 0., + latency_90: 0., + latency_95: 0., + latency_99: 0., + latency_999: 0., + server_cpu_usage: 0., + successful_requests_per_second: 0., + failed_requests_per_second: 0., + client_polls_per_request: 0., + server_polls_per_request: 0., + server_queries_per_cpu_sec: 0., + client_queries_per_cpu_sec: 0., + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ScenarioResultSummary { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ScenarioResultSummary").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ScenarioResultSummary { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ScenarioResultSummary { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ScenarioResult) +pub struct ScenarioResult { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.scenario) + pub scenario: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.latencies) + pub latencies: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.client_stats) + pub client_stats: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.server_stats) + pub server_stats: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.server_cores) + pub server_cores: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.summary) + pub summary: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.client_success) + pub client_success: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.server_success) + pub server_success: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ScenarioResult.request_results) + pub request_results: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ScenarioResult.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ScenarioResult { + fn default() -> &'a ScenarioResult { + ::default_instance() + } +} + +impl ScenarioResult { + pub fn new() -> ScenarioResult { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(9); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Scenario>( + "scenario", + |m: &ScenarioResult| { &m.scenario }, + |m: &mut ScenarioResult| { &mut m.scenario }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, super::stats::HistogramData>( + "latencies", + |m: &ScenarioResult| { &m.latencies }, + |m: &mut ScenarioResult| { &mut m.latencies }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "client_stats", + |m: &ScenarioResult| { &m.client_stats }, + |m: &mut ScenarioResult| { &mut m.client_stats }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "server_stats", + |m: &ScenarioResult| { &m.server_stats }, + |m: &mut ScenarioResult| { &mut m.server_stats }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "server_cores", + |m: &ScenarioResult| { &m.server_cores }, + |m: &mut ScenarioResult| { &mut m.server_cores }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, ScenarioResultSummary>( + "summary", + |m: &ScenarioResult| { &m.summary }, + |m: &mut ScenarioResult| { &mut m.summary }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "client_success", + |m: &ScenarioResult| { &m.client_success }, + |m: &mut ScenarioResult| { &mut m.client_success }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "server_success", + |m: &ScenarioResult| { &m.server_success }, + |m: &mut ScenarioResult| { &mut m.server_success }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "request_results", + |m: &ScenarioResult| { &m.request_results }, + |m: &mut ScenarioResult| { &mut m.request_results }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ScenarioResult", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ScenarioResult { + const NAME: &'static str = "ScenarioResult"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.scenario)?; + }, + 18 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.latencies)?; + }, + 26 => { + self.client_stats.push(is.read_message()?); + }, + 34 => { + self.server_stats.push(is.read_message()?); + }, + 42 => { + is.read_repeated_packed_int32_into(&mut self.server_cores)?; + }, + 40 => { + self.server_cores.push(is.read_int32()?); + }, + 50 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.summary)?; + }, + 58 => { + is.read_repeated_packed_bool_into(&mut self.client_success)?; + }, + 56 => { + self.client_success.push(is.read_bool()?); + }, + 66 => { + is.read_repeated_packed_bool_into(&mut self.server_success)?; + }, + 64 => { + self.server_success.push(is.read_bool()?); + }, + 74 => { + self.request_results.push(is.read_message()?); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.scenario.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.latencies.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + for value in &self.client_stats { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.server_stats { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + for value in &self.server_cores { + my_size += ::protobufv3::rt::int32_size(5, *value); + }; + if let Some(v) = self.summary.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += 2 * self.client_success.len() as u64; + my_size += 2 * self.server_success.len() as u64; + for value in &self.request_results { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.scenario.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.latencies.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + } + for v in &self.client_stats { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + }; + for v in &self.server_stats { + ::protobufv3::rt::write_message_field_with_cached_size(4, v, os)?; + }; + for v in &self.server_cores { + os.write_int32(5, *v)?; + }; + if let Some(v) = self.summary.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(6, v, os)?; + } + for v in &self.client_success { + os.write_bool(7, *v)?; + }; + for v in &self.server_success { + os.write_bool(8, *v)?; + }; + for v in &self.request_results { + ::protobufv3::rt::write_message_field_with_cached_size(9, v, os)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ScenarioResult { + ScenarioResult::new() + } + + fn clear(&mut self) { + self.scenario.clear(); + self.latencies.clear(); + self.client_stats.clear(); + self.server_stats.clear(); + self.server_cores.clear(); + self.summary.clear(); + self.client_success.clear(); + self.server_success.clear(); + self.request_results.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static ScenarioResult { + static instance: ScenarioResult = ScenarioResult { + scenario: ::protobufv3::MessageField::none(), + latencies: ::protobufv3::MessageField::none(), + client_stats: ::std::vec::Vec::new(), + server_stats: ::std::vec::Vec::new(), + server_cores: ::std::vec::Vec::new(), + summary: ::protobufv3::MessageField::none(), + client_success: ::std::vec::Vec::new(), + server_success: ::std::vec::Vec::new(), + request_results: ::std::vec::Vec::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ScenarioResult { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ScenarioResult").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ScenarioResult { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ScenarioResult { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:grpc.testing.ClientType) +pub enum ClientType { + // @@protoc_insertion_point(enum_value:grpc.testing.ClientType.SYNC_CLIENT) + SYNC_CLIENT = 0, + // @@protoc_insertion_point(enum_value:grpc.testing.ClientType.ASYNC_CLIENT) + ASYNC_CLIENT = 1, + // @@protoc_insertion_point(enum_value:grpc.testing.ClientType.OTHER_CLIENT) + OTHER_CLIENT = 2, +} + +impl ::protobufv3::Enum for ClientType { + const NAME: &'static str = "ClientType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ClientType::SYNC_CLIENT), + 1 => ::std::option::Option::Some(ClientType::ASYNC_CLIENT), + 2 => ::std::option::Option::Some(ClientType::OTHER_CLIENT), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [ClientType] = &[ + ClientType::SYNC_CLIENT, + ClientType::ASYNC_CLIENT, + ClientType::OTHER_CLIENT, + ]; +} + +impl ::protobufv3::EnumFull for ClientType { + fn enum_descriptor() -> ::protobufv3::reflect::EnumDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::EnumDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("ClientType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobufv3::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for ClientType { + fn default() -> Self { + ClientType::SYNC_CLIENT + } +} + +impl ClientType { + fn generated_enum_descriptor_data() -> ::protobufv3::reflect::GeneratedEnumDescriptorData { + ::protobufv3::reflect::GeneratedEnumDescriptorData::new::("ClientType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:grpc.testing.ServerType) +pub enum ServerType { + // @@protoc_insertion_point(enum_value:grpc.testing.ServerType.SYNC_SERVER) + SYNC_SERVER = 0, + // @@protoc_insertion_point(enum_value:grpc.testing.ServerType.ASYNC_SERVER) + ASYNC_SERVER = 1, + // @@protoc_insertion_point(enum_value:grpc.testing.ServerType.ASYNC_GENERIC_SERVER) + ASYNC_GENERIC_SERVER = 2, + // @@protoc_insertion_point(enum_value:grpc.testing.ServerType.OTHER_SERVER) + OTHER_SERVER = 3, +} + +impl ::protobufv3::Enum for ServerType { + const NAME: &'static str = "ServerType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ServerType::SYNC_SERVER), + 1 => ::std::option::Option::Some(ServerType::ASYNC_SERVER), + 2 => ::std::option::Option::Some(ServerType::ASYNC_GENERIC_SERVER), + 3 => ::std::option::Option::Some(ServerType::OTHER_SERVER), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [ServerType] = &[ + ServerType::SYNC_SERVER, + ServerType::ASYNC_SERVER, + ServerType::ASYNC_GENERIC_SERVER, + ServerType::OTHER_SERVER, + ]; +} + +impl ::protobufv3::EnumFull for ServerType { + fn enum_descriptor() -> ::protobufv3::reflect::EnumDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::EnumDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("ServerType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobufv3::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for ServerType { + fn default() -> Self { + ServerType::SYNC_SERVER + } +} + +impl ServerType { + fn generated_enum_descriptor_data() -> ::protobufv3::reflect::GeneratedEnumDescriptorData { + ::protobufv3::reflect::GeneratedEnumDescriptorData::new::("ServerType") + } +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:grpc.testing.RpcType) +pub enum RpcType { + // @@protoc_insertion_point(enum_value:grpc.testing.RpcType.UNARY) + UNARY = 0, + // @@protoc_insertion_point(enum_value:grpc.testing.RpcType.STREAMING) + STREAMING = 1, + // @@protoc_insertion_point(enum_value:grpc.testing.RpcType.STREAMING_FROM_CLIENT) + STREAMING_FROM_CLIENT = 2, + // @@protoc_insertion_point(enum_value:grpc.testing.RpcType.STREAMING_FROM_SERVER) + STREAMING_FROM_SERVER = 3, + // @@protoc_insertion_point(enum_value:grpc.testing.RpcType.STREAMING_BOTH_WAYS) + STREAMING_BOTH_WAYS = 4, +} + +impl ::protobufv3::Enum for RpcType { + const NAME: &'static str = "RpcType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(RpcType::UNARY), + 1 => ::std::option::Option::Some(RpcType::STREAMING), + 2 => ::std::option::Option::Some(RpcType::STREAMING_FROM_CLIENT), + 3 => ::std::option::Option::Some(RpcType::STREAMING_FROM_SERVER), + 4 => ::std::option::Option::Some(RpcType::STREAMING_BOTH_WAYS), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [RpcType] = &[ + RpcType::UNARY, + RpcType::STREAMING, + RpcType::STREAMING_FROM_CLIENT, + RpcType::STREAMING_FROM_SERVER, + RpcType::STREAMING_BOTH_WAYS, + ]; +} + +impl ::protobufv3::EnumFull for RpcType { + fn enum_descriptor() -> ::protobufv3::reflect::EnumDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::EnumDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("RpcType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobufv3::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for RpcType { + fn default() -> Self { + RpcType::UNARY + } +} + +impl RpcType { + fn generated_enum_descriptor_data() -> ::protobufv3::reflect::GeneratedEnumDescriptorData { + ::protobufv3::reflect::GeneratedEnumDescriptorData::new::("RpcType") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1agrpc/testing/control.proto\x12\x0cgrpc.testing\x1a\x1bgrpc/testing\ + /payloads.proto\x1a\x18grpc/testing/stats.proto\"2\n\rPoissonParams\x12!\ + \n\x0coffered_load\x18\x01\x20\x01(\x01R\x0bofferedLoad\"\x12\n\x10Close\ + dLoopParams\"\x90\x01\n\nLoadParams\x12A\n\x0bclosed_loop\x18\x01\x20\ + \x01(\x0b2\x1e.grpc.testing.ClosedLoopParamsH\0R\nclosedLoop\x127\n\x07p\ + oisson\x18\x02\x20\x01(\x0b2\x1b.grpc.testing.PoissonParamsH\0R\x07poiss\ + onB\x06\n\x04load\"\x7f\n\x0eSecurityParams\x12\x1e\n\x0buse_test_ca\x18\ + \x01\x20\x01(\x08R\tuseTestCa\x120\n\x14server_host_override\x18\x02\x20\ + \x01(\tR\x12serverHostOverride\x12\x1b\n\tcred_type\x18\x03\x20\x01(\tR\ + \x08credType\"g\n\nChannelArg\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04n\ + ame\x12\x1d\n\tstr_value\x18\x02\x20\x01(\tH\0R\x08strValue\x12\x1d\n\ti\ + nt_value\x18\x03\x20\x01(\x05H\0R\x08intValueB\x07\n\x05value\"\xc7\x06\ + \n\x0cClientConfig\x12%\n\x0eserver_targets\x18\x01\x20\x03(\tR\rserverT\ + argets\x129\n\x0bclient_type\x18\x02\x20\x01(\x0e2\x18.grpc.testing.Clie\ + ntTypeR\nclientType\x12E\n\x0fsecurity_params\x18\x03\x20\x01(\x0b2\x1c.\ + grpc.testing.SecurityParamsR\x0esecurityParams\x12?\n\x1coutstanding_rpc\ + s_per_channel\x18\x04\x20\x01(\x05R\x19outstandingRpcsPerChannel\x12'\n\ + \x0fclient_channels\x18\x05\x20\x01(\x05R\x0eclientChannels\x120\n\x14as\ + ync_client_threads\x18\x07\x20\x01(\x05R\x12asyncClientThreads\x120\n\ + \x08rpc_type\x18\x08\x20\x01(\x0e2\x15.grpc.testing.RpcTypeR\x07rpcType\ + \x129\n\x0bload_params\x18\n\x20\x01(\x0b2\x18.grpc.testing.LoadParamsR\ + \nloadParams\x12B\n\x0epayload_config\x18\x0b\x20\x01(\x0b2\x1b.grpc.tes\ + ting.PayloadConfigR\rpayloadConfig\x12H\n\x10histogram_params\x18\x0c\ + \x20\x01(\x0b2\x1d.grpc.testing.HistogramParamsR\x0fhistogramParams\x12\ + \x1b\n\tcore_list\x18\r\x20\x03(\x05R\x08coreList\x12\x1d\n\ncore_limit\ + \x18\x0e\x20\x01(\x05R\tcoreLimit\x12(\n\x10other_client_api\x18\x0f\x20\ + \x01(\tR\x0eotherClientApi\x12;\n\x0cchannel_args\x18\x10\x20\x03(\x0b2\ + \x18.grpc.testing.ChannelArgR\x0bchannelArgs\x12$\n\x0ethreads_per_cq\ + \x18\x11\x20\x01(\x05R\x0cthreadsPerCq\x12.\n\x13messages_per_stream\x18\ + \x12\x20\x01(\x05R\x11messagesPerStream\"?\n\x0cClientStatus\x12/\n\x05s\ + tats\x18\x01\x20\x01(\x0b2\x19.grpc.testing.ClientStatsR\x05stats\"\x1c\ + \n\x04Mark\x12\x14\n\x05reset\x18\x01\x20\x01(\x08R\x05reset\"u\n\nClien\ + tArgs\x122\n\x05setup\x18\x01\x20\x01(\x0b2\x1a.grpc.testing.ClientConfi\ + gH\0R\x05setup\x12(\n\x04mark\x18\x02\x20\x01(\x0b2\x12.grpc.testing.Mar\ + kH\0R\x04markB\t\n\x07argtype\"\x95\x04\n\x0cServerConfig\x129\n\x0bserv\ + er_type\x18\x01\x20\x01(\x0e2\x18.grpc.testing.ServerTypeR\nserverType\ + \x12E\n\x0fsecurity_params\x18\x02\x20\x01(\x0b2\x1c.grpc.testing.Securi\ + tyParamsR\x0esecurityParams\x12\x12\n\x04port\x18\x04\x20\x01(\x05R\x04p\ + ort\x120\n\x14async_server_threads\x18\x07\x20\x01(\x05R\x12asyncServerT\ + hreads\x12\x1d\n\ncore_limit\x18\x08\x20\x01(\x05R\tcoreLimit\x12B\n\x0e\ + payload_config\x18\t\x20\x01(\x0b2\x1b.grpc.testing.PayloadConfigR\rpayl\ + oadConfig\x12\x1b\n\tcore_list\x18\n\x20\x03(\x05R\x08coreList\x12(\n\ + \x10other_server_api\x18\x0b\x20\x01(\tR\x0eotherServerApi\x12$\n\x0ethr\ + eads_per_cq\x18\x0c\x20\x01(\x05R\x0cthreadsPerCq\x12/\n\x13resource_quo\ + ta_size\x18\xe9\x07\x20\x01(\x05R\x11resourceQuotaSize\x12<\n\x0cchannel\ + _args\x18\xea\x07\x20\x03(\x0b2\x18.grpc.testing.ChannelArgR\x0bchannelA\ + rgs\"u\n\nServerArgs\x122\n\x05setup\x18\x01\x20\x01(\x0b2\x1a.grpc.test\ + ing.ServerConfigH\0R\x05setup\x12(\n\x04mark\x18\x02\x20\x01(\x0b2\x12.g\ + rpc.testing.MarkH\0R\x04markB\t\n\x07argtype\"i\n\x0cServerStatus\x12/\n\ + \x05stats\x18\x01\x20\x01(\x0b2\x19.grpc.testing.ServerStatsR\x05stats\ + \x12\x12\n\x04port\x18\x02\x20\x01(\x05R\x04port\x12\x14\n\x05cores\x18\ + \x03\x20\x01(\x05R\x05cores\"\r\n\x0bCoreRequest\"$\n\x0cCoreResponse\ + \x12\x14\n\x05cores\x18\x01\x20\x01(\x05R\x05cores\"\x06\n\x04Void\"\xef\ + \x02\n\x08Scenario\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12?\n\ + \rclient_config\x18\x02\x20\x01(\x0b2\x1a.grpc.testing.ClientConfigR\x0c\ + clientConfig\x12\x1f\n\x0bnum_clients\x18\x03\x20\x01(\x05R\nnumClients\ + \x12?\n\rserver_config\x18\x04\x20\x01(\x0b2\x1a.grpc.testing.ServerConf\ + igR\x0cserverConfig\x12\x1f\n\x0bnum_servers\x18\x05\x20\x01(\x05R\nnumS\ + ervers\x12%\n\x0ewarmup_seconds\x18\x06\x20\x01(\x05R\rwarmupSeconds\x12\ + +\n\x11benchmark_seconds\x18\x07\x20\x01(\x05R\x10benchmarkSeconds\x127\ + \n\x18spawn_local_worker_count\x18\x08\x20\x01(\x05R\x15spawnLocalWorker\ + Count\"A\n\tScenarios\x124\n\tscenarios\x18\x01\x20\x03(\x0b2\x16.grpc.t\ + esting.ScenarioR\tscenarios\"\xbb\x06\n\x15ScenarioResultSummary\x12\x10\ + \n\x03qps\x18\x01\x20\x01(\x01R\x03qps\x12-\n\x13qps_per_server_core\x18\ + \x02\x20\x01(\x01R\x10qpsPerServerCore\x12,\n\x12server_system_time\x18\ + \x03\x20\x01(\x01R\x10serverSystemTime\x12(\n\x10server_user_time\x18\ + \x04\x20\x01(\x01R\x0eserverUserTime\x12,\n\x12client_system_time\x18\ + \x05\x20\x01(\x01R\x10clientSystemTime\x12(\n\x10client_user_time\x18\ + \x06\x20\x01(\x01R\x0eclientUserTime\x12\x1d\n\nlatency_50\x18\x07\x20\ + \x01(\x01R\tlatency50\x12\x1d\n\nlatency_90\x18\x08\x20\x01(\x01R\tlaten\ + cy90\x12\x1d\n\nlatency_95\x18\t\x20\x01(\x01R\tlatency95\x12\x1d\n\nlat\ + ency_99\x18\n\x20\x01(\x01R\tlatency99\x12\x1f\n\x0blatency_999\x18\x0b\ + \x20\x01(\x01R\nlatency999\x12(\n\x10server_cpu_usage\x18\x0c\x20\x01(\ + \x01R\x0eserverCpuUsage\x12C\n\x1esuccessful_requests_per_second\x18\r\ + \x20\x01(\x01R\x1bsuccessfulRequestsPerSecond\x12;\n\x1afailed_requests_\ + per_second\x18\x0e\x20\x01(\x01R\x17failedRequestsPerSecond\x127\n\x18cl\ + ient_polls_per_request\x18\x0f\x20\x01(\x01R\x15clientPollsPerRequest\ + \x127\n\x18server_polls_per_request\x18\x10\x20\x01(\x01R\x15serverPolls\ + PerRequest\x12:\n\x1aserver_queries_per_cpu_sec\x18\x11\x20\x01(\x01R\ + \x16serverQueriesPerCpuSec\x12:\n\x1aclient_queries_per_cpu_sec\x18\x12\ + \x20\x01(\x01R\x16clientQueriesPerCpuSec\"\xf6\x03\n\x0eScenarioResult\ + \x122\n\x08scenario\x18\x01\x20\x01(\x0b2\x16.grpc.testing.ScenarioR\x08\ + scenario\x129\n\tlatencies\x18\x02\x20\x01(\x0b2\x1b.grpc.testing.Histog\ + ramDataR\tlatencies\x12<\n\x0cclient_stats\x18\x03\x20\x03(\x0b2\x19.grp\ + c.testing.ClientStatsR\x0bclientStats\x12<\n\x0cserver_stats\x18\x04\x20\ + \x03(\x0b2\x19.grpc.testing.ServerStatsR\x0bserverStats\x12!\n\x0cserver\ + _cores\x18\x05\x20\x03(\x05R\x0bserverCores\x12=\n\x07summary\x18\x06\ + \x20\x01(\x0b2#.grpc.testing.ScenarioResultSummaryR\x07summary\x12%\n\ + \x0eclient_success\x18\x07\x20\x03(\x08R\rclientSuccess\x12%\n\x0eserver\ + _success\x18\x08\x20\x03(\x08R\rserverSuccess\x12I\n\x0frequest_results\ + \x18\t\x20\x03(\x0b2\x20.grpc.testing.RequestResultCountR\x0erequestResu\ + lts*A\n\nClientType\x12\x0f\n\x0bSYNC_CLIENT\x10\0\x12\x10\n\x0cASYNC_CL\ + IENT\x10\x01\x12\x10\n\x0cOTHER_CLIENT\x10\x02*[\n\nServerType\x12\x0f\n\ + \x0bSYNC_SERVER\x10\0\x12\x10\n\x0cASYNC_SERVER\x10\x01\x12\x18\n\x14ASY\ + NC_GENERIC_SERVER\x10\x02\x12\x10\n\x0cOTHER_SERVER\x10\x03*r\n\x07RpcTy\ + pe\x12\t\n\x05UNARY\x10\0\x12\r\n\tSTREAMING\x10\x01\x12\x19\n\x15STREAM\ + ING_FROM_CLIENT\x10\x02\x12\x19\n\x15STREAMING_FROM_SERVER\x10\x03\x12\ + \x17\n\x13STREAMING_BOTH_WAYS\x10\x04b\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(2); + deps.push(super::payloads::file_descriptor().clone()); + deps.push(super::stats::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(19); + messages.push(PoissonParams::generated_message_descriptor_data()); + messages.push(ClosedLoopParams::generated_message_descriptor_data()); + messages.push(LoadParams::generated_message_descriptor_data()); + messages.push(SecurityParams::generated_message_descriptor_data()); + messages.push(ChannelArg::generated_message_descriptor_data()); + messages.push(ClientConfig::generated_message_descriptor_data()); + messages.push(ClientStatus::generated_message_descriptor_data()); + messages.push(Mark::generated_message_descriptor_data()); + messages.push(ClientArgs::generated_message_descriptor_data()); + messages.push(ServerConfig::generated_message_descriptor_data()); + messages.push(ServerArgs::generated_message_descriptor_data()); + messages.push(ServerStatus::generated_message_descriptor_data()); + messages.push(CoreRequest::generated_message_descriptor_data()); + messages.push(CoreResponse::generated_message_descriptor_data()); + messages.push(Void::generated_message_descriptor_data()); + messages.push(Scenario::generated_message_descriptor_data()); + messages.push(Scenarios::generated_message_descriptor_data()); + messages.push(ScenarioResultSummary::generated_message_descriptor_data()); + messages.push(ScenarioResult::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(3); + enums.push(ClientType::generated_enum_descriptor_data()); + enums.push(ServerType::generated_enum_descriptor_data()); + enums.push(RpcType::generated_enum_descriptor_data()); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/proto/src/proto/protobuf_v3/testing/empty.rs b/proto/src/proto/protobuf_v3/testing/empty.rs new file mode 100644 index 000000000..c3c7dac94 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/empty.rs @@ -0,0 +1,162 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/empty.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.Empty) +pub struct Empty { + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.Empty.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Empty { + fn default() -> &'a Empty { + ::default_instance() + } +} + +impl Empty { + pub fn new() -> Empty { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Empty", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Empty { + const NAME: &'static str = "Empty"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Empty { + Empty::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static Empty { + static instance: Empty = Empty { + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Empty { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Empty").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Empty { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Empty { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x18grpc/testing/empty.proto\x12\x0cgrpc.testing\"\x07\n\x05Emptyb\x06\ + proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(1); + messages.push(Empty::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/proto/src/proto/protobuf_v3/testing/messages.rs b/proto/src/proto/protobuf_v3/testing/messages.rs new file mode 100644 index 000000000..b08e89a4b --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/messages.rs @@ -0,0 +1,1960 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/messages.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.BoolValue) +pub struct BoolValue { + // message fields + // @@protoc_insertion_point(field:grpc.testing.BoolValue.value) + pub value: bool, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.BoolValue.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a BoolValue { + fn default() -> &'a BoolValue { + ::default_instance() + } +} + +impl BoolValue { + pub fn new() -> BoolValue { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "value", + |m: &BoolValue| { &m.value }, + |m: &mut BoolValue| { &mut m.value }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "BoolValue", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for BoolValue { + const NAME: &'static str = "BoolValue"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.value = is.read_bool()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.value != false { + my_size += 1 + 1; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.value != false { + os.write_bool(1, self.value)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> BoolValue { + BoolValue::new() + } + + fn clear(&mut self) { + self.value = false; + self.special_fields.clear(); + } + + fn default_instance() -> &'static BoolValue { + static instance: BoolValue = BoolValue { + value: false, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for BoolValue { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("BoolValue").unwrap()).clone() + } +} + +impl ::std::fmt::Display for BoolValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for BoolValue { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.Payload) +pub struct Payload { + // message fields + // @@protoc_insertion_point(field:grpc.testing.Payload.type) + pub type_: ::protobufv3::EnumOrUnknown, + // @@protoc_insertion_point(field:grpc.testing.Payload.body) + pub body: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.Payload.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a Payload { + fn default() -> &'a Payload { + ::default_instance() + } +} + +impl Payload { + pub fn new() -> Payload { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "type", + |m: &Payload| { &m.type_ }, + |m: &mut Payload| { &mut m.type_ }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "body", + |m: &Payload| { &m.body }, + |m: &mut Payload| { &mut m.body }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "Payload", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for Payload { + const NAME: &'static str = "Payload"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.type_ = is.read_enum_or_unknown()?; + }, + 18 => { + self.body = is.read_bytes()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.type_ != ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE) { + my_size += ::protobufv3::rt::int32_size(1, self.type_.value()); + } + if !self.body.is_empty() { + my_size += ::protobufv3::rt::bytes_size(2, &self.body); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.type_ != ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE) { + os.write_enum(1, ::protobufv3::EnumOrUnknown::value(&self.type_))?; + } + if !self.body.is_empty() { + os.write_bytes(2, &self.body)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> Payload { + Payload::new() + } + + fn clear(&mut self) { + self.type_ = ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE); + self.body.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static Payload { + static instance: Payload = Payload { + type_: ::protobufv3::EnumOrUnknown::from_i32(0), + body: ::std::vec::Vec::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for Payload { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("Payload").unwrap()).clone() + } +} + +impl ::std::fmt::Display for Payload { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for Payload { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.EchoStatus) +pub struct EchoStatus { + // message fields + // @@protoc_insertion_point(field:grpc.testing.EchoStatus.code) + pub code: i32, + // @@protoc_insertion_point(field:grpc.testing.EchoStatus.message) + pub message: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.EchoStatus.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a EchoStatus { + fn default() -> &'a EchoStatus { + ::default_instance() + } +} + +impl EchoStatus { + pub fn new() -> EchoStatus { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "code", + |m: &EchoStatus| { &m.code }, + |m: &mut EchoStatus| { &mut m.code }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "message", + |m: &EchoStatus| { &m.message }, + |m: &mut EchoStatus| { &mut m.message }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "EchoStatus", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for EchoStatus { + const NAME: &'static str = "EchoStatus"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.code = is.read_int32()?; + }, + 18 => { + self.message = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.code != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.code); + } + if !self.message.is_empty() { + my_size += ::protobufv3::rt::string_size(2, &self.message); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.code != 0 { + os.write_int32(1, self.code)?; + } + if !self.message.is_empty() { + os.write_string(2, &self.message)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> EchoStatus { + EchoStatus::new() + } + + fn clear(&mut self) { + self.code = 0; + self.message.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static EchoStatus { + static instance: EchoStatus = EchoStatus { + code: 0, + message: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for EchoStatus { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("EchoStatus").unwrap()).clone() + } +} + +impl ::std::fmt::Display for EchoStatus { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for EchoStatus { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.SimpleRequest) +pub struct SimpleRequest { + // message fields + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.response_type) + pub response_type: ::protobufv3::EnumOrUnknown, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.response_size) + pub response_size: i32, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.payload) + pub payload: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.fill_username) + pub fill_username: bool, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.fill_oauth_scope) + pub fill_oauth_scope: bool, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.response_compressed) + pub response_compressed: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.response_status) + pub response_status: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.SimpleRequest.expect_compressed) + pub expect_compressed: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.SimpleRequest.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SimpleRequest { + fn default() -> &'a SimpleRequest { + ::default_instance() + } +} + +impl SimpleRequest { + pub fn new() -> SimpleRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(8); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "response_type", + |m: &SimpleRequest| { &m.response_type }, + |m: &mut SimpleRequest| { &mut m.response_type }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "response_size", + |m: &SimpleRequest| { &m.response_size }, + |m: &mut SimpleRequest| { &mut m.response_size }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Payload>( + "payload", + |m: &SimpleRequest| { &m.payload }, + |m: &mut SimpleRequest| { &mut m.payload }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "fill_username", + |m: &SimpleRequest| { &m.fill_username }, + |m: &mut SimpleRequest| { &mut m.fill_username }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "fill_oauth_scope", + |m: &SimpleRequest| { &m.fill_oauth_scope }, + |m: &mut SimpleRequest| { &mut m.fill_oauth_scope }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, BoolValue>( + "response_compressed", + |m: &SimpleRequest| { &m.response_compressed }, + |m: &mut SimpleRequest| { &mut m.response_compressed }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, EchoStatus>( + "response_status", + |m: &SimpleRequest| { &m.response_status }, + |m: &mut SimpleRequest| { &mut m.response_status }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, BoolValue>( + "expect_compressed", + |m: &SimpleRequest| { &m.expect_compressed }, + |m: &mut SimpleRequest| { &mut m.expect_compressed }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "SimpleRequest", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for SimpleRequest { + const NAME: &'static str = "SimpleRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.response_type = is.read_enum_or_unknown()?; + }, + 16 => { + self.response_size = is.read_int32()?; + }, + 26 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload)?; + }, + 32 => { + self.fill_username = is.read_bool()?; + }, + 40 => { + self.fill_oauth_scope = is.read_bool()?; + }, + 50 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.response_compressed)?; + }, + 58 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.response_status)?; + }, + 66 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.expect_compressed)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.response_type != ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE) { + my_size += ::protobufv3::rt::int32_size(1, self.response_type.value()); + } + if self.response_size != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.response_size); + } + if let Some(v) = self.payload.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.fill_username != false { + my_size += 1 + 1; + } + if self.fill_oauth_scope != false { + my_size += 1 + 1; + } + if let Some(v) = self.response_compressed.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.response_status.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.expect_compressed.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.response_type != ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE) { + os.write_enum(1, ::protobufv3::EnumOrUnknown::value(&self.response_type))?; + } + if self.response_size != 0 { + os.write_int32(2, self.response_size)?; + } + if let Some(v) = self.payload.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + } + if self.fill_username != false { + os.write_bool(4, self.fill_username)?; + } + if self.fill_oauth_scope != false { + os.write_bool(5, self.fill_oauth_scope)?; + } + if let Some(v) = self.response_compressed.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(6, v, os)?; + } + if let Some(v) = self.response_status.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(7, v, os)?; + } + if let Some(v) = self.expect_compressed.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(8, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> SimpleRequest { + SimpleRequest::new() + } + + fn clear(&mut self) { + self.response_type = ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE); + self.response_size = 0; + self.payload.clear(); + self.fill_username = false; + self.fill_oauth_scope = false; + self.response_compressed.clear(); + self.response_status.clear(); + self.expect_compressed.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static SimpleRequest { + static instance: SimpleRequest = SimpleRequest { + response_type: ::protobufv3::EnumOrUnknown::from_i32(0), + response_size: 0, + payload: ::protobufv3::MessageField::none(), + fill_username: false, + fill_oauth_scope: false, + response_compressed: ::protobufv3::MessageField::none(), + response_status: ::protobufv3::MessageField::none(), + expect_compressed: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for SimpleRequest { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SimpleRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SimpleRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for SimpleRequest { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.SimpleResponse) +pub struct SimpleResponse { + // message fields + // @@protoc_insertion_point(field:grpc.testing.SimpleResponse.payload) + pub payload: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.SimpleResponse.username) + pub username: ::std::string::String, + // @@protoc_insertion_point(field:grpc.testing.SimpleResponse.oauth_scope) + pub oauth_scope: ::std::string::String, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.SimpleResponse.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SimpleResponse { + fn default() -> &'a SimpleResponse { + ::default_instance() + } +} + +impl SimpleResponse { + pub fn new() -> SimpleResponse { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Payload>( + "payload", + |m: &SimpleResponse| { &m.payload }, + |m: &mut SimpleResponse| { &mut m.payload }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "username", + |m: &SimpleResponse| { &m.username }, + |m: &mut SimpleResponse| { &mut m.username }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "oauth_scope", + |m: &SimpleResponse| { &m.oauth_scope }, + |m: &mut SimpleResponse| { &mut m.oauth_scope }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "SimpleResponse", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for SimpleResponse { + const NAME: &'static str = "SimpleResponse"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload)?; + }, + 18 => { + self.username = is.read_string()?; + }, + 26 => { + self.oauth_scope = is.read_string()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payload.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if !self.username.is_empty() { + my_size += ::protobufv3::rt::string_size(2, &self.username); + } + if !self.oauth_scope.is_empty() { + my_size += ::protobufv3::rt::string_size(3, &self.oauth_scope); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.payload.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if !self.username.is_empty() { + os.write_string(2, &self.username)?; + } + if !self.oauth_scope.is_empty() { + os.write_string(3, &self.oauth_scope)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> SimpleResponse { + SimpleResponse::new() + } + + fn clear(&mut self) { + self.payload.clear(); + self.username.clear(); + self.oauth_scope.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static SimpleResponse { + static instance: SimpleResponse = SimpleResponse { + payload: ::protobufv3::MessageField::none(), + username: ::std::string::String::new(), + oauth_scope: ::std::string::String::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for SimpleResponse { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SimpleResponse").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SimpleResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for SimpleResponse { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.StreamingInputCallRequest) +pub struct StreamingInputCallRequest { + // message fields + // @@protoc_insertion_point(field:grpc.testing.StreamingInputCallRequest.payload) + pub payload: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.StreamingInputCallRequest.expect_compressed) + pub expect_compressed: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.StreamingInputCallRequest.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StreamingInputCallRequest { + fn default() -> &'a StreamingInputCallRequest { + ::default_instance() + } +} + +impl StreamingInputCallRequest { + pub fn new() -> StreamingInputCallRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Payload>( + "payload", + |m: &StreamingInputCallRequest| { &m.payload }, + |m: &mut StreamingInputCallRequest| { &mut m.payload }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, BoolValue>( + "expect_compressed", + |m: &StreamingInputCallRequest| { &m.expect_compressed }, + |m: &mut StreamingInputCallRequest| { &mut m.expect_compressed }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "StreamingInputCallRequest", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for StreamingInputCallRequest { + const NAME: &'static str = "StreamingInputCallRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload)?; + }, + 18 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.expect_compressed)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payload.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.expect_compressed.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.payload.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if let Some(v) = self.expect_compressed.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> StreamingInputCallRequest { + StreamingInputCallRequest::new() + } + + fn clear(&mut self) { + self.payload.clear(); + self.expect_compressed.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static StreamingInputCallRequest { + static instance: StreamingInputCallRequest = StreamingInputCallRequest { + payload: ::protobufv3::MessageField::none(), + expect_compressed: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for StreamingInputCallRequest { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StreamingInputCallRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StreamingInputCallRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for StreamingInputCallRequest { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.StreamingInputCallResponse) +pub struct StreamingInputCallResponse { + // message fields + // @@protoc_insertion_point(field:grpc.testing.StreamingInputCallResponse.aggregated_payload_size) + pub aggregated_payload_size: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.StreamingInputCallResponse.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StreamingInputCallResponse { + fn default() -> &'a StreamingInputCallResponse { + ::default_instance() + } +} + +impl StreamingInputCallResponse { + pub fn new() -> StreamingInputCallResponse { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "aggregated_payload_size", + |m: &StreamingInputCallResponse| { &m.aggregated_payload_size }, + |m: &mut StreamingInputCallResponse| { &mut m.aggregated_payload_size }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "StreamingInputCallResponse", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for StreamingInputCallResponse { + const NAME: &'static str = "StreamingInputCallResponse"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.aggregated_payload_size = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.aggregated_payload_size != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.aggregated_payload_size); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.aggregated_payload_size != 0 { + os.write_int32(1, self.aggregated_payload_size)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> StreamingInputCallResponse { + StreamingInputCallResponse::new() + } + + fn clear(&mut self) { + self.aggregated_payload_size = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static StreamingInputCallResponse { + static instance: StreamingInputCallResponse = StreamingInputCallResponse { + aggregated_payload_size: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for StreamingInputCallResponse { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StreamingInputCallResponse").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StreamingInputCallResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for StreamingInputCallResponse { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ResponseParameters) +pub struct ResponseParameters { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ResponseParameters.size) + pub size: i32, + // @@protoc_insertion_point(field:grpc.testing.ResponseParameters.interval_us) + pub interval_us: i32, + // @@protoc_insertion_point(field:grpc.testing.ResponseParameters.compressed) + pub compressed: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ResponseParameters.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ResponseParameters { + fn default() -> &'a ResponseParameters { + ::default_instance() + } +} + +impl ResponseParameters { + pub fn new() -> ResponseParameters { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "size", + |m: &ResponseParameters| { &m.size }, + |m: &mut ResponseParameters| { &mut m.size }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "interval_us", + |m: &ResponseParameters| { &m.interval_us }, + |m: &mut ResponseParameters| { &mut m.interval_us }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, BoolValue>( + "compressed", + |m: &ResponseParameters| { &m.compressed }, + |m: &mut ResponseParameters| { &mut m.compressed }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ResponseParameters", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ResponseParameters { + const NAME: &'static str = "ResponseParameters"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.size = is.read_int32()?; + }, + 16 => { + self.interval_us = is.read_int32()?; + }, + 26 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.compressed)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.size != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.size); + } + if self.interval_us != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.interval_us); + } + if let Some(v) = self.compressed.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.size != 0 { + os.write_int32(1, self.size)?; + } + if self.interval_us != 0 { + os.write_int32(2, self.interval_us)?; + } + if let Some(v) = self.compressed.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ResponseParameters { + ResponseParameters::new() + } + + fn clear(&mut self) { + self.size = 0; + self.interval_us = 0; + self.compressed.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static ResponseParameters { + static instance: ResponseParameters = ResponseParameters { + size: 0, + interval_us: 0, + compressed: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ResponseParameters { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ResponseParameters").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ResponseParameters { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ResponseParameters { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.StreamingOutputCallRequest) +pub struct StreamingOutputCallRequest { + // message fields + // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallRequest.response_type) + pub response_type: ::protobufv3::EnumOrUnknown, + // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallRequest.response_parameters) + pub response_parameters: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallRequest.payload) + pub payload: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallRequest.response_status) + pub response_status: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.StreamingOutputCallRequest.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StreamingOutputCallRequest { + fn default() -> &'a StreamingOutputCallRequest { + ::default_instance() + } +} + +impl StreamingOutputCallRequest { + pub fn new() -> StreamingOutputCallRequest { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(4); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "response_type", + |m: &StreamingOutputCallRequest| { &m.response_type }, + |m: &mut StreamingOutputCallRequest| { &mut m.response_type }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "response_parameters", + |m: &StreamingOutputCallRequest| { &m.response_parameters }, + |m: &mut StreamingOutputCallRequest| { &mut m.response_parameters }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Payload>( + "payload", + |m: &StreamingOutputCallRequest| { &m.payload }, + |m: &mut StreamingOutputCallRequest| { &mut m.payload }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, EchoStatus>( + "response_status", + |m: &StreamingOutputCallRequest| { &m.response_status }, + |m: &mut StreamingOutputCallRequest| { &mut m.response_status }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "StreamingOutputCallRequest", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for StreamingOutputCallRequest { + const NAME: &'static str = "StreamingOutputCallRequest"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.response_type = is.read_enum_or_unknown()?; + }, + 18 => { + self.response_parameters.push(is.read_message()?); + }, + 26 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload)?; + }, + 58 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.response_status)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.response_type != ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE) { + my_size += ::protobufv3::rt::int32_size(1, self.response_type.value()); + } + for value in &self.response_parameters { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + if let Some(v) = self.payload.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if let Some(v) = self.response_status.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.response_type != ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE) { + os.write_enum(1, ::protobufv3::EnumOrUnknown::value(&self.response_type))?; + } + for v in &self.response_parameters { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + }; + if let Some(v) = self.payload.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + } + if let Some(v) = self.response_status.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(7, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> StreamingOutputCallRequest { + StreamingOutputCallRequest::new() + } + + fn clear(&mut self) { + self.response_type = ::protobufv3::EnumOrUnknown::new(PayloadType::COMPRESSABLE); + self.response_parameters.clear(); + self.payload.clear(); + self.response_status.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static StreamingOutputCallRequest { + static instance: StreamingOutputCallRequest = StreamingOutputCallRequest { + response_type: ::protobufv3::EnumOrUnknown::from_i32(0), + response_parameters: ::std::vec::Vec::new(), + payload: ::protobufv3::MessageField::none(), + response_status: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for StreamingOutputCallRequest { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StreamingOutputCallRequest").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StreamingOutputCallRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for StreamingOutputCallRequest { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.StreamingOutputCallResponse) +pub struct StreamingOutputCallResponse { + // message fields + // @@protoc_insertion_point(field:grpc.testing.StreamingOutputCallResponse.payload) + pub payload: ::protobufv3::MessageField, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.StreamingOutputCallResponse.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a StreamingOutputCallResponse { + fn default() -> &'a StreamingOutputCallResponse { + ::default_instance() + } +} + +impl StreamingOutputCallResponse { + pub fn new() -> StreamingOutputCallResponse { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, Payload>( + "payload", + |m: &StreamingOutputCallResponse| { &m.payload }, + |m: &mut StreamingOutputCallResponse| { &mut m.payload }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "StreamingOutputCallResponse", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for StreamingOutputCallResponse { + const NAME: &'static str = "StreamingOutputCallResponse"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.payload)?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.payload.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.payload.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> StreamingOutputCallResponse { + StreamingOutputCallResponse::new() + } + + fn clear(&mut self) { + self.payload.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static StreamingOutputCallResponse { + static instance: StreamingOutputCallResponse = StreamingOutputCallResponse { + payload: ::protobufv3::MessageField::none(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for StreamingOutputCallResponse { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("StreamingOutputCallResponse").unwrap()).clone() + } +} + +impl ::std::fmt::Display for StreamingOutputCallResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for StreamingOutputCallResponse { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ReconnectParams) +pub struct ReconnectParams { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ReconnectParams.max_reconnect_backoff_ms) + pub max_reconnect_backoff_ms: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ReconnectParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ReconnectParams { + fn default() -> &'a ReconnectParams { + ::default_instance() + } +} + +impl ReconnectParams { + pub fn new() -> ReconnectParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "max_reconnect_backoff_ms", + |m: &ReconnectParams| { &m.max_reconnect_backoff_ms }, + |m: &mut ReconnectParams| { &mut m.max_reconnect_backoff_ms }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ReconnectParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ReconnectParams { + const NAME: &'static str = "ReconnectParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.max_reconnect_backoff_ms = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.max_reconnect_backoff_ms != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.max_reconnect_backoff_ms); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.max_reconnect_backoff_ms != 0 { + os.write_int32(1, self.max_reconnect_backoff_ms)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ReconnectParams { + ReconnectParams::new() + } + + fn clear(&mut self) { + self.max_reconnect_backoff_ms = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ReconnectParams { + static instance: ReconnectParams = ReconnectParams { + max_reconnect_backoff_ms: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ReconnectParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ReconnectParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ReconnectParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ReconnectParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ReconnectInfo) +pub struct ReconnectInfo { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ReconnectInfo.passed) + pub passed: bool, + // @@protoc_insertion_point(field:grpc.testing.ReconnectInfo.backoff_ms) + pub backoff_ms: ::std::vec::Vec, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ReconnectInfo.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ReconnectInfo { + fn default() -> &'a ReconnectInfo { + ::default_instance() + } +} + +impl ReconnectInfo { + pub fn new() -> ReconnectInfo { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "passed", + |m: &ReconnectInfo| { &m.passed }, + |m: &mut ReconnectInfo| { &mut m.passed }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "backoff_ms", + |m: &ReconnectInfo| { &m.backoff_ms }, + |m: &mut ReconnectInfo| { &mut m.backoff_ms }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ReconnectInfo", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ReconnectInfo { + const NAME: &'static str = "ReconnectInfo"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.passed = is.read_bool()?; + }, + 18 => { + is.read_repeated_packed_int32_into(&mut self.backoff_ms)?; + }, + 16 => { + self.backoff_ms.push(is.read_int32()?); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.passed != false { + my_size += 1 + 1; + } + for value in &self.backoff_ms { + my_size += ::protobufv3::rt::int32_size(2, *value); + }; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.passed != false { + os.write_bool(1, self.passed)?; + } + for v in &self.backoff_ms { + os.write_int32(2, *v)?; + }; + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ReconnectInfo { + ReconnectInfo::new() + } + + fn clear(&mut self) { + self.passed = false; + self.backoff_ms.clear(); + self.special_fields.clear(); + } + + fn default_instance() -> &'static ReconnectInfo { + static instance: ReconnectInfo = ReconnectInfo { + passed: false, + backoff_ms: ::std::vec::Vec::new(), + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ReconnectInfo { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ReconnectInfo").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ReconnectInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ReconnectInfo { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:grpc.testing.PayloadType) +pub enum PayloadType { + // @@protoc_insertion_point(enum_value:grpc.testing.PayloadType.COMPRESSABLE) + COMPRESSABLE = 0, +} + +impl ::protobufv3::Enum for PayloadType { + const NAME: &'static str = "PayloadType"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(PayloadType::COMPRESSABLE), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [PayloadType] = &[ + PayloadType::COMPRESSABLE, + ]; +} + +impl ::protobufv3::EnumFull for PayloadType { + fn enum_descriptor() -> ::protobufv3::reflect::EnumDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::EnumDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().enum_by_package_relative_name("PayloadType").unwrap()).clone() + } + + fn descriptor(&self) -> ::protobufv3::reflect::EnumValueDescriptor { + let index = *self as usize; + Self::enum_descriptor().value_by_index(index) + } +} + +impl ::std::default::Default for PayloadType { + fn default() -> Self { + PayloadType::COMPRESSABLE + } +} + +impl PayloadType { + fn generated_enum_descriptor_data() -> ::protobufv3::reflect::GeneratedEnumDescriptorData { + ::protobufv3::reflect::GeneratedEnumDescriptorData::new::("PayloadType") + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1bgrpc/testing/messages.proto\x12\x0cgrpc.testing\"!\n\tBoolValue\ + \x12\x14\n\x05value\x18\x01\x20\x01(\x08R\x05value\"L\n\x07Payload\x12-\ + \n\x04type\x18\x01\x20\x01(\x0e2\x19.grpc.testing.PayloadTypeR\x04type\ + \x12\x12\n\x04body\x18\x02\x20\x01(\x0cR\x04body\":\n\nEchoStatus\x12\ + \x12\n\x04code\x18\x01\x20\x01(\x05R\x04code\x12\x18\n\x07message\x18\ + \x02\x20\x01(\tR\x07message\"\xc7\x03\n\rSimpleRequest\x12>\n\rresponse_\ + type\x18\x01\x20\x01(\x0e2\x19.grpc.testing.PayloadTypeR\x0cresponseType\ + \x12#\n\rresponse_size\x18\x02\x20\x01(\x05R\x0cresponseSize\x12/\n\x07p\ + ayload\x18\x03\x20\x01(\x0b2\x15.grpc.testing.PayloadR\x07payload\x12#\n\ + \rfill_username\x18\x04\x20\x01(\x08R\x0cfillUsername\x12(\n\x10fill_oau\ + th_scope\x18\x05\x20\x01(\x08R\x0efillOauthScope\x12H\n\x13response_comp\ + ressed\x18\x06\x20\x01(\x0b2\x17.grpc.testing.BoolValueR\x12responseComp\ + ressed\x12A\n\x0fresponse_status\x18\x07\x20\x01(\x0b2\x18.grpc.testing.\ + EchoStatusR\x0eresponseStatus\x12D\n\x11expect_compressed\x18\x08\x20\ + \x01(\x0b2\x17.grpc.testing.BoolValueR\x10expectCompressed\"~\n\x0eSimpl\ + eResponse\x12/\n\x07payload\x18\x01\x20\x01(\x0b2\x15.grpc.testing.Paylo\ + adR\x07payload\x12\x1a\n\x08username\x18\x02\x20\x01(\tR\x08username\x12\ + \x1f\n\x0boauth_scope\x18\x03\x20\x01(\tR\noauthScope\"\x92\x01\n\x19Str\ + eamingInputCallRequest\x12/\n\x07payload\x18\x01\x20\x01(\x0b2\x15.grpc.\ + testing.PayloadR\x07payload\x12D\n\x11expect_compressed\x18\x02\x20\x01(\ + \x0b2\x17.grpc.testing.BoolValueR\x10expectCompressed\"T\n\x1aStreamingI\ + nputCallResponse\x126\n\x17aggregated_payload_size\x18\x01\x20\x01(\x05R\ + \x15aggregatedPayloadSize\"\x82\x01\n\x12ResponseParameters\x12\x12\n\ + \x04size\x18\x01\x20\x01(\x05R\x04size\x12\x1f\n\x0binterval_us\x18\x02\ + \x20\x01(\x05R\nintervalUs\x127\n\ncompressed\x18\x03\x20\x01(\x0b2\x17.\ + grpc.testing.BoolValueR\ncompressed\"\xa3\x02\n\x1aStreamingOutputCallRe\ + quest\x12>\n\rresponse_type\x18\x01\x20\x01(\x0e2\x19.grpc.testing.Paylo\ + adTypeR\x0cresponseType\x12Q\n\x13response_parameters\x18\x02\x20\x03(\ + \x0b2\x20.grpc.testing.ResponseParametersR\x12responseParameters\x12/\n\ + \x07payload\x18\x03\x20\x01(\x0b2\x15.grpc.testing.PayloadR\x07payload\ + \x12A\n\x0fresponse_status\x18\x07\x20\x01(\x0b2\x18.grpc.testing.EchoSt\ + atusR\x0eresponseStatus\"N\n\x1bStreamingOutputCallResponse\x12/\n\x07pa\ + yload\x18\x01\x20\x01(\x0b2\x15.grpc.testing.PayloadR\x07payload\"J\n\ + \x0fReconnectParams\x127\n\x18max_reconnect_backoff_ms\x18\x01\x20\x01(\ + \x05R\x15maxReconnectBackoffMs\"F\n\rReconnectInfo\x12\x16\n\x06passed\ + \x18\x01\x20\x01(\x08R\x06passed\x12\x1d\n\nbackoff_ms\x18\x02\x20\x03(\ + \x05R\tbackoffMs*\x1f\n\x0bPayloadType\x12\x10\n\x0cCOMPRESSABLE\x10\0b\ + \x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(12); + messages.push(BoolValue::generated_message_descriptor_data()); + messages.push(Payload::generated_message_descriptor_data()); + messages.push(EchoStatus::generated_message_descriptor_data()); + messages.push(SimpleRequest::generated_message_descriptor_data()); + messages.push(SimpleResponse::generated_message_descriptor_data()); + messages.push(StreamingInputCallRequest::generated_message_descriptor_data()); + messages.push(StreamingInputCallResponse::generated_message_descriptor_data()); + messages.push(ResponseParameters::generated_message_descriptor_data()); + messages.push(StreamingOutputCallRequest::generated_message_descriptor_data()); + messages.push(StreamingOutputCallResponse::generated_message_descriptor_data()); + messages.push(ReconnectParams::generated_message_descriptor_data()); + messages.push(ReconnectInfo::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(1); + enums.push(PayloadType::generated_enum_descriptor_data()); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/proto/src/proto/protobuf_v3/testing/mod.rs b/proto/src/proto/protobuf_v3/testing/mod.rs new file mode 100644 index 000000000..6f27845ad --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/mod.rs @@ -0,0 +1,9 @@ +// @generated + +pub mod control; +pub mod empty; +pub mod messages; +pub mod payloads; +pub mod services; +pub mod stats; +pub mod test; diff --git a/proto/src/proto/protobuf_v3/testing/payloads.rs b/proto/src/proto/protobuf_v3/testing/payloads.rs new file mode 100644 index 000000000..cefff4fe7 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/payloads.rs @@ -0,0 +1,801 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/payloads.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ByteBufferParams) +pub struct ByteBufferParams { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ByteBufferParams.req_size) + pub req_size: i32, + // @@protoc_insertion_point(field:grpc.testing.ByteBufferParams.resp_size) + pub resp_size: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ByteBufferParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ByteBufferParams { + fn default() -> &'a ByteBufferParams { + ::default_instance() + } +} + +impl ByteBufferParams { + pub fn new() -> ByteBufferParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "req_size", + |m: &ByteBufferParams| { &m.req_size }, + |m: &mut ByteBufferParams| { &mut m.req_size }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "resp_size", + |m: &ByteBufferParams| { &m.resp_size }, + |m: &mut ByteBufferParams| { &mut m.resp_size }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ByteBufferParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ByteBufferParams { + const NAME: &'static str = "ByteBufferParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.req_size = is.read_int32()?; + }, + 16 => { + self.resp_size = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.req_size != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.req_size); + } + if self.resp_size != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.resp_size); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.req_size != 0 { + os.write_int32(1, self.req_size)?; + } + if self.resp_size != 0 { + os.write_int32(2, self.resp_size)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ByteBufferParams { + ByteBufferParams::new() + } + + fn clear(&mut self) { + self.req_size = 0; + self.resp_size = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ByteBufferParams { + static instance: ByteBufferParams = ByteBufferParams { + req_size: 0, + resp_size: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ByteBufferParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ByteBufferParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ByteBufferParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ByteBufferParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.SimpleProtoParams) +pub struct SimpleProtoParams { + // message fields + // @@protoc_insertion_point(field:grpc.testing.SimpleProtoParams.req_size) + pub req_size: i32, + // @@protoc_insertion_point(field:grpc.testing.SimpleProtoParams.resp_size) + pub resp_size: i32, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.SimpleProtoParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a SimpleProtoParams { + fn default() -> &'a SimpleProtoParams { + ::default_instance() + } +} + +impl SimpleProtoParams { + pub fn new() -> SimpleProtoParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "req_size", + |m: &SimpleProtoParams| { &m.req_size }, + |m: &mut SimpleProtoParams| { &mut m.req_size }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "resp_size", + |m: &SimpleProtoParams| { &m.resp_size }, + |m: &mut SimpleProtoParams| { &mut m.resp_size }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "SimpleProtoParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for SimpleProtoParams { + const NAME: &'static str = "SimpleProtoParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.req_size = is.read_int32()?; + }, + 16 => { + self.resp_size = is.read_int32()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.req_size != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.req_size); + } + if self.resp_size != 0 { + my_size += ::protobufv3::rt::int32_size(2, self.resp_size); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.req_size != 0 { + os.write_int32(1, self.req_size)?; + } + if self.resp_size != 0 { + os.write_int32(2, self.resp_size)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> SimpleProtoParams { + SimpleProtoParams::new() + } + + fn clear(&mut self) { + self.req_size = 0; + self.resp_size = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static SimpleProtoParams { + static instance: SimpleProtoParams = SimpleProtoParams { + req_size: 0, + resp_size: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for SimpleProtoParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("SimpleProtoParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for SimpleProtoParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for SimpleProtoParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ComplexProtoParams) +pub struct ComplexProtoParams { + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ComplexProtoParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ComplexProtoParams { + fn default() -> &'a ComplexProtoParams { + ::default_instance() + } +} + +impl ComplexProtoParams { + pub fn new() -> ComplexProtoParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(0); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ComplexProtoParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ComplexProtoParams { + const NAME: &'static str = "ComplexProtoParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ComplexProtoParams { + ComplexProtoParams::new() + } + + fn clear(&mut self) { + self.special_fields.clear(); + } + + fn default_instance() -> &'static ComplexProtoParams { + static instance: ComplexProtoParams = ComplexProtoParams { + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ComplexProtoParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ComplexProtoParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ComplexProtoParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ComplexProtoParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.PayloadConfig) +pub struct PayloadConfig { + // message oneof groups + pub payload: ::std::option::Option, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.PayloadConfig.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a PayloadConfig { + fn default() -> &'a PayloadConfig { + ::default_instance() + } +} + +impl PayloadConfig { + pub fn new() -> PayloadConfig { + ::std::default::Default::default() + } + + // .grpc.testing.ByteBufferParams bytebuf_params = 1; + + pub fn bytebuf_params(&self) -> &ByteBufferParams { + match self.payload { + ::std::option::Option::Some(payload_config::Payload::BytebufParams(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_bytebuf_params(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_bytebuf_params(&self) -> bool { + match self.payload { + ::std::option::Option::Some(payload_config::Payload::BytebufParams(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_bytebuf_params(&mut self, v: ByteBufferParams) { + self.payload = ::std::option::Option::Some(payload_config::Payload::BytebufParams(v)) + } + + // Mutable pointer to the field. + pub fn mut_bytebuf_params(&mut self) -> &mut ByteBufferParams { + if let ::std::option::Option::Some(payload_config::Payload::BytebufParams(_)) = self.payload { + } else { + self.payload = ::std::option::Option::Some(payload_config::Payload::BytebufParams(ByteBufferParams::new())); + } + match self.payload { + ::std::option::Option::Some(payload_config::Payload::BytebufParams(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_bytebuf_params(&mut self) -> ByteBufferParams { + if self.has_bytebuf_params() { + match self.payload.take() { + ::std::option::Option::Some(payload_config::Payload::BytebufParams(v)) => v, + _ => panic!(), + } + } else { + ByteBufferParams::new() + } + } + + // .grpc.testing.SimpleProtoParams simple_params = 2; + + pub fn simple_params(&self) -> &SimpleProtoParams { + match self.payload { + ::std::option::Option::Some(payload_config::Payload::SimpleParams(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_simple_params(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_simple_params(&self) -> bool { + match self.payload { + ::std::option::Option::Some(payload_config::Payload::SimpleParams(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_simple_params(&mut self, v: SimpleProtoParams) { + self.payload = ::std::option::Option::Some(payload_config::Payload::SimpleParams(v)) + } + + // Mutable pointer to the field. + pub fn mut_simple_params(&mut self) -> &mut SimpleProtoParams { + if let ::std::option::Option::Some(payload_config::Payload::SimpleParams(_)) = self.payload { + } else { + self.payload = ::std::option::Option::Some(payload_config::Payload::SimpleParams(SimpleProtoParams::new())); + } + match self.payload { + ::std::option::Option::Some(payload_config::Payload::SimpleParams(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_simple_params(&mut self) -> SimpleProtoParams { + if self.has_simple_params() { + match self.payload.take() { + ::std::option::Option::Some(payload_config::Payload::SimpleParams(v)) => v, + _ => panic!(), + } + } else { + SimpleProtoParams::new() + } + } + + // .grpc.testing.ComplexProtoParams complex_params = 3; + + pub fn complex_params(&self) -> &ComplexProtoParams { + match self.payload { + ::std::option::Option::Some(payload_config::Payload::ComplexParams(ref v)) => v, + _ => ::default_instance(), + } + } + + pub fn clear_complex_params(&mut self) { + self.payload = ::std::option::Option::None; + } + + pub fn has_complex_params(&self) -> bool { + match self.payload { + ::std::option::Option::Some(payload_config::Payload::ComplexParams(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_complex_params(&mut self, v: ComplexProtoParams) { + self.payload = ::std::option::Option::Some(payload_config::Payload::ComplexParams(v)) + } + + // Mutable pointer to the field. + pub fn mut_complex_params(&mut self) -> &mut ComplexProtoParams { + if let ::std::option::Option::Some(payload_config::Payload::ComplexParams(_)) = self.payload { + } else { + self.payload = ::std::option::Option::Some(payload_config::Payload::ComplexParams(ComplexProtoParams::new())); + } + match self.payload { + ::std::option::Option::Some(payload_config::Payload::ComplexParams(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_complex_params(&mut self) -> ComplexProtoParams { + if self.has_complex_params() { + match self.payload.take() { + ::std::option::Option::Some(payload_config::Payload::ComplexParams(v)) => v, + _ => panic!(), + } + } else { + ComplexProtoParams::new() + } + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(1); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, ByteBufferParams>( + "bytebuf_params", + PayloadConfig::has_bytebuf_params, + PayloadConfig::bytebuf_params, + PayloadConfig::mut_bytebuf_params, + PayloadConfig::set_bytebuf_params, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, SimpleProtoParams>( + "simple_params", + PayloadConfig::has_simple_params, + PayloadConfig::simple_params, + PayloadConfig::mut_simple_params, + PayloadConfig::set_simple_params, + )); + fields.push(::protobufv3::reflect::rt::v2::make_oneof_message_has_get_mut_set_accessor::<_, ComplexProtoParams>( + "complex_params", + PayloadConfig::has_complex_params, + PayloadConfig::complex_params, + PayloadConfig::mut_complex_params, + PayloadConfig::set_complex_params, + )); + oneofs.push(payload_config::Payload::generated_oneof_descriptor_data()); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "PayloadConfig", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for PayloadConfig { + const NAME: &'static str = "PayloadConfig"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.payload = ::std::option::Option::Some(payload_config::Payload::BytebufParams(is.read_message()?)); + }, + 18 => { + self.payload = ::std::option::Option::Some(payload_config::Payload::SimpleParams(is.read_message()?)); + }, + 26 => { + self.payload = ::std::option::Option::Some(payload_config::Payload::ComplexParams(is.read_message()?)); + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.payload { + match v { + &payload_config::Payload::BytebufParams(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + &payload_config::Payload::SimpleParams(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + &payload_config::Payload::ComplexParams(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }, + }; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let ::std::option::Option::Some(ref v) = self.payload { + match v { + &payload_config::Payload::BytebufParams(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + }, + &payload_config::Payload::SimpleParams(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(2, v, os)?; + }, + &payload_config::Payload::ComplexParams(ref v) => { + ::protobufv3::rt::write_message_field_with_cached_size(3, v, os)?; + }, + }; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> PayloadConfig { + PayloadConfig::new() + } + + fn clear(&mut self) { + self.payload = ::std::option::Option::None; + self.payload = ::std::option::Option::None; + self.payload = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static PayloadConfig { + static instance: PayloadConfig = PayloadConfig { + payload: ::std::option::Option::None, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for PayloadConfig { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("PayloadConfig").unwrap()).clone() + } +} + +impl ::std::fmt::Display for PayloadConfig { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for PayloadConfig { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +/// Nested message and enums of message `PayloadConfig` +pub mod payload_config { + + #[derive(Clone,PartialEq,Debug)] + #[non_exhaustive] + // @@protoc_insertion_point(oneof:grpc.testing.PayloadConfig.payload) + pub enum Payload { + // @@protoc_insertion_point(oneof_field:grpc.testing.PayloadConfig.bytebuf_params) + BytebufParams(super::ByteBufferParams), + // @@protoc_insertion_point(oneof_field:grpc.testing.PayloadConfig.simple_params) + SimpleParams(super::SimpleProtoParams), + // @@protoc_insertion_point(oneof_field:grpc.testing.PayloadConfig.complex_params) + ComplexParams(super::ComplexProtoParams), + } + + impl ::protobufv3::Oneof for Payload { + } + + impl ::protobufv3::OneofFull for Payload { + fn descriptor() -> ::protobufv3::reflect::OneofDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::OneofDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| ::descriptor().oneof_by_name("payload").unwrap()).clone() + } + } + + impl Payload { + pub(in super) fn generated_oneof_descriptor_data() -> ::protobufv3::reflect::GeneratedOneofDescriptorData { + ::protobufv3::reflect::GeneratedOneofDescriptorData::new::("payload") + } + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1bgrpc/testing/payloads.proto\x12\x0cgrpc.testing\"J\n\x10ByteBuffer\ + Params\x12\x19\n\x08req_size\x18\x01\x20\x01(\x05R\x07reqSize\x12\x1b\n\ + \tresp_size\x18\x02\x20\x01(\x05R\x08respSize\"K\n\x11SimpleProtoParams\ + \x12\x19\n\x08req_size\x18\x01\x20\x01(\x05R\x07reqSize\x12\x1b\n\tresp_\ + size\x18\x02\x20\x01(\x05R\x08respSize\"\x14\n\x12ComplexProtoParams\"\ + \xf6\x01\n\rPayloadConfig\x12G\n\x0ebytebuf_params\x18\x01\x20\x01(\x0b2\ + \x1e.grpc.testing.ByteBufferParamsH\0R\rbytebufParams\x12F\n\rsimple_par\ + ams\x18\x02\x20\x01(\x0b2\x1f.grpc.testing.SimpleProtoParamsH\0R\x0csimp\ + leParams\x12I\n\x0ecomplex_params\x18\x03\x20\x01(\x0b2\x20.grpc.testing\ + .ComplexProtoParamsH\0R\rcomplexParamsB\t\n\x07payloadb\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(4); + messages.push(ByteBufferParams::generated_message_descriptor_data()); + messages.push(SimpleProtoParams::generated_message_descriptor_data()); + messages.push(ComplexProtoParams::generated_message_descriptor_data()); + messages.push(PayloadConfig::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/proto/src/proto/protobuf_v3/testing/services.rs b/proto/src/proto/protobuf_v3/testing/services.rs new file mode 100644 index 000000000..538c3c655 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/services.rs @@ -0,0 +1,78 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/services.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1bgrpc/testing/services.proto\x12\x0cgrpc.testing\x1a\x1bgrpc/testin\ + g/messages.proto\x1a\x1agrpc/testing/control.proto\x1a\x18grpc/testing/s\ + tats.proto2\xa6\x03\n\x10BenchmarkService\x12F\n\tUnaryCall\x12\x1b.grpc\ + .testing.SimpleRequest\x1a\x1c.grpc.testing.SimpleResponse\x12N\n\rStrea\ + mingCall\x12\x1b.grpc.testing.SimpleRequest\x1a\x1c.grpc.testing.SimpleR\ + esponse(\x010\x01\x12R\n\x13StreamingFromClient\x12\x1b.grpc.testing.Sim\ + pleRequest\x1a\x1c.grpc.testing.SimpleResponse(\x01\x12R\n\x13StreamingF\ + romServer\x12\x1b.grpc.testing.SimpleRequest\x1a\x1c.grpc.testing.Simple\ + Response0\x01\x12R\n\x11StreamingBothWays\x12\x1b.grpc.testing.SimpleReq\ + uest\x1a\x1c.grpc.testing.SimpleResponse(\x010\x012\x97\x02\n\rWorkerSer\ + vice\x12E\n\tRunServer\x12\x18.grpc.testing.ServerArgs\x1a\x1a.grpc.test\ + ing.ServerStatus(\x010\x01\x12E\n\tRunClient\x12\x18.grpc.testing.Client\ + Args\x1a\x1a.grpc.testing.ClientStatus(\x010\x01\x12B\n\tCoreCount\x12\ + \x19.grpc.testing.CoreRequest\x1a\x1a.grpc.testing.CoreResponse\x124\n\n\ + QuitWorker\x12\x12.grpc.testing.Void\x1a\x12.grpc.testing.Void2^\n\x18Re\ + portQpsScenarioService\x12B\n\x0eReportScenario\x12\x1c.grpc.testing.Sce\ + narioResult\x1a\x12.grpc.testing.Voidb\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(3); + deps.push(super::messages::file_descriptor().clone()); + deps.push(super::control::file_descriptor().clone()); + deps.push(super::stats::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(0); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} + +pub use super::services_grpc::*; diff --git a/proto/src/proto/protobuf_v3/testing/services_grpc.rs b/proto/src/proto/protobuf_v3/testing/services_grpc.rs new file mode 100644 index 000000000..a6a1977d2 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/services_grpc.rs @@ -0,0 +1,341 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_BENCHMARK_SERVICE_UNARY_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.BenchmarkService/UnaryCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_BENCHMARK_SERVICE_STREAMING_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/grpc.testing.BenchmarkService/StreamingCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_BENCHMARK_SERVICE_STREAMING_FROM_CLIENT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ClientStreaming, + name: "/grpc.testing.BenchmarkService/StreamingFromClient", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_BENCHMARK_SERVICE_STREAMING_FROM_SERVER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ServerStreaming, + name: "/grpc.testing.BenchmarkService/StreamingFromServer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_BENCHMARK_SERVICE_STREAMING_BOTH_WAYS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/grpc.testing.BenchmarkService/StreamingBothWays", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct BenchmarkServiceClient { + pub client: ::grpcio::Client, +} + +impl BenchmarkServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + BenchmarkServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn unary_call_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_BENCHMARK_SERVICE_UNARY_CALL, req, opt) + } + + pub fn unary_call(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result { + self.unary_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn unary_call_async_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_BENCHMARK_SERVICE_UNARY_CALL, req, opt) + } + + pub fn unary_call_async(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.unary_call_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn streaming_call_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_BENCHMARK_SERVICE_STREAMING_CALL, opt) + } + + pub fn streaming_call(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.streaming_call_opt(::grpcio::CallOption::default()) + } + + pub fn streaming_from_client_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver)> { + self.client.client_streaming(&METHOD_BENCHMARK_SERVICE_STREAMING_FROM_CLIENT, opt) + } + + pub fn streaming_from_client(&self) -> ::grpcio::Result<(::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver)> { + self.streaming_from_client_opt(::grpcio::CallOption::default()) + } + + pub fn streaming_from_server_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.client.server_streaming(&METHOD_BENCHMARK_SERVICE_STREAMING_FROM_SERVER, req, opt) + } + + pub fn streaming_from_server(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.streaming_from_server_opt(req, ::grpcio::CallOption::default()) + } + + pub fn streaming_both_ways_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_BENCHMARK_SERVICE_STREAMING_BOTH_WAYS, opt) + } + + pub fn streaming_both_ways(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.streaming_both_ways_opt(::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait BenchmarkService { + fn unary_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::messages::SimpleRequest, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn streaming_call(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn streaming_from_client(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn streaming_from_server(&mut self, ctx: ::grpcio::RpcContext, _req: super::messages::SimpleRequest, sink: ::grpcio::ServerStreamingSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn streaming_both_ways(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_benchmark_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_BENCHMARK_SERVICE_UNARY_CALL, move |ctx, req, resp| { + instance.unary_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_BENCHMARK_SERVICE_STREAMING_CALL, move |ctx, req, resp| { + instance.streaming_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_client_streaming_handler(&METHOD_BENCHMARK_SERVICE_STREAMING_FROM_CLIENT, move |ctx, req, resp| { + instance.streaming_from_client(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_server_streaming_handler(&METHOD_BENCHMARK_SERVICE_STREAMING_FROM_SERVER, move |ctx, req, resp| { + instance.streaming_from_server(ctx, req, resp) + }); + let mut instance = s; + builder = builder.add_duplex_streaming_handler(&METHOD_BENCHMARK_SERVICE_STREAMING_BOTH_WAYS, move |ctx, req, resp| { + instance.streaming_both_ways(ctx, req, resp) + }); + builder.build() +} + +const METHOD_WORKER_SERVICE_RUN_SERVER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/grpc.testing.WorkerService/RunServer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_WORKER_SERVICE_RUN_CLIENT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/grpc.testing.WorkerService/RunClient", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_WORKER_SERVICE_CORE_COUNT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.WorkerService/CoreCount", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_WORKER_SERVICE_QUIT_WORKER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.WorkerService/QuitWorker", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct WorkerServiceClient { + pub client: ::grpcio::Client, +} + +impl WorkerServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + WorkerServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn run_server_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_WORKER_SERVICE_RUN_SERVER, opt) + } + + pub fn run_server(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.run_server_opt(::grpcio::CallOption::default()) + } + + pub fn run_client_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_WORKER_SERVICE_RUN_CLIENT, opt) + } + + pub fn run_client(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.run_client_opt(::grpcio::CallOption::default()) + } + + pub fn core_count_opt(&self, req: &super::control::CoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_WORKER_SERVICE_CORE_COUNT, req, opt) + } + + pub fn core_count(&self, req: &super::control::CoreRequest) -> ::grpcio::Result { + self.core_count_opt(req, ::grpcio::CallOption::default()) + } + + pub fn core_count_async_opt(&self, req: &super::control::CoreRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_WORKER_SERVICE_CORE_COUNT, req, opt) + } + + pub fn core_count_async(&self, req: &super::control::CoreRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.core_count_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn quit_worker_opt(&self, req: &super::control::Void, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_WORKER_SERVICE_QUIT_WORKER, req, opt) + } + + pub fn quit_worker(&self, req: &super::control::Void) -> ::grpcio::Result { + self.quit_worker_opt(req, ::grpcio::CallOption::default()) + } + + pub fn quit_worker_async_opt(&self, req: &super::control::Void, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_WORKER_SERVICE_QUIT_WORKER, req, opt) + } + + pub fn quit_worker_async(&self, req: &super::control::Void) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.quit_worker_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait WorkerService { + fn run_server(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn run_client(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn core_count(&mut self, ctx: ::grpcio::RpcContext, _req: super::control::CoreRequest, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn quit_worker(&mut self, ctx: ::grpcio::RpcContext, _req: super::control::Void, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_worker_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_WORKER_SERVICE_RUN_SERVER, move |ctx, req, resp| { + instance.run_server(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_WORKER_SERVICE_RUN_CLIENT, move |ctx, req, resp| { + instance.run_client(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_WORKER_SERVICE_CORE_COUNT, move |ctx, req, resp| { + instance.core_count(ctx, req, resp) + }); + let mut instance = s; + builder = builder.add_unary_handler(&METHOD_WORKER_SERVICE_QUIT_WORKER, move |ctx, req, resp| { + instance.quit_worker(ctx, req, resp) + }); + builder.build() +} + +const METHOD_REPORT_QPS_SCENARIO_SERVICE_REPORT_SCENARIO: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.ReportQpsScenarioService/ReportScenario", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct ReportQpsScenarioServiceClient { + pub client: ::grpcio::Client, +} + +impl ReportQpsScenarioServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + ReportQpsScenarioServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn report_scenario_opt(&self, req: &super::control::ScenarioResult, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_REPORT_QPS_SCENARIO_SERVICE_REPORT_SCENARIO, req, opt) + } + + pub fn report_scenario(&self, req: &super::control::ScenarioResult) -> ::grpcio::Result { + self.report_scenario_opt(req, ::grpcio::CallOption::default()) + } + + pub fn report_scenario_async_opt(&self, req: &super::control::ScenarioResult, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_REPORT_QPS_SCENARIO_SERVICE_REPORT_SCENARIO, req, opt) + } + + pub fn report_scenario_async(&self, req: &super::control::ScenarioResult) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.report_scenario_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait ReportQpsScenarioService { + fn report_scenario(&mut self, ctx: ::grpcio::RpcContext, _req: super::control::ScenarioResult, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_report_qps_scenario_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s; + builder = builder.add_unary_handler(&METHOD_REPORT_QPS_SCENARIO_SERVICE_REPORT_SCENARIO, move |ctx, req, resp| { + instance.report_scenario(ctx, req, resp) + }); + builder.build() +} diff --git a/proto/src/proto/protobuf_v3/testing/stats.rs b/proto/src/proto/protobuf_v3/testing/stats.rs new file mode 100644 index 000000000..b85df900a --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/stats.rs @@ -0,0 +1,1004 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/stats.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ServerStats) +pub struct ServerStats { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ServerStats.time_elapsed) + pub time_elapsed: f64, + // @@protoc_insertion_point(field:grpc.testing.ServerStats.time_user) + pub time_user: f64, + // @@protoc_insertion_point(field:grpc.testing.ServerStats.time_system) + pub time_system: f64, + // @@protoc_insertion_point(field:grpc.testing.ServerStats.total_cpu_time) + pub total_cpu_time: u64, + // @@protoc_insertion_point(field:grpc.testing.ServerStats.idle_cpu_time) + pub idle_cpu_time: u64, + // @@protoc_insertion_point(field:grpc.testing.ServerStats.cq_poll_count) + pub cq_poll_count: u64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ServerStats.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ServerStats { + fn default() -> &'a ServerStats { + ::default_instance() + } +} + +impl ServerStats { + pub fn new() -> ServerStats { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "time_elapsed", + |m: &ServerStats| { &m.time_elapsed }, + |m: &mut ServerStats| { &mut m.time_elapsed }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "time_user", + |m: &ServerStats| { &m.time_user }, + |m: &mut ServerStats| { &mut m.time_user }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "time_system", + |m: &ServerStats| { &m.time_system }, + |m: &mut ServerStats| { &mut m.time_system }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "total_cpu_time", + |m: &ServerStats| { &m.total_cpu_time }, + |m: &mut ServerStats| { &mut m.total_cpu_time }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "idle_cpu_time", + |m: &ServerStats| { &m.idle_cpu_time }, + |m: &mut ServerStats| { &mut m.idle_cpu_time }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "cq_poll_count", + |m: &ServerStats| { &m.cq_poll_count }, + |m: &mut ServerStats| { &mut m.cq_poll_count }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ServerStats", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ServerStats { + const NAME: &'static str = "ServerStats"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 9 => { + self.time_elapsed = is.read_double()?; + }, + 17 => { + self.time_user = is.read_double()?; + }, + 25 => { + self.time_system = is.read_double()?; + }, + 32 => { + self.total_cpu_time = is.read_uint64()?; + }, + 40 => { + self.idle_cpu_time = is.read_uint64()?; + }, + 48 => { + self.cq_poll_count = is.read_uint64()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.time_elapsed != 0. { + my_size += 1 + 8; + } + if self.time_user != 0. { + my_size += 1 + 8; + } + if self.time_system != 0. { + my_size += 1 + 8; + } + if self.total_cpu_time != 0 { + my_size += ::protobufv3::rt::uint64_size(4, self.total_cpu_time); + } + if self.idle_cpu_time != 0 { + my_size += ::protobufv3::rt::uint64_size(5, self.idle_cpu_time); + } + if self.cq_poll_count != 0 { + my_size += ::protobufv3::rt::uint64_size(6, self.cq_poll_count); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.time_elapsed != 0. { + os.write_double(1, self.time_elapsed)?; + } + if self.time_user != 0. { + os.write_double(2, self.time_user)?; + } + if self.time_system != 0. { + os.write_double(3, self.time_system)?; + } + if self.total_cpu_time != 0 { + os.write_uint64(4, self.total_cpu_time)?; + } + if self.idle_cpu_time != 0 { + os.write_uint64(5, self.idle_cpu_time)?; + } + if self.cq_poll_count != 0 { + os.write_uint64(6, self.cq_poll_count)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ServerStats { + ServerStats::new() + } + + fn clear(&mut self) { + self.time_elapsed = 0.; + self.time_user = 0.; + self.time_system = 0.; + self.total_cpu_time = 0; + self.idle_cpu_time = 0; + self.cq_poll_count = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ServerStats { + static instance: ServerStats = ServerStats { + time_elapsed: 0., + time_user: 0., + time_system: 0., + total_cpu_time: 0, + idle_cpu_time: 0, + cq_poll_count: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ServerStats { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ServerStats").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ServerStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ServerStats { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.HistogramParams) +pub struct HistogramParams { + // message fields + // @@protoc_insertion_point(field:grpc.testing.HistogramParams.resolution) + pub resolution: f64, + // @@protoc_insertion_point(field:grpc.testing.HistogramParams.max_possible) + pub max_possible: f64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.HistogramParams.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HistogramParams { + fn default() -> &'a HistogramParams { + ::default_instance() + } +} + +impl HistogramParams { + pub fn new() -> HistogramParams { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "resolution", + |m: &HistogramParams| { &m.resolution }, + |m: &mut HistogramParams| { &mut m.resolution }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "max_possible", + |m: &HistogramParams| { &m.max_possible }, + |m: &mut HistogramParams| { &mut m.max_possible }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "HistogramParams", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for HistogramParams { + const NAME: &'static str = "HistogramParams"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 9 => { + self.resolution = is.read_double()?; + }, + 17 => { + self.max_possible = is.read_double()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.resolution != 0. { + my_size += 1 + 8; + } + if self.max_possible != 0. { + my_size += 1 + 8; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.resolution != 0. { + os.write_double(1, self.resolution)?; + } + if self.max_possible != 0. { + os.write_double(2, self.max_possible)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> HistogramParams { + HistogramParams::new() + } + + fn clear(&mut self) { + self.resolution = 0.; + self.max_possible = 0.; + self.special_fields.clear(); + } + + fn default_instance() -> &'static HistogramParams { + static instance: HistogramParams = HistogramParams { + resolution: 0., + max_possible: 0., + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for HistogramParams { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HistogramParams").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HistogramParams { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for HistogramParams { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.HistogramData) +pub struct HistogramData { + // message fields + // @@protoc_insertion_point(field:grpc.testing.HistogramData.bucket) + pub bucket: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.HistogramData.min_seen) + pub min_seen: f64, + // @@protoc_insertion_point(field:grpc.testing.HistogramData.max_seen) + pub max_seen: f64, + // @@protoc_insertion_point(field:grpc.testing.HistogramData.sum) + pub sum: f64, + // @@protoc_insertion_point(field:grpc.testing.HistogramData.sum_of_squares) + pub sum_of_squares: f64, + // @@protoc_insertion_point(field:grpc.testing.HistogramData.count) + pub count: f64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.HistogramData.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a HistogramData { + fn default() -> &'a HistogramData { + ::default_instance() + } +} + +impl HistogramData { + pub fn new() -> HistogramData { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "bucket", + |m: &HistogramData| { &m.bucket }, + |m: &mut HistogramData| { &mut m.bucket }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "min_seen", + |m: &HistogramData| { &m.min_seen }, + |m: &mut HistogramData| { &mut m.min_seen }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "max_seen", + |m: &HistogramData| { &m.max_seen }, + |m: &mut HistogramData| { &mut m.max_seen }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "sum", + |m: &HistogramData| { &m.sum }, + |m: &mut HistogramData| { &mut m.sum }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "sum_of_squares", + |m: &HistogramData| { &m.sum_of_squares }, + |m: &mut HistogramData| { &mut m.sum_of_squares }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "count", + |m: &HistogramData| { &m.count }, + |m: &mut HistogramData| { &mut m.count }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "HistogramData", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for HistogramData { + const NAME: &'static str = "HistogramData"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.bucket)?; + }, + 8 => { + self.bucket.push(is.read_uint32()?); + }, + 17 => { + self.min_seen = is.read_double()?; + }, + 25 => { + self.max_seen = is.read_double()?; + }, + 33 => { + self.sum = is.read_double()?; + }, + 41 => { + self.sum_of_squares = is.read_double()?; + }, + 49 => { + self.count = is.read_double()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.bucket { + my_size += ::protobufv3::rt::uint32_size(1, *value); + }; + if self.min_seen != 0. { + my_size += 1 + 8; + } + if self.max_seen != 0. { + my_size += 1 + 8; + } + if self.sum != 0. { + my_size += 1 + 8; + } + if self.sum_of_squares != 0. { + my_size += 1 + 8; + } + if self.count != 0. { + my_size += 1 + 8; + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + for v in &self.bucket { + os.write_uint32(1, *v)?; + }; + if self.min_seen != 0. { + os.write_double(2, self.min_seen)?; + } + if self.max_seen != 0. { + os.write_double(3, self.max_seen)?; + } + if self.sum != 0. { + os.write_double(4, self.sum)?; + } + if self.sum_of_squares != 0. { + os.write_double(5, self.sum_of_squares)?; + } + if self.count != 0. { + os.write_double(6, self.count)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> HistogramData { + HistogramData::new() + } + + fn clear(&mut self) { + self.bucket.clear(); + self.min_seen = 0.; + self.max_seen = 0.; + self.sum = 0.; + self.sum_of_squares = 0.; + self.count = 0.; + self.special_fields.clear(); + } + + fn default_instance() -> &'static HistogramData { + static instance: HistogramData = HistogramData { + bucket: ::std::vec::Vec::new(), + min_seen: 0., + max_seen: 0., + sum: 0., + sum_of_squares: 0., + count: 0., + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for HistogramData { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("HistogramData").unwrap()).clone() + } +} + +impl ::std::fmt::Display for HistogramData { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for HistogramData { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.RequestResultCount) +pub struct RequestResultCount { + // message fields + // @@protoc_insertion_point(field:grpc.testing.RequestResultCount.status_code) + pub status_code: i32, + // @@protoc_insertion_point(field:grpc.testing.RequestResultCount.count) + pub count: i64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.RequestResultCount.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a RequestResultCount { + fn default() -> &'a RequestResultCount { + ::default_instance() + } +} + +impl RequestResultCount { + pub fn new() -> RequestResultCount { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(2); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "status_code", + |m: &RequestResultCount| { &m.status_code }, + |m: &mut RequestResultCount| { &mut m.status_code }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "count", + |m: &RequestResultCount| { &m.count }, + |m: &mut RequestResultCount| { &mut m.count }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "RequestResultCount", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for RequestResultCount { + const NAME: &'static str = "RequestResultCount"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.status_code = is.read_int32()?; + }, + 16 => { + self.count = is.read_int64()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if self.status_code != 0 { + my_size += ::protobufv3::rt::int32_size(1, self.status_code); + } + if self.count != 0 { + my_size += ::protobufv3::rt::int64_size(2, self.count); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if self.status_code != 0 { + os.write_int32(1, self.status_code)?; + } + if self.count != 0 { + os.write_int64(2, self.count)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> RequestResultCount { + RequestResultCount::new() + } + + fn clear(&mut self) { + self.status_code = 0; + self.count = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static RequestResultCount { + static instance: RequestResultCount = RequestResultCount { + status_code: 0, + count: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for RequestResultCount { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("RequestResultCount").unwrap()).clone() + } +} + +impl ::std::fmt::Display for RequestResultCount { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for RequestResultCount { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +#[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:grpc.testing.ClientStats) +pub struct ClientStats { + // message fields + // @@protoc_insertion_point(field:grpc.testing.ClientStats.latencies) + pub latencies: ::protobufv3::MessageField, + // @@protoc_insertion_point(field:grpc.testing.ClientStats.time_elapsed) + pub time_elapsed: f64, + // @@protoc_insertion_point(field:grpc.testing.ClientStats.time_user) + pub time_user: f64, + // @@protoc_insertion_point(field:grpc.testing.ClientStats.time_system) + pub time_system: f64, + // @@protoc_insertion_point(field:grpc.testing.ClientStats.request_results) + pub request_results: ::std::vec::Vec, + // @@protoc_insertion_point(field:grpc.testing.ClientStats.cq_poll_count) + pub cq_poll_count: u64, + // special fields + // @@protoc_insertion_point(special_field:grpc.testing.ClientStats.special_fields) + pub special_fields: ::protobufv3::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a ClientStats { + fn default() -> &'a ClientStats { + ::default_instance() + } +} + +impl ClientStats { + pub fn new() -> ClientStats { + ::std::default::Default::default() + } + + fn generated_message_descriptor_data() -> ::protobufv3::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(6); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobufv3::reflect::rt::v2::make_message_field_accessor::<_, HistogramData>( + "latencies", + |m: &ClientStats| { &m.latencies }, + |m: &mut ClientStats| { &mut m.latencies }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "time_elapsed", + |m: &ClientStats| { &m.time_elapsed }, + |m: &mut ClientStats| { &mut m.time_elapsed }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "time_user", + |m: &ClientStats| { &m.time_user }, + |m: &mut ClientStats| { &mut m.time_user }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "time_system", + |m: &ClientStats| { &m.time_system }, + |m: &mut ClientStats| { &mut m.time_system }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "request_results", + |m: &ClientStats| { &m.request_results }, + |m: &mut ClientStats| { &mut m.request_results }, + )); + fields.push(::protobufv3::reflect::rt::v2::make_simpler_field_accessor::<_, _>( + "cq_poll_count", + |m: &ClientStats| { &m.cq_poll_count }, + |m: &mut ClientStats| { &mut m.cq_poll_count }, + )); + ::protobufv3::reflect::GeneratedMessageDescriptorData::new_2::( + "ClientStats", + fields, + oneofs, + ) + } +} + +impl ::protobufv3::Message for ClientStats { + const NAME: &'static str = "ClientStats"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobufv3::CodedInputStream<'_>) -> ::protobufv3::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobufv3::rt::read_singular_message_into_field(is, &mut self.latencies)?; + }, + 17 => { + self.time_elapsed = is.read_double()?; + }, + 25 => { + self.time_user = is.read_double()?; + }, + 33 => { + self.time_system = is.read_double()?; + }, + 42 => { + self.request_results.push(is.read_message()?); + }, + 48 => { + self.cq_poll_count = is.read_uint64()?; + }, + tag => { + ::protobufv3::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.latencies.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + } + if self.time_elapsed != 0. { + my_size += 1 + 8; + } + if self.time_user != 0. { + my_size += 1 + 8; + } + if self.time_system != 0. { + my_size += 1 + 8; + } + for value in &self.request_results { + let len = value.compute_size(); + my_size += 1 + ::protobufv3::rt::compute_raw_varint64_size(len) + len; + }; + if self.cq_poll_count != 0 { + my_size += ::protobufv3::rt::uint64_size(6, self.cq_poll_count); + } + my_size += ::protobufv3::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobufv3::CodedOutputStream<'_>) -> ::protobufv3::Result<()> { + if let Some(v) = self.latencies.as_ref() { + ::protobufv3::rt::write_message_field_with_cached_size(1, v, os)?; + } + if self.time_elapsed != 0. { + os.write_double(2, self.time_elapsed)?; + } + if self.time_user != 0. { + os.write_double(3, self.time_user)?; + } + if self.time_system != 0. { + os.write_double(4, self.time_system)?; + } + for v in &self.request_results { + ::protobufv3::rt::write_message_field_with_cached_size(5, v, os)?; + }; + if self.cq_poll_count != 0 { + os.write_uint64(6, self.cq_poll_count)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobufv3::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobufv3::SpecialFields { + &mut self.special_fields + } + + fn new() -> ClientStats { + ClientStats::new() + } + + fn clear(&mut self) { + self.latencies.clear(); + self.time_elapsed = 0.; + self.time_user = 0.; + self.time_system = 0.; + self.request_results.clear(); + self.cq_poll_count = 0; + self.special_fields.clear(); + } + + fn default_instance() -> &'static ClientStats { + static instance: ClientStats = ClientStats { + latencies: ::protobufv3::MessageField::none(), + time_elapsed: 0., + time_user: 0., + time_system: 0., + request_results: ::std::vec::Vec::new(), + cq_poll_count: 0, + special_fields: ::protobufv3::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobufv3::MessageFull for ClientStats { + fn descriptor() -> ::protobufv3::reflect::MessageDescriptor { + static descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::MessageDescriptor> = ::protobufv3::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("ClientStats").unwrap()).clone() + } +} + +impl ::std::fmt::Display for ClientStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobufv3::text_format::fmt(self, f) + } +} + +impl ::protobufv3::reflect::ProtobufValue for ClientStats { + type RuntimeType = ::protobufv3::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x18grpc/testing/stats.proto\x12\x0cgrpc.testing\"\xdc\x01\n\x0bServer\ + Stats\x12!\n\x0ctime_elapsed\x18\x01\x20\x01(\x01R\x0btimeElapsed\x12\ + \x1b\n\ttime_user\x18\x02\x20\x01(\x01R\x08timeUser\x12\x1f\n\x0btime_sy\ + stem\x18\x03\x20\x01(\x01R\ntimeSystem\x12$\n\x0etotal_cpu_time\x18\x04\ + \x20\x01(\x04R\x0ctotalCpuTime\x12\"\n\ridle_cpu_time\x18\x05\x20\x01(\ + \x04R\x0bidleCpuTime\x12\"\n\rcq_poll_count\x18\x06\x20\x01(\x04R\x0bcqP\ + ollCount\"T\n\x0fHistogramParams\x12\x1e\n\nresolution\x18\x01\x20\x01(\ + \x01R\nresolution\x12!\n\x0cmax_possible\x18\x02\x20\x01(\x01R\x0bmaxPos\ + sible\"\xab\x01\n\rHistogramData\x12\x16\n\x06bucket\x18\x01\x20\x03(\rR\ + \x06bucket\x12\x19\n\x08min_seen\x18\x02\x20\x01(\x01R\x07minSeen\x12\ + \x19\n\x08max_seen\x18\x03\x20\x01(\x01R\x07maxSeen\x12\x10\n\x03sum\x18\ + \x04\x20\x01(\x01R\x03sum\x12$\n\x0esum_of_squares\x18\x05\x20\x01(\x01R\ + \x0csumOfSquares\x12\x14\n\x05count\x18\x06\x20\x01(\x01R\x05count\"K\n\ + \x12RequestResultCount\x12\x1f\n\x0bstatus_code\x18\x01\x20\x01(\x05R\ns\ + tatusCode\x12\x14\n\x05count\x18\x02\x20\x01(\x03R\x05count\"\x98\x02\n\ + \x0bClientStats\x129\n\tlatencies\x18\x01\x20\x01(\x0b2\x1b.grpc.testing\ + .HistogramDataR\tlatencies\x12!\n\x0ctime_elapsed\x18\x02\x20\x01(\x01R\ + \x0btimeElapsed\x12\x1b\n\ttime_user\x18\x03\x20\x01(\x01R\x08timeUser\ + \x12\x1f\n\x0btime_system\x18\x04\x20\x01(\x01R\ntimeSystem\x12I\n\x0fre\ + quest_results\x18\x05\x20\x03(\x0b2\x20.grpc.testing.RequestResultCountR\ + \x0erequestResults\x12\"\n\rcq_poll_count\x18\x06\x20\x01(\x04R\x0bcqPol\ + lCountb\x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(0); + let mut messages = ::std::vec::Vec::with_capacity(5); + messages.push(ServerStats::generated_message_descriptor_data()); + messages.push(HistogramParams::generated_message_descriptor_data()); + messages.push(HistogramData::generated_message_descriptor_data()); + messages.push(RequestResultCount::generated_message_descriptor_data()); + messages.push(ClientStats::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/proto/src/proto/protobuf_v3/testing/test.rs b/proto/src/proto/protobuf_v3/testing/test.rs new file mode 100644 index 000000000..18c7d39a5 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/test.rs @@ -0,0 +1,79 @@ +// This file is generated by rust-protobuf 3.2.0. Do not edit +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `grpc/testing/test.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobufv3::VERSION_3_2_0; + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x17grpc/testing/test.proto\x12\x0cgrpc.testing\x1a\x18grpc/testing/em\ + pty.proto\x1a\x1bgrpc/testing/messages.proto2\xcb\x05\n\x0bTestService\ + \x125\n\tEmptyCall\x12\x13.grpc.testing.Empty\x1a\x13.grpc.testing.Empty\ + \x12F\n\tUnaryCall\x12\x1b.grpc.testing.SimpleRequest\x1a\x1c.grpc.testi\ + ng.SimpleResponse\x12O\n\x12CacheableUnaryCall\x12\x1b.grpc.testing.Simp\ + leRequest\x1a\x1c.grpc.testing.SimpleResponse\x12l\n\x13StreamingOutputC\ + all\x12(.grpc.testing.StreamingOutputCallRequest\x1a).grpc.testing.Strea\ + mingOutputCallResponse0\x01\x12i\n\x12StreamingInputCall\x12'.grpc.testi\ + ng.StreamingInputCallRequest\x1a(.grpc.testing.StreamingInputCallRespons\ + e(\x01\x12i\n\x0eFullDuplexCall\x12(.grpc.testing.StreamingOutputCallReq\ + uest\x1a).grpc.testing.StreamingOutputCallResponse(\x010\x01\x12i\n\x0eH\ + alfDuplexCall\x12(.grpc.testing.StreamingOutputCallRequest\x1a).grpc.tes\ + ting.StreamingOutputCallResponse(\x010\x01\x12=\n\x11UnimplementedCall\ + \x12\x13.grpc.testing.Empty\x1a\x13.grpc.testing.Empty2U\n\x14Unimplemen\ + tedService\x12=\n\x11UnimplementedCall\x12\x13.grpc.testing.Empty\x1a\ + \x13.grpc.testing.Empty2\x89\x01\n\x10ReconnectService\x12;\n\x05Start\ + \x12\x1d.grpc.testing.ReconnectParams\x1a\x13.grpc.testing.Empty\x128\n\ + \x04Stop\x12\x13.grpc.testing.Empty\x1a\x1b.grpc.testing.ReconnectInfob\ + \x06proto3\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobufv3::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobufv3::rt::Lazy<::protobufv3::descriptor::FileDescriptorProto> = ::protobufv3::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobufv3::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobufv3::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobufv3::rt::Lazy<::protobufv3::reflect::GeneratedFileDescriptor> = ::protobufv3::rt::Lazy::new(); + static file_descriptor: ::protobufv3::rt::Lazy<::protobufv3::reflect::FileDescriptor> = ::protobufv3::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(2); + deps.push(super::empty::file_descriptor().clone()); + deps.push(super::messages::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(0); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobufv3::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobufv3::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} + +pub use super::test_grpc::*; diff --git a/proto/src/proto/protobuf_v3/testing/test_grpc.rs b/proto/src/proto/protobuf_v3/testing/test_grpc.rs new file mode 100644 index 000000000..40cba8c04 --- /dev/null +++ b/proto/src/proto/protobuf_v3/testing/test_grpc.rs @@ -0,0 +1,387 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_TEST_SERVICE_EMPTY_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.TestService/EmptyCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_UNARY_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.TestService/UnaryCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_CACHEABLE_UNARY_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.TestService/CacheableUnaryCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_STREAMING_OUTPUT_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ServerStreaming, + name: "/grpc.testing.TestService/StreamingOutputCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_STREAMING_INPUT_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::ClientStreaming, + name: "/grpc.testing.TestService/StreamingInputCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_FULL_DUPLEX_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/grpc.testing.TestService/FullDuplexCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_HALF_DUPLEX_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Duplex, + name: "/grpc.testing.TestService/HalfDuplexCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_TEST_SERVICE_UNIMPLEMENTED_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.TestService/UnimplementedCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct TestServiceClient { + pub client: ::grpcio::Client, +} + +impl TestServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + TestServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn empty_call_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TEST_SERVICE_EMPTY_CALL, req, opt) + } + + pub fn empty_call(&self, req: &super::empty::Empty) -> ::grpcio::Result { + self.empty_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn empty_call_async_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_TEST_SERVICE_EMPTY_CALL, req, opt) + } + + pub fn empty_call_async(&self, req: &super::empty::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.empty_call_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn unary_call_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TEST_SERVICE_UNARY_CALL, req, opt) + } + + pub fn unary_call(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result { + self.unary_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn unary_call_async_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_TEST_SERVICE_UNARY_CALL, req, opt) + } + + pub fn unary_call_async(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.unary_call_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn cacheable_unary_call_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TEST_SERVICE_CACHEABLE_UNARY_CALL, req, opt) + } + + pub fn cacheable_unary_call(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result { + self.cacheable_unary_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn cacheable_unary_call_async_opt(&self, req: &super::messages::SimpleRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_TEST_SERVICE_CACHEABLE_UNARY_CALL, req, opt) + } + + pub fn cacheable_unary_call_async(&self, req: &super::messages::SimpleRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.cacheable_unary_call_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn streaming_output_call_opt(&self, req: &super::messages::StreamingOutputCallRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.client.server_streaming(&METHOD_TEST_SERVICE_STREAMING_OUTPUT_CALL, req, opt) + } + + pub fn streaming_output_call(&self, req: &super::messages::StreamingOutputCallRequest) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver> { + self.streaming_output_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn streaming_input_call_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver)> { + self.client.client_streaming(&METHOD_TEST_SERVICE_STREAMING_INPUT_CALL, opt) + } + + pub fn streaming_input_call(&self) -> ::grpcio::Result<(::grpcio::ClientCStreamSender, ::grpcio::ClientCStreamReceiver)> { + self.streaming_input_call_opt(::grpcio::CallOption::default()) + } + + pub fn full_duplex_call_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_TEST_SERVICE_FULL_DUPLEX_CALL, opt) + } + + pub fn full_duplex_call(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.full_duplex_call_opt(::grpcio::CallOption::default()) + } + + pub fn half_duplex_call_opt(&self, opt: ::grpcio::CallOption) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.client.duplex_streaming(&METHOD_TEST_SERVICE_HALF_DUPLEX_CALL, opt) + } + + pub fn half_duplex_call(&self) -> ::grpcio::Result<(::grpcio::ClientDuplexSender, ::grpcio::ClientDuplexReceiver)> { + self.half_duplex_call_opt(::grpcio::CallOption::default()) + } + + pub fn unimplemented_call_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_TEST_SERVICE_UNIMPLEMENTED_CALL, req, opt) + } + + pub fn unimplemented_call(&self, req: &super::empty::Empty) -> ::grpcio::Result { + self.unimplemented_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn unimplemented_call_async_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_TEST_SERVICE_UNIMPLEMENTED_CALL, req, opt) + } + + pub fn unimplemented_call_async(&self, req: &super::empty::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.unimplemented_call_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait TestService { + fn empty_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::empty::Empty, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn unary_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::messages::SimpleRequest, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn cacheable_unary_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::messages::SimpleRequest, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn streaming_output_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::messages::StreamingOutputCallRequest, sink: ::grpcio::ServerStreamingSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn streaming_input_call(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::ClientStreamingSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn full_duplex_call(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn half_duplex_call(&mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream, sink: ::grpcio::DuplexSink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn unimplemented_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::empty::Empty, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_test_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TEST_SERVICE_EMPTY_CALL, move |ctx, req, resp| { + instance.empty_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TEST_SERVICE_UNARY_CALL, move |ctx, req, resp| { + instance.unary_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_TEST_SERVICE_CACHEABLE_UNARY_CALL, move |ctx, req, resp| { + instance.cacheable_unary_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_server_streaming_handler(&METHOD_TEST_SERVICE_STREAMING_OUTPUT_CALL, move |ctx, req, resp| { + instance.streaming_output_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_client_streaming_handler(&METHOD_TEST_SERVICE_STREAMING_INPUT_CALL, move |ctx, req, resp| { + instance.streaming_input_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_TEST_SERVICE_FULL_DUPLEX_CALL, move |ctx, req, resp| { + instance.full_duplex_call(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_duplex_streaming_handler(&METHOD_TEST_SERVICE_HALF_DUPLEX_CALL, move |ctx, req, resp| { + instance.half_duplex_call(ctx, req, resp) + }); + let mut instance = s; + builder = builder.add_unary_handler(&METHOD_TEST_SERVICE_UNIMPLEMENTED_CALL, move |ctx, req, resp| { + instance.unimplemented_call(ctx, req, resp) + }); + builder.build() +} + +const METHOD_UNIMPLEMENTED_SERVICE_UNIMPLEMENTED_CALL: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.UnimplementedService/UnimplementedCall", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct UnimplementedServiceClient { + pub client: ::grpcio::Client, +} + +impl UnimplementedServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + UnimplementedServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn unimplemented_call_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_UNIMPLEMENTED_SERVICE_UNIMPLEMENTED_CALL, req, opt) + } + + pub fn unimplemented_call(&self, req: &super::empty::Empty) -> ::grpcio::Result { + self.unimplemented_call_opt(req, ::grpcio::CallOption::default()) + } + + pub fn unimplemented_call_async_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_UNIMPLEMENTED_SERVICE_UNIMPLEMENTED_CALL, req, opt) + } + + pub fn unimplemented_call_async(&self, req: &super::empty::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.unimplemented_call_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait UnimplementedService { + fn unimplemented_call(&mut self, ctx: ::grpcio::RpcContext, _req: super::empty::Empty, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_unimplemented_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s; + builder = builder.add_unary_handler(&METHOD_UNIMPLEMENTED_SERVICE_UNIMPLEMENTED_CALL, move |ctx, req, resp| { + instance.unimplemented_call(ctx, req, resp) + }); + builder.build() +} + +const METHOD_RECONNECT_SERVICE_START: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.ReconnectService/Start", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_RECONNECT_SERVICE_STOP: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.testing.ReconnectService/Stop", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct ReconnectServiceClient { + pub client: ::grpcio::Client, +} + +impl ReconnectServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + ReconnectServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn start_opt(&self, req: &super::messages::ReconnectParams, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_RECONNECT_SERVICE_START, req, opt) + } + + pub fn start(&self, req: &super::messages::ReconnectParams) -> ::grpcio::Result { + self.start_opt(req, ::grpcio::CallOption::default()) + } + + pub fn start_async_opt(&self, req: &super::messages::ReconnectParams, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_RECONNECT_SERVICE_START, req, opt) + } + + pub fn start_async(&self, req: &super::messages::ReconnectParams) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.start_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn stop_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_RECONNECT_SERVICE_STOP, req, opt) + } + + pub fn stop(&self, req: &super::empty::Empty) -> ::grpcio::Result { + self.stop_opt(req, ::grpcio::CallOption::default()) + } + + pub fn stop_async_opt(&self, req: &super::empty::Empty, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_RECONNECT_SERVICE_STOP, req, opt) + } + + pub fn stop_async(&self, req: &super::empty::Empty) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.stop_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::std::future::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait ReconnectService { + fn start(&mut self, ctx: ::grpcio::RpcContext, _req: super::messages::ReconnectParams, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } + fn stop(&mut self, ctx: ::grpcio::RpcContext, _req: super::empty::Empty, sink: ::grpcio::UnarySink) { + grpcio::unimplemented_call!(ctx, sink) + } +} + +pub fn create_reconnect_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_RECONNECT_SERVICE_START, move |ctx, req, resp| { + instance.start(ctx, req, resp) + }); + let mut instance = s; + builder = builder.add_unary_handler(&METHOD_RECONNECT_SERVICE_STOP, move |ctx, req, resp| { + instance.stop(ctx, req, resp) + }); + builder.build() +} diff --git a/proto/src/util.rs b/proto/src/util.rs index dadf2a111..6a585fb8d 100644 --- a/proto/src/util.rs +++ b/proto/src/util.rs @@ -6,11 +6,17 @@ use grpcio::{ }; use std::convert::TryFrom; -#[cfg(all(feature = "protobuf-codec", not(feature = "prost-codec")))] -use crate::testing::messages::{Payload, ResponseParameters}; +#[cfg(all( + any(feature = "protobuf-codec", feature = "protobufv3-codec"), + not(feature = "prost-codec") +))] +use crate::proto::protobuf::testing::messages::{Payload, ResponseParameters}; #[cfg(feature = "prost-codec")] use crate::testing::{Payload, ResponseParameters}; +#[cfg(feature = "protobufv3-codec")] +use protobufv3 as protobuf; + /// Create a payload with the specified size. pub fn new_payload(size: usize) -> Payload { Payload { @@ -46,7 +52,7 @@ impl TryFrom for Status { fn try_from(value: grpcio::RpcStatus) -> grpcio::Result { let mut s = Status::default(); - #[cfg(feature = "protobuf-codec")] + #[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] protobuf::Message::merge_from_bytes(&mut s, value.details())?; #[cfg(feature = "prost-codec")] prost::Message::merge(&mut s, value.details())?; @@ -75,7 +81,7 @@ impl TryFrom for grpcio::RpcStatus { type Error = grpcio::Error; fn try_from(value: Status) -> grpcio::Result { - #[cfg(feature = "protobuf-codec")] + #[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] let details = protobuf::Message::write_to_bytes(&value)?; #[cfg(feature = "prost-codec")] let details = { diff --git a/src/codec.rs b/src/codec.rs index e4449e637..c51a284dd 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -29,11 +29,15 @@ pub struct Marshaller { pub de: DeserializeFn, } -#[cfg(feature = "protobuf-codec")] +#[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] pub mod pb_codec { - use protobuf::{CodedInputStream, CodedOutputStream, Message}; + #[cfg(feature = "protobuf-codec")] + use protobuf::{CodedOutputStream, Message}; - use super::{MessageReader, MAX_MESSAGE_SIZE}; + #[cfg(feature = "protobufv3-codec")] + use protobufv3::{CodedOutputStream, Message}; + + use super::{from_buf_read, MessageReader, MAX_MESSAGE_SIZE}; use crate::buf::GrpcSlice; use crate::error::{Error, Result}; @@ -57,13 +61,23 @@ pub mod pb_codec { #[inline] pub fn de(mut reader: MessageReader) -> Result { - let mut s = CodedInputStream::from_buffered_reader(&mut reader); + let mut s = from_buf_read(&mut reader); let mut m = T::new(); m.merge_from(&mut s)?; Ok(m) } } +#[cfg(feature = "protobuf-codec")] +fn from_buf_read(reader: &mut MessageReader) -> protobuf::CodedInputStream { + protobuf::CodedInputStream::from_buffered_reader(reader) +} + +#[cfg(feature = "protobufv3-codec")] +fn from_buf_read(reader: &mut MessageReader) -> protobufv3::CodedInputStream { + protobufv3::CodedInputStream::from_buf_read(reader) +} + #[cfg(feature = "prost-codec")] pub mod pr_codec { use prost::Message; diff --git a/src/error.rs b/src/error.rs index 260425cad..3b0dc74d0 100644 --- a/src/error.rs +++ b/src/error.rs @@ -9,6 +9,9 @@ use crate::grpc_sys::grpc_call_error; #[cfg(feature = "protobuf-codec")] use protobuf::ProtobufError; +#[cfg(feature = "protobufv3-codec")] +use protobufv3::Error as ProtobufError; + /// Errors generated from this library. #[derive(Debug)] pub enum Error { @@ -58,7 +61,7 @@ impl error::Error for Error { } } -#[cfg(feature = "protobuf-codec")] +#[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] impl From for Error { fn from(e: ProtobufError) -> Error { Error::Codec(Box::new(e)) diff --git a/src/lib.rs b/src/lib.rs index 652467025..c8cebcac5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,7 +62,7 @@ pub use crate::channel::{ }; pub use crate::client::Client; -#[cfg(feature = "protobuf-codec")] +#[cfg(any(feature = "protobuf-codec", feature = "protobufv3-codec"))] pub use crate::codec::pb_codec::{de as pb_de, ser as pb_ser}; #[cfg(feature = "prost-codec")] pub use crate::codec::pr_codec::{de as pr_de, ser as pr_ser}; diff --git a/tests-and-examples/Cargo.toml b/tests-and-examples/Cargo.toml index 51b0dd970..ed53a5528 100644 --- a/tests-and-examples/Cargo.toml +++ b/tests-and-examples/Cargo.toml @@ -8,6 +8,7 @@ publish = false [features] default = ["protobuf-codec"] protobuf-codec = ["protobuf", "grpcio/protobuf-codec", "grpcio-proto/protobuf-codec", "grpcio-health/protobuf-codec"] +protobufv3-codec = ["protobufv3", "grpcio/protobufv3-codec", "grpcio-proto/protobufv3-codec", "grpcio-health/protobufv3-codec"] prost-codec = ["prost", "bytes", "grpcio/prost-codec", "grpcio-proto/prost-codec", "grpcio-health/prost-codec"] [dependencies] @@ -17,7 +18,8 @@ futures-channel = { version = "0.3", features = ["sink"] } futures-executor = "0.3" futures-util = { version = "0.3", features = ["sink"] } futures-timer = "3.0" -protobuf = { version = "2.22", optional = true } +protobuf = { version = "2", optional = true } +protobufv3 = { package = "protobuf", version = "3.2", optional = true } prost = { version = "0.11", optional = true } bytes = { version = "1.0", optional = true } log = "0.4" @@ -39,23 +41,29 @@ slog-term = "2.2" [[example]] name = "route_guide_client" path = "examples/route_guide/client.rs" +#required-features = "protobuf-codec" or "protobufv3-codec" [[example]] name = "route_guide_server" path = "examples/route_guide/server.rs" +#required-features = "protobuf-codec" or "protobufv3-codec" [[example]] name = "greeter_client" path = "examples/hello_world/client.rs" +#required-features = "protobuf-codec" or "protobufv3-codec" [[example]] name = "greeter_server" path = "examples/hello_world/server.rs" +#required-features = "protobuf-codec" or "protobufv3-codec" [[example]] name = "lb_greeter_client" path = "examples/load_balancing/client.rs" +#required-features = "protobuf-codec" or "protobufv3-codec" [[example]] name = "lb_greeter_server" path = "examples/load_balancing/server.rs" +#required-features = "protobuf-codec" or "protobufv3-codec" diff --git a/tests-and-examples/examples/hello_world/client.rs b/tests-and-examples/examples/hello_world/client.rs index b1ba3b846..e17a42a1b 100644 --- a/tests-and-examples/examples/hello_world/client.rs +++ b/tests-and-examples/examples/hello_world/client.rs @@ -19,7 +19,7 @@ fn main() { let client = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let reply = client.say_hello(&req).expect("rpc"); - info!("Greeter received: {}", reply.get_message()); + info!("Greeter received: {}", reply.message); } diff --git a/tests-and-examples/examples/hello_world/server.rs b/tests-and-examples/examples/hello_world/server.rs index 1bf2d976e..225b5803b 100644 --- a/tests-and-examples/examples/hello_world/server.rs +++ b/tests-and-examples/examples/hello_world/server.rs @@ -26,9 +26,9 @@ struct GreeterService; impl Greeter for GreeterService { fn say_hello(&mut self, ctx: RpcContext<'_>, req: HelloRequest, sink: UnarySink) { - let msg = format!("Hello {}", req.get_name()); + let msg = format!("Hello {}", req.name); let mut resp = HelloReply::default(); - resp.set_message(msg); + resp.message = msg; let f = sink .success(resp) .map_err(move |e| error!("failed to reply {:?}: {:?}", req, e)) diff --git a/tests-and-examples/examples/load_balancing/client.rs b/tests-and-examples/examples/load_balancing/client.rs index e231d8787..253462b42 100644 --- a/tests-and-examples/examples/load_balancing/client.rs +++ b/tests-and-examples/examples/load_balancing/client.rs @@ -28,8 +28,8 @@ fn main() { for _ in 0..2 { let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let reply = client.say_hello(&req).expect("rpc"); - info!("Greeter received: {}", reply.get_message()); + info!("Greeter received: {}", reply.message); } } diff --git a/tests-and-examples/examples/load_balancing/server.rs b/tests-and-examples/examples/load_balancing/server.rs index f6b777165..5042f3bd5 100644 --- a/tests-and-examples/examples/load_balancing/server.rs +++ b/tests-and-examples/examples/load_balancing/server.rs @@ -28,9 +28,9 @@ struct GreeterService { impl Greeter for GreeterService { fn say_hello(&mut self, ctx: RpcContext<'_>, req: HelloRequest, sink: UnarySink) { - let msg = format!("Hello {}, I'm {}", req.get_name(), self.name); + let msg = format!("Hello {}, I'm {}", req.name, self.name); let mut resp = HelloReply::default(); - resp.set_message(msg); + resp.message = msg; let f = sink .success(resp) .map_err(move |e| error!("failed to reply {:?}: {:?}", req, e)) diff --git a/tests-and-examples/examples/route_guide/client.rs b/tests-and-examples/examples/route_guide/client.rs index 0ab20ac82..0c616f3e0 100644 --- a/tests-and-examples/examples/route_guide/client.rs +++ b/tests-and-examples/examples/route_guide/client.rs @@ -22,39 +22,39 @@ use rand::{seq::SliceRandom, Rng}; fn new_point(lat: i32, lon: i32) -> Point { let mut point = Point::default(); - point.set_latitude(lat); - point.set_longitude(lon); + point.latitude = lat; + point.longitude = lon; point } fn new_rect(lat1: i32, lon1: i32, lat2: i32, lon2: i32) -> Rectangle { let mut rect = Rectangle::default(); - rect.set_lo(new_point(lat1, lon1)); - rect.set_hi(new_point(lat2, lon2)); + rect.lo = Some(new_point(lat1, lon1)).into(); + rect.hi = Some(new_point(lat2, lon2)).into(); rect } fn new_note(lat: i32, lon: i32, msg: &str) -> RouteNote { let mut note = RouteNote::default(); - note.set_location(new_point(lat, lon)); - note.set_message(msg.to_owned()); + note.location = Some(new_point(lat, lon)).into(); + note.message = msg.to_owned(); note } async fn get_feature(client: &RouteGuideClient, point: &Point) -> Result<()> { let get_feature = client.get_feature_async(point)?; let f = get_feature.await?; - if !f.has_location() { + if f.location.is_none() { warn!("Server returns incomplete feature."); return Ok(()); } - if f.get_name().is_empty() { + if f.name.is_empty() { warn!("Found no feature at {}", util::format_point(point)); return Ok(()); } info!( "Found feature called {} at {}", - f.get_name(), + f.name, util::format_point(point) ); Ok(()) @@ -65,11 +65,17 @@ async fn list_features(client: &RouteGuideClient) -> Result<()> { info!("Looking for features between 40, -75 and 42, -73"); let mut list_features = client.list_features(&rect)?; while let Some(feature) = list_features.try_next().await? { - let loc = feature.get_location(); + #[cfg(feature = "protobuf-codec")] info!( "Found feature {} at {}", - feature.get_name(), - util::format_point(loc) + feature.name, + util::format_point(feature.get_location()) + ); + #[cfg(feature = "protobufv3-codec")] + info!( + "Found feature {} at {}", + feature.name, + util::format_point(&feature.location.0.unwrap()) ); } info!("List feature rpc succeeded."); @@ -82,18 +88,21 @@ async fn record_route(client: &RouteGuideClient) -> Result<()> { let (mut sink, receiver) = client.record_route()?; for _ in 0..10usize { let f = features.choose(&mut rng).unwrap(); - let point = f.get_location(); - info!("Visiting {}", util::format_point(point)); - sink.send((point.to_owned(), WriteFlags::default())).await?; + #[cfg(feature = "protobuf-codec")] + let point = f.get_location().to_owned(); + #[cfg(feature = "protobufv3-codec")] + let point = f.location.0.clone().unwrap().as_ref().clone(); + info!("Visiting {}", util::format_point(&point)); + sink.send((point, WriteFlags::default())).await?; thread::sleep(Duration::from_millis(rng.gen_range(500, 1500))); } // flush sink.close().await?; let summary = receiver.await?; - info!("Finished trip with {} points", summary.get_point_count()); - info!("Passed {} features", summary.get_feature_count()); - info!("Travelled {} meters", summary.get_distance()); - info!("It took {} seconds", summary.get_elapsed_time()); + info!("Finished trip with {} points", summary.point_count); + info!("Passed {} features", summary.feature_count); + info!("Travelled {} meters", summary.distance); + info!("It took {} seconds", summary.elapsed_time); Ok(()) } @@ -119,12 +128,17 @@ async fn route_chat(client: &RouteGuideClient) -> Result<()> { let receive = async move { while let Some(note) = receiver.try_next().await? { - let location = note.get_location(); + #[cfg(feature = "protobuf-codec")] info!( "Got message {} at {}, {}", note.get_message(), - location.get_latitude(), - location.get_longitude() + note.get_location().get_latitude(), + note.get_location().get_longitude() + ); + #[cfg(feature = "protobufv3-codec")] + info!( + "Got message {} at {}, {}", + note.message, note.location.latitude, note.location.longitude ); } Ok(()) as Result<_> diff --git a/tests-and-examples/examples/route_guide/server.rs b/tests-and-examples/examples/route_guide/server.rs index e14417327..2f1ad4ed1 100644 --- a/tests-and-examples/examples/route_guide/server.rs +++ b/tests-and-examples/examples/route_guide/server.rs @@ -28,12 +28,21 @@ struct RouteGuideService { received_notes: Arc>>, } +#[cfg(feature = "protobuf-codec")] +fn get_point<'a>(f: &'a Feature) -> &'a grpcio_proto::example::route_guide::Point { + f.get_location() +} +#[cfg(feature = "protobufv3-codec")] +fn get_point<'a>(f: &'a Feature) -> &'a grpcio_proto::example::route_guide::Point { + f.location.0.as_ref().unwrap() +} + impl RouteGuide for RouteGuideService { fn get_feature(&mut self, ctx: RpcContext<'_>, point: Point, sink: UnarySink) { let data = self.data.clone(); let resp = data .iter() - .find(|f| same_point(f.get_location(), &point)) + .find(|f| same_point(get_point(f), &point)) .map_or_else(Feature::default, ToOwned::to_owned); let f = sink .success(resp) @@ -52,7 +61,7 @@ impl RouteGuide for RouteGuideService { let features: Vec<_> = data .iter() .filter_map(move |f| { - if fit_in(f.get_location(), &rect) { + if fit_in(get_point(f), &rect) { Some((f.to_owned(), WriteFlags::default())) } else { None @@ -87,7 +96,7 @@ impl RouteGuide for RouteGuideService { summary.point_count += 1; let valid_point = data .iter() - .any(|f| !f.get_name().is_empty() && same_point(f.get_location(), &point)); + .any(|f| !f.name.is_empty() && same_point(get_point(f), &point)); if valid_point { summary.feature_count += 1; } @@ -118,9 +127,17 @@ impl RouteGuide for RouteGuideService { while let Some(n) = notes.try_next().await? { let buffer = received_notes.lock().unwrap().clone(); for note in buffer.iter() { + #[cfg(feature = "protobuf-codec")] if same_point(n.get_location(), note.get_location()) { resp.send((note.clone(), WriteFlags::default())).await?; } + #[cfg(feature = "protobufv3-codec")] + if same_point( + n.location.0.as_ref().unwrap(), + note.location.0.as_ref().unwrap(), + ) { + resp.send((note.clone(), WriteFlags::default())).await?; + } } received_notes.lock().unwrap().push(n); } diff --git a/tests-and-examples/examples/route_guide/util.rs b/tests-and-examples/examples/route_guide/util.rs index 7ce3d83bb..60ea96c41 100644 --- a/tests-and-examples/examples/route_guide/util.rs +++ b/tests-and-examples/examples/route_guide/util.rs @@ -24,9 +24,11 @@ struct FeatureRef { impl From for Feature { fn from(r: FeatureRef) -> Feature { let mut f = Feature::default(); - f.set_name(r.name); - f.mut_location().set_latitude(r.location.latitude); - f.mut_location().set_longitude(r.location.longitude); + f.name = r.name; + let mut point = Point::new(); + point.longitude = r.location.longitude; + point.latitude = r.location.latitude; + f.location = Some(point).into(); f } } @@ -38,9 +40,10 @@ pub fn load_db() -> Vec { } pub fn same_point(lhs: &Point, rhs: &Point) -> bool { - lhs.get_longitude() == rhs.get_longitude() && lhs.get_latitude() == rhs.get_latitude() + lhs.longitude == rhs.longitude && lhs.latitude == rhs.latitude } +#[cfg(feature = "protobuf-codec")] pub fn fit_in(lhs: &Point, rhs: &Rectangle) -> bool { let hi = rhs.get_hi(); let lo = rhs.get_lo(); @@ -50,6 +53,14 @@ pub fn fit_in(lhs: &Point, rhs: &Rectangle) -> bool { && lhs.get_latitude() >= lo.get_latitude() } +#[cfg(feature = "protobufv3-codec")] +pub fn fit_in(lhs: &Point, rhs: &Rectangle) -> bool { + lhs.longitude <= rhs.hi.longitude + && lhs.longitude >= rhs.lo.longitude + && lhs.latitude <= rhs.hi.latitude + && lhs.latitude >= rhs.lo.latitude +} + const COORD_FACTOR: f64 = 10000000.0; pub fn convert_to_rad(num: f64) -> f64 { @@ -59,16 +70,16 @@ pub fn convert_to_rad(num: f64) -> f64 { pub fn format_point(p: &Point) -> String { format!( "{}, {}", - p.get_latitude() as f64 / COORD_FACTOR, - p.get_longitude() as f64 / COORD_FACTOR + p.latitude as f64 / COORD_FACTOR, + p.longitude as f64 / COORD_FACTOR ) } pub fn cal_distance(lhs: &Point, rhs: &Point) -> f64 { - let lat1 = lhs.get_latitude() as f64 / COORD_FACTOR; - let lon1 = lhs.get_longitude() as f64 / COORD_FACTOR; - let lat2 = rhs.get_latitude() as f64 / COORD_FACTOR; - let lon2 = rhs.get_longitude() as f64 / COORD_FACTOR; + let lat1 = lhs.latitude as f64 / COORD_FACTOR; + let lon1 = lhs.longitude as f64 / COORD_FACTOR; + let lat2 = rhs.latitude as f64 / COORD_FACTOR; + let lon2 = rhs.longitude as f64 / COORD_FACTOR; let lat_rad_1 = convert_to_rad(lat1); let lat_rad_2 = convert_to_rad(lat2); let delta_lat_rad = convert_to_rad(lat2 - lat1); diff --git a/tests-and-examples/tests/cases/auth_context.rs b/tests-and-examples/tests/cases/auth_context.rs index 63846e51a..93d7bbd11 100644 --- a/tests-and-examples/tests/cases/auth_context.rs +++ b/tests-and-examples/tests/cases/auth_context.rs @@ -17,12 +17,7 @@ struct GreeterService { } impl Greeter for GreeterService { - fn say_hello( - &mut self, - ctx: RpcContext<'_>, - mut req: HelloRequest, - sink: UnarySink, - ) { + fn say_hello(&mut self, ctx: RpcContext<'_>, req: HelloRequest, sink: UnarySink) { if let Some(auth_context) = ctx.auth_context() { let mut ctx_map = HashMap::new(); for (key, value) in auth_context @@ -35,7 +30,7 @@ impl Greeter for GreeterService { } let mut resp = HelloReply::default(); - resp.set_message(format!("hello {}", req.take_name())); + resp.message = format!("hello {}", req.name); ctx.spawn( sink.success(resp) .map_err(|e| panic!("failed to reply {:?}", e)) @@ -78,10 +73,10 @@ fn test_auth_context() { let client = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let resp = client.say_hello(&req).unwrap(); - assert_eq!(resp.get_message(), "hello world"); + assert_eq!(resp.message, "hello world"); // Test auth_context keys let ctx_map = rx.recv_timeout(Duration::from_secs(1)).unwrap().unwrap(); @@ -118,10 +113,10 @@ fn test_no_crash_on_insecure() { let client = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let resp = client.say_hello(&req).unwrap(); - assert_eq!(resp.get_message(), "hello world"); + assert_eq!(resp.message, "hello world"); // Test auth_context keys let ctx_map = rx.recv_timeout(Duration::from_secs(1)).unwrap().unwrap(); diff --git a/tests-and-examples/tests/cases/credential.rs b/tests-and-examples/tests/cases/credential.rs index 349718420..05c3e6998 100644 --- a/tests-and-examples/tests/cases/credential.rs +++ b/tests-and-examples/tests/cases/credential.rs @@ -8,6 +8,7 @@ use grpcio::{ UnarySink, }; use grpcio_proto::example::helloworld::*; + use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use tests_and_examples::util::{read_cert_pair, read_single_crt}; @@ -17,9 +18,9 @@ struct GreeterService; impl Greeter for GreeterService { fn say_hello(&mut self, ctx: RpcContext<'_>, req: HelloRequest, sink: UnarySink) { - let msg = format!("Hello {}", req.get_name()); + let msg = format!("Hello {}", req.name); let mut resp = HelloReply::default(); - resp.set_message(msg); + resp.message = msg; let f = sink .success(resp) .map_err(move |e| panic!("failed to reply {:?}", e)) @@ -105,9 +106,9 @@ fn test_reload_new() { .connect(&format!("127.0.0.1:{port}")); let client1 = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let reply = client1.say_hello(&req).expect("rpc"); - assert_eq!(reply.get_message(), "Hello world"); + assert_eq!(reply.message, "Hello world"); // To connect the server whose CN is "*.test.google.fr". switch.store(true, Ordering::Relaxed); @@ -120,15 +121,15 @@ fn test_reload_new() { .connect(&format!("127.0.0.1:{}", port.clone())); let client2 = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let reply = client2.say_hello(&req).expect("rpc"); - assert_eq!(reply.get_message(), "Hello world"); + assert_eq!(reply.message, "Hello world"); // Existing connection is still going to work. let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let reply = client1.say_hello(&req).expect("rpc"); - assert_eq!(reply.get_message(), "Hello world"); + assert_eq!(reply.message, "Hello world"); } #[test] @@ -161,8 +162,8 @@ fn test_reload_fail() { for _ in 0..10 { let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let reply = client.say_hello(&req).expect("rpc"); - assert_eq!(reply.get_message(), "Hello world"); + assert_eq!(reply.message, "Hello world"); } } diff --git a/tests-and-examples/tests/cases/kick.rs b/tests-and-examples/tests/cases/kick.rs index 0e9ba452b..6c13f6ebb 100644 --- a/tests-and-examples/tests/cases/kick.rs +++ b/tests-and-examples/tests/cases/kick.rs @@ -18,20 +18,15 @@ struct GreeterService { } impl Greeter for GreeterService { - fn say_hello( - &mut self, - ctx: RpcContext<'_>, - mut req: HelloRequest, - sink: UnarySink, - ) { + fn say_hello(&mut self, ctx: RpcContext<'_>, req: HelloRequest, sink: UnarySink) { let (tx, rx) = oneshot::channel(); let tx_lock = self.tx.clone(); - let name = req.take_name(); + let name = req.name; let f = async move { *tx_lock.lock().unwrap() = Some(tx); let greet = rx.await?; let mut resp = HelloReply::default(); - resp.set_message(format!("{greet} {name}")); + resp.message = format!("{greet} {name}"); sink.success(resp).await?; Ok(()) } @@ -57,7 +52,7 @@ fn test_kick() { let ch = ChannelBuilder::new(env).connect(&format!("127.0.0.1:{port}")); let client = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let f = client.say_hello_async(&req).unwrap(); loop { thread::sleep(Duration::from_millis(10)); @@ -69,7 +64,7 @@ fn test_kick() { break; } let reply = block_on(f).expect("rpc"); - assert_eq!(reply.get_message(), "hello world"); + assert_eq!(reply.message, "hello world"); // Spawn a future in the client. let (tx1, rx2) = spawn_chianed_channel(&client); @@ -106,12 +101,7 @@ pub struct DeadLockService { } impl Greeter for DeadLockService { - fn say_hello( - &mut self, - ctx: RpcContext<'_>, - mut req: HelloRequest, - sink: UnarySink, - ) { + fn say_hello(&mut self, ctx: RpcContext<'_>, req: HelloRequest, sink: UnarySink) { let chan = Arc::new(Mutex::new(NaiveChannel { data: None, waker: None, @@ -120,11 +110,11 @@ impl Greeter for DeadLockService { let rx = NaiveReceiver { chan: tx.chan.clone(), }; - let name = req.take_name(); + let name = req.name; let reporter = self.reporter.clone(); ctx.spawn(rx.then(|greet| async move { let mut resp = HelloReply::default(); - resp.set_message(format!("{greet} {name}")); + resp.message = format!("{greet} {name}"); if let Err(e) = sink.success(resp).await { panic!("failed to reply {:?}", e); } @@ -210,7 +200,7 @@ fn test_deadlock() { let ch = ChannelBuilder::new(env).connect(&format!("127.0.0.1:{port}")); let client = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let f = client.say_hello_async(&req).unwrap(); if let Err(e) = rx.recv_timeout(Duration::from_secs(5)) { // Panic will still calling drop method of server, which will wait for @@ -219,5 +209,5 @@ fn test_deadlock() { std::process::exit(1); } let reply = block_on(f).expect("rpc"); - assert_eq!(reply.get_message(), "hello world"); + assert_eq!(reply.message, "hello world"); } diff --git a/tests-and-examples/tests/cases/metadata.rs b/tests-and-examples/tests/cases/metadata.rs index 24ebde6e7..caaf7802c 100644 --- a/tests-and-examples/tests/cases/metadata.rs +++ b/tests-and-examples/tests/cases/metadata.rs @@ -5,6 +5,7 @@ use futures_util::future::{FutureExt as _, TryFutureExt as _}; use futures_util::{SinkExt, TryStreamExt}; use grpcio::*; use grpcio_proto::example::helloworld::*; + use grpcio_proto::example::route_guide::{Feature, Rectangle}; use grpcio_proto::example::route_guide_grpc::{create_route_guide, RouteGuide, RouteGuideClient}; use grpcio_proto::google::rpc::Status; @@ -18,7 +19,7 @@ impl Greeter for GreeterService { fn say_hello( &mut self, ctx: RpcContext<'_>, - mut req: HelloRequest, + req: HelloRequest, mut sink: UnarySink, ) { let headers = ctx.request_headers().clone(); @@ -30,7 +31,11 @@ impl Greeter for GreeterService { message: "name can't be root".to_owned(), ..Default::default() }; + #[cfg(feature = "protobuf-codec")] let any = protobuf::well_known_types::Any::pack(&req).unwrap(); + + #[cfg(feature = "protobufv3-codec")] + let any = protobufv3::well_known_types::any::Any::pack(&req).unwrap(); status.details.push(any); ctx.spawn( sink.fail(status.try_into().unwrap()) @@ -41,7 +46,7 @@ impl Greeter for GreeterService { } let mut resp = HelloReply::default(); - resp.set_message(format!("hello {}", req.take_name())); + resp.message = format!("hello {}", req.name); ctx.spawn( sink.success(resp) .map_err(|e| panic!("failed to reply {:?}", e)) @@ -96,7 +101,7 @@ fn test_metadata() { let call_opt = CallOption::default().headers(metadata); let mut req = HelloRequest::default(); - req.set_name("world".to_owned()); + req.name = "world".to_owned(); let mut resp = client .list_features_opt(&Default::default(), call_opt) .unwrap(); @@ -133,7 +138,7 @@ fn test_rich_error() { let client = GreeterClient::new(ch); let mut req = HelloRequest::default(); - req.set_name("root".to_owned()); + req.name = "root".to_owned(); let s: Status = match client.say_hello(&req) { Err(grpcio::Error::RpcFailure(s)) => s.try_into().unwrap(), res => panic!("expected failure, got {:?}", res), diff --git a/tests-and-examples/tests/cases/misc.rs b/tests-and-examples/tests/cases/misc.rs index ff37e0c6e..fa71113b3 100644 --- a/tests-and-examples/tests/cases/misc.rs +++ b/tests-and-examples/tests/cases/misc.rs @@ -5,6 +5,7 @@ use futures_timer::Delay; use futures_util::future::{self, FutureExt as _, TryFutureExt as _}; use grpcio::*; use grpcio_proto::example::helloworld::*; + use std::sync::atomic::*; use std::sync::*; use std::thread::{self, JoinHandle}; @@ -17,7 +18,7 @@ impl Greeter for PeerService { fn say_hello(&mut self, ctx: RpcContext<'_>, _: HelloRequest, sink: UnarySink) { let peer = ctx.peer(); let mut resp = HelloReply::default(); - resp.set_message(peer); + resp.message = peer; ctx.spawn( sink.success(resp) .map_err(|e| panic!("failed to reply {:?}", e)) @@ -72,7 +73,7 @@ fn test_peer() { let req = HelloRequest::default(); let resp = client.say_hello(&req).unwrap(); - assert!(resp.get_message().contains("127.0.0.1"), "{:?}", resp); + assert!(resp.message.contains("127.0.0.1"), "{:?}", resp); assert_eq!(counter_collect.load(Ordering::Relaxed), 2); } @@ -187,7 +188,7 @@ mod unix_domain_socket { let req = HelloRequest::default(); let resp = client.say_hello(&req).unwrap(); - assert_eq!(resp.get_message(), "unix:", "{resp:?}"); + assert_eq!(resp.message, "unix:", "{resp:?}"); } #[test] @@ -371,7 +372,7 @@ fn test_connectivity() { let client = GreeterClient::new(ch.clone()); let req = HelloRequest::default(); let resp = client.say_hello(&req).unwrap(); - assert!(!resp.get_message().is_empty()); + assert!(!resp.message.is_empty()); client.spawn(async move { ch.wait_for_connected(Duration::from_secs(3)).await; }); diff --git a/tests-and-examples/tests/cases/stream.rs b/tests-and-examples/tests/cases/stream.rs index a522d9232..ec045856c 100644 --- a/tests-and-examples/tests/cases/stream.rs +++ b/tests-and-examples/tests/cases/stream.rs @@ -37,11 +37,7 @@ impl RouteGuide for RouteGuideService { let mut summary = RouteSummary::default(); let mut current_num = 0; while let Some(point) = points.try_next().await? { - assert_eq!( - point.get_longitude(), - current_num, - "messages sequence is wrong" - ); + assert_eq!(point.longitude, current_num, "messages sequence is wrong"); current_num += 1; summary.point_count += 1; // Send a reply message after receiving a limited number of messages, which @@ -99,7 +95,7 @@ fn test_client_send_all() { let mut send_data = vec![]; for i in 0..MESSAGE_NUM { let mut p = Point::default(); - p.set_longitude(i); + p.longitude = i; send_data.push(p); } let send_stream = stream::iter(send_data); @@ -108,14 +104,14 @@ fn test_client_send_all() { .await ); let summary = receiver.await.unwrap(); - assert_eq!(summary.get_point_count(), MESSAGE_NUM); + assert_eq!(summary.point_count, MESSAGE_NUM); // Test for send all enable batch let (mut sink, receiver) = client.record_route().unwrap(); let mut send_data = vec![]; for i in 0..MESSAGE_NUM { let mut p = Point::default(); - p.set_longitude(i); + p.longitude = i; send_data.push(p); } let send_stream = stream::iter(send_data); @@ -125,14 +121,14 @@ fn test_client_send_all() { .await ); let summary = receiver.await.unwrap(); - assert_eq!(summary.get_point_count(), MESSAGE_NUM); + assert_eq!(summary.point_count, MESSAGE_NUM); // Test for send all and all buffer hints are true let (mut sink, receiver) = client.record_route().unwrap(); let mut send_data = vec![]; for i in 0..MESSAGE_NUM { let mut p = Point::default(); - p.set_longitude(i); + p.longitude = i; send_data.push(p); } let send_stream = stream::iter(send_data); @@ -155,7 +151,7 @@ fn test_client_send_all() { let recv_msg_task = async move { let summary = receiver.await.unwrap(); tx.send(()).await.unwrap(); - assert_eq!(summary.get_point_count(), MESSAGE_NUM); + assert_eq!(summary.point_count, MESSAGE_NUM); }; join!(recv_msg_task, close_sink_task); }; diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index d9cc91cd4..571c77095 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -11,3 +11,4 @@ prost-build = "0.11" # Use an old enough version to make sure generated code with TiKV's fork. # TODO: use latest one when TiKV's fork is updated protoc-rust = "=2.8" +protobuf-codegen = "3.2.0" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index e1aab16c0..31bc61fdf 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,3 +1,4 @@ +use protobuf_codegen; use std::process::{self, Command}; use std::{ env, @@ -116,18 +117,31 @@ const PROTOS: &[(&str, &[&str], &str, &str)] = &[ ("proto/proto", &["google/rpc"], "proto/src/proto", "google/rpc"), ]; -const NAMING_PATCH: &[(&str, &[(&str, &str)])] = &[( - "health/src/proto/protobuf/health.rs", - &[ - ("HealthCheckResponse_ServingStatus", "ServingStatus"), - // Order is important. - ("NOT_SERVING", "NotServing"), - ("SERVICE_UNKNOWN", "ServiceUnknown"), - ("UNKNOWN", "Unknown"), - ("SERVING", "Serving"), - ("rustfmt_skip", "rustfmt::skip"), - ], -)]; +const NAMING_PATCH: &[(&str, &[(&str, &str)])] = &[ + ( + "health/src/proto/protobuf/health.rs", + &[ + ("HealthCheckResponse_ServingStatus", "ServingStatus"), + // Order is important. + ("NOT_SERVING", "NotServing"), + ("SERVICE_UNKNOWN", "ServiceUnknown"), + ("UNKNOWN", "Unknown"), + ("SERVING", "Serving"), + ("rustfmt_skip", "rustfmt::skip"), + ], + ), + ( + "health/src/proto/protobuf_v3/health.rs", + &[ + // Order is important. + ("NOT_SERVING", "NotServing"), + ("SERVICE_UNKNOWN", "ServiceUnknown"), + ("UNKNOWN", "Unknown"), + ("SERVING", "Serving"), + ("rustfmt_skip", "rustfmt::skip"), + ], + ), +]; fn modify(path: impl AsRef, f: impl FnOnce(&mut String)) { let path = path.as_ref(); @@ -140,21 +154,16 @@ fn modify(path: impl AsRef, f: impl FnOnce(&mut String)) { File::create(path).unwrap().write_all(content.as_bytes()).unwrap(); } -fn generate_protobuf(protoc: &Path, include: &str, inputs: &[&str], out_dir: &str) { +/// If out_dir already exists, deletes and recreates it. +fn delete_and_mkdir(out_dir: &str) { if Path::new(out_dir).exists() { fs::remove_dir_all(out_dir).unwrap(); } fs::create_dir_all(out_dir).unwrap(); +} - // TODO: update rust-protobuf to allow specifying protoc explicitly. - protoc_rust::run(protoc_rust::Args { - out_dir, - includes: &[include], - input: inputs, - customize: protoc_rust::Customize::default(), - }) - .unwrap(); - +/// Builds grpcio-compiler and uses it to generate _grpc.rs files. Used in both protobufv2 and v3. +fn run_gen_grpc(protoc: &Path, include: &str, inputs: &[&str], out_dir: &str) { exec(cargo().args(&["build", "-p", "grpcio-compiler"])); let mut c = cmd(protoc); c.arg(format!("-I{}", include)) @@ -164,7 +173,10 @@ fn generate_protobuf(protoc: &Path, include: &str, inputs: &[&str], out_dir: &st c.arg(i); } exec(&mut c); +} +// Does string replacements on predefined files. Used with protobuf v2 and v3. +fn apply_naming_patch() { for (path, name_fixes) in NAMING_PATCH { modify(path, |content| { for (old, new) in *name_fixes { @@ -172,30 +184,95 @@ fn generate_protobuf(protoc: &Path, include: &str, inputs: &[&str], out_dir: &st } }); } +} +/// Loops over all _grpc.rs files in out_dir, and if a corresponding .rs file exists, links it by adding a "use" statement. +fn link_pb_with_grpc_rs(out_dir: &str) { for f in fs::read_dir(out_dir).unwrap() { - let p = f.unwrap(); - if p.path().extension().unwrap() == "rs" { - let file_name = p.path().file_name().unwrap().to_str().unwrap().to_string(); - if file_name.ends_with("_grpc.rs") { - let pb_path = p.path().with_file_name(format!("{}.rs", &file_name[..file_name.len() - 8])); - modify(pb_path, |content| { - content.push_str(&format!("\npub use super::{}::*;\n", &file_name[..file_name.len() - 3])); - }); - } - modify(p.path(), |content| { + let path = f.unwrap().path(); + let file_name = path.file_name().unwrap().to_str().unwrap().to_string(); + if !file_name.ends_with("_grpc.rs") { + continue; + } + // remove _grpc + let pb_file_name = format!("{}.rs", &file_name[..file_name.len() - 8]); + let pb_path = path.with_file_name(pb_file_name); + // remove .rs + let module_name = &file_name[..file_name.len() - 3]; + modify(pb_path, |content| { + content.push_str(&format!("\npub use super::{}::*;\n", module_name)); + }); + } +} + +/// Removes the protobuf version constraint in all .rs files in out_dir. +/// note: now that we have distinct protobuf v2 and v3 generated files, not sure this step is necessary or good practice anymore +fn remove_protobuf_version_constraint(out_dir: &str) { + for f in fs::read_dir(out_dir).unwrap() { + let path = f.unwrap().path(); + if path.extension().unwrap() == "rs" { + modify(path, |content| { *content = remove_match(&content, |l| l.contains("::protobuf::VERSION")); }); } } } +fn generate_protobuf(protoc: &Path, include: &str, inputs: &[&str], out_dir: &str) { + delete_and_mkdir(out_dir); + + // TODO: update rust-protobuf to allow specifying protoc explicitly. + protoc_rust::run(protoc_rust::Args { + out_dir, + includes: &[include], + input: inputs, + customize: protoc_rust::Customize::default(), + }) + .unwrap(); + + run_gen_grpc(protoc, include, inputs, out_dir); + apply_naming_patch(); + link_pb_with_grpc_rs(out_dir); + // note: now that we have distinct protobuf v2 and v3 generated files, not sure this step is necessary or good practice anymore + remove_protobuf_version_constraint(out_dir); +} + +fn generate_protobufv3(protoc: &Path, include: &str, inputs: &[&str], out_dir: &str) { + delete_and_mkdir(out_dir); + + let _ = protobuf_codegen::Codegen::new() + .protoc() + .includes([include]) + .inputs(inputs) + .out_dir(out_dir) + .run(); + + run_gen_grpc(protoc, include, inputs, out_dir); + apply_naming_patch(); + + for f in fs::read_dir(out_dir).unwrap() { + let path = f.unwrap().path(); + if path.extension().unwrap() == "rs" { + modify(&path, |content| { + *content = content.replace("::protobuf::", "::protobufv3::"); + }); + + // remove ".proto file is parsed by protoc X.Y.Z" line + modify(&path, |content| { + *content = remove_match(&content, |l| l.contains(".proto file is parsed by protoc")); + }); + } + } + + link_pb_with_grpc_rs(out_dir); + // note: now that we have distinct protobuf v2 and v3 generated files, not sure this step is necessary or good practice anymore + remove_protobuf_version_constraint(out_dir); +} + fn generate_prost(protoc: &Path, include: &str, inputs: &[&str], out_dir: &str) { env::set_var("PROTOC", protoc); - if Path::new(out_dir).exists() { - fs::remove_dir_all(out_dir).unwrap(); - } - fs::create_dir_all(out_dir).unwrap(); + delete_and_mkdir(out_dir); + exec( cargo() .args(&[ @@ -242,7 +319,18 @@ fn codegen() { &inputs_ref, &format!("{}/protobuf/{}", out_dir, package), ); - generate_prost(&protoc, include, &inputs_ref, &format!("{}/prost/{}", out_dir, package)); + generate_protobufv3( + &protoc, + include, + &inputs_ref, + &format!("{}/protobuf_v3/{}", out_dir, package), + ); + generate_prost( + &protoc, + include, + &inputs_ref, + &format!("{}/prost/{}", out_dir, package), + ); } exec(cargo().args(&["fmt", "--all"])) }