1pub mod fund_service_client {
4 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5 use tonic::codegen::http::Uri;
6 use tonic::codegen::*;
7 #[derive(Debug, Clone)]
8 pub struct FundServiceClient<T> {
9 inner: tonic::client::Grpc<T>,
10 }
11 impl FundServiceClient<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> FundServiceClient<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 ) -> FundServiceClient<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 FundServiceClient::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_fund(
88 &mut self,
89 request: impl tonic::IntoRequest<super::GetFundRequest>,
90 ) -> std::result::Result<tonic::Response<super::Fund>, tonic::Status> {
91 self.inner
92 .ready()
93 .await
94 .map_err(|e| {
95 tonic::Status::new(
96 tonic::Code::Unknown,
97 format!("Service was not ready: {}", e.into()),
98 )
99 })?;
100 let codec = tonic::codec::ProstCodec::default();
101 let path = http::uri::PathAndQuery::from_static(
102 "/kdo.v1.fund.FundService/GetFund",
103 );
104 let mut req = request.into_request();
105 req.extensions_mut()
106 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "GetFund"));
107 self.inner.unary(req, path, codec).await
108 }
109 pub async fn stream_fund(
110 &mut self,
111 request: impl tonic::IntoRequest<super::GetFundRequest>,
112 ) -> std::result::Result<
113 tonic::Response<tonic::codec::Streaming<super::Fund>>,
114 tonic::Status,
115 > {
116 self.inner
117 .ready()
118 .await
119 .map_err(|e| {
120 tonic::Status::new(
121 tonic::Code::Unknown,
122 format!("Service was not ready: {}", e.into()),
123 )
124 })?;
125 let codec = tonic::codec::ProstCodec::default();
126 let path = http::uri::PathAndQuery::from_static(
127 "/kdo.v1.fund.FundService/StreamFund",
128 );
129 let mut req = request.into_request();
130 req.extensions_mut()
131 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "StreamFund"));
132 self.inner.server_streaming(req, path, codec).await
133 }
134 pub async fn list_funds(
135 &mut self,
136 request: impl tonic::IntoRequest<super::ListFundsRequest>,
137 ) -> std::result::Result<
138 tonic::Response<super::ListFundsResponse>,
139 tonic::Status,
140 > {
141 self.inner
142 .ready()
143 .await
144 .map_err(|e| {
145 tonic::Status::new(
146 tonic::Code::Unknown,
147 format!("Service was not ready: {}", e.into()),
148 )
149 })?;
150 let codec = tonic::codec::ProstCodec::default();
151 let path = http::uri::PathAndQuery::from_static(
152 "/kdo.v1.fund.FundService/ListFunds",
153 );
154 let mut req = request.into_request();
155 req.extensions_mut()
156 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "ListFunds"));
157 self.inner.unary(req, path, codec).await
158 }
159 pub async fn list_fund_trading_snapshots(
160 &mut self,
161 request: impl tonic::IntoRequest<super::ListFundTradingSnapshotsRequest>,
162 ) -> std::result::Result<
163 tonic::Response<super::ListFundTradingSnapshotsResponse>,
164 tonic::Status,
165 > {
166 self.inner
167 .ready()
168 .await
169 .map_err(|e| {
170 tonic::Status::new(
171 tonic::Code::Unknown,
172 format!("Service was not ready: {}", e.into()),
173 )
174 })?;
175 let codec = tonic::codec::ProstCodec::default();
176 let path = http::uri::PathAndQuery::from_static(
177 "/kdo.v1.fund.FundService/ListFundTradingSnapshots",
178 );
179 let mut req = request.into_request();
180 req.extensions_mut()
181 .insert(
182 GrpcMethod::new(
183 "kdo.v1.fund.FundService",
184 "ListFundTradingSnapshots",
185 ),
186 );
187 self.inner.unary(req, path, codec).await
188 }
189 pub async fn stream_fund_trading_snapshots(
190 &mut self,
191 request: impl tonic::IntoRequest<super::ListFundTradingSnapshotsRequest>,
192 ) -> std::result::Result<
193 tonic::Response<
194 tonic::codec::Streaming<super::ListFundTradingSnapshotsResponse>,
195 >,
196 tonic::Status,
197 > {
198 self.inner
199 .ready()
200 .await
201 .map_err(|e| {
202 tonic::Status::new(
203 tonic::Code::Unknown,
204 format!("Service was not ready: {}", e.into()),
205 )
206 })?;
207 let codec = tonic::codec::ProstCodec::default();
208 let path = http::uri::PathAndQuery::from_static(
209 "/kdo.v1.fund.FundService/StreamFundTradingSnapshots",
210 );
211 let mut req = request.into_request();
212 req.extensions_mut()
213 .insert(
214 GrpcMethod::new(
215 "kdo.v1.fund.FundService",
216 "StreamFundTradingSnapshots",
217 ),
218 );
219 self.inner.server_streaming(req, path, codec).await
220 }
221 pub async fn watch_loss_limit_alerts(
222 &mut self,
223 request: impl tonic::IntoRequest<super::WatchLossLimitAlertsRequest>,
224 ) -> std::result::Result<
225 tonic::Response<tonic::codec::Streaming<super::LossLimitAlert>>,
226 tonic::Status,
227 > {
228 self.inner
229 .ready()
230 .await
231 .map_err(|e| {
232 tonic::Status::new(
233 tonic::Code::Unknown,
234 format!("Service was not ready: {}", e.into()),
235 )
236 })?;
237 let codec = tonic::codec::ProstCodec::default();
238 let path = http::uri::PathAndQuery::from_static(
239 "/kdo.v1.fund.FundService/WatchLossLimitAlerts",
240 );
241 let mut req = request.into_request();
242 req.extensions_mut()
243 .insert(
244 GrpcMethod::new("kdo.v1.fund.FundService", "WatchLossLimitAlerts"),
245 );
246 self.inner.server_streaming(req, path, codec).await
247 }
248 }
249}
250pub mod fund_service_server {
252 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
253 use tonic::codegen::*;
254 #[async_trait]
256 pub trait FundService: Send + Sync + 'static {
257 async fn get_fund(
258 &self,
259 request: tonic::Request<super::GetFundRequest>,
260 ) -> std::result::Result<tonic::Response<super::Fund>, tonic::Status>;
261 type StreamFundStream: tonic::codegen::tokio_stream::Stream<
263 Item = std::result::Result<super::Fund, tonic::Status>,
264 >
265 + Send
266 + 'static;
267 async fn stream_fund(
268 &self,
269 request: tonic::Request<super::GetFundRequest>,
270 ) -> std::result::Result<tonic::Response<Self::StreamFundStream>, tonic::Status>;
271 async fn list_funds(
272 &self,
273 request: tonic::Request<super::ListFundsRequest>,
274 ) -> std::result::Result<
275 tonic::Response<super::ListFundsResponse>,
276 tonic::Status,
277 >;
278 async fn list_fund_trading_snapshots(
279 &self,
280 request: tonic::Request<super::ListFundTradingSnapshotsRequest>,
281 ) -> std::result::Result<
282 tonic::Response<super::ListFundTradingSnapshotsResponse>,
283 tonic::Status,
284 >;
285 type StreamFundTradingSnapshotsStream: tonic::codegen::tokio_stream::Stream<
287 Item = std::result::Result<
288 super::ListFundTradingSnapshotsResponse,
289 tonic::Status,
290 >,
291 >
292 + Send
293 + 'static;
294 async fn stream_fund_trading_snapshots(
295 &self,
296 request: tonic::Request<super::ListFundTradingSnapshotsRequest>,
297 ) -> std::result::Result<
298 tonic::Response<Self::StreamFundTradingSnapshotsStream>,
299 tonic::Status,
300 >;
301 type WatchLossLimitAlertsStream: tonic::codegen::tokio_stream::Stream<
303 Item = std::result::Result<super::LossLimitAlert, tonic::Status>,
304 >
305 + Send
306 + 'static;
307 async fn watch_loss_limit_alerts(
308 &self,
309 request: tonic::Request<super::WatchLossLimitAlertsRequest>,
310 ) -> std::result::Result<
311 tonic::Response<Self::WatchLossLimitAlertsStream>,
312 tonic::Status,
313 >;
314 }
315 #[derive(Debug)]
316 pub struct FundServiceServer<T: FundService> {
317 inner: Arc<T>,
318 accept_compression_encodings: EnabledCompressionEncodings,
319 send_compression_encodings: EnabledCompressionEncodings,
320 max_decoding_message_size: Option<usize>,
321 max_encoding_message_size: Option<usize>,
322 }
323 impl<T: FundService> FundServiceServer<T> {
324 pub fn new(inner: T) -> Self {
325 Self::from_arc(Arc::new(inner))
326 }
327 pub fn from_arc(inner: Arc<T>) -> Self {
328 Self {
329 inner,
330 accept_compression_encodings: Default::default(),
331 send_compression_encodings: Default::default(),
332 max_decoding_message_size: None,
333 max_encoding_message_size: None,
334 }
335 }
336 pub fn with_interceptor<F>(
337 inner: T,
338 interceptor: F,
339 ) -> InterceptedService<Self, F>
340 where
341 F: tonic::service::Interceptor,
342 {
343 InterceptedService::new(Self::new(inner), interceptor)
344 }
345 #[must_use]
347 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
348 self.accept_compression_encodings.enable(encoding);
349 self
350 }
351 #[must_use]
353 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
354 self.send_compression_encodings.enable(encoding);
355 self
356 }
357 #[must_use]
361 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
362 self.max_decoding_message_size = Some(limit);
363 self
364 }
365 #[must_use]
369 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
370 self.max_encoding_message_size = Some(limit);
371 self
372 }
373 }
374 impl<T, B> tonic::codegen::Service<http::Request<B>> for FundServiceServer<T>
375 where
376 T: FundService,
377 B: Body + Send + 'static,
378 B::Error: Into<StdError> + Send + 'static,
379 {
380 type Response = http::Response<tonic::body::BoxBody>;
381 type Error = std::convert::Infallible;
382 type Future = BoxFuture<Self::Response, Self::Error>;
383 fn poll_ready(
384 &mut self,
385 _cx: &mut Context<'_>,
386 ) -> Poll<std::result::Result<(), Self::Error>> {
387 Poll::Ready(Ok(()))
388 }
389 fn call(&mut self, req: http::Request<B>) -> Self::Future {
390 match req.uri().path() {
391 "/kdo.v1.fund.FundService/GetFund" => {
392 #[allow(non_camel_case_types)]
393 struct GetFundSvc<T: FundService>(pub Arc<T>);
394 impl<
395 T: FundService,
396 > tonic::server::UnaryService<super::GetFundRequest>
397 for GetFundSvc<T> {
398 type Response = super::Fund;
399 type Future = BoxFuture<
400 tonic::Response<Self::Response>,
401 tonic::Status,
402 >;
403 fn call(
404 &mut self,
405 request: tonic::Request<super::GetFundRequest>,
406 ) -> Self::Future {
407 let inner = Arc::clone(&self.0);
408 let fut = async move {
409 <T as FundService>::get_fund(&inner, request).await
410 };
411 Box::pin(fut)
412 }
413 }
414 let accept_compression_encodings = self.accept_compression_encodings;
415 let send_compression_encodings = self.send_compression_encodings;
416 let max_decoding_message_size = self.max_decoding_message_size;
417 let max_encoding_message_size = self.max_encoding_message_size;
418 let inner = self.inner.clone();
419 let fut = async move {
420 let method = GetFundSvc(inner);
421 let codec = tonic::codec::ProstCodec::default();
422 let mut grpc = tonic::server::Grpc::new(codec)
423 .apply_compression_config(
424 accept_compression_encodings,
425 send_compression_encodings,
426 )
427 .apply_max_message_size_config(
428 max_decoding_message_size,
429 max_encoding_message_size,
430 );
431 let res = grpc.unary(method, req).await;
432 Ok(res)
433 };
434 Box::pin(fut)
435 }
436 "/kdo.v1.fund.FundService/StreamFund" => {
437 #[allow(non_camel_case_types)]
438 struct StreamFundSvc<T: FundService>(pub Arc<T>);
439 impl<
440 T: FundService,
441 > tonic::server::ServerStreamingService<super::GetFundRequest>
442 for StreamFundSvc<T> {
443 type Response = super::Fund;
444 type ResponseStream = T::StreamFundStream;
445 type Future = BoxFuture<
446 tonic::Response<Self::ResponseStream>,
447 tonic::Status,
448 >;
449 fn call(
450 &mut self,
451 request: tonic::Request<super::GetFundRequest>,
452 ) -> Self::Future {
453 let inner = Arc::clone(&self.0);
454 let fut = async move {
455 <T as FundService>::stream_fund(&inner, request).await
456 };
457 Box::pin(fut)
458 }
459 }
460 let accept_compression_encodings = self.accept_compression_encodings;
461 let send_compression_encodings = self.send_compression_encodings;
462 let max_decoding_message_size = self.max_decoding_message_size;
463 let max_encoding_message_size = self.max_encoding_message_size;
464 let inner = self.inner.clone();
465 let fut = async move {
466 let method = StreamFundSvc(inner);
467 let codec = tonic::codec::ProstCodec::default();
468 let mut grpc = tonic::server::Grpc::new(codec)
469 .apply_compression_config(
470 accept_compression_encodings,
471 send_compression_encodings,
472 )
473 .apply_max_message_size_config(
474 max_decoding_message_size,
475 max_encoding_message_size,
476 );
477 let res = grpc.server_streaming(method, req).await;
478 Ok(res)
479 };
480 Box::pin(fut)
481 }
482 "/kdo.v1.fund.FundService/ListFunds" => {
483 #[allow(non_camel_case_types)]
484 struct ListFundsSvc<T: FundService>(pub Arc<T>);
485 impl<
486 T: FundService,
487 > tonic::server::UnaryService<super::ListFundsRequest>
488 for ListFundsSvc<T> {
489 type Response = super::ListFundsResponse;
490 type Future = BoxFuture<
491 tonic::Response<Self::Response>,
492 tonic::Status,
493 >;
494 fn call(
495 &mut self,
496 request: tonic::Request<super::ListFundsRequest>,
497 ) -> Self::Future {
498 let inner = Arc::clone(&self.0);
499 let fut = async move {
500 <T as FundService>::list_funds(&inner, request).await
501 };
502 Box::pin(fut)
503 }
504 }
505 let accept_compression_encodings = self.accept_compression_encodings;
506 let send_compression_encodings = self.send_compression_encodings;
507 let max_decoding_message_size = self.max_decoding_message_size;
508 let max_encoding_message_size = self.max_encoding_message_size;
509 let inner = self.inner.clone();
510 let fut = async move {
511 let method = ListFundsSvc(inner);
512 let codec = tonic::codec::ProstCodec::default();
513 let mut grpc = tonic::server::Grpc::new(codec)
514 .apply_compression_config(
515 accept_compression_encodings,
516 send_compression_encodings,
517 )
518 .apply_max_message_size_config(
519 max_decoding_message_size,
520 max_encoding_message_size,
521 );
522 let res = grpc.unary(method, req).await;
523 Ok(res)
524 };
525 Box::pin(fut)
526 }
527 "/kdo.v1.fund.FundService/ListFundTradingSnapshots" => {
528 #[allow(non_camel_case_types)]
529 struct ListFundTradingSnapshotsSvc<T: FundService>(pub Arc<T>);
530 impl<
531 T: FundService,
532 > tonic::server::UnaryService<super::ListFundTradingSnapshotsRequest>
533 for ListFundTradingSnapshotsSvc<T> {
534 type Response = super::ListFundTradingSnapshotsResponse;
535 type Future = BoxFuture<
536 tonic::Response<Self::Response>,
537 tonic::Status,
538 >;
539 fn call(
540 &mut self,
541 request: tonic::Request<
542 super::ListFundTradingSnapshotsRequest,
543 >,
544 ) -> Self::Future {
545 let inner = Arc::clone(&self.0);
546 let fut = async move {
547 <T as FundService>::list_fund_trading_snapshots(
548 &inner,
549 request,
550 )
551 .await
552 };
553 Box::pin(fut)
554 }
555 }
556 let accept_compression_encodings = self.accept_compression_encodings;
557 let send_compression_encodings = self.send_compression_encodings;
558 let max_decoding_message_size = self.max_decoding_message_size;
559 let max_encoding_message_size = self.max_encoding_message_size;
560 let inner = self.inner.clone();
561 let fut = async move {
562 let method = ListFundTradingSnapshotsSvc(inner);
563 let codec = tonic::codec::ProstCodec::default();
564 let mut grpc = tonic::server::Grpc::new(codec)
565 .apply_compression_config(
566 accept_compression_encodings,
567 send_compression_encodings,
568 )
569 .apply_max_message_size_config(
570 max_decoding_message_size,
571 max_encoding_message_size,
572 );
573 let res = grpc.unary(method, req).await;
574 Ok(res)
575 };
576 Box::pin(fut)
577 }
578 "/kdo.v1.fund.FundService/StreamFundTradingSnapshots" => {
579 #[allow(non_camel_case_types)]
580 struct StreamFundTradingSnapshotsSvc<T: FundService>(pub Arc<T>);
581 impl<
582 T: FundService,
583 > tonic::server::ServerStreamingService<
584 super::ListFundTradingSnapshotsRequest,
585 > for StreamFundTradingSnapshotsSvc<T> {
586 type Response = super::ListFundTradingSnapshotsResponse;
587 type ResponseStream = T::StreamFundTradingSnapshotsStream;
588 type Future = BoxFuture<
589 tonic::Response<Self::ResponseStream>,
590 tonic::Status,
591 >;
592 fn call(
593 &mut self,
594 request: tonic::Request<
595 super::ListFundTradingSnapshotsRequest,
596 >,
597 ) -> Self::Future {
598 let inner = Arc::clone(&self.0);
599 let fut = async move {
600 <T as FundService>::stream_fund_trading_snapshots(
601 &inner,
602 request,
603 )
604 .await
605 };
606 Box::pin(fut)
607 }
608 }
609 let accept_compression_encodings = self.accept_compression_encodings;
610 let send_compression_encodings = self.send_compression_encodings;
611 let max_decoding_message_size = self.max_decoding_message_size;
612 let max_encoding_message_size = self.max_encoding_message_size;
613 let inner = self.inner.clone();
614 let fut = async move {
615 let method = StreamFundTradingSnapshotsSvc(inner);
616 let codec = tonic::codec::ProstCodec::default();
617 let mut grpc = tonic::server::Grpc::new(codec)
618 .apply_compression_config(
619 accept_compression_encodings,
620 send_compression_encodings,
621 )
622 .apply_max_message_size_config(
623 max_decoding_message_size,
624 max_encoding_message_size,
625 );
626 let res = grpc.server_streaming(method, req).await;
627 Ok(res)
628 };
629 Box::pin(fut)
630 }
631 "/kdo.v1.fund.FundService/WatchLossLimitAlerts" => {
632 #[allow(non_camel_case_types)]
633 struct WatchLossLimitAlertsSvc<T: FundService>(pub Arc<T>);
634 impl<
635 T: FundService,
636 > tonic::server::ServerStreamingService<
637 super::WatchLossLimitAlertsRequest,
638 > for WatchLossLimitAlertsSvc<T> {
639 type Response = super::LossLimitAlert;
640 type ResponseStream = T::WatchLossLimitAlertsStream;
641 type Future = BoxFuture<
642 tonic::Response<Self::ResponseStream>,
643 tonic::Status,
644 >;
645 fn call(
646 &mut self,
647 request: tonic::Request<super::WatchLossLimitAlertsRequest>,
648 ) -> Self::Future {
649 let inner = Arc::clone(&self.0);
650 let fut = async move {
651 <T as FundService>::watch_loss_limit_alerts(&inner, request)
652 .await
653 };
654 Box::pin(fut)
655 }
656 }
657 let accept_compression_encodings = self.accept_compression_encodings;
658 let send_compression_encodings = self.send_compression_encodings;
659 let max_decoding_message_size = self.max_decoding_message_size;
660 let max_encoding_message_size = self.max_encoding_message_size;
661 let inner = self.inner.clone();
662 let fut = async move {
663 let method = WatchLossLimitAlertsSvc(inner);
664 let codec = tonic::codec::ProstCodec::default();
665 let mut grpc = tonic::server::Grpc::new(codec)
666 .apply_compression_config(
667 accept_compression_encodings,
668 send_compression_encodings,
669 )
670 .apply_max_message_size_config(
671 max_decoding_message_size,
672 max_encoding_message_size,
673 );
674 let res = grpc.server_streaming(method, req).await;
675 Ok(res)
676 };
677 Box::pin(fut)
678 }
679 _ => {
680 Box::pin(async move {
681 Ok(
682 http::Response::builder()
683 .status(200)
684 .header("grpc-status", tonic::Code::Unimplemented as i32)
685 .header(
686 http::header::CONTENT_TYPE,
687 tonic::metadata::GRPC_CONTENT_TYPE,
688 )
689 .body(empty_body())
690 .unwrap(),
691 )
692 })
693 }
694 }
695 }
696 }
697 impl<T: FundService> Clone for FundServiceServer<T> {
698 fn clone(&self) -> Self {
699 let inner = self.inner.clone();
700 Self {
701 inner,
702 accept_compression_encodings: self.accept_compression_encodings,
703 send_compression_encodings: self.send_compression_encodings,
704 max_decoding_message_size: self.max_decoding_message_size,
705 max_encoding_message_size: self.max_encoding_message_size,
706 }
707 }
708 }
709 impl<T: FundService> tonic::server::NamedService for FundServiceServer<T> {
710 const NAME: &'static str = "kdo.v1.fund.FundService";
711 }
712}