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