risingwave_pb/
frontend_service.rs

1// This file is @generated by prost-build.
2#[derive(prost_helpers::AnyPB)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct GetTableReplacePlanRequest {
5    #[prost(uint32, tag = "1", wrapper = "crate::id::DatabaseId")]
6    pub database_id: crate::id::DatabaseId,
7    #[prost(uint32, tag = "2", wrapper = "crate::id::TableId")]
8    pub table_id: crate::id::TableId,
9    #[prost(message, optional, tag = "3")]
10    pub cdc_table_change: ::core::option::Option<super::ddl_service::TableSchemaChange>,
11}
12#[derive(prost_helpers::AnyPB)]
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct GetTableReplacePlanResponse {
15    #[prost(message, optional, tag = "1")]
16    pub replace_plan: ::core::option::Option<super::ddl_service::ReplaceJobPlan>,
17}
18#[derive(prost_helpers::AnyPB)]
19#[derive(Clone, Copy, PartialEq, ::prost::Message)]
20pub struct GetRunningSqlsRequest {}
21#[derive(prost_helpers::AnyPB)]
22#[derive(Clone, PartialEq, ::prost::Message)]
23pub struct GetRunningSqlsResponse {
24    #[prost(message, repeated, tag = "1")]
25    pub running_sqls: ::prost::alloc::vec::Vec<RunningSql>,
26}
27#[derive(prost_helpers::AnyPB)]
28#[derive(Clone, PartialEq, ::prost::Message)]
29pub struct RunningSql {
30    #[prost(int32, tag = "1")]
31    pub process_id: i32,
32    #[prost(string, tag = "2")]
33    pub user_name: ::prost::alloc::string::String,
34    #[prost(string, tag = "3")]
35    pub peer_addr: ::prost::alloc::string::String,
36    #[prost(string, tag = "4")]
37    pub database: ::prost::alloc::string::String,
38    #[prost(uint64, optional, tag = "5")]
39    pub elapsed_millis: ::core::option::Option<u64>,
40    #[prost(string, optional, tag = "6")]
41    pub sql: ::core::option::Option<::prost::alloc::string::String>,
42}
43#[derive(prost_helpers::AnyPB)]
44#[derive(Clone, Copy, PartialEq, ::prost::Message)]
45pub struct CancelRunningSqlRequest {
46    #[prost(int32, tag = "1")]
47    pub process_id: i32,
48}
49#[derive(prost_helpers::AnyPB)]
50#[derive(Clone, Copy, PartialEq, ::prost::Message)]
51pub struct CancelRunningSqlResponse {}
52/// Generated client implementations.
53pub mod frontend_service_client {
54    #![allow(
55        unused_variables,
56        dead_code,
57        missing_docs,
58        clippy::wildcard_imports,
59        clippy::let_unit_value,
60    )]
61    use tonic::codegen::*;
62    use tonic::codegen::http::Uri;
63    #[derive(Debug, Clone)]
64    pub struct FrontendServiceClient<T> {
65        inner: tonic::client::Grpc<T>,
66    }
67    impl FrontendServiceClient<tonic::transport::Channel> {
68        /// Attempt to create a new client by connecting to a given endpoint.
69        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
70        where
71            D: TryInto<tonic::transport::Endpoint>,
72            D::Error: Into<StdError>,
73        {
74            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
75            Ok(Self::new(conn))
76        }
77    }
78    impl<T> FrontendServiceClient<T>
79    where
80        T: tonic::client::GrpcService<tonic::body::BoxBody>,
81        T::Error: Into<StdError>,
82        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
83        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
84    {
85        pub fn new(inner: T) -> Self {
86            let inner = tonic::client::Grpc::new(inner);
87            Self { inner }
88        }
89        pub fn with_origin(inner: T, origin: Uri) -> Self {
90            let inner = tonic::client::Grpc::with_origin(inner, origin);
91            Self { inner }
92        }
93        pub fn with_interceptor<F>(
94            inner: T,
95            interceptor: F,
96        ) -> FrontendServiceClient<InterceptedService<T, F>>
97        where
98            F: tonic::service::Interceptor,
99            T::ResponseBody: Default,
100            T: tonic::codegen::Service<
101                http::Request<tonic::body::BoxBody>,
102                Response = http::Response<
103                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
104                >,
105            >,
106            <T as tonic::codegen::Service<
107                http::Request<tonic::body::BoxBody>,
108            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
109        {
110            FrontendServiceClient::new(InterceptedService::new(inner, interceptor))
111        }
112        /// Compress requests with the given encoding.
113        ///
114        /// This requires the server to support it otherwise it might respond with an
115        /// error.
116        #[must_use]
117        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
118            self.inner = self.inner.send_compressed(encoding);
119            self
120        }
121        /// Enable decompressing responses.
122        #[must_use]
123        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
124            self.inner = self.inner.accept_compressed(encoding);
125            self
126        }
127        /// Limits the maximum size of a decoded message.
128        ///
129        /// Default: `4MB`
130        #[must_use]
131        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
132            self.inner = self.inner.max_decoding_message_size(limit);
133            self
134        }
135        /// Limits the maximum size of an encoded message.
136        ///
137        /// Default: `usize::MAX`
138        #[must_use]
139        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
140            self.inner = self.inner.max_encoding_message_size(limit);
141            self
142        }
143        pub async fn get_table_replace_plan(
144            &mut self,
145            request: impl tonic::IntoRequest<super::GetTableReplacePlanRequest>,
146        ) -> std::result::Result<
147            tonic::Response<super::GetTableReplacePlanResponse>,
148            tonic::Status,
149        > {
150            self.inner
151                .ready()
152                .await
153                .map_err(|e| {
154                    tonic::Status::unknown(
155                        format!("Service was not ready: {}", e.into()),
156                    )
157                })?;
158            let codec = tonic::codec::ProstCodec::default();
159            let path = http::uri::PathAndQuery::from_static(
160                "/frontend_service.FrontendService/GetTableReplacePlan",
161            );
162            let mut req = request.into_request();
163            req.extensions_mut()
164                .insert(
165                    GrpcMethod::new(
166                        "frontend_service.FrontendService",
167                        "GetTableReplacePlan",
168                    ),
169                );
170            self.inner.unary(req, path, codec).await
171        }
172        pub async fn get_running_sqls(
173            &mut self,
174            request: impl tonic::IntoRequest<super::GetRunningSqlsRequest>,
175        ) -> std::result::Result<
176            tonic::Response<super::GetRunningSqlsResponse>,
177            tonic::Status,
178        > {
179            self.inner
180                .ready()
181                .await
182                .map_err(|e| {
183                    tonic::Status::unknown(
184                        format!("Service was not ready: {}", e.into()),
185                    )
186                })?;
187            let codec = tonic::codec::ProstCodec::default();
188            let path = http::uri::PathAndQuery::from_static(
189                "/frontend_service.FrontendService/GetRunningSqls",
190            );
191            let mut req = request.into_request();
192            req.extensions_mut()
193                .insert(
194                    GrpcMethod::new("frontend_service.FrontendService", "GetRunningSqls"),
195                );
196            self.inner.unary(req, path, codec).await
197        }
198        pub async fn cancel_running_sql(
199            &mut self,
200            request: impl tonic::IntoRequest<super::CancelRunningSqlRequest>,
201        ) -> std::result::Result<
202            tonic::Response<super::CancelRunningSqlResponse>,
203            tonic::Status,
204        > {
205            self.inner
206                .ready()
207                .await
208                .map_err(|e| {
209                    tonic::Status::unknown(
210                        format!("Service was not ready: {}", e.into()),
211                    )
212                })?;
213            let codec = tonic::codec::ProstCodec::default();
214            let path = http::uri::PathAndQuery::from_static(
215                "/frontend_service.FrontendService/CancelRunningSql",
216            );
217            let mut req = request.into_request();
218            req.extensions_mut()
219                .insert(
220                    GrpcMethod::new(
221                        "frontend_service.FrontendService",
222                        "CancelRunningSql",
223                    ),
224                );
225            self.inner.unary(req, path, codec).await
226        }
227    }
228}
229/// Generated server implementations.
230pub mod frontend_service_server {
231    #![allow(
232        unused_variables,
233        dead_code,
234        missing_docs,
235        clippy::wildcard_imports,
236        clippy::let_unit_value,
237    )]
238    use tonic::codegen::*;
239    /// Generated trait containing gRPC methods that should be implemented for use with FrontendServiceServer.
240    #[async_trait]
241    pub trait FrontendService: std::marker::Send + std::marker::Sync + 'static {
242        async fn get_table_replace_plan(
243            &self,
244            request: tonic::Request<super::GetTableReplacePlanRequest>,
245        ) -> std::result::Result<
246            tonic::Response<super::GetTableReplacePlanResponse>,
247            tonic::Status,
248        >;
249        async fn get_running_sqls(
250            &self,
251            request: tonic::Request<super::GetRunningSqlsRequest>,
252        ) -> std::result::Result<
253            tonic::Response<super::GetRunningSqlsResponse>,
254            tonic::Status,
255        >;
256        async fn cancel_running_sql(
257            &self,
258            request: tonic::Request<super::CancelRunningSqlRequest>,
259        ) -> std::result::Result<
260            tonic::Response<super::CancelRunningSqlResponse>,
261            tonic::Status,
262        >;
263    }
264    #[derive(Debug)]
265    pub struct FrontendServiceServer<T> {
266        inner: Arc<T>,
267        accept_compression_encodings: EnabledCompressionEncodings,
268        send_compression_encodings: EnabledCompressionEncodings,
269        max_decoding_message_size: Option<usize>,
270        max_encoding_message_size: Option<usize>,
271    }
272    impl<T> FrontendServiceServer<T> {
273        pub fn new(inner: T) -> Self {
274            Self::from_arc(Arc::new(inner))
275        }
276        pub fn from_arc(inner: Arc<T>) -> Self {
277            Self {
278                inner,
279                accept_compression_encodings: Default::default(),
280                send_compression_encodings: Default::default(),
281                max_decoding_message_size: None,
282                max_encoding_message_size: None,
283            }
284        }
285        pub fn with_interceptor<F>(
286            inner: T,
287            interceptor: F,
288        ) -> InterceptedService<Self, F>
289        where
290            F: tonic::service::Interceptor,
291        {
292            InterceptedService::new(Self::new(inner), interceptor)
293        }
294        /// Enable decompressing requests with the given encoding.
295        #[must_use]
296        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
297            self.accept_compression_encodings.enable(encoding);
298            self
299        }
300        /// Compress responses with the given encoding, if the client supports it.
301        #[must_use]
302        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
303            self.send_compression_encodings.enable(encoding);
304            self
305        }
306        /// Limits the maximum size of a decoded message.
307        ///
308        /// Default: `4MB`
309        #[must_use]
310        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
311            self.max_decoding_message_size = Some(limit);
312            self
313        }
314        /// Limits the maximum size of an encoded message.
315        ///
316        /// Default: `usize::MAX`
317        #[must_use]
318        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
319            self.max_encoding_message_size = Some(limit);
320            self
321        }
322    }
323    impl<T, B> tonic::codegen::Service<http::Request<B>> for FrontendServiceServer<T>
324    where
325        T: FrontendService,
326        B: Body + std::marker::Send + 'static,
327        B::Error: Into<StdError> + std::marker::Send + 'static,
328    {
329        type Response = http::Response<tonic::body::BoxBody>;
330        type Error = std::convert::Infallible;
331        type Future = BoxFuture<Self::Response, Self::Error>;
332        fn poll_ready(
333            &mut self,
334            _cx: &mut Context<'_>,
335        ) -> Poll<std::result::Result<(), Self::Error>> {
336            Poll::Ready(Ok(()))
337        }
338        fn call(&mut self, req: http::Request<B>) -> Self::Future {
339            match req.uri().path() {
340                "/frontend_service.FrontendService/GetTableReplacePlan" => {
341                    #[allow(non_camel_case_types)]
342                    struct GetTableReplacePlanSvc<T: FrontendService>(pub Arc<T>);
343                    impl<
344                        T: FrontendService,
345                    > tonic::server::UnaryService<super::GetTableReplacePlanRequest>
346                    for GetTableReplacePlanSvc<T> {
347                        type Response = super::GetTableReplacePlanResponse;
348                        type Future = BoxFuture<
349                            tonic::Response<Self::Response>,
350                            tonic::Status,
351                        >;
352                        fn call(
353                            &mut self,
354                            request: tonic::Request<super::GetTableReplacePlanRequest>,
355                        ) -> Self::Future {
356                            let inner = Arc::clone(&self.0);
357                            let fut = async move {
358                                <T as FrontendService>::get_table_replace_plan(
359                                        &inner,
360                                        request,
361                                    )
362                                    .await
363                            };
364                            Box::pin(fut)
365                        }
366                    }
367                    let accept_compression_encodings = self.accept_compression_encodings;
368                    let send_compression_encodings = self.send_compression_encodings;
369                    let max_decoding_message_size = self.max_decoding_message_size;
370                    let max_encoding_message_size = self.max_encoding_message_size;
371                    let inner = self.inner.clone();
372                    let fut = async move {
373                        let method = GetTableReplacePlanSvc(inner);
374                        let codec = tonic::codec::ProstCodec::default();
375                        let mut grpc = tonic::server::Grpc::new(codec)
376                            .apply_compression_config(
377                                accept_compression_encodings,
378                                send_compression_encodings,
379                            )
380                            .apply_max_message_size_config(
381                                max_decoding_message_size,
382                                max_encoding_message_size,
383                            );
384                        let res = grpc.unary(method, req).await;
385                        Ok(res)
386                    };
387                    Box::pin(fut)
388                }
389                "/frontend_service.FrontendService/GetRunningSqls" => {
390                    #[allow(non_camel_case_types)]
391                    struct GetRunningSqlsSvc<T: FrontendService>(pub Arc<T>);
392                    impl<
393                        T: FrontendService,
394                    > tonic::server::UnaryService<super::GetRunningSqlsRequest>
395                    for GetRunningSqlsSvc<T> {
396                        type Response = super::GetRunningSqlsResponse;
397                        type Future = BoxFuture<
398                            tonic::Response<Self::Response>,
399                            tonic::Status,
400                        >;
401                        fn call(
402                            &mut self,
403                            request: tonic::Request<super::GetRunningSqlsRequest>,
404                        ) -> Self::Future {
405                            let inner = Arc::clone(&self.0);
406                            let fut = async move {
407                                <T as FrontendService>::get_running_sqls(&inner, request)
408                                    .await
409                            };
410                            Box::pin(fut)
411                        }
412                    }
413                    let accept_compression_encodings = self.accept_compression_encodings;
414                    let send_compression_encodings = self.send_compression_encodings;
415                    let max_decoding_message_size = self.max_decoding_message_size;
416                    let max_encoding_message_size = self.max_encoding_message_size;
417                    let inner = self.inner.clone();
418                    let fut = async move {
419                        let method = GetRunningSqlsSvc(inner);
420                        let codec = tonic::codec::ProstCodec::default();
421                        let mut grpc = tonic::server::Grpc::new(codec)
422                            .apply_compression_config(
423                                accept_compression_encodings,
424                                send_compression_encodings,
425                            )
426                            .apply_max_message_size_config(
427                                max_decoding_message_size,
428                                max_encoding_message_size,
429                            );
430                        let res = grpc.unary(method, req).await;
431                        Ok(res)
432                    };
433                    Box::pin(fut)
434                }
435                "/frontend_service.FrontendService/CancelRunningSql" => {
436                    #[allow(non_camel_case_types)]
437                    struct CancelRunningSqlSvc<T: FrontendService>(pub Arc<T>);
438                    impl<
439                        T: FrontendService,
440                    > tonic::server::UnaryService<super::CancelRunningSqlRequest>
441                    for CancelRunningSqlSvc<T> {
442                        type Response = super::CancelRunningSqlResponse;
443                        type Future = BoxFuture<
444                            tonic::Response<Self::Response>,
445                            tonic::Status,
446                        >;
447                        fn call(
448                            &mut self,
449                            request: tonic::Request<super::CancelRunningSqlRequest>,
450                        ) -> Self::Future {
451                            let inner = Arc::clone(&self.0);
452                            let fut = async move {
453                                <T as FrontendService>::cancel_running_sql(&inner, request)
454                                    .await
455                            };
456                            Box::pin(fut)
457                        }
458                    }
459                    let accept_compression_encodings = self.accept_compression_encodings;
460                    let send_compression_encodings = self.send_compression_encodings;
461                    let max_decoding_message_size = self.max_decoding_message_size;
462                    let max_encoding_message_size = self.max_encoding_message_size;
463                    let inner = self.inner.clone();
464                    let fut = async move {
465                        let method = CancelRunningSqlSvc(inner);
466                        let codec = tonic::codec::ProstCodec::default();
467                        let mut grpc = tonic::server::Grpc::new(codec)
468                            .apply_compression_config(
469                                accept_compression_encodings,
470                                send_compression_encodings,
471                            )
472                            .apply_max_message_size_config(
473                                max_decoding_message_size,
474                                max_encoding_message_size,
475                            );
476                        let res = grpc.unary(method, req).await;
477                        Ok(res)
478                    };
479                    Box::pin(fut)
480                }
481                _ => {
482                    Box::pin(async move {
483                        let mut response = http::Response::new(empty_body());
484                        let headers = response.headers_mut();
485                        headers
486                            .insert(
487                                tonic::Status::GRPC_STATUS,
488                                (tonic::Code::Unimplemented as i32).into(),
489                            );
490                        headers
491                            .insert(
492                                http::header::CONTENT_TYPE,
493                                tonic::metadata::GRPC_CONTENT_TYPE,
494                            );
495                        Ok(response)
496                    })
497                }
498            }
499        }
500    }
501    impl<T> Clone for FrontendServiceServer<T> {
502        fn clone(&self) -> Self {
503            let inner = self.inner.clone();
504            Self {
505                inner,
506                accept_compression_encodings: self.accept_compression_encodings,
507                send_compression_encodings: self.send_compression_encodings,
508                max_decoding_message_size: self.max_decoding_message_size,
509                max_encoding_message_size: self.max_encoding_message_size,
510            }
511        }
512    }
513    /// Generated gRPC service name
514    pub const SERVICE_NAME: &str = "frontend_service.FrontendService";
515    impl<T> tonic::server::NamedService for FrontendServiceServer<T> {
516        const NAME: &'static str = SERVICE_NAME;
517    }
518}