1 // This file is @generated by prost-build.
2 /// The message sent by the client when calling ServerReflectionInfo method.
3 #[derive(Clone, PartialEq, ::prost::Message)]
4 pub struct ServerReflectionRequest {
5     #[prost(string, tag = "1")]
6     pub host: ::prost::alloc::string::String,
7     /// To use reflection service, the client should set one of the following
8     /// fields in message_request. The server distinguishes requests by their
9     /// defined field and then handles them using corresponding methods.
10     #[prost(oneof = "server_reflection_request::MessageRequest", tags = "3, 4, 5, 6, 7")]
11     pub message_request: ::core::option::Option<
12         server_reflection_request::MessageRequest,
13     >,
14 }
15 /// Nested message and enum types in `ServerReflectionRequest`.
16 pub mod server_reflection_request {
17     /// To use reflection service, the client should set one of the following
18     /// fields in message_request. The server distinguishes requests by their
19     /// defined field and then handles them using corresponding methods.
20     #[derive(Clone, PartialEq, ::prost::Oneof)]
21     pub enum MessageRequest {
22         /// Find a proto file by the file name.
23         #[prost(string, tag = "3")]
24         FileByFilename(::prost::alloc::string::String),
25         /// Find the proto file that declares the given fully-qualified symbol name.
26         /// This field should be a fully-qualified symbol name
27         /// (e.g. <package>.<service>\[.<method>\] or <package>.<type>).
28         #[prost(string, tag = "4")]
29         FileContainingSymbol(::prost::alloc::string::String),
30         /// Find the proto file which defines an extension extending the given
31         /// message type with the given field number.
32         #[prost(message, tag = "5")]
33         FileContainingExtension(super::ExtensionRequest),
34         /// Finds the tag numbers used by all known extensions of the given message
35         /// type, and appends them to ExtensionNumberResponse in an undefined order.
36         /// Its corresponding method is best-effort: it's not guaranteed that the
37         /// reflection service will implement this method, and it's not guaranteed
38         /// that this method will provide all extensions. Returns
39         /// StatusCode::UNIMPLEMENTED if it's not implemented.
40         /// This field should be a fully-qualified type name. The format is
41         /// <package>.<type>
42         #[prost(string, tag = "6")]
43         AllExtensionNumbersOfType(::prost::alloc::string::String),
44         /// List the full names of registered services. The content will not be
45         /// checked.
46         #[prost(string, tag = "7")]
47         ListServices(::prost::alloc::string::String),
48     }
49 }
50 /// The type name and extension number sent by the client when requesting
51 /// file_containing_extension.
52 #[derive(Clone, PartialEq, ::prost::Message)]
53 pub struct ExtensionRequest {
54     /// Fully-qualified type name. The format should be <package>.<type>
55     #[prost(string, tag = "1")]
56     pub containing_type: ::prost::alloc::string::String,
57     #[prost(int32, tag = "2")]
58     pub extension_number: i32,
59 }
60 /// The message sent by the server to answer ServerReflectionInfo method.
61 #[derive(Clone, PartialEq, ::prost::Message)]
62 pub struct ServerReflectionResponse {
63     #[prost(string, tag = "1")]
64     pub valid_host: ::prost::alloc::string::String,
65     #[prost(message, optional, tag = "2")]
66     pub original_request: ::core::option::Option<ServerReflectionRequest>,
67     /// The server sets one of the following fields according to the message_request
68     /// in the request.
69     #[prost(oneof = "server_reflection_response::MessageResponse", tags = "4, 5, 6, 7")]
70     pub message_response: ::core::option::Option<
71         server_reflection_response::MessageResponse,
72     >,
73 }
74 /// Nested message and enum types in `ServerReflectionResponse`.
75 pub mod server_reflection_response {
76     /// The server sets one of the following fields according to the message_request
77     /// in the request.
78     #[derive(Clone, PartialEq, ::prost::Oneof)]
79     pub enum MessageResponse {
80         /// This message is used to answer file_by_filename, file_containing_symbol,
81         /// file_containing_extension requests with transitive dependencies.
82         /// As the repeated label is not allowed in oneof fields, we use a
83         /// FileDescriptorResponse message to encapsulate the repeated fields.
84         /// The reflection service is allowed to avoid sending FileDescriptorProtos
85         /// that were previously sent in response to earlier requests in the stream.
86         #[prost(message, tag = "4")]
87         FileDescriptorResponse(super::FileDescriptorResponse),
88         /// This message is used to answer all_extension_numbers_of_type requests.
89         #[prost(message, tag = "5")]
90         AllExtensionNumbersResponse(super::ExtensionNumberResponse),
91         /// This message is used to answer list_services requests.
92         #[prost(message, tag = "6")]
93         ListServicesResponse(super::ListServiceResponse),
94         /// This message is used when an error occurs.
95         #[prost(message, tag = "7")]
96         ErrorResponse(super::ErrorResponse),
97     }
98 }
99 /// Serialized FileDescriptorProto messages sent by the server answering
100 /// a file_by_filename, file_containing_symbol, or file_containing_extension
101 /// request.
102 #[derive(Clone, PartialEq, ::prost::Message)]
103 pub struct FileDescriptorResponse {
104     /// Serialized FileDescriptorProto messages. We avoid taking a dependency on
105     /// descriptor.proto, which uses proto2 only features, by making them opaque
106     /// bytes instead.
107     #[prost(bytes = "vec", repeated, tag = "1")]
108     pub file_descriptor_proto: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
109 }
110 /// A list of extension numbers sent by the server answering
111 /// all_extension_numbers_of_type request.
112 #[derive(Clone, PartialEq, ::prost::Message)]
113 pub struct ExtensionNumberResponse {
114     /// Full name of the base type, including the package name. The format
115     /// is <package>.<type>
116     #[prost(string, tag = "1")]
117     pub base_type_name: ::prost::alloc::string::String,
118     #[prost(int32, repeated, tag = "2")]
119     pub extension_number: ::prost::alloc::vec::Vec<i32>,
120 }
121 /// A list of ServiceResponse sent by the server answering list_services request.
122 #[derive(Clone, PartialEq, ::prost::Message)]
123 pub struct ListServiceResponse {
124     /// The information of each service may be expanded in the future, so we use
125     /// ServiceResponse message to encapsulate it.
126     #[prost(message, repeated, tag = "1")]
127     pub service: ::prost::alloc::vec::Vec<ServiceResponse>,
128 }
129 /// The information of a single service used by ListServiceResponse to answer
130 /// list_services request.
131 #[derive(Clone, PartialEq, ::prost::Message)]
132 pub struct ServiceResponse {
133     /// Full name of a registered service, including its package name. The format
134     /// is <package>.<service>
135     #[prost(string, tag = "1")]
136     pub name: ::prost::alloc::string::String,
137 }
138 /// The error code and error message sent by the server when an error occurs.
139 #[derive(Clone, PartialEq, ::prost::Message)]
140 pub struct ErrorResponse {
141     /// This field uses the error codes defined in grpc::StatusCode.
142     #[prost(int32, tag = "1")]
143     pub error_code: i32,
144     #[prost(string, tag = "2")]
145     pub error_message: ::prost::alloc::string::String,
146 }
147 /// Generated client implementations.
148 pub mod server_reflection_client {
149     #![allow(
150         unused_variables,
151         dead_code,
152         missing_docs,
153         clippy::wildcard_imports,
154         clippy::let_unit_value,
155     )]
156     use tonic::codegen::*;
157     use tonic::codegen::http::Uri;
158     #[derive(Debug, Clone)]
159     pub struct ServerReflectionClient<T> {
160         inner: tonic::client::Grpc<T>,
161     }
162     impl<T> ServerReflectionClient<T>
163     where
164         T: tonic::client::GrpcService<tonic::body::Body>,
165         T::Error: Into<StdError>,
166         T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
167         <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
168     {
new(inner: T) -> Self169         pub fn new(inner: T) -> Self {
170             let inner = tonic::client::Grpc::new(inner);
171             Self { inner }
172         }
with_origin(inner: T, origin: Uri) -> Self173         pub fn with_origin(inner: T, origin: Uri) -> Self {
174             let inner = tonic::client::Grpc::with_origin(inner, origin);
175             Self { inner }
176         }
with_interceptor<F>( inner: T, interceptor: F, ) -> ServerReflectionClient<InterceptedService<T, F>> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request<tonic::body::Body>, Response = http::Response< <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody, >, >, <T as tonic::codegen::Service< http::Request<tonic::body::Body>, >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,177         pub fn with_interceptor<F>(
178             inner: T,
179             interceptor: F,
180         ) -> ServerReflectionClient<InterceptedService<T, F>>
181         where
182             F: tonic::service::Interceptor,
183             T::ResponseBody: Default,
184             T: tonic::codegen::Service<
185                 http::Request<tonic::body::Body>,
186                 Response = http::Response<
187                     <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
188                 >,
189             >,
190             <T as tonic::codegen::Service<
191                 http::Request<tonic::body::Body>,
192             >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
193         {
194             ServerReflectionClient::new(InterceptedService::new(inner, interceptor))
195         }
196         /// Compress requests with the given encoding.
197         ///
198         /// This requires the server to support it otherwise it might respond with an
199         /// error.
200         #[must_use]
send_compressed(mut self, encoding: CompressionEncoding) -> Self201         pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
202             self.inner = self.inner.send_compressed(encoding);
203             self
204         }
205         /// Enable decompressing responses.
206         #[must_use]
accept_compressed(mut self, encoding: CompressionEncoding) -> Self207         pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
208             self.inner = self.inner.accept_compressed(encoding);
209             self
210         }
211         /// Limits the maximum size of a decoded message.
212         ///
213         /// Default: `4MB`
214         #[must_use]
max_decoding_message_size(mut self, limit: usize) -> Self215         pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
216             self.inner = self.inner.max_decoding_message_size(limit);
217             self
218         }
219         /// Limits the maximum size of an encoded message.
220         ///
221         /// Default: `usize::MAX`
222         #[must_use]
max_encoding_message_size(mut self, limit: usize) -> Self223         pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
224             self.inner = self.inner.max_encoding_message_size(limit);
225             self
226         }
227         /// The reflection service is structured as a bidirectional stream, ensuring
228         /// all related requests go to a single server.
server_reflection_info( &mut self, request: impl tonic::IntoStreamingRequest< Message = super::ServerReflectionRequest, >, ) -> std::result::Result< tonic::Response<tonic::codec::Streaming<super::ServerReflectionResponse>>, tonic::Status, >229         pub async fn server_reflection_info(
230             &mut self,
231             request: impl tonic::IntoStreamingRequest<
232                 Message = super::ServerReflectionRequest,
233             >,
234         ) -> std::result::Result<
235             tonic::Response<tonic::codec::Streaming<super::ServerReflectionResponse>>,
236             tonic::Status,
237         > {
238             self.inner
239                 .ready()
240                 .await
241                 .map_err(|e| {
242                     tonic::Status::unknown(
243                         format!("Service was not ready: {}", e.into()),
244                     )
245                 })?;
246             let codec = tonic::codec::ProstCodec::default();
247             let path = http::uri::PathAndQuery::from_static(
248                 "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo",
249             );
250             let mut req = request.into_streaming_request();
251             req.extensions_mut()
252                 .insert(
253                     GrpcMethod::new(
254                         "grpc.reflection.v1.ServerReflection",
255                         "ServerReflectionInfo",
256                     ),
257                 );
258             self.inner.streaming(req, path, codec).await
259         }
260     }
261 }
262 /// Generated server implementations.
263 pub mod server_reflection_server {
264     #![allow(
265         unused_variables,
266         dead_code,
267         missing_docs,
268         clippy::wildcard_imports,
269         clippy::let_unit_value,
270     )]
271     use tonic::codegen::*;
272     /// Generated trait containing gRPC methods that should be implemented for use with ServerReflectionServer.
273     #[async_trait]
274     pub trait ServerReflection: std::marker::Send + std::marker::Sync + 'static {
275         /// Server streaming response type for the ServerReflectionInfo method.
276         type ServerReflectionInfoStream: tonic::codegen::tokio_stream::Stream<
277                 Item = std::result::Result<
278                     super::ServerReflectionResponse,
279                     tonic::Status,
280                 >,
281             >
282             + std::marker::Send
283             + 'static;
284         /// The reflection service is structured as a bidirectional stream, ensuring
285         /// all related requests go to a single server.
server_reflection_info( &self, request: tonic::Request<tonic::Streaming<super::ServerReflectionRequest>>, ) -> std::result::Result< tonic::Response<Self::ServerReflectionInfoStream>, tonic::Status, >286         async fn server_reflection_info(
287             &self,
288             request: tonic::Request<tonic::Streaming<super::ServerReflectionRequest>>,
289         ) -> std::result::Result<
290             tonic::Response<Self::ServerReflectionInfoStream>,
291             tonic::Status,
292         >;
293     }
294     #[derive(Debug)]
295     pub struct ServerReflectionServer<T> {
296         inner: Arc<T>,
297         accept_compression_encodings: EnabledCompressionEncodings,
298         send_compression_encodings: EnabledCompressionEncodings,
299         max_decoding_message_size: Option<usize>,
300         max_encoding_message_size: Option<usize>,
301     }
302     impl<T> ServerReflectionServer<T> {
new(inner: T) -> Self303         pub fn new(inner: T) -> Self {
304             Self::from_arc(Arc::new(inner))
305         }
from_arc(inner: Arc<T>) -> Self306         pub fn from_arc(inner: Arc<T>) -> Self {
307             Self {
308                 inner,
309                 accept_compression_encodings: Default::default(),
310                 send_compression_encodings: Default::default(),
311                 max_decoding_message_size: None,
312                 max_encoding_message_size: None,
313             }
314         }
with_interceptor<F>( inner: T, interceptor: F, ) -> InterceptedService<Self, F> where F: tonic::service::Interceptor,315         pub fn with_interceptor<F>(
316             inner: T,
317             interceptor: F,
318         ) -> InterceptedService<Self, F>
319         where
320             F: tonic::service::Interceptor,
321         {
322             InterceptedService::new(Self::new(inner), interceptor)
323         }
324         /// Enable decompressing requests with the given encoding.
325         #[must_use]
accept_compressed(mut self, encoding: CompressionEncoding) -> Self326         pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
327             self.accept_compression_encodings.enable(encoding);
328             self
329         }
330         /// Compress responses with the given encoding, if the client supports it.
331         #[must_use]
send_compressed(mut self, encoding: CompressionEncoding) -> Self332         pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
333             self.send_compression_encodings.enable(encoding);
334             self
335         }
336         /// Limits the maximum size of a decoded message.
337         ///
338         /// Default: `4MB`
339         #[must_use]
max_decoding_message_size(mut self, limit: usize) -> Self340         pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
341             self.max_decoding_message_size = Some(limit);
342             self
343         }
344         /// Limits the maximum size of an encoded message.
345         ///
346         /// Default: `usize::MAX`
347         #[must_use]
max_encoding_message_size(mut self, limit: usize) -> Self348         pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
349             self.max_encoding_message_size = Some(limit);
350             self
351         }
352     }
353     impl<T, B> tonic::codegen::Service<http::Request<B>> for ServerReflectionServer<T>
354     where
355         T: ServerReflection,
356         B: Body + std::marker::Send + 'static,
357         B::Error: Into<StdError> + std::marker::Send + 'static,
358     {
359         type Response = http::Response<tonic::body::Body>;
360         type Error = std::convert::Infallible;
361         type Future = BoxFuture<Self::Response, Self::Error>;
poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll<std::result::Result<(), Self::Error>>362         fn poll_ready(
363             &mut self,
364             _cx: &mut Context<'_>,
365         ) -> Poll<std::result::Result<(), Self::Error>> {
366             Poll::Ready(Ok(()))
367         }
call(&mut self, req: http::Request<B>) -> Self::Future368         fn call(&mut self, req: http::Request<B>) -> Self::Future {
369             match req.uri().path() {
370                 "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo" => {
371                     #[allow(non_camel_case_types)]
372                     struct ServerReflectionInfoSvc<T: ServerReflection>(pub Arc<T>);
373                     impl<
374                         T: ServerReflection,
375                     > tonic::server::StreamingService<super::ServerReflectionRequest>
376                     for ServerReflectionInfoSvc<T> {
377                         type Response = super::ServerReflectionResponse;
378                         type ResponseStream = T::ServerReflectionInfoStream;
379                         type Future = BoxFuture<
380                             tonic::Response<Self::ResponseStream>,
381                             tonic::Status,
382                         >;
383                         fn call(
384                             &mut self,
385                             request: tonic::Request<
386                                 tonic::Streaming<super::ServerReflectionRequest>,
387                             >,
388                         ) -> Self::Future {
389                             let inner = Arc::clone(&self.0);
390                             let fut = async move {
391                                 <T as ServerReflection>::server_reflection_info(
392                                         &inner,
393                                         request,
394                                     )
395                                     .await
396                             };
397                             Box::pin(fut)
398                         }
399                     }
400                     let accept_compression_encodings = self.accept_compression_encodings;
401                     let send_compression_encodings = self.send_compression_encodings;
402                     let max_decoding_message_size = self.max_decoding_message_size;
403                     let max_encoding_message_size = self.max_encoding_message_size;
404                     let inner = self.inner.clone();
405                     let fut = async move {
406                         let method = ServerReflectionInfoSvc(inner);
407                         let codec = tonic::codec::ProstCodec::default();
408                         let mut grpc = tonic::server::Grpc::new(codec)
409                             .apply_compression_config(
410                                 accept_compression_encodings,
411                                 send_compression_encodings,
412                             )
413                             .apply_max_message_size_config(
414                                 max_decoding_message_size,
415                                 max_encoding_message_size,
416                             );
417                         let res = grpc.streaming(method, req).await;
418                         Ok(res)
419                     };
420                     Box::pin(fut)
421                 }
422                 _ => {
423                     Box::pin(async move {
424                         let mut response = http::Response::new(
425                             tonic::body::Body::default(),
426                         );
427                         let headers = response.headers_mut();
428                         headers
429                             .insert(
430                                 tonic::Status::GRPC_STATUS,
431                                 (tonic::Code::Unimplemented as i32).into(),
432                             );
433                         headers
434                             .insert(
435                                 http::header::CONTENT_TYPE,
436                                 tonic::metadata::GRPC_CONTENT_TYPE,
437                             );
438                         Ok(response)
439                     })
440                 }
441             }
442         }
443     }
444     impl<T> Clone for ServerReflectionServer<T> {
clone(&self) -> Self445         fn clone(&self) -> Self {
446             let inner = self.inner.clone();
447             Self {
448                 inner,
449                 accept_compression_encodings: self.accept_compression_encodings,
450                 send_compression_encodings: self.send_compression_encodings,
451                 max_decoding_message_size: self.max_decoding_message_size,
452                 max_encoding_message_size: self.max_encoding_message_size,
453             }
454         }
455     }
456     /// Generated gRPC service name
457     pub const SERVICE_NAME: &str = "grpc.reflection.v1.ServerReflection";
458     impl<T> tonic::server::NamedService for ServerReflectionServer<T> {
459         const NAME: &'static str = SERVICE_NAME;
460     }
461 }
462