risingwave_pb/
compute.rs

1// This file is @generated by prost-build.
2#[derive(prost_helpers::AnyPB)]
3#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4pub struct ShowConfigRequest {}
5#[derive(prost_helpers::AnyPB)]
6#[derive(Clone, PartialEq, ::prost::Message)]
7pub struct ShowConfigResponse {
8    #[prost(string, tag = "1")]
9    pub batch_config: ::prost::alloc::string::String,
10    #[prost(string, tag = "2")]
11    pub stream_config: ::prost::alloc::string::String,
12}
13#[derive(prost_helpers::AnyPB)]
14#[derive(Clone, Copy, PartialEq, ::prost::Message)]
15pub struct ResizeCacheRequest {
16    #[prost(uint64, tag = "1")]
17    pub meta_cache_capacity: u64,
18    #[prost(uint64, tag = "2")]
19    pub data_cache_capacity: u64,
20}
21#[derive(prost_helpers::AnyPB)]
22#[derive(Clone, Copy, PartialEq, ::prost::Message)]
23pub struct ResizeCacheResponse {}
24/// Generated client implementations.
25pub mod config_service_client {
26    #![allow(
27        unused_variables,
28        dead_code,
29        missing_docs,
30        clippy::wildcard_imports,
31        clippy::let_unit_value,
32    )]
33    use tonic::codegen::*;
34    use tonic::codegen::http::Uri;
35    #[derive(Debug, Clone)]
36    pub struct ConfigServiceClient<T> {
37        inner: tonic::client::Grpc<T>,
38    }
39    impl ConfigServiceClient<tonic::transport::Channel> {
40        /// Attempt to create a new client by connecting to a given endpoint.
41        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
42        where
43            D: TryInto<tonic::transport::Endpoint>,
44            D::Error: Into<StdError>,
45        {
46            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
47            Ok(Self::new(conn))
48        }
49    }
50    impl<T> ConfigServiceClient<T>
51    where
52        T: tonic::client::GrpcService<tonic::body::BoxBody>,
53        T::Error: Into<StdError>,
54        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
55        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
56    {
57        pub fn new(inner: T) -> Self {
58            let inner = tonic::client::Grpc::new(inner);
59            Self { inner }
60        }
61        pub fn with_origin(inner: T, origin: Uri) -> Self {
62            let inner = tonic::client::Grpc::with_origin(inner, origin);
63            Self { inner }
64        }
65        pub fn with_interceptor<F>(
66            inner: T,
67            interceptor: F,
68        ) -> ConfigServiceClient<InterceptedService<T, F>>
69        where
70            F: tonic::service::Interceptor,
71            T::ResponseBody: Default,
72            T: tonic::codegen::Service<
73                http::Request<tonic::body::BoxBody>,
74                Response = http::Response<
75                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
76                >,
77            >,
78            <T as tonic::codegen::Service<
79                http::Request<tonic::body::BoxBody>,
80            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
81        {
82            ConfigServiceClient::new(InterceptedService::new(inner, interceptor))
83        }
84        /// Compress requests with the given encoding.
85        ///
86        /// This requires the server to support it otherwise it might respond with an
87        /// error.
88        #[must_use]
89        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
90            self.inner = self.inner.send_compressed(encoding);
91            self
92        }
93        /// Enable decompressing responses.
94        #[must_use]
95        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
96            self.inner = self.inner.accept_compressed(encoding);
97            self
98        }
99        /// Limits the maximum size of a decoded message.
100        ///
101        /// Default: `4MB`
102        #[must_use]
103        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
104            self.inner = self.inner.max_decoding_message_size(limit);
105            self
106        }
107        /// Limits the maximum size of an encoded message.
108        ///
109        /// Default: `usize::MAX`
110        #[must_use]
111        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
112            self.inner = self.inner.max_encoding_message_size(limit);
113            self
114        }
115        pub async fn show_config(
116            &mut self,
117            request: impl tonic::IntoRequest<super::ShowConfigRequest>,
118        ) -> std::result::Result<
119            tonic::Response<super::ShowConfigResponse>,
120            tonic::Status,
121        > {
122            self.inner
123                .ready()
124                .await
125                .map_err(|e| {
126                    tonic::Status::unknown(
127                        format!("Service was not ready: {}", e.into()),
128                    )
129                })?;
130            let codec = tonic::codec::ProstCodec::default();
131            let path = http::uri::PathAndQuery::from_static(
132                "/compute.ConfigService/ShowConfig",
133            );
134            let mut req = request.into_request();
135            req.extensions_mut()
136                .insert(GrpcMethod::new("compute.ConfigService", "ShowConfig"));
137            self.inner.unary(req, path, codec).await
138        }
139        pub async fn resize_cache(
140            &mut self,
141            request: impl tonic::IntoRequest<super::ResizeCacheRequest>,
142        ) -> std::result::Result<
143            tonic::Response<super::ResizeCacheResponse>,
144            tonic::Status,
145        > {
146            self.inner
147                .ready()
148                .await
149                .map_err(|e| {
150                    tonic::Status::unknown(
151                        format!("Service was not ready: {}", e.into()),
152                    )
153                })?;
154            let codec = tonic::codec::ProstCodec::default();
155            let path = http::uri::PathAndQuery::from_static(
156                "/compute.ConfigService/ResizeCache",
157            );
158            let mut req = request.into_request();
159            req.extensions_mut()
160                .insert(GrpcMethod::new("compute.ConfigService", "ResizeCache"));
161            self.inner.unary(req, path, codec).await
162        }
163    }
164}
165/// Generated server implementations.
166pub mod config_service_server {
167    #![allow(
168        unused_variables,
169        dead_code,
170        missing_docs,
171        clippy::wildcard_imports,
172        clippy::let_unit_value,
173    )]
174    use tonic::codegen::*;
175    /// Generated trait containing gRPC methods that should be implemented for use with ConfigServiceServer.
176    #[async_trait]
177    pub trait ConfigService: std::marker::Send + std::marker::Sync + 'static {
178        async fn show_config(
179            &self,
180            request: tonic::Request<super::ShowConfigRequest>,
181        ) -> std::result::Result<
182            tonic::Response<super::ShowConfigResponse>,
183            tonic::Status,
184        >;
185        async fn resize_cache(
186            &self,
187            request: tonic::Request<super::ResizeCacheRequest>,
188        ) -> std::result::Result<
189            tonic::Response<super::ResizeCacheResponse>,
190            tonic::Status,
191        >;
192    }
193    #[derive(Debug)]
194    pub struct ConfigServiceServer<T> {
195        inner: Arc<T>,
196        accept_compression_encodings: EnabledCompressionEncodings,
197        send_compression_encodings: EnabledCompressionEncodings,
198        max_decoding_message_size: Option<usize>,
199        max_encoding_message_size: Option<usize>,
200    }
201    impl<T> ConfigServiceServer<T> {
202        pub fn new(inner: T) -> Self {
203            Self::from_arc(Arc::new(inner))
204        }
205        pub fn from_arc(inner: Arc<T>) -> Self {
206            Self {
207                inner,
208                accept_compression_encodings: Default::default(),
209                send_compression_encodings: Default::default(),
210                max_decoding_message_size: None,
211                max_encoding_message_size: None,
212            }
213        }
214        pub fn with_interceptor<F>(
215            inner: T,
216            interceptor: F,
217        ) -> InterceptedService<Self, F>
218        where
219            F: tonic::service::Interceptor,
220        {
221            InterceptedService::new(Self::new(inner), interceptor)
222        }
223        /// Enable decompressing requests with the given encoding.
224        #[must_use]
225        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
226            self.accept_compression_encodings.enable(encoding);
227            self
228        }
229        /// Compress responses with the given encoding, if the client supports it.
230        #[must_use]
231        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
232            self.send_compression_encodings.enable(encoding);
233            self
234        }
235        /// Limits the maximum size of a decoded message.
236        ///
237        /// Default: `4MB`
238        #[must_use]
239        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
240            self.max_decoding_message_size = Some(limit);
241            self
242        }
243        /// Limits the maximum size of an encoded message.
244        ///
245        /// Default: `usize::MAX`
246        #[must_use]
247        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
248            self.max_encoding_message_size = Some(limit);
249            self
250        }
251    }
252    impl<T, B> tonic::codegen::Service<http::Request<B>> for ConfigServiceServer<T>
253    where
254        T: ConfigService,
255        B: Body + std::marker::Send + 'static,
256        B::Error: Into<StdError> + std::marker::Send + 'static,
257    {
258        type Response = http::Response<tonic::body::BoxBody>;
259        type Error = std::convert::Infallible;
260        type Future = BoxFuture<Self::Response, Self::Error>;
261        fn poll_ready(
262            &mut self,
263            _cx: &mut Context<'_>,
264        ) -> Poll<std::result::Result<(), Self::Error>> {
265            Poll::Ready(Ok(()))
266        }
267        fn call(&mut self, req: http::Request<B>) -> Self::Future {
268            match req.uri().path() {
269                "/compute.ConfigService/ShowConfig" => {
270                    #[allow(non_camel_case_types)]
271                    struct ShowConfigSvc<T: ConfigService>(pub Arc<T>);
272                    impl<
273                        T: ConfigService,
274                    > tonic::server::UnaryService<super::ShowConfigRequest>
275                    for ShowConfigSvc<T> {
276                        type Response = super::ShowConfigResponse;
277                        type Future = BoxFuture<
278                            tonic::Response<Self::Response>,
279                            tonic::Status,
280                        >;
281                        fn call(
282                            &mut self,
283                            request: tonic::Request<super::ShowConfigRequest>,
284                        ) -> Self::Future {
285                            let inner = Arc::clone(&self.0);
286                            let fut = async move {
287                                <T as ConfigService>::show_config(&inner, request).await
288                            };
289                            Box::pin(fut)
290                        }
291                    }
292                    let accept_compression_encodings = self.accept_compression_encodings;
293                    let send_compression_encodings = self.send_compression_encodings;
294                    let max_decoding_message_size = self.max_decoding_message_size;
295                    let max_encoding_message_size = self.max_encoding_message_size;
296                    let inner = self.inner.clone();
297                    let fut = async move {
298                        let method = ShowConfigSvc(inner);
299                        let codec = tonic::codec::ProstCodec::default();
300                        let mut grpc = tonic::server::Grpc::new(codec)
301                            .apply_compression_config(
302                                accept_compression_encodings,
303                                send_compression_encodings,
304                            )
305                            .apply_max_message_size_config(
306                                max_decoding_message_size,
307                                max_encoding_message_size,
308                            );
309                        let res = grpc.unary(method, req).await;
310                        Ok(res)
311                    };
312                    Box::pin(fut)
313                }
314                "/compute.ConfigService/ResizeCache" => {
315                    #[allow(non_camel_case_types)]
316                    struct ResizeCacheSvc<T: ConfigService>(pub Arc<T>);
317                    impl<
318                        T: ConfigService,
319                    > tonic::server::UnaryService<super::ResizeCacheRequest>
320                    for ResizeCacheSvc<T> {
321                        type Response = super::ResizeCacheResponse;
322                        type Future = BoxFuture<
323                            tonic::Response<Self::Response>,
324                            tonic::Status,
325                        >;
326                        fn call(
327                            &mut self,
328                            request: tonic::Request<super::ResizeCacheRequest>,
329                        ) -> Self::Future {
330                            let inner = Arc::clone(&self.0);
331                            let fut = async move {
332                                <T as ConfigService>::resize_cache(&inner, request).await
333                            };
334                            Box::pin(fut)
335                        }
336                    }
337                    let accept_compression_encodings = self.accept_compression_encodings;
338                    let send_compression_encodings = self.send_compression_encodings;
339                    let max_decoding_message_size = self.max_decoding_message_size;
340                    let max_encoding_message_size = self.max_encoding_message_size;
341                    let inner = self.inner.clone();
342                    let fut = async move {
343                        let method = ResizeCacheSvc(inner);
344                        let codec = tonic::codec::ProstCodec::default();
345                        let mut grpc = tonic::server::Grpc::new(codec)
346                            .apply_compression_config(
347                                accept_compression_encodings,
348                                send_compression_encodings,
349                            )
350                            .apply_max_message_size_config(
351                                max_decoding_message_size,
352                                max_encoding_message_size,
353                            );
354                        let res = grpc.unary(method, req).await;
355                        Ok(res)
356                    };
357                    Box::pin(fut)
358                }
359                _ => {
360                    Box::pin(async move {
361                        let mut response = http::Response::new(empty_body());
362                        let headers = response.headers_mut();
363                        headers
364                            .insert(
365                                tonic::Status::GRPC_STATUS,
366                                (tonic::Code::Unimplemented as i32).into(),
367                            );
368                        headers
369                            .insert(
370                                http::header::CONTENT_TYPE,
371                                tonic::metadata::GRPC_CONTENT_TYPE,
372                            );
373                        Ok(response)
374                    })
375                }
376            }
377        }
378    }
379    impl<T> Clone for ConfigServiceServer<T> {
380        fn clone(&self) -> Self {
381            let inner = self.inner.clone();
382            Self {
383                inner,
384                accept_compression_encodings: self.accept_compression_encodings,
385                send_compression_encodings: self.send_compression_encodings,
386                max_decoding_message_size: self.max_decoding_message_size,
387                max_encoding_message_size: self.max_encoding_message_size,
388            }
389        }
390    }
391    /// Generated gRPC service name
392    pub const SERVICE_NAME: &str = "compute.ConfigService";
393    impl<T> tonic::server::NamedService for ConfigServiceServer<T> {
394        const NAME: &'static str = SERVICE_NAME;
395    }
396}