risingwave_pb/
task_service.rs

1// This file is @generated by prost-build.
2/// Task is a running instance of Stage.
3#[derive(prost_helpers::AnyPB)]
4#[derive(Clone, PartialEq, ::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, ::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    /// Optional error message for failed task.
21    #[prost(string, tag = "3")]
22    pub error_message: ::prost::alloc::string::String,
23}
24/// Nested message and enum types in `TaskInfoResponse`.
25pub 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        /// Note: Requirement of proto3: first enum must be 0.
41        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        /// String value of the enum field names used in the ProtoBuf definition.
52        ///
53        /// The values are not transformed in any way and thus are considered stable
54        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
55        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        /// Creates an enum from field names used in the ProtoBuf definition.
68        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(message, optional, tag = "3")]
91    pub epoch: ::core::option::Option<super::common::BatchQueryEpoch>,
92    #[prost(map = "string, string", tag = "4")]
93    pub tracing_context: ::std::collections::HashMap<
94        ::prost::alloc::string::String,
95        ::prost::alloc::string::String,
96    >,
97    #[prost(message, optional, tag = "5")]
98    pub expr_context: ::core::option::Option<super::plan_common::ExprContext>,
99}
100#[derive(prost_helpers::AnyPB)]
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct CancelTaskRequest {
103    #[prost(message, optional, tag = "1")]
104    pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
105}
106#[derive(prost_helpers::AnyPB)]
107#[derive(Clone, PartialEq, ::prost::Message)]
108pub struct CancelTaskResponse {
109    #[prost(message, optional, tag = "1")]
110    pub status: ::core::option::Option<super::common::Status>,
111}
112#[derive(prost_helpers::AnyPB)]
113#[derive(Clone, PartialEq, ::prost::Message)]
114pub struct GetTaskInfoRequest {
115    #[prost(message, optional, tag = "1")]
116    pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
117}
118#[derive(prost_helpers::AnyPB)]
119#[derive(Clone, PartialEq, ::prost::Message)]
120pub struct GetDataResponse {
121    #[prost(message, optional, tag = "2")]
122    pub record_batch: ::core::option::Option<super::data::DataChunk>,
123}
124#[derive(prost_helpers::AnyPB)]
125#[derive(Clone, PartialEq, ::prost::Message)]
126pub struct FastInsertRequest {
127    /// Id of the table to perform inserting.
128    #[prost(uint32, tag = "1")]
129    pub table_id: u32,
130    /// Version of the table.
131    #[prost(uint64, tag = "2")]
132    pub table_version_id: u64,
133    #[prost(uint32, repeated, tag = "3")]
134    pub column_indices: ::prost::alloc::vec::Vec<u32>,
135    #[prost(message, optional, tag = "4")]
136    pub data_chunk: ::core::option::Option<super::data::DataChunk>,
137    /// An optional field and will be `None` for tables without user-defined pk.
138    /// The `BatchInsertExecutor` should add a column with NULL value which will
139    /// be filled in streaming.
140    #[prost(uint32, optional, tag = "5")]
141    pub row_id_index: ::core::option::Option<u32>,
142    /// Use this number to assign the insert req to different worker nodes and dml channels.
143    #[prost(uint32, tag = "6")]
144    pub request_id: u32,
145    /// TODO(kexiang): add support for default columns. plan_common.ExprContext expr_context is needed for it.
146    #[prost(bool, tag = "7")]
147    pub wait_for_persistence: bool,
148}
149#[derive(prost_helpers::AnyPB)]
150#[derive(Clone, PartialEq, ::prost::Message)]
151pub struct FastInsertResponse {
152    #[prost(enumeration = "fast_insert_response::Status", tag = "1")]
153    pub status: i32,
154    #[prost(string, tag = "2")]
155    pub error_message: ::prost::alloc::string::String,
156}
157/// Nested message and enum types in `FastInsertResponse`.
158pub mod fast_insert_response {
159    #[derive(prost_helpers::AnyPB)]
160    #[derive(
161        Clone,
162        Copy,
163        Debug,
164        PartialEq,
165        Eq,
166        Hash,
167        PartialOrd,
168        Ord,
169        ::prost::Enumeration
170    )]
171    #[repr(i32)]
172    pub enum Status {
173        Unspecified = 0,
174        Succeeded = 1,
175        DmlFailed = 2,
176    }
177    impl Status {
178        /// String value of the enum field names used in the ProtoBuf definition.
179        ///
180        /// The values are not transformed in any way and thus are considered stable
181        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
182        pub fn as_str_name(&self) -> &'static str {
183            match self {
184                Self::Unspecified => "UNSPECIFIED",
185                Self::Succeeded => "SUCCEEDED",
186                Self::DmlFailed => "DML_FAILED",
187            }
188        }
189        /// Creates an enum from field names used in the ProtoBuf definition.
190        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
191            match value {
192                "UNSPECIFIED" => Some(Self::Unspecified),
193                "SUCCEEDED" => Some(Self::Succeeded),
194                "DML_FAILED" => Some(Self::DmlFailed),
195                _ => None,
196            }
197        }
198    }
199}
200#[derive(prost_helpers::AnyPB)]
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct ExecuteRequest {
203    #[prost(message, optional, tag = "1")]
204    pub task_id: ::core::option::Option<super::batch_plan::TaskId>,
205    #[prost(message, optional, tag = "2")]
206    pub plan: ::core::option::Option<super::batch_plan::PlanFragment>,
207    #[prost(message, optional, tag = "3")]
208    pub epoch: ::core::option::Option<super::common::BatchQueryEpoch>,
209    #[prost(map = "string, string", tag = "4")]
210    pub tracing_context: ::std::collections::HashMap<
211        ::prost::alloc::string::String,
212        ::prost::alloc::string::String,
213    >,
214    #[prost(message, optional, tag = "5")]
215    pub expr_context: ::core::option::Option<super::plan_common::ExprContext>,
216}
217#[derive(prost_helpers::AnyPB)]
218#[derive(Clone, PartialEq, ::prost::Message)]
219pub struct GetDataRequest {
220    #[prost(message, optional, tag = "1")]
221    pub task_output_id: ::core::option::Option<super::batch_plan::TaskOutputId>,
222}
223/// The structure for permit-based back-pressure.
224#[derive(prost_helpers::AnyPB)]
225#[derive(Clone, Copy, PartialEq, ::prost::Message)]
226pub struct Permits {
227    #[prost(oneof = "permits::Value", tags = "1, 2")]
228    pub value: ::core::option::Option<permits::Value>,
229}
230/// Nested message and enum types in `Permits`.
231pub mod permits {
232    #[derive(prost_helpers::AnyPB)]
233    #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
234    pub enum Value {
235        /// The permits required for a chunk, i.e. the cardinality of the chunk.
236        #[prost(uint32, tag = "1")]
237        Record(u32),
238        /// The permits required for a barrier, typically 1.
239        #[prost(uint32, tag = "2")]
240        Barrier(u32),
241    }
242}
243#[derive(prost_helpers::AnyPB)]
244#[derive(Clone, PartialEq, ::prost::Message)]
245pub struct GetStreamRequest {
246    #[prost(oneof = "get_stream_request::Value", tags = "1, 2")]
247    pub value: ::core::option::Option<get_stream_request::Value>,
248}
249/// Nested message and enum types in `GetStreamRequest`.
250pub mod get_stream_request {
251    #[derive(prost_helpers::AnyPB)]
252    #[derive(Clone, PartialEq, ::prost::Message)]
253    pub struct Get {
254        #[prost(uint32, tag = "1")]
255        pub up_actor_id: u32,
256        #[prost(uint32, tag = "2")]
257        pub down_actor_id: u32,
258        #[prost(uint32, tag = "3")]
259        pub up_fragment_id: u32,
260        #[prost(uint32, tag = "4")]
261        pub down_fragment_id: u32,
262        #[prost(uint32, tag = "5")]
263        pub database_id: u32,
264        #[prost(string, tag = "6")]
265        pub term_id: ::prost::alloc::string::String,
266    }
267    #[derive(prost_helpers::AnyPB)]
268    #[derive(Clone, PartialEq, ::prost::Oneof)]
269    pub enum Value {
270        /// The first message, which tells the upstream which channel this exchange stream is for.
271        #[prost(message, tag = "1")]
272        Get(Get),
273        /// The following messages, which adds the permits back to the upstream to achieve back-pressure.
274        #[prost(message, tag = "2")]
275        AddPermits(super::Permits),
276    }
277}
278#[derive(prost_helpers::AnyPB)]
279#[derive(Clone, PartialEq, ::prost::Message)]
280pub struct GetStreamResponse {
281    #[prost(message, optional, tag = "1")]
282    pub message: ::core::option::Option<super::stream_plan::StreamMessageBatch>,
283    /// The number of permits acquired for this message, which should be sent back to the upstream with `add_permits`.
284    /// In theory, this can also be derived from the message itself by the receiver. Here we send it explicitly to
285    /// avoid any sense of inconsistency for the derivation logic, so the receiver can simply send it back verbatim.
286    #[prost(message, optional, tag = "2")]
287    pub permits: ::core::option::Option<Permits>,
288}
289/// Generated client implementations.
290pub mod task_service_client {
291    #![allow(
292        unused_variables,
293        dead_code,
294        missing_docs,
295        clippy::wildcard_imports,
296        clippy::let_unit_value,
297    )]
298    use tonic::codegen::*;
299    use tonic::codegen::http::Uri;
300    #[derive(Debug, Clone)]
301    pub struct TaskServiceClient<T> {
302        inner: tonic::client::Grpc<T>,
303    }
304    impl TaskServiceClient<tonic::transport::Channel> {
305        /// Attempt to create a new client by connecting to a given endpoint.
306        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
307        where
308            D: TryInto<tonic::transport::Endpoint>,
309            D::Error: Into<StdError>,
310        {
311            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
312            Ok(Self::new(conn))
313        }
314    }
315    impl<T> TaskServiceClient<T>
316    where
317        T: tonic::client::GrpcService<tonic::body::BoxBody>,
318        T::Error: Into<StdError>,
319        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
320        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
321    {
322        pub fn new(inner: T) -> Self {
323            let inner = tonic::client::Grpc::new(inner);
324            Self { inner }
325        }
326        pub fn with_origin(inner: T, origin: Uri) -> Self {
327            let inner = tonic::client::Grpc::with_origin(inner, origin);
328            Self { inner }
329        }
330        pub fn with_interceptor<F>(
331            inner: T,
332            interceptor: F,
333        ) -> TaskServiceClient<InterceptedService<T, F>>
334        where
335            F: tonic::service::Interceptor,
336            T::ResponseBody: Default,
337            T: tonic::codegen::Service<
338                http::Request<tonic::body::BoxBody>,
339                Response = http::Response<
340                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
341                >,
342            >,
343            <T as tonic::codegen::Service<
344                http::Request<tonic::body::BoxBody>,
345            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
346        {
347            TaskServiceClient::new(InterceptedService::new(inner, interceptor))
348        }
349        /// Compress requests with the given encoding.
350        ///
351        /// This requires the server to support it otherwise it might respond with an
352        /// error.
353        #[must_use]
354        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
355            self.inner = self.inner.send_compressed(encoding);
356            self
357        }
358        /// Enable decompressing responses.
359        #[must_use]
360        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
361            self.inner = self.inner.accept_compressed(encoding);
362            self
363        }
364        /// Limits the maximum size of a decoded message.
365        ///
366        /// Default: `4MB`
367        #[must_use]
368        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
369            self.inner = self.inner.max_decoding_message_size(limit);
370            self
371        }
372        /// Limits the maximum size of an encoded message.
373        ///
374        /// Default: `usize::MAX`
375        #[must_use]
376        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
377            self.inner = self.inner.max_encoding_message_size(limit);
378            self
379        }
380        pub async fn create_task(
381            &mut self,
382            request: impl tonic::IntoRequest<super::CreateTaskRequest>,
383        ) -> std::result::Result<
384            tonic::Response<tonic::codec::Streaming<super::TaskInfoResponse>>,
385            tonic::Status,
386        > {
387            self.inner
388                .ready()
389                .await
390                .map_err(|e| {
391                    tonic::Status::unknown(
392                        format!("Service was not ready: {}", e.into()),
393                    )
394                })?;
395            let codec = tonic::codec::ProstCodec::default();
396            let path = http::uri::PathAndQuery::from_static(
397                "/task_service.TaskService/CreateTask",
398            );
399            let mut req = request.into_request();
400            req.extensions_mut()
401                .insert(GrpcMethod::new("task_service.TaskService", "CreateTask"));
402            self.inner.server_streaming(req, path, codec).await
403        }
404        /// Cancel an already-died (self execution-failure, previous aborted, completed) task will still succeed.
405        pub async fn cancel_task(
406            &mut self,
407            request: impl tonic::IntoRequest<super::CancelTaskRequest>,
408        ) -> std::result::Result<
409            tonic::Response<super::CancelTaskResponse>,
410            tonic::Status,
411        > {
412            self.inner
413                .ready()
414                .await
415                .map_err(|e| {
416                    tonic::Status::unknown(
417                        format!("Service was not ready: {}", e.into()),
418                    )
419                })?;
420            let codec = tonic::codec::ProstCodec::default();
421            let path = http::uri::PathAndQuery::from_static(
422                "/task_service.TaskService/CancelTask",
423            );
424            let mut req = request.into_request();
425            req.extensions_mut()
426                .insert(GrpcMethod::new("task_service.TaskService", "CancelTask"));
427            self.inner.unary(req, path, codec).await
428        }
429        pub async fn execute(
430            &mut self,
431            request: impl tonic::IntoRequest<super::ExecuteRequest>,
432        ) -> std::result::Result<
433            tonic::Response<tonic::codec::Streaming<super::GetDataResponse>>,
434            tonic::Status,
435        > {
436            self.inner
437                .ready()
438                .await
439                .map_err(|e| {
440                    tonic::Status::unknown(
441                        format!("Service was not ready: {}", e.into()),
442                    )
443                })?;
444            let codec = tonic::codec::ProstCodec::default();
445            let path = http::uri::PathAndQuery::from_static(
446                "/task_service.TaskService/Execute",
447            );
448            let mut req = request.into_request();
449            req.extensions_mut()
450                .insert(GrpcMethod::new("task_service.TaskService", "Execute"));
451            self.inner.server_streaming(req, path, codec).await
452        }
453        /// A lightweight version insert, only for non-pgwire insert, such as inserts from webhooks and websockets.
454        pub async fn fast_insert(
455            &mut self,
456            request: impl tonic::IntoRequest<super::FastInsertRequest>,
457        ) -> std::result::Result<
458            tonic::Response<super::FastInsertResponse>,
459            tonic::Status,
460        > {
461            self.inner
462                .ready()
463                .await
464                .map_err(|e| {
465                    tonic::Status::unknown(
466                        format!("Service was not ready: {}", e.into()),
467                    )
468                })?;
469            let codec = tonic::codec::ProstCodec::default();
470            let path = http::uri::PathAndQuery::from_static(
471                "/task_service.TaskService/FastInsert",
472            );
473            let mut req = request.into_request();
474            req.extensions_mut()
475                .insert(GrpcMethod::new("task_service.TaskService", "FastInsert"));
476            self.inner.unary(req, path, codec).await
477        }
478    }
479}
480/// Generated client implementations.
481pub mod exchange_service_client {
482    #![allow(
483        unused_variables,
484        dead_code,
485        missing_docs,
486        clippy::wildcard_imports,
487        clippy::let_unit_value,
488    )]
489    use tonic::codegen::*;
490    use tonic::codegen::http::Uri;
491    #[derive(Debug, Clone)]
492    pub struct ExchangeServiceClient<T> {
493        inner: tonic::client::Grpc<T>,
494    }
495    impl ExchangeServiceClient<tonic::transport::Channel> {
496        /// Attempt to create a new client by connecting to a given endpoint.
497        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
498        where
499            D: TryInto<tonic::transport::Endpoint>,
500            D::Error: Into<StdError>,
501        {
502            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
503            Ok(Self::new(conn))
504        }
505    }
506    impl<T> ExchangeServiceClient<T>
507    where
508        T: tonic::client::GrpcService<tonic::body::BoxBody>,
509        T::Error: Into<StdError>,
510        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
511        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
512    {
513        pub fn new(inner: T) -> Self {
514            let inner = tonic::client::Grpc::new(inner);
515            Self { inner }
516        }
517        pub fn with_origin(inner: T, origin: Uri) -> Self {
518            let inner = tonic::client::Grpc::with_origin(inner, origin);
519            Self { inner }
520        }
521        pub fn with_interceptor<F>(
522            inner: T,
523            interceptor: F,
524        ) -> ExchangeServiceClient<InterceptedService<T, F>>
525        where
526            F: tonic::service::Interceptor,
527            T::ResponseBody: Default,
528            T: tonic::codegen::Service<
529                http::Request<tonic::body::BoxBody>,
530                Response = http::Response<
531                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
532                >,
533            >,
534            <T as tonic::codegen::Service<
535                http::Request<tonic::body::BoxBody>,
536            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
537        {
538            ExchangeServiceClient::new(InterceptedService::new(inner, interceptor))
539        }
540        /// Compress requests with the given encoding.
541        ///
542        /// This requires the server to support it otherwise it might respond with an
543        /// error.
544        #[must_use]
545        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
546            self.inner = self.inner.send_compressed(encoding);
547            self
548        }
549        /// Enable decompressing responses.
550        #[must_use]
551        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
552            self.inner = self.inner.accept_compressed(encoding);
553            self
554        }
555        /// Limits the maximum size of a decoded message.
556        ///
557        /// Default: `4MB`
558        #[must_use]
559        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
560            self.inner = self.inner.max_decoding_message_size(limit);
561            self
562        }
563        /// Limits the maximum size of an encoded message.
564        ///
565        /// Default: `usize::MAX`
566        #[must_use]
567        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
568            self.inner = self.inner.max_encoding_message_size(limit);
569            self
570        }
571        pub async fn get_data(
572            &mut self,
573            request: impl tonic::IntoRequest<super::GetDataRequest>,
574        ) -> std::result::Result<
575            tonic::Response<tonic::codec::Streaming<super::GetDataResponse>>,
576            tonic::Status,
577        > {
578            self.inner
579                .ready()
580                .await
581                .map_err(|e| {
582                    tonic::Status::unknown(
583                        format!("Service was not ready: {}", e.into()),
584                    )
585                })?;
586            let codec = tonic::codec::ProstCodec::default();
587            let path = http::uri::PathAndQuery::from_static(
588                "/task_service.ExchangeService/GetData",
589            );
590            let mut req = request.into_request();
591            req.extensions_mut()
592                .insert(GrpcMethod::new("task_service.ExchangeService", "GetData"));
593            self.inner.server_streaming(req, path, codec).await
594        }
595        pub async fn get_stream(
596            &mut self,
597            request: impl tonic::IntoStreamingRequest<Message = super::GetStreamRequest>,
598        ) -> std::result::Result<
599            tonic::Response<tonic::codec::Streaming<super::GetStreamResponse>>,
600            tonic::Status,
601        > {
602            self.inner
603                .ready()
604                .await
605                .map_err(|e| {
606                    tonic::Status::unknown(
607                        format!("Service was not ready: {}", e.into()),
608                    )
609                })?;
610            let codec = tonic::codec::ProstCodec::default();
611            let path = http::uri::PathAndQuery::from_static(
612                "/task_service.ExchangeService/GetStream",
613            );
614            let mut req = request.into_streaming_request();
615            req.extensions_mut()
616                .insert(GrpcMethod::new("task_service.ExchangeService", "GetStream"));
617            self.inner.streaming(req, path, codec).await
618        }
619    }
620}
621/// Generated server implementations.
622pub mod task_service_server {
623    #![allow(
624        unused_variables,
625        dead_code,
626        missing_docs,
627        clippy::wildcard_imports,
628        clippy::let_unit_value,
629    )]
630    use tonic::codegen::*;
631    /// Generated trait containing gRPC methods that should be implemented for use with TaskServiceServer.
632    #[async_trait]
633    pub trait TaskService: std::marker::Send + std::marker::Sync + 'static {
634        /// Server streaming response type for the CreateTask method.
635        type CreateTaskStream: tonic::codegen::tokio_stream::Stream<
636                Item = std::result::Result<super::TaskInfoResponse, tonic::Status>,
637            >
638            + std::marker::Send
639            + 'static;
640        async fn create_task(
641            &self,
642            request: tonic::Request<super::CreateTaskRequest>,
643        ) -> std::result::Result<tonic::Response<Self::CreateTaskStream>, tonic::Status>;
644        /// Cancel an already-died (self execution-failure, previous aborted, completed) task will still succeed.
645        async fn cancel_task(
646            &self,
647            request: tonic::Request<super::CancelTaskRequest>,
648        ) -> std::result::Result<
649            tonic::Response<super::CancelTaskResponse>,
650            tonic::Status,
651        >;
652        /// Server streaming response type for the Execute method.
653        type ExecuteStream: tonic::codegen::tokio_stream::Stream<
654                Item = std::result::Result<super::GetDataResponse, tonic::Status>,
655            >
656            + std::marker::Send
657            + 'static;
658        async fn execute(
659            &self,
660            request: tonic::Request<super::ExecuteRequest>,
661        ) -> std::result::Result<tonic::Response<Self::ExecuteStream>, tonic::Status>;
662        /// A lightweight version insert, only for non-pgwire insert, such as inserts from webhooks and websockets.
663        async fn fast_insert(
664            &self,
665            request: tonic::Request<super::FastInsertRequest>,
666        ) -> std::result::Result<
667            tonic::Response<super::FastInsertResponse>,
668            tonic::Status,
669        >;
670    }
671    #[derive(Debug)]
672    pub struct TaskServiceServer<T> {
673        inner: Arc<T>,
674        accept_compression_encodings: EnabledCompressionEncodings,
675        send_compression_encodings: EnabledCompressionEncodings,
676        max_decoding_message_size: Option<usize>,
677        max_encoding_message_size: Option<usize>,
678    }
679    impl<T> TaskServiceServer<T> {
680        pub fn new(inner: T) -> Self {
681            Self::from_arc(Arc::new(inner))
682        }
683        pub fn from_arc(inner: Arc<T>) -> Self {
684            Self {
685                inner,
686                accept_compression_encodings: Default::default(),
687                send_compression_encodings: Default::default(),
688                max_decoding_message_size: None,
689                max_encoding_message_size: None,
690            }
691        }
692        pub fn with_interceptor<F>(
693            inner: T,
694            interceptor: F,
695        ) -> InterceptedService<Self, F>
696        where
697            F: tonic::service::Interceptor,
698        {
699            InterceptedService::new(Self::new(inner), interceptor)
700        }
701        /// Enable decompressing requests with the given encoding.
702        #[must_use]
703        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
704            self.accept_compression_encodings.enable(encoding);
705            self
706        }
707        /// Compress responses with the given encoding, if the client supports it.
708        #[must_use]
709        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
710            self.send_compression_encodings.enable(encoding);
711            self
712        }
713        /// Limits the maximum size of a decoded message.
714        ///
715        /// Default: `4MB`
716        #[must_use]
717        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
718            self.max_decoding_message_size = Some(limit);
719            self
720        }
721        /// Limits the maximum size of an encoded message.
722        ///
723        /// Default: `usize::MAX`
724        #[must_use]
725        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
726            self.max_encoding_message_size = Some(limit);
727            self
728        }
729    }
730    impl<T, B> tonic::codegen::Service<http::Request<B>> for TaskServiceServer<T>
731    where
732        T: TaskService,
733        B: Body + std::marker::Send + 'static,
734        B::Error: Into<StdError> + std::marker::Send + 'static,
735    {
736        type Response = http::Response<tonic::body::BoxBody>;
737        type Error = std::convert::Infallible;
738        type Future = BoxFuture<Self::Response, Self::Error>;
739        fn poll_ready(
740            &mut self,
741            _cx: &mut Context<'_>,
742        ) -> Poll<std::result::Result<(), Self::Error>> {
743            Poll::Ready(Ok(()))
744        }
745        fn call(&mut self, req: http::Request<B>) -> Self::Future {
746            match req.uri().path() {
747                "/task_service.TaskService/CreateTask" => {
748                    #[allow(non_camel_case_types)]
749                    struct CreateTaskSvc<T: TaskService>(pub Arc<T>);
750                    impl<
751                        T: TaskService,
752                    > tonic::server::ServerStreamingService<super::CreateTaskRequest>
753                    for CreateTaskSvc<T> {
754                        type Response = super::TaskInfoResponse;
755                        type ResponseStream = T::CreateTaskStream;
756                        type Future = BoxFuture<
757                            tonic::Response<Self::ResponseStream>,
758                            tonic::Status,
759                        >;
760                        fn call(
761                            &mut self,
762                            request: tonic::Request<super::CreateTaskRequest>,
763                        ) -> Self::Future {
764                            let inner = Arc::clone(&self.0);
765                            let fut = async move {
766                                <T as TaskService>::create_task(&inner, request).await
767                            };
768                            Box::pin(fut)
769                        }
770                    }
771                    let accept_compression_encodings = self.accept_compression_encodings;
772                    let send_compression_encodings = self.send_compression_encodings;
773                    let max_decoding_message_size = self.max_decoding_message_size;
774                    let max_encoding_message_size = self.max_encoding_message_size;
775                    let inner = self.inner.clone();
776                    let fut = async move {
777                        let method = CreateTaskSvc(inner);
778                        let codec = tonic::codec::ProstCodec::default();
779                        let mut grpc = tonic::server::Grpc::new(codec)
780                            .apply_compression_config(
781                                accept_compression_encodings,
782                                send_compression_encodings,
783                            )
784                            .apply_max_message_size_config(
785                                max_decoding_message_size,
786                                max_encoding_message_size,
787                            );
788                        let res = grpc.server_streaming(method, req).await;
789                        Ok(res)
790                    };
791                    Box::pin(fut)
792                }
793                "/task_service.TaskService/CancelTask" => {
794                    #[allow(non_camel_case_types)]
795                    struct CancelTaskSvc<T: TaskService>(pub Arc<T>);
796                    impl<
797                        T: TaskService,
798                    > tonic::server::UnaryService<super::CancelTaskRequest>
799                    for CancelTaskSvc<T> {
800                        type Response = super::CancelTaskResponse;
801                        type Future = BoxFuture<
802                            tonic::Response<Self::Response>,
803                            tonic::Status,
804                        >;
805                        fn call(
806                            &mut self,
807                            request: tonic::Request<super::CancelTaskRequest>,
808                        ) -> Self::Future {
809                            let inner = Arc::clone(&self.0);
810                            let fut = async move {
811                                <T as TaskService>::cancel_task(&inner, request).await
812                            };
813                            Box::pin(fut)
814                        }
815                    }
816                    let accept_compression_encodings = self.accept_compression_encodings;
817                    let send_compression_encodings = self.send_compression_encodings;
818                    let max_decoding_message_size = self.max_decoding_message_size;
819                    let max_encoding_message_size = self.max_encoding_message_size;
820                    let inner = self.inner.clone();
821                    let fut = async move {
822                        let method = CancelTaskSvc(inner);
823                        let codec = tonic::codec::ProstCodec::default();
824                        let mut grpc = tonic::server::Grpc::new(codec)
825                            .apply_compression_config(
826                                accept_compression_encodings,
827                                send_compression_encodings,
828                            )
829                            .apply_max_message_size_config(
830                                max_decoding_message_size,
831                                max_encoding_message_size,
832                            );
833                        let res = grpc.unary(method, req).await;
834                        Ok(res)
835                    };
836                    Box::pin(fut)
837                }
838                "/task_service.TaskService/Execute" => {
839                    #[allow(non_camel_case_types)]
840                    struct ExecuteSvc<T: TaskService>(pub Arc<T>);
841                    impl<
842                        T: TaskService,
843                    > tonic::server::ServerStreamingService<super::ExecuteRequest>
844                    for ExecuteSvc<T> {
845                        type Response = super::GetDataResponse;
846                        type ResponseStream = T::ExecuteStream;
847                        type Future = BoxFuture<
848                            tonic::Response<Self::ResponseStream>,
849                            tonic::Status,
850                        >;
851                        fn call(
852                            &mut self,
853                            request: tonic::Request<super::ExecuteRequest>,
854                        ) -> Self::Future {
855                            let inner = Arc::clone(&self.0);
856                            let fut = async move {
857                                <T as TaskService>::execute(&inner, request).await
858                            };
859                            Box::pin(fut)
860                        }
861                    }
862                    let accept_compression_encodings = self.accept_compression_encodings;
863                    let send_compression_encodings = self.send_compression_encodings;
864                    let max_decoding_message_size = self.max_decoding_message_size;
865                    let max_encoding_message_size = self.max_encoding_message_size;
866                    let inner = self.inner.clone();
867                    let fut = async move {
868                        let method = ExecuteSvc(inner);
869                        let codec = tonic::codec::ProstCodec::default();
870                        let mut grpc = tonic::server::Grpc::new(codec)
871                            .apply_compression_config(
872                                accept_compression_encodings,
873                                send_compression_encodings,
874                            )
875                            .apply_max_message_size_config(
876                                max_decoding_message_size,
877                                max_encoding_message_size,
878                            );
879                        let res = grpc.server_streaming(method, req).await;
880                        Ok(res)
881                    };
882                    Box::pin(fut)
883                }
884                "/task_service.TaskService/FastInsert" => {
885                    #[allow(non_camel_case_types)]
886                    struct FastInsertSvc<T: TaskService>(pub Arc<T>);
887                    impl<
888                        T: TaskService,
889                    > tonic::server::UnaryService<super::FastInsertRequest>
890                    for FastInsertSvc<T> {
891                        type Response = super::FastInsertResponse;
892                        type Future = BoxFuture<
893                            tonic::Response<Self::Response>,
894                            tonic::Status,
895                        >;
896                        fn call(
897                            &mut self,
898                            request: tonic::Request<super::FastInsertRequest>,
899                        ) -> Self::Future {
900                            let inner = Arc::clone(&self.0);
901                            let fut = async move {
902                                <T as TaskService>::fast_insert(&inner, request).await
903                            };
904                            Box::pin(fut)
905                        }
906                    }
907                    let accept_compression_encodings = self.accept_compression_encodings;
908                    let send_compression_encodings = self.send_compression_encodings;
909                    let max_decoding_message_size = self.max_decoding_message_size;
910                    let max_encoding_message_size = self.max_encoding_message_size;
911                    let inner = self.inner.clone();
912                    let fut = async move {
913                        let method = FastInsertSvc(inner);
914                        let codec = tonic::codec::ProstCodec::default();
915                        let mut grpc = tonic::server::Grpc::new(codec)
916                            .apply_compression_config(
917                                accept_compression_encodings,
918                                send_compression_encodings,
919                            )
920                            .apply_max_message_size_config(
921                                max_decoding_message_size,
922                                max_encoding_message_size,
923                            );
924                        let res = grpc.unary(method, req).await;
925                        Ok(res)
926                    };
927                    Box::pin(fut)
928                }
929                _ => {
930                    Box::pin(async move {
931                        let mut response = http::Response::new(empty_body());
932                        let headers = response.headers_mut();
933                        headers
934                            .insert(
935                                tonic::Status::GRPC_STATUS,
936                                (tonic::Code::Unimplemented as i32).into(),
937                            );
938                        headers
939                            .insert(
940                                http::header::CONTENT_TYPE,
941                                tonic::metadata::GRPC_CONTENT_TYPE,
942                            );
943                        Ok(response)
944                    })
945                }
946            }
947        }
948    }
949    impl<T> Clone for TaskServiceServer<T> {
950        fn clone(&self) -> Self {
951            let inner = self.inner.clone();
952            Self {
953                inner,
954                accept_compression_encodings: self.accept_compression_encodings,
955                send_compression_encodings: self.send_compression_encodings,
956                max_decoding_message_size: self.max_decoding_message_size,
957                max_encoding_message_size: self.max_encoding_message_size,
958            }
959        }
960    }
961    /// Generated gRPC service name
962    pub const SERVICE_NAME: &str = "task_service.TaskService";
963    impl<T> tonic::server::NamedService for TaskServiceServer<T> {
964        const NAME: &'static str = SERVICE_NAME;
965    }
966}
967/// Generated server implementations.
968pub mod exchange_service_server {
969    #![allow(
970        unused_variables,
971        dead_code,
972        missing_docs,
973        clippy::wildcard_imports,
974        clippy::let_unit_value,
975    )]
976    use tonic::codegen::*;
977    /// Generated trait containing gRPC methods that should be implemented for use with ExchangeServiceServer.
978    #[async_trait]
979    pub trait ExchangeService: std::marker::Send + std::marker::Sync + 'static {
980        /// Server streaming response type for the GetData method.
981        type GetDataStream: tonic::codegen::tokio_stream::Stream<
982                Item = std::result::Result<super::GetDataResponse, tonic::Status>,
983            >
984            + std::marker::Send
985            + 'static;
986        async fn get_data(
987            &self,
988            request: tonic::Request<super::GetDataRequest>,
989        ) -> std::result::Result<tonic::Response<Self::GetDataStream>, tonic::Status>;
990        /// Server streaming response type for the GetStream method.
991        type GetStreamStream: tonic::codegen::tokio_stream::Stream<
992                Item = std::result::Result<super::GetStreamResponse, tonic::Status>,
993            >
994            + std::marker::Send
995            + 'static;
996        async fn get_stream(
997            &self,
998            request: tonic::Request<tonic::Streaming<super::GetStreamRequest>>,
999        ) -> std::result::Result<tonic::Response<Self::GetStreamStream>, tonic::Status>;
1000    }
1001    #[derive(Debug)]
1002    pub struct ExchangeServiceServer<T> {
1003        inner: Arc<T>,
1004        accept_compression_encodings: EnabledCompressionEncodings,
1005        send_compression_encodings: EnabledCompressionEncodings,
1006        max_decoding_message_size: Option<usize>,
1007        max_encoding_message_size: Option<usize>,
1008    }
1009    impl<T> ExchangeServiceServer<T> {
1010        pub fn new(inner: T) -> Self {
1011            Self::from_arc(Arc::new(inner))
1012        }
1013        pub fn from_arc(inner: Arc<T>) -> Self {
1014            Self {
1015                inner,
1016                accept_compression_encodings: Default::default(),
1017                send_compression_encodings: Default::default(),
1018                max_decoding_message_size: None,
1019                max_encoding_message_size: None,
1020            }
1021        }
1022        pub fn with_interceptor<F>(
1023            inner: T,
1024            interceptor: F,
1025        ) -> InterceptedService<Self, F>
1026        where
1027            F: tonic::service::Interceptor,
1028        {
1029            InterceptedService::new(Self::new(inner), interceptor)
1030        }
1031        /// Enable decompressing requests with the given encoding.
1032        #[must_use]
1033        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1034            self.accept_compression_encodings.enable(encoding);
1035            self
1036        }
1037        /// Compress responses with the given encoding, if the client supports it.
1038        #[must_use]
1039        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1040            self.send_compression_encodings.enable(encoding);
1041            self
1042        }
1043        /// Limits the maximum size of a decoded message.
1044        ///
1045        /// Default: `4MB`
1046        #[must_use]
1047        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1048            self.max_decoding_message_size = Some(limit);
1049            self
1050        }
1051        /// Limits the maximum size of an encoded message.
1052        ///
1053        /// Default: `usize::MAX`
1054        #[must_use]
1055        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1056            self.max_encoding_message_size = Some(limit);
1057            self
1058        }
1059    }
1060    impl<T, B> tonic::codegen::Service<http::Request<B>> for ExchangeServiceServer<T>
1061    where
1062        T: ExchangeService,
1063        B: Body + std::marker::Send + 'static,
1064        B::Error: Into<StdError> + std::marker::Send + 'static,
1065    {
1066        type Response = http::Response<tonic::body::BoxBody>;
1067        type Error = std::convert::Infallible;
1068        type Future = BoxFuture<Self::Response, Self::Error>;
1069        fn poll_ready(
1070            &mut self,
1071            _cx: &mut Context<'_>,
1072        ) -> Poll<std::result::Result<(), Self::Error>> {
1073            Poll::Ready(Ok(()))
1074        }
1075        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1076            match req.uri().path() {
1077                "/task_service.ExchangeService/GetData" => {
1078                    #[allow(non_camel_case_types)]
1079                    struct GetDataSvc<T: ExchangeService>(pub Arc<T>);
1080                    impl<
1081                        T: ExchangeService,
1082                    > tonic::server::ServerStreamingService<super::GetDataRequest>
1083                    for GetDataSvc<T> {
1084                        type Response = super::GetDataResponse;
1085                        type ResponseStream = T::GetDataStream;
1086                        type Future = BoxFuture<
1087                            tonic::Response<Self::ResponseStream>,
1088                            tonic::Status,
1089                        >;
1090                        fn call(
1091                            &mut self,
1092                            request: tonic::Request<super::GetDataRequest>,
1093                        ) -> Self::Future {
1094                            let inner = Arc::clone(&self.0);
1095                            let fut = async move {
1096                                <T as ExchangeService>::get_data(&inner, request).await
1097                            };
1098                            Box::pin(fut)
1099                        }
1100                    }
1101                    let accept_compression_encodings = self.accept_compression_encodings;
1102                    let send_compression_encodings = self.send_compression_encodings;
1103                    let max_decoding_message_size = self.max_decoding_message_size;
1104                    let max_encoding_message_size = self.max_encoding_message_size;
1105                    let inner = self.inner.clone();
1106                    let fut = async move {
1107                        let method = GetDataSvc(inner);
1108                        let codec = tonic::codec::ProstCodec::default();
1109                        let mut grpc = tonic::server::Grpc::new(codec)
1110                            .apply_compression_config(
1111                                accept_compression_encodings,
1112                                send_compression_encodings,
1113                            )
1114                            .apply_max_message_size_config(
1115                                max_decoding_message_size,
1116                                max_encoding_message_size,
1117                            );
1118                        let res = grpc.server_streaming(method, req).await;
1119                        Ok(res)
1120                    };
1121                    Box::pin(fut)
1122                }
1123                "/task_service.ExchangeService/GetStream" => {
1124                    #[allow(non_camel_case_types)]
1125                    struct GetStreamSvc<T: ExchangeService>(pub Arc<T>);
1126                    impl<
1127                        T: ExchangeService,
1128                    > tonic::server::StreamingService<super::GetStreamRequest>
1129                    for GetStreamSvc<T> {
1130                        type Response = super::GetStreamResponse;
1131                        type ResponseStream = T::GetStreamStream;
1132                        type Future = BoxFuture<
1133                            tonic::Response<Self::ResponseStream>,
1134                            tonic::Status,
1135                        >;
1136                        fn call(
1137                            &mut self,
1138                            request: tonic::Request<
1139                                tonic::Streaming<super::GetStreamRequest>,
1140                            >,
1141                        ) -> Self::Future {
1142                            let inner = Arc::clone(&self.0);
1143                            let fut = async move {
1144                                <T as ExchangeService>::get_stream(&inner, request).await
1145                            };
1146                            Box::pin(fut)
1147                        }
1148                    }
1149                    let accept_compression_encodings = self.accept_compression_encodings;
1150                    let send_compression_encodings = self.send_compression_encodings;
1151                    let max_decoding_message_size = self.max_decoding_message_size;
1152                    let max_encoding_message_size = self.max_encoding_message_size;
1153                    let inner = self.inner.clone();
1154                    let fut = async move {
1155                        let method = GetStreamSvc(inner);
1156                        let codec = tonic::codec::ProstCodec::default();
1157                        let mut grpc = tonic::server::Grpc::new(codec)
1158                            .apply_compression_config(
1159                                accept_compression_encodings,
1160                                send_compression_encodings,
1161                            )
1162                            .apply_max_message_size_config(
1163                                max_decoding_message_size,
1164                                max_encoding_message_size,
1165                            );
1166                        let res = grpc.streaming(method, req).await;
1167                        Ok(res)
1168                    };
1169                    Box::pin(fut)
1170                }
1171                _ => {
1172                    Box::pin(async move {
1173                        let mut response = http::Response::new(empty_body());
1174                        let headers = response.headers_mut();
1175                        headers
1176                            .insert(
1177                                tonic::Status::GRPC_STATUS,
1178                                (tonic::Code::Unimplemented as i32).into(),
1179                            );
1180                        headers
1181                            .insert(
1182                                http::header::CONTENT_TYPE,
1183                                tonic::metadata::GRPC_CONTENT_TYPE,
1184                            );
1185                        Ok(response)
1186                    })
1187                }
1188            }
1189        }
1190    }
1191    impl<T> Clone for ExchangeServiceServer<T> {
1192        fn clone(&self) -> Self {
1193            let inner = self.inner.clone();
1194            Self {
1195                inner,
1196                accept_compression_encodings: self.accept_compression_encodings,
1197                send_compression_encodings: self.send_compression_encodings,
1198                max_decoding_message_size: self.max_decoding_message_size,
1199                max_encoding_message_size: self.max_encoding_message_size,
1200            }
1201        }
1202    }
1203    /// Generated gRPC service name
1204    pub const SERVICE_NAME: &str = "task_service.ExchangeService";
1205    impl<T> tonic::server::NamedService for ExchangeServiceServer<T> {
1206        const NAME: &'static str = SERVICE_NAME;
1207    }
1208}