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