1pub mod system_service_client {
4 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5 use tonic::codegen::*;
6 use tonic::codegen::http::Uri;
7 #[derive(Debug, Clone)]
8 pub struct SystemServiceClient<T> {
9 inner: tonic::client::Grpc<T>,
10 }
11 impl SystemServiceClient<tonic::transport::Channel> {
12 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14 where
15 D: TryInto<tonic::transport::Endpoint>,
16 D::Error: Into<StdError>,
17 {
18 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19 Ok(Self::new(conn))
20 }
21 }
22 impl<T> SystemServiceClient<T>
23 where
24 T: tonic::client::GrpcService<tonic::body::BoxBody>,
25 T::Error: Into<StdError>,
26 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28 {
29 pub fn new(inner: T) -> Self {
30 let inner = tonic::client::Grpc::new(inner);
31 Self { inner }
32 }
33 pub fn with_origin(inner: T, origin: Uri) -> Self {
34 let inner = tonic::client::Grpc::with_origin(inner, origin);
35 Self { inner }
36 }
37 pub fn with_interceptor<F>(
38 inner: T,
39 interceptor: F,
40 ) -> SystemServiceClient<InterceptedService<T, F>>
41 where
42 F: tonic::service::Interceptor,
43 T::ResponseBody: Default,
44 T: tonic::codegen::Service<
45 http::Request<tonic::body::BoxBody>,
46 Response = http::Response<
47 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48 >,
49 >,
50 <T as tonic::codegen::Service<
51 http::Request<tonic::body::BoxBody>,
52 >>::Error: Into<StdError> + Send + Sync,
53 {
54 SystemServiceClient::new(InterceptedService::new(inner, interceptor))
55 }
56 #[must_use]
61 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62 self.inner = self.inner.send_compressed(encoding);
63 self
64 }
65 #[must_use]
67 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68 self.inner = self.inner.accept_compressed(encoding);
69 self
70 }
71 #[must_use]
75 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76 self.inner = self.inner.max_decoding_message_size(limit);
77 self
78 }
79 #[must_use]
83 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84 self.inner = self.inner.max_encoding_message_size(limit);
85 self
86 }
87 pub async fn get_connection_info(
88 &mut self,
89 request: impl tonic::IntoRequest<super::GetConnectionInfoRequest>,
90 ) -> std::result::Result<
91 tonic::Response<super::GetConnectionInfoResponse>,
92 tonic::Status,
93 > {
94 self.inner
95 .ready()
96 .await
97 .map_err(|e| {
98 tonic::Status::new(
99 tonic::Code::Unknown,
100 format!("Service was not ready: {}", e.into()),
101 )
102 })?;
103 let codec = tonic::codec::ProstCodec::default();
104 let path = http::uri::PathAndQuery::from_static(
105 "/kdo.v1.system.SystemService/GetConnectionInfo",
106 );
107 let mut req = request.into_request();
108 req.extensions_mut()
109 .insert(
110 GrpcMethod::new("kdo.v1.system.SystemService", "GetConnectionInfo"),
111 );
112 self.inner.unary(req, path, codec).await
113 }
114 pub async fn get_version_info(
115 &mut self,
116 request: impl tonic::IntoRequest<super::GetVersionInfoRequest>,
117 ) -> std::result::Result<
118 tonic::Response<super::GetVersionInfoResponse>,
119 tonic::Status,
120 > {
121 self.inner
122 .ready()
123 .await
124 .map_err(|e| {
125 tonic::Status::new(
126 tonic::Code::Unknown,
127 format!("Service was not ready: {}", e.into()),
128 )
129 })?;
130 let codec = tonic::codec::ProstCodec::default();
131 let path = http::uri::PathAndQuery::from_static(
132 "/kdo.v1.system.SystemService/GetVersionInfo",
133 );
134 let mut req = request.into_request();
135 req.extensions_mut()
136 .insert(
137 GrpcMethod::new("kdo.v1.system.SystemService", "GetVersionInfo"),
138 );
139 self.inner.unary(req, path, codec).await
140 }
141 pub async fn stop_all_trading(
142 &mut self,
143 request: impl tonic::IntoRequest<super::StopAllTradingRequest>,
144 ) -> std::result::Result<
145 tonic::Response<super::StopAllTradingResponse>,
146 tonic::Status,
147 > {
148 self.inner
149 .ready()
150 .await
151 .map_err(|e| {
152 tonic::Status::new(
153 tonic::Code::Unknown,
154 format!("Service was not ready: {}", e.into()),
155 )
156 })?;
157 let codec = tonic::codec::ProstCodec::default();
158 let path = http::uri::PathAndQuery::from_static(
159 "/kdo.v1.system.SystemService/StopAllTrading",
160 );
161 let mut req = request.into_request();
162 req.extensions_mut()
163 .insert(
164 GrpcMethod::new("kdo.v1.system.SystemService", "StopAllTrading"),
165 );
166 self.inner.unary(req, path, codec).await
167 }
168 }
169}
170pub mod system_service_server {
172 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
173 use tonic::codegen::*;
174 #[async_trait]
176 pub trait SystemService: Send + Sync + 'static {
177 async fn get_connection_info(
178 &self,
179 request: tonic::Request<super::GetConnectionInfoRequest>,
180 ) -> std::result::Result<
181 tonic::Response<super::GetConnectionInfoResponse>,
182 tonic::Status,
183 >;
184 async fn get_version_info(
185 &self,
186 request: tonic::Request<super::GetVersionInfoRequest>,
187 ) -> std::result::Result<
188 tonic::Response<super::GetVersionInfoResponse>,
189 tonic::Status,
190 >;
191 async fn stop_all_trading(
192 &self,
193 request: tonic::Request<super::StopAllTradingRequest>,
194 ) -> std::result::Result<
195 tonic::Response<super::StopAllTradingResponse>,
196 tonic::Status,
197 >;
198 }
199 #[derive(Debug)]
200 pub struct SystemServiceServer<T: SystemService> {
201 inner: Arc<T>,
202 accept_compression_encodings: EnabledCompressionEncodings,
203 send_compression_encodings: EnabledCompressionEncodings,
204 max_decoding_message_size: Option<usize>,
205 max_encoding_message_size: Option<usize>,
206 }
207 impl<T: SystemService> SystemServiceServer<T> {
208 pub fn new(inner: T) -> Self {
209 Self::from_arc(Arc::new(inner))
210 }
211 pub fn from_arc(inner: Arc<T>) -> Self {
212 Self {
213 inner,
214 accept_compression_encodings: Default::default(),
215 send_compression_encodings: Default::default(),
216 max_decoding_message_size: None,
217 max_encoding_message_size: None,
218 }
219 }
220 pub fn with_interceptor<F>(
221 inner: T,
222 interceptor: F,
223 ) -> InterceptedService<Self, F>
224 where
225 F: tonic::service::Interceptor,
226 {
227 InterceptedService::new(Self::new(inner), interceptor)
228 }
229 #[must_use]
231 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
232 self.accept_compression_encodings.enable(encoding);
233 self
234 }
235 #[must_use]
237 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
238 self.send_compression_encodings.enable(encoding);
239 self
240 }
241 #[must_use]
245 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
246 self.max_decoding_message_size = Some(limit);
247 self
248 }
249 #[must_use]
253 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
254 self.max_encoding_message_size = Some(limit);
255 self
256 }
257 }
258 impl<T, B> tonic::codegen::Service<http::Request<B>> for SystemServiceServer<T>
259 where
260 T: SystemService,
261 B: Body + Send + 'static,
262 B::Error: Into<StdError> + Send + 'static,
263 {
264 type Response = http::Response<tonic::body::BoxBody>;
265 type Error = std::convert::Infallible;
266 type Future = BoxFuture<Self::Response, Self::Error>;
267 fn poll_ready(
268 &mut self,
269 _cx: &mut Context<'_>,
270 ) -> Poll<std::result::Result<(), Self::Error>> {
271 Poll::Ready(Ok(()))
272 }
273 fn call(&mut self, req: http::Request<B>) -> Self::Future {
274 match req.uri().path() {
275 "/kdo.v1.system.SystemService/GetConnectionInfo" => {
276 #[allow(non_camel_case_types)]
277 struct GetConnectionInfoSvc<T: SystemService>(pub Arc<T>);
278 impl<
279 T: SystemService,
280 > tonic::server::UnaryService<super::GetConnectionInfoRequest>
281 for GetConnectionInfoSvc<T> {
282 type Response = super::GetConnectionInfoResponse;
283 type Future = BoxFuture<
284 tonic::Response<Self::Response>,
285 tonic::Status,
286 >;
287 fn call(
288 &mut self,
289 request: tonic::Request<super::GetConnectionInfoRequest>,
290 ) -> Self::Future {
291 let inner = Arc::clone(&self.0);
292 let fut = async move {
293 <T as SystemService>::get_connection_info(&inner, request)
294 .await
295 };
296 Box::pin(fut)
297 }
298 }
299 let accept_compression_encodings = self.accept_compression_encodings;
300 let send_compression_encodings = self.send_compression_encodings;
301 let max_decoding_message_size = self.max_decoding_message_size;
302 let max_encoding_message_size = self.max_encoding_message_size;
303 let inner = self.inner.clone();
304 let fut = async move {
305 let method = GetConnectionInfoSvc(inner);
306 let codec = tonic::codec::ProstCodec::default();
307 let mut grpc = tonic::server::Grpc::new(codec)
308 .apply_compression_config(
309 accept_compression_encodings,
310 send_compression_encodings,
311 )
312 .apply_max_message_size_config(
313 max_decoding_message_size,
314 max_encoding_message_size,
315 );
316 let res = grpc.unary(method, req).await;
317 Ok(res)
318 };
319 Box::pin(fut)
320 }
321 "/kdo.v1.system.SystemService/GetVersionInfo" => {
322 #[allow(non_camel_case_types)]
323 struct GetVersionInfoSvc<T: SystemService>(pub Arc<T>);
324 impl<
325 T: SystemService,
326 > tonic::server::UnaryService<super::GetVersionInfoRequest>
327 for GetVersionInfoSvc<T> {
328 type Response = super::GetVersionInfoResponse;
329 type Future = BoxFuture<
330 tonic::Response<Self::Response>,
331 tonic::Status,
332 >;
333 fn call(
334 &mut self,
335 request: tonic::Request<super::GetVersionInfoRequest>,
336 ) -> Self::Future {
337 let inner = Arc::clone(&self.0);
338 let fut = async move {
339 <T as SystemService>::get_version_info(&inner, request)
340 .await
341 };
342 Box::pin(fut)
343 }
344 }
345 let accept_compression_encodings = self.accept_compression_encodings;
346 let send_compression_encodings = self.send_compression_encodings;
347 let max_decoding_message_size = self.max_decoding_message_size;
348 let max_encoding_message_size = self.max_encoding_message_size;
349 let inner = self.inner.clone();
350 let fut = async move {
351 let method = GetVersionInfoSvc(inner);
352 let codec = tonic::codec::ProstCodec::default();
353 let mut grpc = tonic::server::Grpc::new(codec)
354 .apply_compression_config(
355 accept_compression_encodings,
356 send_compression_encodings,
357 )
358 .apply_max_message_size_config(
359 max_decoding_message_size,
360 max_encoding_message_size,
361 );
362 let res = grpc.unary(method, req).await;
363 Ok(res)
364 };
365 Box::pin(fut)
366 }
367 "/kdo.v1.system.SystemService/StopAllTrading" => {
368 #[allow(non_camel_case_types)]
369 struct StopAllTradingSvc<T: SystemService>(pub Arc<T>);
370 impl<
371 T: SystemService,
372 > tonic::server::UnaryService<super::StopAllTradingRequest>
373 for StopAllTradingSvc<T> {
374 type Response = super::StopAllTradingResponse;
375 type Future = BoxFuture<
376 tonic::Response<Self::Response>,
377 tonic::Status,
378 >;
379 fn call(
380 &mut self,
381 request: tonic::Request<super::StopAllTradingRequest>,
382 ) -> Self::Future {
383 let inner = Arc::clone(&self.0);
384 let fut = async move {
385 <T as SystemService>::stop_all_trading(&inner, request)
386 .await
387 };
388 Box::pin(fut)
389 }
390 }
391 let accept_compression_encodings = self.accept_compression_encodings;
392 let send_compression_encodings = self.send_compression_encodings;
393 let max_decoding_message_size = self.max_decoding_message_size;
394 let max_encoding_message_size = self.max_encoding_message_size;
395 let inner = self.inner.clone();
396 let fut = async move {
397 let method = StopAllTradingSvc(inner);
398 let codec = tonic::codec::ProstCodec::default();
399 let mut grpc = tonic::server::Grpc::new(codec)
400 .apply_compression_config(
401 accept_compression_encodings,
402 send_compression_encodings,
403 )
404 .apply_max_message_size_config(
405 max_decoding_message_size,
406 max_encoding_message_size,
407 );
408 let res = grpc.unary(method, req).await;
409 Ok(res)
410 };
411 Box::pin(fut)
412 }
413 _ => {
414 Box::pin(async move {
415 Ok(
416 http::Response::builder()
417 .status(200)
418 .header("grpc-status", tonic::Code::Unimplemented as i32)
419 .header(
420 http::header::CONTENT_TYPE,
421 tonic::metadata::GRPC_CONTENT_TYPE,
422 )
423 .body(empty_body())
424 .unwrap(),
425 )
426 })
427 }
428 }
429 }
430 }
431 impl<T: SystemService> Clone for SystemServiceServer<T> {
432 fn clone(&self) -> Self {
433 let inner = self.inner.clone();
434 Self {
435 inner,
436 accept_compression_encodings: self.accept_compression_encodings,
437 send_compression_encodings: self.send_compression_encodings,
438 max_decoding_message_size: self.max_decoding_message_size,
439 max_encoding_message_size: self.max_encoding_message_size,
440 }
441 }
442 }
443 impl<T: SystemService> tonic::server::NamedService for SystemServiceServer<T> {
444 const NAME: &'static str = "kdo.v1.system.SystemService";
445 }
446}