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