1#[derive(prost_helpers::AnyPB)]
4#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct TaskId {
6 #[prost(string, tag = "1")]
7 pub query_id: ::prost::alloc::string::String,
8 #[prost(uint32, tag = "2")]
9 pub stage_id: u32,
10 #[prost(uint32, tag = "3")]
11 pub task_id: u32,
12}
13#[derive(prost_helpers::AnyPB)]
14#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
15pub struct TaskInfoResponse {
16 #[prost(message, optional, tag = "1")]
17 pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
18 #[prost(enumeration = "task_info_response::TaskStatus", tag = "2")]
19 pub task_status: i32,
20 #[prost(string, tag = "3")]
22 pub error_message: ::prost::alloc::string::String,
23}
24pub mod task_info_response {
26 #[derive(prost_helpers::AnyPB)]
27 #[derive(
28 Clone,
29 Copy,
30 Debug,
31 PartialEq,
32 Eq,
33 Hash,
34 PartialOrd,
35 Ord,
36 ::prost::Enumeration
37 )]
38 #[repr(i32)]
39 pub enum TaskStatus {
40 Unspecified = 0,
42 Pending = 2,
43 Running = 3,
44 Finished = 6,
45 Failed = 7,
46 Aborted = 8,
47 Cancelled = 9,
48 Ping = 10,
49 }
50 impl TaskStatus {
51 pub fn as_str_name(&self) -> &'static str {
56 match self {
57 Self::Unspecified => "UNSPECIFIED",
58 Self::Pending => "PENDING",
59 Self::Running => "RUNNING",
60 Self::Finished => "FINISHED",
61 Self::Failed => "FAILED",
62 Self::Aborted => "ABORTED",
63 Self::Cancelled => "CANCELLED",
64 Self::Ping => "PING",
65 }
66 }
67 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
69 match value {
70 "UNSPECIFIED" => Some(Self::Unspecified),
71 "PENDING" => Some(Self::Pending),
72 "RUNNING" => Some(Self::Running),
73 "FINISHED" => Some(Self::Finished),
74 "FAILED" => Some(Self::Failed),
75 "ABORTED" => Some(Self::Aborted),
76 "CANCELLED" => Some(Self::Cancelled),
77 "PING" => Some(Self::Ping),
78 _ => None,
79 }
80 }
81 }
82}
83#[derive(prost_helpers::AnyPB)]
84#[derive(Clone, PartialEq, ::prost::Message)]
85pub struct CreateTaskRequest {
86 #[prost(message, optional, tag = "1")]
87 pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
88 #[prost(message, optional, tag = "2")]
89 pub plan: ::core::option::Option<super::batch_plan::PlanFragment>,
90 #[prost(map = "string, string", tag = "4")]
91 pub tracing_context: ::std::collections::HashMap<
92 ::prost::alloc::string::String,
93 ::prost::alloc::string::String,
94 >,
95 #[prost(message, optional, tag = "5")]
96 pub expr_context: ::core::option::Option<super::plan_common::ExprContext>,
97}
98#[derive(prost_helpers::AnyPB)]
99#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
100pub struct CancelTaskRequest {
101 #[prost(message, optional, tag = "1")]
102 pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
103}
104#[derive(prost_helpers::AnyPB)]
105#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
106pub struct CancelTaskResponse {
107 #[prost(message, optional, tag = "1")]
108 pub status: ::core::option::Option<super::common::Status>,
109}
110#[derive(prost_helpers::AnyPB)]
111#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
112pub struct GetTaskInfoRequest {
113 #[prost(message, optional, tag = "1")]
114 pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
115}
116#[derive(prost_helpers::AnyPB)]
117#[derive(Clone, PartialEq, ::prost::Message)]
118pub struct GetDataResponse {
119 #[prost(message, optional, tag = "2")]
120 pub record_batch: ::core::option::Option<super::data::DataChunk>,
121}
122#[derive(prost_helpers::AnyPB)]
123#[derive(Clone, PartialEq, ::prost::Message)]
124pub struct FastInsertRequest {
125 #[prost(uint32, tag = "1", wrapper = "crate::id::TableId")]
127 pub table_id: crate::id::TableId,
128 #[prost(uint64, tag = "2")]
130 pub table_version_id: u64,
131 #[prost(message, optional, tag = "4")]
132 pub data_chunk: ::core::option::Option<super::data::DataChunk>,
133 #[prost(uint32, optional, tag = "5")]
137 pub row_id_index: ::core::option::Option<u32>,
138 #[prost(uint32, tag = "6")]
140 pub request_id: u32,
141 #[prost(bool, tag = "7")]
143 pub wait_for_persistence: bool,
144}
145#[derive(prost_helpers::AnyPB)]
146#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
147pub struct FastInsertResponse {
148 #[prost(enumeration = "fast_insert_response::Status", tag = "1")]
149 pub status: i32,
150 #[prost(string, tag = "2")]
151 pub error_message: ::prost::alloc::string::String,
152}
153pub mod fast_insert_response {
155 #[derive(prost_helpers::AnyPB)]
156 #[derive(
157 Clone,
158 Copy,
159 Debug,
160 PartialEq,
161 Eq,
162 Hash,
163 PartialOrd,
164 Ord,
165 ::prost::Enumeration
166 )]
167 #[repr(i32)]
168 pub enum Status {
169 Unspecified = 0,
170 Succeeded = 1,
171 DmlFailed = 2,
172 }
173 impl Status {
174 pub fn as_str_name(&self) -> &'static str {
179 match self {
180 Self::Unspecified => "UNSPECIFIED",
181 Self::Succeeded => "SUCCEEDED",
182 Self::DmlFailed => "DML_FAILED",
183 }
184 }
185 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
187 match value {
188 "UNSPECIFIED" => Some(Self::Unspecified),
189 "SUCCEEDED" => Some(Self::Succeeded),
190 "DML_FAILED" => Some(Self::DmlFailed),
191 _ => None,
192 }
193 }
194 }
195}
196#[derive(prost_helpers::AnyPB)]
197#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
198pub struct IngestDmlInitRequest {
199 #[prost(uint32, tag = "1", wrapper = "crate::id::TableId")]
201 pub table_id: crate::id::TableId,
202 #[prost(uint64, tag = "2")]
204 pub table_version_id: u64,
205 #[prost(uint32, tag = "3")]
207 pub request_id: u32,
208 #[prost(uint32, optional, tag = "4")]
210 pub row_id_index: ::core::option::Option<u32>,
211}
212#[derive(prost_helpers::AnyPB)]
213#[derive(Clone, PartialEq, ::prost::Message)]
214pub struct IngestDmlPayloadRequest {
215 #[prost(uint64, tag = "1")]
217 pub dml_batch_id: u64,
218 #[prost(message, optional, tag = "2")]
220 pub chunk: ::core::option::Option<super::data::StreamChunk>,
221}
222#[derive(prost_helpers::AnyPB)]
223#[derive(Clone, PartialEq, ::prost::Message)]
224pub struct IngestDmlRequest {
225 #[prost(oneof = "ingest_dml_request::Request", tags = "1, 2")]
226 pub request: ::core::option::Option<ingest_dml_request::Request>,
227}
228pub mod ingest_dml_request {
230 #[derive(prost_helpers::AnyPB)]
231 #[derive(Clone, PartialEq, ::prost::Oneof)]
232 pub enum Request {
233 #[prost(message, tag = "1")]
234 Init(super::IngestDmlInitRequest),
235 #[prost(message, tag = "2")]
236 Payload(super::IngestDmlPayloadRequest),
237 }
238}
239#[derive(prost_helpers::AnyPB)]
240#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
241pub struct IngestDmlInitResponse {}
242#[derive(prost_helpers::AnyPB)]
243#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
244pub struct IngestDmlAckResponse {
245 #[prost(uint64, tag = "1")]
246 pub dml_batch_id: u64,
247}
248#[derive(prost_helpers::AnyPB)]
249#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
250pub struct IngestDmlResponse {
251 #[prost(oneof = "ingest_dml_response::Response", tags = "1, 2")]
252 pub response: ::core::option::Option<ingest_dml_response::Response>,
253}
254pub mod ingest_dml_response {
256 #[derive(prost_helpers::AnyPB)]
257 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
258 pub enum Response {
259 #[prost(message, tag = "1")]
260 Init(super::IngestDmlInitResponse),
261 #[prost(message, tag = "2")]
262 Ack(super::IngestDmlAckResponse),
263 }
264}
265#[derive(prost_helpers::AnyPB)]
266#[derive(Clone, PartialEq, ::prost::Message)]
267pub struct ExecuteRequest {
268 #[prost(message, optional, tag = "1")]
269 pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
270 #[prost(message, optional, tag = "2")]
271 pub plan: ::core::option::Option<super::batch_plan::PlanFragment>,
272 #[prost(map = "string, string", tag = "4")]
273 pub tracing_context: ::std::collections::HashMap<
274 ::prost::alloc::string::String,
275 ::prost::alloc::string::String,
276 >,
277 #[prost(message, optional, tag = "5")]
278 pub expr_context: ::core::option::Option<super::plan_common::ExprContext>,
279}
280#[derive(prost_helpers::AnyPB)]
281#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
282pub struct GetDataRequest {
283 #[prost(message, optional, tag = "1")]
284 pub task_output_id: ::core::option::Option<super::batch_plan::TaskOutputId>,
285}
286#[derive(prost_helpers::AnyPB)]
288#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
289pub struct Permits {
290 #[prost(oneof = "permits::Value", tags = "1, 2")]
291 pub value: ::core::option::Option<permits::Value>,
292}
293pub mod permits {
295 #[derive(prost_helpers::AnyPB)]
296 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
297 pub enum Value {
298 #[prost(uint32, tag = "1")]
300 Record(u32),
301 #[prost(uint32, tag = "2")]
303 Barrier(u32),
304 }
305}
306#[derive(prost_helpers::AnyPB)]
307#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
308pub struct GetStreamRequest {
309 #[prost(oneof = "get_stream_request::Value", tags = "1, 2")]
310 pub value: ::core::option::Option<get_stream_request::Value>,
311}
312pub mod get_stream_request {
314 #[derive(prost_helpers::AnyPB)]
315 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
316 pub struct Get {
317 #[prost(uint32, tag = "1", wrapper = "crate::id::ActorId")]
318 pub up_actor_id: crate::id::ActorId,
319 #[prost(uint32, tag = "2", wrapper = "crate::id::ActorId")]
320 pub down_actor_id: crate::id::ActorId,
321 #[prost(uint32, tag = "3", wrapper = "crate::id::FragmentId")]
322 pub up_fragment_id: crate::id::FragmentId,
323 #[prost(uint32, tag = "4", wrapper = "crate::id::FragmentId")]
324 pub down_fragment_id: crate::id::FragmentId,
325 #[prost(uint64, tag = "5", wrapper = "crate::id::PartialGraphId")]
326 pub up_partial_graph_id: crate::id::PartialGraphId,
327 #[prost(string, tag = "6")]
328 pub term_id: ::prost::alloc::string::String,
329 }
330 #[derive(prost_helpers::AnyPB)]
331 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
332 pub enum Value {
333 #[prost(message, tag = "1")]
335 Get(Get),
336 #[prost(message, tag = "2")]
338 AddPermits(super::Permits),
339 }
340}
341#[derive(prost_helpers::AnyPB)]
342#[derive(Clone, PartialEq, ::prost::Message)]
343pub struct GetStreamResponse {
344 #[prost(message, optional, tag = "1")]
345 pub message: ::core::option::Option<super::stream_plan::StreamMessageBatch>,
346 #[prost(message, optional, tag = "2")]
350 pub permits: ::core::option::Option<Permits>,
351}
352pub mod task_service_client {
354 #![allow(
355 unused_variables,
356 dead_code,
357 missing_docs,
358 clippy::wildcard_imports,
359 clippy::let_unit_value,
360 )]
361 use tonic::codegen::*;
362 use tonic::codegen::http::Uri;
363 #[derive(Debug, Clone)]
364 pub struct TaskServiceClient<T> {
365 inner: tonic::client::Grpc<T>,
366 }
367 impl TaskServiceClient<tonic::transport::Channel> {
368 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
370 where
371 D: TryInto<tonic::transport::Endpoint>,
372 D::Error: Into<StdError>,
373 {
374 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
375 Ok(Self::new(conn))
376 }
377 }
378 impl<T> TaskServiceClient<T>
379 where
380 T: tonic::client::GrpcService<tonic::body::Body>,
381 T::Error: Into<StdError>,
382 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
383 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
384 {
385 pub fn new(inner: T) -> Self {
386 let inner = tonic::client::Grpc::new(inner);
387 Self { inner }
388 }
389 pub fn with_origin(inner: T, origin: Uri) -> Self {
390 let inner = tonic::client::Grpc::with_origin(inner, origin);
391 Self { inner }
392 }
393 pub fn with_interceptor<F>(
394 inner: T,
395 interceptor: F,
396 ) -> TaskServiceClient<InterceptedService<T, F>>
397 where
398 F: tonic::service::Interceptor,
399 T::ResponseBody: Default,
400 T: tonic::codegen::Service<
401 http::Request<tonic::body::Body>,
402 Response = http::Response<
403 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
404 >,
405 >,
406 <T as tonic::codegen::Service<
407 http::Request<tonic::body::Body>,
408 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
409 {
410 TaskServiceClient::new(InterceptedService::new(inner, interceptor))
411 }
412 #[must_use]
417 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
418 self.inner = self.inner.send_compressed(encoding);
419 self
420 }
421 #[must_use]
423 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
424 self.inner = self.inner.accept_compressed(encoding);
425 self
426 }
427 #[must_use]
431 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
432 self.inner = self.inner.max_decoding_message_size(limit);
433 self
434 }
435 #[must_use]
439 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
440 self.inner = self.inner.max_encoding_message_size(limit);
441 self
442 }
443 pub async fn create_task(
444 &mut self,
445 request: impl tonic::IntoRequest<super::CreateTaskRequest>,
446 ) -> std::result::Result<
447 tonic::Response<tonic::codec::Streaming<super::TaskInfoResponse>>,
448 tonic::Status,
449 > {
450 self.inner
451 .ready()
452 .await
453 .map_err(|e| {
454 tonic::Status::unknown(
455 format!("Service was not ready: {}", e.into()),
456 )
457 })?;
458 let codec = tonic_prost::ProstCodec::default();
459 let path = http::uri::PathAndQuery::from_static(
460 "/task_service.TaskService/CreateTask",
461 );
462 let mut req = request.into_request();
463 req.extensions_mut()
464 .insert(GrpcMethod::new("task_service.TaskService", "CreateTask"));
465 self.inner.server_streaming(req, path, codec).await
466 }
467 pub async fn cancel_task(
469 &mut self,
470 request: impl tonic::IntoRequest<super::CancelTaskRequest>,
471 ) -> std::result::Result<
472 tonic::Response<super::CancelTaskResponse>,
473 tonic::Status,
474 > {
475 self.inner
476 .ready()
477 .await
478 .map_err(|e| {
479 tonic::Status::unknown(
480 format!("Service was not ready: {}", e.into()),
481 )
482 })?;
483 let codec = tonic_prost::ProstCodec::default();
484 let path = http::uri::PathAndQuery::from_static(
485 "/task_service.TaskService/CancelTask",
486 );
487 let mut req = request.into_request();
488 req.extensions_mut()
489 .insert(GrpcMethod::new("task_service.TaskService", "CancelTask"));
490 self.inner.unary(req, path, codec).await
491 }
492 pub async fn execute(
493 &mut self,
494 request: impl tonic::IntoRequest<super::ExecuteRequest>,
495 ) -> std::result::Result<
496 tonic::Response<tonic::codec::Streaming<super::GetDataResponse>>,
497 tonic::Status,
498 > {
499 self.inner
500 .ready()
501 .await
502 .map_err(|e| {
503 tonic::Status::unknown(
504 format!("Service was not ready: {}", e.into()),
505 )
506 })?;
507 let codec = tonic_prost::ProstCodec::default();
508 let path = http::uri::PathAndQuery::from_static(
509 "/task_service.TaskService/Execute",
510 );
511 let mut req = request.into_request();
512 req.extensions_mut()
513 .insert(GrpcMethod::new("task_service.TaskService", "Execute"));
514 self.inner.server_streaming(req, path, codec).await
515 }
516 pub async fn fast_insert(
518 &mut self,
519 request: impl tonic::IntoRequest<super::FastInsertRequest>,
520 ) -> std::result::Result<
521 tonic::Response<super::FastInsertResponse>,
522 tonic::Status,
523 > {
524 self.inner
525 .ready()
526 .await
527 .map_err(|e| {
528 tonic::Status::unknown(
529 format!("Service was not ready: {}", e.into()),
530 )
531 })?;
532 let codec = tonic_prost::ProstCodec::default();
533 let path = http::uri::PathAndQuery::from_static(
534 "/task_service.TaskService/FastInsert",
535 );
536 let mut req = request.into_request();
537 req.extensions_mut()
538 .insert(GrpcMethod::new("task_service.TaskService", "FastInsert"));
539 self.inner.unary(req, path, codec).await
540 }
541 pub async fn ingest_dml(
543 &mut self,
544 request: impl tonic::IntoStreamingRequest<Message = super::IngestDmlRequest>,
545 ) -> std::result::Result<
546 tonic::Response<tonic::codec::Streaming<super::IngestDmlResponse>>,
547 tonic::Status,
548 > {
549 self.inner
550 .ready()
551 .await
552 .map_err(|e| {
553 tonic::Status::unknown(
554 format!("Service was not ready: {}", e.into()),
555 )
556 })?;
557 let codec = tonic_prost::ProstCodec::default();
558 let path = http::uri::PathAndQuery::from_static(
559 "/task_service.TaskService/IngestDml",
560 );
561 let mut req = request.into_streaming_request();
562 req.extensions_mut()
563 .insert(GrpcMethod::new("task_service.TaskService", "IngestDml"));
564 self.inner.streaming(req, path, codec).await
565 }
566 }
567}
568pub mod task_service_server {
570 #![allow(
571 unused_variables,
572 dead_code,
573 missing_docs,
574 clippy::wildcard_imports,
575 clippy::let_unit_value,
576 )]
577 use tonic::codegen::*;
578 #[async_trait]
580 pub trait TaskService: std::marker::Send + std::marker::Sync + 'static {
581 type CreateTaskStream: tonic::codegen::tokio_stream::Stream<
583 Item = std::result::Result<super::TaskInfoResponse, tonic::Status>,
584 >
585 + std::marker::Send
586 + 'static;
587 async fn create_task(
588 &self,
589 request: tonic::Request<super::CreateTaskRequest>,
590 ) -> std::result::Result<tonic::Response<Self::CreateTaskStream>, tonic::Status>;
591 async fn cancel_task(
593 &self,
594 request: tonic::Request<super::CancelTaskRequest>,
595 ) -> std::result::Result<
596 tonic::Response<super::CancelTaskResponse>,
597 tonic::Status,
598 >;
599 type ExecuteStream: tonic::codegen::tokio_stream::Stream<
601 Item = std::result::Result<super::GetDataResponse, tonic::Status>,
602 >
603 + std::marker::Send
604 + 'static;
605 async fn execute(
606 &self,
607 request: tonic::Request<super::ExecuteRequest>,
608 ) -> std::result::Result<tonic::Response<Self::ExecuteStream>, tonic::Status>;
609 async fn fast_insert(
611 &self,
612 request: tonic::Request<super::FastInsertRequest>,
613 ) -> std::result::Result<
614 tonic::Response<super::FastInsertResponse>,
615 tonic::Status,
616 >;
617 type IngestDmlStream: tonic::codegen::tokio_stream::Stream<
619 Item = std::result::Result<super::IngestDmlResponse, tonic::Status>,
620 >
621 + std::marker::Send
622 + 'static;
623 async fn ingest_dml(
625 &self,
626 request: tonic::Request<tonic::Streaming<super::IngestDmlRequest>>,
627 ) -> std::result::Result<tonic::Response<Self::IngestDmlStream>, tonic::Status>;
628 }
629 #[derive(Debug)]
630 pub struct TaskServiceServer<T> {
631 inner: Arc<T>,
632 accept_compression_encodings: EnabledCompressionEncodings,
633 send_compression_encodings: EnabledCompressionEncodings,
634 max_decoding_message_size: Option<usize>,
635 max_encoding_message_size: Option<usize>,
636 }
637 impl<T> TaskServiceServer<T> {
638 pub fn new(inner: T) -> Self {
639 Self::from_arc(Arc::new(inner))
640 }
641 pub fn from_arc(inner: Arc<T>) -> Self {
642 Self {
643 inner,
644 accept_compression_encodings: Default::default(),
645 send_compression_encodings: Default::default(),
646 max_decoding_message_size: None,
647 max_encoding_message_size: None,
648 }
649 }
650 pub fn with_interceptor<F>(
651 inner: T,
652 interceptor: F,
653 ) -> InterceptedService<Self, F>
654 where
655 F: tonic::service::Interceptor,
656 {
657 InterceptedService::new(Self::new(inner), interceptor)
658 }
659 #[must_use]
661 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
662 self.accept_compression_encodings.enable(encoding);
663 self
664 }
665 #[must_use]
667 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
668 self.send_compression_encodings.enable(encoding);
669 self
670 }
671 #[must_use]
675 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
676 self.max_decoding_message_size = Some(limit);
677 self
678 }
679 #[must_use]
683 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
684 self.max_encoding_message_size = Some(limit);
685 self
686 }
687 }
688 impl<T, B> tonic::codegen::Service<http::Request<B>> for TaskServiceServer<T>
689 where
690 T: TaskService,
691 B: Body + std::marker::Send + 'static,
692 B::Error: Into<StdError> + std::marker::Send + 'static,
693 {
694 type Response = http::Response<tonic::body::Body>;
695 type Error = std::convert::Infallible;
696 type Future = BoxFuture<Self::Response, Self::Error>;
697 fn poll_ready(
698 &mut self,
699 _cx: &mut Context<'_>,
700 ) -> Poll<std::result::Result<(), Self::Error>> {
701 Poll::Ready(Ok(()))
702 }
703 fn call(&mut self, req: http::Request<B>) -> Self::Future {
704 match req.uri().path() {
705 "/task_service.TaskService/CreateTask" => {
706 #[allow(non_camel_case_types)]
707 struct CreateTaskSvc<T: TaskService>(pub Arc<T>);
708 impl<
709 T: TaskService,
710 > tonic::server::ServerStreamingService<super::CreateTaskRequest>
711 for CreateTaskSvc<T> {
712 type Response = super::TaskInfoResponse;
713 type ResponseStream = T::CreateTaskStream;
714 type Future = BoxFuture<
715 tonic::Response<Self::ResponseStream>,
716 tonic::Status,
717 >;
718 fn call(
719 &mut self,
720 request: tonic::Request<super::CreateTaskRequest>,
721 ) -> Self::Future {
722 let inner = Arc::clone(&self.0);
723 let fut = async move {
724 <T as TaskService>::create_task(&inner, request).await
725 };
726 Box::pin(fut)
727 }
728 }
729 let accept_compression_encodings = self.accept_compression_encodings;
730 let send_compression_encodings = self.send_compression_encodings;
731 let max_decoding_message_size = self.max_decoding_message_size;
732 let max_encoding_message_size = self.max_encoding_message_size;
733 let inner = self.inner.clone();
734 let fut = async move {
735 let method = CreateTaskSvc(inner);
736 let codec = tonic_prost::ProstCodec::default();
737 let mut grpc = tonic::server::Grpc::new(codec)
738 .apply_compression_config(
739 accept_compression_encodings,
740 send_compression_encodings,
741 )
742 .apply_max_message_size_config(
743 max_decoding_message_size,
744 max_encoding_message_size,
745 );
746 let res = grpc.server_streaming(method, req).await;
747 Ok(res)
748 };
749 Box::pin(fut)
750 }
751 "/task_service.TaskService/CancelTask" => {
752 #[allow(non_camel_case_types)]
753 struct CancelTaskSvc<T: TaskService>(pub Arc<T>);
754 impl<
755 T: TaskService,
756 > tonic::server::UnaryService<super::CancelTaskRequest>
757 for CancelTaskSvc<T> {
758 type Response = super::CancelTaskResponse;
759 type Future = BoxFuture<
760 tonic::Response<Self::Response>,
761 tonic::Status,
762 >;
763 fn call(
764 &mut self,
765 request: tonic::Request<super::CancelTaskRequest>,
766 ) -> Self::Future {
767 let inner = Arc::clone(&self.0);
768 let fut = async move {
769 <T as TaskService>::cancel_task(&inner, request).await
770 };
771 Box::pin(fut)
772 }
773 }
774 let accept_compression_encodings = self.accept_compression_encodings;
775 let send_compression_encodings = self.send_compression_encodings;
776 let max_decoding_message_size = self.max_decoding_message_size;
777 let max_encoding_message_size = self.max_encoding_message_size;
778 let inner = self.inner.clone();
779 let fut = async move {
780 let method = CancelTaskSvc(inner);
781 let codec = tonic_prost::ProstCodec::default();
782 let mut grpc = tonic::server::Grpc::new(codec)
783 .apply_compression_config(
784 accept_compression_encodings,
785 send_compression_encodings,
786 )
787 .apply_max_message_size_config(
788 max_decoding_message_size,
789 max_encoding_message_size,
790 );
791 let res = grpc.unary(method, req).await;
792 Ok(res)
793 };
794 Box::pin(fut)
795 }
796 "/task_service.TaskService/Execute" => {
797 #[allow(non_camel_case_types)]
798 struct ExecuteSvc<T: TaskService>(pub Arc<T>);
799 impl<
800 T: TaskService,
801 > tonic::server::ServerStreamingService<super::ExecuteRequest>
802 for ExecuteSvc<T> {
803 type Response = super::GetDataResponse;
804 type ResponseStream = T::ExecuteStream;
805 type Future = BoxFuture<
806 tonic::Response<Self::ResponseStream>,
807 tonic::Status,
808 >;
809 fn call(
810 &mut self,
811 request: tonic::Request<super::ExecuteRequest>,
812 ) -> Self::Future {
813 let inner = Arc::clone(&self.0);
814 let fut = async move {
815 <T as TaskService>::execute(&inner, request).await
816 };
817 Box::pin(fut)
818 }
819 }
820 let accept_compression_encodings = self.accept_compression_encodings;
821 let send_compression_encodings = self.send_compression_encodings;
822 let max_decoding_message_size = self.max_decoding_message_size;
823 let max_encoding_message_size = self.max_encoding_message_size;
824 let inner = self.inner.clone();
825 let fut = async move {
826 let method = ExecuteSvc(inner);
827 let codec = tonic_prost::ProstCodec::default();
828 let mut grpc = tonic::server::Grpc::new(codec)
829 .apply_compression_config(
830 accept_compression_encodings,
831 send_compression_encodings,
832 )
833 .apply_max_message_size_config(
834 max_decoding_message_size,
835 max_encoding_message_size,
836 );
837 let res = grpc.server_streaming(method, req).await;
838 Ok(res)
839 };
840 Box::pin(fut)
841 }
842 "/task_service.TaskService/FastInsert" => {
843 #[allow(non_camel_case_types)]
844 struct FastInsertSvc<T: TaskService>(pub Arc<T>);
845 impl<
846 T: TaskService,
847 > tonic::server::UnaryService<super::FastInsertRequest>
848 for FastInsertSvc<T> {
849 type Response = super::FastInsertResponse;
850 type Future = BoxFuture<
851 tonic::Response<Self::Response>,
852 tonic::Status,
853 >;
854 fn call(
855 &mut self,
856 request: tonic::Request<super::FastInsertRequest>,
857 ) -> Self::Future {
858 let inner = Arc::clone(&self.0);
859 let fut = async move {
860 <T as TaskService>::fast_insert(&inner, request).await
861 };
862 Box::pin(fut)
863 }
864 }
865 let accept_compression_encodings = self.accept_compression_encodings;
866 let send_compression_encodings = self.send_compression_encodings;
867 let max_decoding_message_size = self.max_decoding_message_size;
868 let max_encoding_message_size = self.max_encoding_message_size;
869 let inner = self.inner.clone();
870 let fut = async move {
871 let method = FastInsertSvc(inner);
872 let codec = tonic_prost::ProstCodec::default();
873 let mut grpc = tonic::server::Grpc::new(codec)
874 .apply_compression_config(
875 accept_compression_encodings,
876 send_compression_encodings,
877 )
878 .apply_max_message_size_config(
879 max_decoding_message_size,
880 max_encoding_message_size,
881 );
882 let res = grpc.unary(method, req).await;
883 Ok(res)
884 };
885 Box::pin(fut)
886 }
887 "/task_service.TaskService/IngestDml" => {
888 #[allow(non_camel_case_types)]
889 struct IngestDmlSvc<T: TaskService>(pub Arc<T>);
890 impl<
891 T: TaskService,
892 > tonic::server::StreamingService<super::IngestDmlRequest>
893 for IngestDmlSvc<T> {
894 type Response = super::IngestDmlResponse;
895 type ResponseStream = T::IngestDmlStream;
896 type Future = BoxFuture<
897 tonic::Response<Self::ResponseStream>,
898 tonic::Status,
899 >;
900 fn call(
901 &mut self,
902 request: tonic::Request<
903 tonic::Streaming<super::IngestDmlRequest>,
904 >,
905 ) -> Self::Future {
906 let inner = Arc::clone(&self.0);
907 let fut = async move {
908 <T as TaskService>::ingest_dml(&inner, request).await
909 };
910 Box::pin(fut)
911 }
912 }
913 let accept_compression_encodings = self.accept_compression_encodings;
914 let send_compression_encodings = self.send_compression_encodings;
915 let max_decoding_message_size = self.max_decoding_message_size;
916 let max_encoding_message_size = self.max_encoding_message_size;
917 let inner = self.inner.clone();
918 let fut = async move {
919 let method = IngestDmlSvc(inner);
920 let codec = tonic_prost::ProstCodec::default();
921 let mut grpc = tonic::server::Grpc::new(codec)
922 .apply_compression_config(
923 accept_compression_encodings,
924 send_compression_encodings,
925 )
926 .apply_max_message_size_config(
927 max_decoding_message_size,
928 max_encoding_message_size,
929 );
930 let res = grpc.streaming(method, req).await;
931 Ok(res)
932 };
933 Box::pin(fut)
934 }
935 _ => {
936 Box::pin(async move {
937 let mut response = http::Response::new(
938 tonic::body::Body::default(),
939 );
940 let headers = response.headers_mut();
941 headers
942 .insert(
943 tonic::Status::GRPC_STATUS,
944 (tonic::Code::Unimplemented as i32).into(),
945 );
946 headers
947 .insert(
948 http::header::CONTENT_TYPE,
949 tonic::metadata::GRPC_CONTENT_TYPE,
950 );
951 Ok(response)
952 })
953 }
954 }
955 }
956 }
957 impl<T> Clone for TaskServiceServer<T> {
958 fn clone(&self) -> Self {
959 let inner = self.inner.clone();
960 Self {
961 inner,
962 accept_compression_encodings: self.accept_compression_encodings,
963 send_compression_encodings: self.send_compression_encodings,
964 max_decoding_message_size: self.max_decoding_message_size,
965 max_encoding_message_size: self.max_encoding_message_size,
966 }
967 }
968 }
969 pub const SERVICE_NAME: &str = "task_service.TaskService";
971 impl<T> tonic::server::NamedService for TaskServiceServer<T> {
972 const NAME: &'static str = SERVICE_NAME;
973 }
974}
975pub mod batch_exchange_service_client {
977 #![allow(
978 unused_variables,
979 dead_code,
980 missing_docs,
981 clippy::wildcard_imports,
982 clippy::let_unit_value,
983 )]
984 use tonic::codegen::*;
985 use tonic::codegen::http::Uri;
986 #[derive(Debug, Clone)]
987 pub struct BatchExchangeServiceClient<T> {
988 inner: tonic::client::Grpc<T>,
989 }
990 impl BatchExchangeServiceClient<tonic::transport::Channel> {
991 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
993 where
994 D: TryInto<tonic::transport::Endpoint>,
995 D::Error: Into<StdError>,
996 {
997 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
998 Ok(Self::new(conn))
999 }
1000 }
1001 impl<T> BatchExchangeServiceClient<T>
1002 where
1003 T: tonic::client::GrpcService<tonic::body::Body>,
1004 T::Error: Into<StdError>,
1005 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1006 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1007 {
1008 pub fn new(inner: T) -> Self {
1009 let inner = tonic::client::Grpc::new(inner);
1010 Self { inner }
1011 }
1012 pub fn with_origin(inner: T, origin: Uri) -> Self {
1013 let inner = tonic::client::Grpc::with_origin(inner, origin);
1014 Self { inner }
1015 }
1016 pub fn with_interceptor<F>(
1017 inner: T,
1018 interceptor: F,
1019 ) -> BatchExchangeServiceClient<InterceptedService<T, F>>
1020 where
1021 F: tonic::service::Interceptor,
1022 T::ResponseBody: Default,
1023 T: tonic::codegen::Service<
1024 http::Request<tonic::body::Body>,
1025 Response = http::Response<
1026 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1027 >,
1028 >,
1029 <T as tonic::codegen::Service<
1030 http::Request<tonic::body::Body>,
1031 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1032 {
1033 BatchExchangeServiceClient::new(InterceptedService::new(inner, interceptor))
1034 }
1035 #[must_use]
1040 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1041 self.inner = self.inner.send_compressed(encoding);
1042 self
1043 }
1044 #[must_use]
1046 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1047 self.inner = self.inner.accept_compressed(encoding);
1048 self
1049 }
1050 #[must_use]
1054 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1055 self.inner = self.inner.max_decoding_message_size(limit);
1056 self
1057 }
1058 #[must_use]
1062 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1063 self.inner = self.inner.max_encoding_message_size(limit);
1064 self
1065 }
1066 pub async fn get_data(
1067 &mut self,
1068 request: impl tonic::IntoRequest<super::GetDataRequest>,
1069 ) -> std::result::Result<
1070 tonic::Response<tonic::codec::Streaming<super::GetDataResponse>>,
1071 tonic::Status,
1072 > {
1073 self.inner
1074 .ready()
1075 .await
1076 .map_err(|e| {
1077 tonic::Status::unknown(
1078 format!("Service was not ready: {}", e.into()),
1079 )
1080 })?;
1081 let codec = tonic_prost::ProstCodec::default();
1082 let path = http::uri::PathAndQuery::from_static(
1083 "/task_service.BatchExchangeService/GetData",
1084 );
1085 let mut req = request.into_request();
1086 req.extensions_mut()
1087 .insert(GrpcMethod::new("task_service.BatchExchangeService", "GetData"));
1088 self.inner.server_streaming(req, path, codec).await
1089 }
1090 }
1091}
1092pub mod batch_exchange_service_server {
1094 #![allow(
1095 unused_variables,
1096 dead_code,
1097 missing_docs,
1098 clippy::wildcard_imports,
1099 clippy::let_unit_value,
1100 )]
1101 use tonic::codegen::*;
1102 #[async_trait]
1104 pub trait BatchExchangeService: std::marker::Send + std::marker::Sync + 'static {
1105 type GetDataStream: tonic::codegen::tokio_stream::Stream<
1107 Item = std::result::Result<super::GetDataResponse, tonic::Status>,
1108 >
1109 + std::marker::Send
1110 + 'static;
1111 async fn get_data(
1112 &self,
1113 request: tonic::Request<super::GetDataRequest>,
1114 ) -> std::result::Result<tonic::Response<Self::GetDataStream>, tonic::Status>;
1115 }
1116 #[derive(Debug)]
1117 pub struct BatchExchangeServiceServer<T> {
1118 inner: Arc<T>,
1119 accept_compression_encodings: EnabledCompressionEncodings,
1120 send_compression_encodings: EnabledCompressionEncodings,
1121 max_decoding_message_size: Option<usize>,
1122 max_encoding_message_size: Option<usize>,
1123 }
1124 impl<T> BatchExchangeServiceServer<T> {
1125 pub fn new(inner: T) -> Self {
1126 Self::from_arc(Arc::new(inner))
1127 }
1128 pub fn from_arc(inner: Arc<T>) -> Self {
1129 Self {
1130 inner,
1131 accept_compression_encodings: Default::default(),
1132 send_compression_encodings: Default::default(),
1133 max_decoding_message_size: None,
1134 max_encoding_message_size: None,
1135 }
1136 }
1137 pub fn with_interceptor<F>(
1138 inner: T,
1139 interceptor: F,
1140 ) -> InterceptedService<Self, F>
1141 where
1142 F: tonic::service::Interceptor,
1143 {
1144 InterceptedService::new(Self::new(inner), interceptor)
1145 }
1146 #[must_use]
1148 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1149 self.accept_compression_encodings.enable(encoding);
1150 self
1151 }
1152 #[must_use]
1154 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1155 self.send_compression_encodings.enable(encoding);
1156 self
1157 }
1158 #[must_use]
1162 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1163 self.max_decoding_message_size = Some(limit);
1164 self
1165 }
1166 #[must_use]
1170 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1171 self.max_encoding_message_size = Some(limit);
1172 self
1173 }
1174 }
1175 impl<T, B> tonic::codegen::Service<http::Request<B>>
1176 for BatchExchangeServiceServer<T>
1177 where
1178 T: BatchExchangeService,
1179 B: Body + std::marker::Send + 'static,
1180 B::Error: Into<StdError> + std::marker::Send + 'static,
1181 {
1182 type Response = http::Response<tonic::body::Body>;
1183 type Error = std::convert::Infallible;
1184 type Future = BoxFuture<Self::Response, Self::Error>;
1185 fn poll_ready(
1186 &mut self,
1187 _cx: &mut Context<'_>,
1188 ) -> Poll<std::result::Result<(), Self::Error>> {
1189 Poll::Ready(Ok(()))
1190 }
1191 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1192 match req.uri().path() {
1193 "/task_service.BatchExchangeService/GetData" => {
1194 #[allow(non_camel_case_types)]
1195 struct GetDataSvc<T: BatchExchangeService>(pub Arc<T>);
1196 impl<
1197 T: BatchExchangeService,
1198 > tonic::server::ServerStreamingService<super::GetDataRequest>
1199 for GetDataSvc<T> {
1200 type Response = super::GetDataResponse;
1201 type ResponseStream = T::GetDataStream;
1202 type Future = BoxFuture<
1203 tonic::Response<Self::ResponseStream>,
1204 tonic::Status,
1205 >;
1206 fn call(
1207 &mut self,
1208 request: tonic::Request<super::GetDataRequest>,
1209 ) -> Self::Future {
1210 let inner = Arc::clone(&self.0);
1211 let fut = async move {
1212 <T as BatchExchangeService>::get_data(&inner, request).await
1213 };
1214 Box::pin(fut)
1215 }
1216 }
1217 let accept_compression_encodings = self.accept_compression_encodings;
1218 let send_compression_encodings = self.send_compression_encodings;
1219 let max_decoding_message_size = self.max_decoding_message_size;
1220 let max_encoding_message_size = self.max_encoding_message_size;
1221 let inner = self.inner.clone();
1222 let fut = async move {
1223 let method = GetDataSvc(inner);
1224 let codec = tonic_prost::ProstCodec::default();
1225 let mut grpc = tonic::server::Grpc::new(codec)
1226 .apply_compression_config(
1227 accept_compression_encodings,
1228 send_compression_encodings,
1229 )
1230 .apply_max_message_size_config(
1231 max_decoding_message_size,
1232 max_encoding_message_size,
1233 );
1234 let res = grpc.server_streaming(method, req).await;
1235 Ok(res)
1236 };
1237 Box::pin(fut)
1238 }
1239 _ => {
1240 Box::pin(async move {
1241 let mut response = http::Response::new(
1242 tonic::body::Body::default(),
1243 );
1244 let headers = response.headers_mut();
1245 headers
1246 .insert(
1247 tonic::Status::GRPC_STATUS,
1248 (tonic::Code::Unimplemented as i32).into(),
1249 );
1250 headers
1251 .insert(
1252 http::header::CONTENT_TYPE,
1253 tonic::metadata::GRPC_CONTENT_TYPE,
1254 );
1255 Ok(response)
1256 })
1257 }
1258 }
1259 }
1260 }
1261 impl<T> Clone for BatchExchangeServiceServer<T> {
1262 fn clone(&self) -> Self {
1263 let inner = self.inner.clone();
1264 Self {
1265 inner,
1266 accept_compression_encodings: self.accept_compression_encodings,
1267 send_compression_encodings: self.send_compression_encodings,
1268 max_decoding_message_size: self.max_decoding_message_size,
1269 max_encoding_message_size: self.max_encoding_message_size,
1270 }
1271 }
1272 }
1273 pub const SERVICE_NAME: &str = "task_service.BatchExchangeService";
1275 impl<T> tonic::server::NamedService for BatchExchangeServiceServer<T> {
1276 const NAME: &'static str = SERVICE_NAME;
1277 }
1278}
1279pub mod stream_exchange_service_client {
1281 #![allow(
1282 unused_variables,
1283 dead_code,
1284 missing_docs,
1285 clippy::wildcard_imports,
1286 clippy::let_unit_value,
1287 )]
1288 use tonic::codegen::*;
1289 use tonic::codegen::http::Uri;
1290 #[derive(Debug, Clone)]
1291 pub struct StreamExchangeServiceClient<T> {
1292 inner: tonic::client::Grpc<T>,
1293 }
1294 impl StreamExchangeServiceClient<tonic::transport::Channel> {
1295 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1297 where
1298 D: TryInto<tonic::transport::Endpoint>,
1299 D::Error: Into<StdError>,
1300 {
1301 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1302 Ok(Self::new(conn))
1303 }
1304 }
1305 impl<T> StreamExchangeServiceClient<T>
1306 where
1307 T: tonic::client::GrpcService<tonic::body::Body>,
1308 T::Error: Into<StdError>,
1309 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1310 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1311 {
1312 pub fn new(inner: T) -> Self {
1313 let inner = tonic::client::Grpc::new(inner);
1314 Self { inner }
1315 }
1316 pub fn with_origin(inner: T, origin: Uri) -> Self {
1317 let inner = tonic::client::Grpc::with_origin(inner, origin);
1318 Self { inner }
1319 }
1320 pub fn with_interceptor<F>(
1321 inner: T,
1322 interceptor: F,
1323 ) -> StreamExchangeServiceClient<InterceptedService<T, F>>
1324 where
1325 F: tonic::service::Interceptor,
1326 T::ResponseBody: Default,
1327 T: tonic::codegen::Service<
1328 http::Request<tonic::body::Body>,
1329 Response = http::Response<
1330 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1331 >,
1332 >,
1333 <T as tonic::codegen::Service<
1334 http::Request<tonic::body::Body>,
1335 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1336 {
1337 StreamExchangeServiceClient::new(InterceptedService::new(inner, interceptor))
1338 }
1339 #[must_use]
1344 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1345 self.inner = self.inner.send_compressed(encoding);
1346 self
1347 }
1348 #[must_use]
1350 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1351 self.inner = self.inner.accept_compressed(encoding);
1352 self
1353 }
1354 #[must_use]
1358 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1359 self.inner = self.inner.max_decoding_message_size(limit);
1360 self
1361 }
1362 #[must_use]
1366 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1367 self.inner = self.inner.max_encoding_message_size(limit);
1368 self
1369 }
1370 pub async fn get_stream(
1371 &mut self,
1372 request: impl tonic::IntoStreamingRequest<Message = super::GetStreamRequest>,
1373 ) -> std::result::Result<
1374 tonic::Response<tonic::codec::Streaming<super::GetStreamResponse>>,
1375 tonic::Status,
1376 > {
1377 self.inner
1378 .ready()
1379 .await
1380 .map_err(|e| {
1381 tonic::Status::unknown(
1382 format!("Service was not ready: {}", e.into()),
1383 )
1384 })?;
1385 let codec = tonic_prost::ProstCodec::default();
1386 let path = http::uri::PathAndQuery::from_static(
1387 "/task_service.StreamExchangeService/GetStream",
1388 );
1389 let mut req = request.into_streaming_request();
1390 req.extensions_mut()
1391 .insert(
1392 GrpcMethod::new("task_service.StreamExchangeService", "GetStream"),
1393 );
1394 self.inner.streaming(req, path, codec).await
1395 }
1396 }
1397}
1398pub mod stream_exchange_service_server {
1400 #![allow(
1401 unused_variables,
1402 dead_code,
1403 missing_docs,
1404 clippy::wildcard_imports,
1405 clippy::let_unit_value,
1406 )]
1407 use tonic::codegen::*;
1408 #[async_trait]
1410 pub trait StreamExchangeService: std::marker::Send + std::marker::Sync + 'static {
1411 type GetStreamStream: tonic::codegen::tokio_stream::Stream<
1413 Item = std::result::Result<super::GetStreamResponse, tonic::Status>,
1414 >
1415 + std::marker::Send
1416 + 'static;
1417 async fn get_stream(
1418 &self,
1419 request: tonic::Request<tonic::Streaming<super::GetStreamRequest>>,
1420 ) -> std::result::Result<tonic::Response<Self::GetStreamStream>, tonic::Status>;
1421 }
1422 #[derive(Debug)]
1423 pub struct StreamExchangeServiceServer<T> {
1424 inner: Arc<T>,
1425 accept_compression_encodings: EnabledCompressionEncodings,
1426 send_compression_encodings: EnabledCompressionEncodings,
1427 max_decoding_message_size: Option<usize>,
1428 max_encoding_message_size: Option<usize>,
1429 }
1430 impl<T> StreamExchangeServiceServer<T> {
1431 pub fn new(inner: T) -> Self {
1432 Self::from_arc(Arc::new(inner))
1433 }
1434 pub fn from_arc(inner: Arc<T>) -> Self {
1435 Self {
1436 inner,
1437 accept_compression_encodings: Default::default(),
1438 send_compression_encodings: Default::default(),
1439 max_decoding_message_size: None,
1440 max_encoding_message_size: None,
1441 }
1442 }
1443 pub fn with_interceptor<F>(
1444 inner: T,
1445 interceptor: F,
1446 ) -> InterceptedService<Self, F>
1447 where
1448 F: tonic::service::Interceptor,
1449 {
1450 InterceptedService::new(Self::new(inner), interceptor)
1451 }
1452 #[must_use]
1454 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1455 self.accept_compression_encodings.enable(encoding);
1456 self
1457 }
1458 #[must_use]
1460 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1461 self.send_compression_encodings.enable(encoding);
1462 self
1463 }
1464 #[must_use]
1468 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1469 self.max_decoding_message_size = Some(limit);
1470 self
1471 }
1472 #[must_use]
1476 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1477 self.max_encoding_message_size = Some(limit);
1478 self
1479 }
1480 }
1481 impl<T, B> tonic::codegen::Service<http::Request<B>>
1482 for StreamExchangeServiceServer<T>
1483 where
1484 T: StreamExchangeService,
1485 B: Body + std::marker::Send + 'static,
1486 B::Error: Into<StdError> + std::marker::Send + 'static,
1487 {
1488 type Response = http::Response<tonic::body::Body>;
1489 type Error = std::convert::Infallible;
1490 type Future = BoxFuture<Self::Response, Self::Error>;
1491 fn poll_ready(
1492 &mut self,
1493 _cx: &mut Context<'_>,
1494 ) -> Poll<std::result::Result<(), Self::Error>> {
1495 Poll::Ready(Ok(()))
1496 }
1497 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1498 match req.uri().path() {
1499 "/task_service.StreamExchangeService/GetStream" => {
1500 #[allow(non_camel_case_types)]
1501 struct GetStreamSvc<T: StreamExchangeService>(pub Arc<T>);
1502 impl<
1503 T: StreamExchangeService,
1504 > tonic::server::StreamingService<super::GetStreamRequest>
1505 for GetStreamSvc<T> {
1506 type Response = super::GetStreamResponse;
1507 type ResponseStream = T::GetStreamStream;
1508 type Future = BoxFuture<
1509 tonic::Response<Self::ResponseStream>,
1510 tonic::Status,
1511 >;
1512 fn call(
1513 &mut self,
1514 request: tonic::Request<
1515 tonic::Streaming<super::GetStreamRequest>,
1516 >,
1517 ) -> Self::Future {
1518 let inner = Arc::clone(&self.0);
1519 let fut = async move {
1520 <T as StreamExchangeService>::get_stream(&inner, request)
1521 .await
1522 };
1523 Box::pin(fut)
1524 }
1525 }
1526 let accept_compression_encodings = self.accept_compression_encodings;
1527 let send_compression_encodings = self.send_compression_encodings;
1528 let max_decoding_message_size = self.max_decoding_message_size;
1529 let max_encoding_message_size = self.max_encoding_message_size;
1530 let inner = self.inner.clone();
1531 let fut = async move {
1532 let method = GetStreamSvc(inner);
1533 let codec = tonic_prost::ProstCodec::default();
1534 let mut grpc = tonic::server::Grpc::new(codec)
1535 .apply_compression_config(
1536 accept_compression_encodings,
1537 send_compression_encodings,
1538 )
1539 .apply_max_message_size_config(
1540 max_decoding_message_size,
1541 max_encoding_message_size,
1542 );
1543 let res = grpc.streaming(method, req).await;
1544 Ok(res)
1545 };
1546 Box::pin(fut)
1547 }
1548 _ => {
1549 Box::pin(async move {
1550 let mut response = http::Response::new(
1551 tonic::body::Body::default(),
1552 );
1553 let headers = response.headers_mut();
1554 headers
1555 .insert(
1556 tonic::Status::GRPC_STATUS,
1557 (tonic::Code::Unimplemented as i32).into(),
1558 );
1559 headers
1560 .insert(
1561 http::header::CONTENT_TYPE,
1562 tonic::metadata::GRPC_CONTENT_TYPE,
1563 );
1564 Ok(response)
1565 })
1566 }
1567 }
1568 }
1569 }
1570 impl<T> Clone for StreamExchangeServiceServer<T> {
1571 fn clone(&self) -> Self {
1572 let inner = self.inner.clone();
1573 Self {
1574 inner,
1575 accept_compression_encodings: self.accept_compression_encodings,
1576 send_compression_encodings: self.send_compression_encodings,
1577 max_decoding_message_size: self.max_decoding_message_size,
1578 max_encoding_message_size: self.max_encoding_message_size,
1579 }
1580 }
1581 }
1582 pub const SERVICE_NAME: &str = "task_service.StreamExchangeService";
1584 impl<T> tonic::server::NamedService for StreamExchangeServiceServer<T> {
1585 const NAME: &'static str = SERVICE_NAME;
1586 }
1587}