1pub mod database_client {
4 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5 use tonic::codegen::*;
6 use tonic::codegen::http::Uri;
7 #[derive(Debug, Clone)]
8 pub struct DatabaseClient<T> {
9 inner: tonic::client::Grpc<T>,
10 }
11 impl DatabaseClient<tonic::transport::Channel> {
12 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14 where
15 D: TryInto<tonic::transport::Endpoint>,
16 D::Error: Into<StdError>,
17 {
18 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19 Ok(Self::new(conn))
20 }
21 }
22 impl<T> DatabaseClient<T>
23 where
24 T: tonic::client::GrpcService<tonic::body::BoxBody>,
25 T::Error: Into<StdError>,
26 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28 {
29 pub fn new(inner: T) -> Self {
30 let inner = tonic::client::Grpc::new(inner);
31 Self { inner }
32 }
33 pub fn with_origin(inner: T, origin: Uri) -> Self {
34 let inner = tonic::client::Grpc::with_origin(inner, origin);
35 Self { inner }
36 }
37 pub fn with_interceptor<F>(
38 inner: T,
39 interceptor: F,
40 ) -> DatabaseClient<InterceptedService<T, F>>
41 where
42 F: tonic::service::Interceptor,
43 T::ResponseBody: Default,
44 T: tonic::codegen::Service<
45 http::Request<tonic::body::BoxBody>,
46 Response = http::Response<
47 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48 >,
49 >,
50 <T as tonic::codegen::Service<
51 http::Request<tonic::body::BoxBody>,
52 >>::Error: Into<StdError> + Send + Sync,
53 {
54 DatabaseClient::new(InterceptedService::new(inner, interceptor))
55 }
56 #[must_use]
61 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62 self.inner = self.inner.send_compressed(encoding);
63 self
64 }
65 #[must_use]
67 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68 self.inner = self.inner.accept_compressed(encoding);
69 self
70 }
71 #[must_use]
75 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76 self.inner = self.inner.max_decoding_message_size(limit);
77 self
78 }
79 #[must_use]
83 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84 self.inner = self.inner.max_encoding_message_size(limit);
85 self
86 }
87 pub async fn has(
88 &mut self,
89 request: impl tonic::IntoRequest<super::HasRequest>,
90 ) -> std::result::Result<tonic::Response<super::HasResponse>, tonic::Status> {
91 self.inner
92 .ready()
93 .await
94 .map_err(|e| {
95 tonic::Status::new(
96 tonic::Code::Unknown,
97 format!("Service was not ready: {}", e.into()),
98 )
99 })?;
100 let codec = tonic::codec::ProstCodec::default();
101 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Has");
102 let mut req = request.into_request();
103 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "Has"));
104 self.inner.unary(req, path, codec).await
105 }
106 pub async fn get(
107 &mut self,
108 request: impl tonic::IntoRequest<super::GetRequest>,
109 ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status> {
110 self.inner
111 .ready()
112 .await
113 .map_err(|e| {
114 tonic::Status::new(
115 tonic::Code::Unknown,
116 format!("Service was not ready: {}", e.into()),
117 )
118 })?;
119 let codec = tonic::codec::ProstCodec::default();
120 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Get");
121 let mut req = request.into_request();
122 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "Get"));
123 self.inner.unary(req, path, codec).await
124 }
125 pub async fn put(
126 &mut self,
127 request: impl tonic::IntoRequest<super::PutRequest>,
128 ) -> std::result::Result<tonic::Response<super::PutResponse>, tonic::Status> {
129 self.inner
130 .ready()
131 .await
132 .map_err(|e| {
133 tonic::Status::new(
134 tonic::Code::Unknown,
135 format!("Service was not ready: {}", e.into()),
136 )
137 })?;
138 let codec = tonic::codec::ProstCodec::default();
139 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Put");
140 let mut req = request.into_request();
141 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "Put"));
142 self.inner.unary(req, path, codec).await
143 }
144 pub async fn delete(
145 &mut self,
146 request: impl tonic::IntoRequest<super::DeleteRequest>,
147 ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
148 self.inner
149 .ready()
150 .await
151 .map_err(|e| {
152 tonic::Status::new(
153 tonic::Code::Unknown,
154 format!("Service was not ready: {}", e.into()),
155 )
156 })?;
157 let codec = tonic::codec::ProstCodec::default();
158 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Delete");
159 let mut req = request.into_request();
160 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "Delete"));
161 self.inner.unary(req, path, codec).await
162 }
163 pub async fn compact(
164 &mut self,
165 request: impl tonic::IntoRequest<super::CompactRequest>,
166 ) -> std::result::Result<
167 tonic::Response<super::CompactResponse>,
168 tonic::Status,
169 > {
170 self.inner
171 .ready()
172 .await
173 .map_err(|e| {
174 tonic::Status::new(
175 tonic::Code::Unknown,
176 format!("Service was not ready: {}", e.into()),
177 )
178 })?;
179 let codec = tonic::codec::ProstCodec::default();
180 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Compact");
181 let mut req = request.into_request();
182 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "Compact"));
183 self.inner.unary(req, path, codec).await
184 }
185 pub async fn close(
186 &mut self,
187 request: impl tonic::IntoRequest<super::CloseRequest>,
188 ) -> std::result::Result<tonic::Response<super::CloseResponse>, tonic::Status> {
189 self.inner
190 .ready()
191 .await
192 .map_err(|e| {
193 tonic::Status::new(
194 tonic::Code::Unknown,
195 format!("Service was not ready: {}", e.into()),
196 )
197 })?;
198 let codec = tonic::codec::ProstCodec::default();
199 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Close");
200 let mut req = request.into_request();
201 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "Close"));
202 self.inner.unary(req, path, codec).await
203 }
204 pub async fn health_check(
205 &mut self,
206 request: impl tonic::IntoRequest<super::super::google::protobuf::Empty>,
207 ) -> std::result::Result<
208 tonic::Response<super::HealthCheckResponse>,
209 tonic::Status,
210 > {
211 self.inner
212 .ready()
213 .await
214 .map_err(|e| {
215 tonic::Status::new(
216 tonic::Code::Unknown,
217 format!("Service was not ready: {}", e.into()),
218 )
219 })?;
220 let codec = tonic::codec::ProstCodec::default();
221 let path = http::uri::PathAndQuery::from_static(
222 "/rpcdb.Database/HealthCheck",
223 );
224 let mut req = request.into_request();
225 req.extensions_mut()
226 .insert(GrpcMethod::new("rpcdb.Database", "HealthCheck"));
227 self.inner.unary(req, path, codec).await
228 }
229 pub async fn write_batch(
230 &mut self,
231 request: impl tonic::IntoRequest<super::WriteBatchRequest>,
232 ) -> std::result::Result<
233 tonic::Response<super::WriteBatchResponse>,
234 tonic::Status,
235 > {
236 self.inner
237 .ready()
238 .await
239 .map_err(|e| {
240 tonic::Status::new(
241 tonic::Code::Unknown,
242 format!("Service was not ready: {}", e.into()),
243 )
244 })?;
245 let codec = tonic::codec::ProstCodec::default();
246 let path = http::uri::PathAndQuery::from_static(
247 "/rpcdb.Database/WriteBatch",
248 );
249 let mut req = request.into_request();
250 req.extensions_mut().insert(GrpcMethod::new("rpcdb.Database", "WriteBatch"));
251 self.inner.unary(req, path, codec).await
252 }
253 pub async fn new_iterator_with_start_and_prefix(
254 &mut self,
255 request: impl tonic::IntoRequest<super::NewIteratorWithStartAndPrefixRequest>,
256 ) -> std::result::Result<
257 tonic::Response<super::NewIteratorWithStartAndPrefixResponse>,
258 tonic::Status,
259 > {
260 self.inner
261 .ready()
262 .await
263 .map_err(|e| {
264 tonic::Status::new(
265 tonic::Code::Unknown,
266 format!("Service was not ready: {}", e.into()),
267 )
268 })?;
269 let codec = tonic::codec::ProstCodec::default();
270 let path = http::uri::PathAndQuery::from_static(
271 "/rpcdb.Database/NewIteratorWithStartAndPrefix",
272 );
273 let mut req = request.into_request();
274 req.extensions_mut()
275 .insert(
276 GrpcMethod::new("rpcdb.Database", "NewIteratorWithStartAndPrefix"),
277 );
278 self.inner.unary(req, path, codec).await
279 }
280 pub async fn iterator_next(
281 &mut self,
282 request: impl tonic::IntoRequest<super::IteratorNextRequest>,
283 ) -> std::result::Result<
284 tonic::Response<super::IteratorNextResponse>,
285 tonic::Status,
286 > {
287 self.inner
288 .ready()
289 .await
290 .map_err(|e| {
291 tonic::Status::new(
292 tonic::Code::Unknown,
293 format!("Service was not ready: {}", e.into()),
294 )
295 })?;
296 let codec = tonic::codec::ProstCodec::default();
297 let path = http::uri::PathAndQuery::from_static(
298 "/rpcdb.Database/IteratorNext",
299 );
300 let mut req = request.into_request();
301 req.extensions_mut()
302 .insert(GrpcMethod::new("rpcdb.Database", "IteratorNext"));
303 self.inner.unary(req, path, codec).await
304 }
305 pub async fn iterator_error(
306 &mut self,
307 request: impl tonic::IntoRequest<super::IteratorErrorRequest>,
308 ) -> std::result::Result<
309 tonic::Response<super::IteratorErrorResponse>,
310 tonic::Status,
311 > {
312 self.inner
313 .ready()
314 .await
315 .map_err(|e| {
316 tonic::Status::new(
317 tonic::Code::Unknown,
318 format!("Service was not ready: {}", e.into()),
319 )
320 })?;
321 let codec = tonic::codec::ProstCodec::default();
322 let path = http::uri::PathAndQuery::from_static(
323 "/rpcdb.Database/IteratorError",
324 );
325 let mut req = request.into_request();
326 req.extensions_mut()
327 .insert(GrpcMethod::new("rpcdb.Database", "IteratorError"));
328 self.inner.unary(req, path, codec).await
329 }
330 pub async fn iterator_release(
331 &mut self,
332 request: impl tonic::IntoRequest<super::IteratorReleaseRequest>,
333 ) -> std::result::Result<
334 tonic::Response<super::IteratorReleaseResponse>,
335 tonic::Status,
336 > {
337 self.inner
338 .ready()
339 .await
340 .map_err(|e| {
341 tonic::Status::new(
342 tonic::Code::Unknown,
343 format!("Service was not ready: {}", e.into()),
344 )
345 })?;
346 let codec = tonic::codec::ProstCodec::default();
347 let path = http::uri::PathAndQuery::from_static(
348 "/rpcdb.Database/IteratorRelease",
349 );
350 let mut req = request.into_request();
351 req.extensions_mut()
352 .insert(GrpcMethod::new("rpcdb.Database", "IteratorRelease"));
353 self.inner.unary(req, path, codec).await
354 }
355 }
356}
357pub mod database_server {
359 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
360 use tonic::codegen::*;
361 #[async_trait]
363 pub trait Database: Send + Sync + 'static {
364 async fn has(
365 &self,
366 request: tonic::Request<super::HasRequest>,
367 ) -> std::result::Result<tonic::Response<super::HasResponse>, tonic::Status>;
368 async fn get(
369 &self,
370 request: tonic::Request<super::GetRequest>,
371 ) -> std::result::Result<tonic::Response<super::GetResponse>, tonic::Status>;
372 async fn put(
373 &self,
374 request: tonic::Request<super::PutRequest>,
375 ) -> std::result::Result<tonic::Response<super::PutResponse>, tonic::Status>;
376 async fn delete(
377 &self,
378 request: tonic::Request<super::DeleteRequest>,
379 ) -> std::result::Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
380 async fn compact(
381 &self,
382 request: tonic::Request<super::CompactRequest>,
383 ) -> std::result::Result<tonic::Response<super::CompactResponse>, tonic::Status>;
384 async fn close(
385 &self,
386 request: tonic::Request<super::CloseRequest>,
387 ) -> std::result::Result<tonic::Response<super::CloseResponse>, tonic::Status>;
388 async fn health_check(
389 &self,
390 request: tonic::Request<super::super::google::protobuf::Empty>,
391 ) -> std::result::Result<
392 tonic::Response<super::HealthCheckResponse>,
393 tonic::Status,
394 >;
395 async fn write_batch(
396 &self,
397 request: tonic::Request<super::WriteBatchRequest>,
398 ) -> std::result::Result<
399 tonic::Response<super::WriteBatchResponse>,
400 tonic::Status,
401 >;
402 async fn new_iterator_with_start_and_prefix(
403 &self,
404 request: tonic::Request<super::NewIteratorWithStartAndPrefixRequest>,
405 ) -> std::result::Result<
406 tonic::Response<super::NewIteratorWithStartAndPrefixResponse>,
407 tonic::Status,
408 >;
409 async fn iterator_next(
410 &self,
411 request: tonic::Request<super::IteratorNextRequest>,
412 ) -> std::result::Result<
413 tonic::Response<super::IteratorNextResponse>,
414 tonic::Status,
415 >;
416 async fn iterator_error(
417 &self,
418 request: tonic::Request<super::IteratorErrorRequest>,
419 ) -> std::result::Result<
420 tonic::Response<super::IteratorErrorResponse>,
421 tonic::Status,
422 >;
423 async fn iterator_release(
424 &self,
425 request: tonic::Request<super::IteratorReleaseRequest>,
426 ) -> std::result::Result<
427 tonic::Response<super::IteratorReleaseResponse>,
428 tonic::Status,
429 >;
430 }
431 #[derive(Debug)]
432 pub struct DatabaseServer<T: Database> {
433 inner: _Inner<T>,
434 accept_compression_encodings: EnabledCompressionEncodings,
435 send_compression_encodings: EnabledCompressionEncodings,
436 max_decoding_message_size: Option<usize>,
437 max_encoding_message_size: Option<usize>,
438 }
439 struct _Inner<T>(Arc<T>);
440 impl<T: Database> DatabaseServer<T> {
441 pub fn new(inner: T) -> Self {
442 Self::from_arc(Arc::new(inner))
443 }
444 pub fn from_arc(inner: Arc<T>) -> Self {
445 let inner = _Inner(inner);
446 Self {
447 inner,
448 accept_compression_encodings: Default::default(),
449 send_compression_encodings: Default::default(),
450 max_decoding_message_size: None,
451 max_encoding_message_size: None,
452 }
453 }
454 pub fn with_interceptor<F>(
455 inner: T,
456 interceptor: F,
457 ) -> InterceptedService<Self, F>
458 where
459 F: tonic::service::Interceptor,
460 {
461 InterceptedService::new(Self::new(inner), interceptor)
462 }
463 #[must_use]
465 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
466 self.accept_compression_encodings.enable(encoding);
467 self
468 }
469 #[must_use]
471 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
472 self.send_compression_encodings.enable(encoding);
473 self
474 }
475 #[must_use]
479 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
480 self.max_decoding_message_size = Some(limit);
481 self
482 }
483 #[must_use]
487 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
488 self.max_encoding_message_size = Some(limit);
489 self
490 }
491 }
492 impl<T, B> tonic::codegen::Service<http::Request<B>> for DatabaseServer<T>
493 where
494 T: Database,
495 B: Body + Send + 'static,
496 B::Error: Into<StdError> + Send + 'static,
497 {
498 type Response = http::Response<tonic::body::BoxBody>;
499 type Error = std::convert::Infallible;
500 type Future = BoxFuture<Self::Response, Self::Error>;
501 fn poll_ready(
502 &mut self,
503 _cx: &mut Context<'_>,
504 ) -> Poll<std::result::Result<(), Self::Error>> {
505 Poll::Ready(Ok(()))
506 }
507 fn call(&mut self, req: http::Request<B>) -> Self::Future {
508 let inner = self.inner.clone();
509 match req.uri().path() {
510 "/rpcdb.Database/Has" => {
511 #[allow(non_camel_case_types)]
512 struct HasSvc<T: Database>(pub Arc<T>);
513 impl<T: Database> tonic::server::UnaryService<super::HasRequest>
514 for HasSvc<T> {
515 type Response = super::HasResponse;
516 type Future = BoxFuture<
517 tonic::Response<Self::Response>,
518 tonic::Status,
519 >;
520 fn call(
521 &mut self,
522 request: tonic::Request<super::HasRequest>,
523 ) -> Self::Future {
524 let inner = Arc::clone(&self.0);
525 let fut = async move { (*inner).has(request).await };
526 Box::pin(fut)
527 }
528 }
529 let accept_compression_encodings = self.accept_compression_encodings;
530 let send_compression_encodings = self.send_compression_encodings;
531 let max_decoding_message_size = self.max_decoding_message_size;
532 let max_encoding_message_size = self.max_encoding_message_size;
533 let inner = self.inner.clone();
534 let fut = async move {
535 let inner = inner.0;
536 let method = HasSvc(inner);
537 let codec = tonic::codec::ProstCodec::default();
538 let mut grpc = tonic::server::Grpc::new(codec)
539 .apply_compression_config(
540 accept_compression_encodings,
541 send_compression_encodings,
542 )
543 .apply_max_message_size_config(
544 max_decoding_message_size,
545 max_encoding_message_size,
546 );
547 let res = grpc.unary(method, req).await;
548 Ok(res)
549 };
550 Box::pin(fut)
551 }
552 "/rpcdb.Database/Get" => {
553 #[allow(non_camel_case_types)]
554 struct GetSvc<T: Database>(pub Arc<T>);
555 impl<T: Database> tonic::server::UnaryService<super::GetRequest>
556 for GetSvc<T> {
557 type Response = super::GetResponse;
558 type Future = BoxFuture<
559 tonic::Response<Self::Response>,
560 tonic::Status,
561 >;
562 fn call(
563 &mut self,
564 request: tonic::Request<super::GetRequest>,
565 ) -> Self::Future {
566 let inner = Arc::clone(&self.0);
567 let fut = async move { (*inner).get(request).await };
568 Box::pin(fut)
569 }
570 }
571 let accept_compression_encodings = self.accept_compression_encodings;
572 let send_compression_encodings = self.send_compression_encodings;
573 let max_decoding_message_size = self.max_decoding_message_size;
574 let max_encoding_message_size = self.max_encoding_message_size;
575 let inner = self.inner.clone();
576 let fut = async move {
577 let inner = inner.0;
578 let method = GetSvc(inner);
579 let codec = tonic::codec::ProstCodec::default();
580 let mut grpc = tonic::server::Grpc::new(codec)
581 .apply_compression_config(
582 accept_compression_encodings,
583 send_compression_encodings,
584 )
585 .apply_max_message_size_config(
586 max_decoding_message_size,
587 max_encoding_message_size,
588 );
589 let res = grpc.unary(method, req).await;
590 Ok(res)
591 };
592 Box::pin(fut)
593 }
594 "/rpcdb.Database/Put" => {
595 #[allow(non_camel_case_types)]
596 struct PutSvc<T: Database>(pub Arc<T>);
597 impl<T: Database> tonic::server::UnaryService<super::PutRequest>
598 for PutSvc<T> {
599 type Response = super::PutResponse;
600 type Future = BoxFuture<
601 tonic::Response<Self::Response>,
602 tonic::Status,
603 >;
604 fn call(
605 &mut self,
606 request: tonic::Request<super::PutRequest>,
607 ) -> Self::Future {
608 let inner = Arc::clone(&self.0);
609 let fut = async move { (*inner).put(request).await };
610 Box::pin(fut)
611 }
612 }
613 let accept_compression_encodings = self.accept_compression_encodings;
614 let send_compression_encodings = self.send_compression_encodings;
615 let max_decoding_message_size = self.max_decoding_message_size;
616 let max_encoding_message_size = self.max_encoding_message_size;
617 let inner = self.inner.clone();
618 let fut = async move {
619 let inner = inner.0;
620 let method = PutSvc(inner);
621 let codec = tonic::codec::ProstCodec::default();
622 let mut grpc = tonic::server::Grpc::new(codec)
623 .apply_compression_config(
624 accept_compression_encodings,
625 send_compression_encodings,
626 )
627 .apply_max_message_size_config(
628 max_decoding_message_size,
629 max_encoding_message_size,
630 );
631 let res = grpc.unary(method, req).await;
632 Ok(res)
633 };
634 Box::pin(fut)
635 }
636 "/rpcdb.Database/Delete" => {
637 #[allow(non_camel_case_types)]
638 struct DeleteSvc<T: Database>(pub Arc<T>);
639 impl<T: Database> tonic::server::UnaryService<super::DeleteRequest>
640 for DeleteSvc<T> {
641 type Response = super::DeleteResponse;
642 type Future = BoxFuture<
643 tonic::Response<Self::Response>,
644 tonic::Status,
645 >;
646 fn call(
647 &mut self,
648 request: tonic::Request<super::DeleteRequest>,
649 ) -> Self::Future {
650 let inner = Arc::clone(&self.0);
651 let fut = async move { (*inner).delete(request).await };
652 Box::pin(fut)
653 }
654 }
655 let accept_compression_encodings = self.accept_compression_encodings;
656 let send_compression_encodings = self.send_compression_encodings;
657 let max_decoding_message_size = self.max_decoding_message_size;
658 let max_encoding_message_size = self.max_encoding_message_size;
659 let inner = self.inner.clone();
660 let fut = async move {
661 let inner = inner.0;
662 let method = DeleteSvc(inner);
663 let codec = tonic::codec::ProstCodec::default();
664 let mut grpc = tonic::server::Grpc::new(codec)
665 .apply_compression_config(
666 accept_compression_encodings,
667 send_compression_encodings,
668 )
669 .apply_max_message_size_config(
670 max_decoding_message_size,
671 max_encoding_message_size,
672 );
673 let res = grpc.unary(method, req).await;
674 Ok(res)
675 };
676 Box::pin(fut)
677 }
678 "/rpcdb.Database/Compact" => {
679 #[allow(non_camel_case_types)]
680 struct CompactSvc<T: Database>(pub Arc<T>);
681 impl<T: Database> tonic::server::UnaryService<super::CompactRequest>
682 for CompactSvc<T> {
683 type Response = super::CompactResponse;
684 type Future = BoxFuture<
685 tonic::Response<Self::Response>,
686 tonic::Status,
687 >;
688 fn call(
689 &mut self,
690 request: tonic::Request<super::CompactRequest>,
691 ) -> Self::Future {
692 let inner = Arc::clone(&self.0);
693 let fut = async move { (*inner).compact(request).await };
694 Box::pin(fut)
695 }
696 }
697 let accept_compression_encodings = self.accept_compression_encodings;
698 let send_compression_encodings = self.send_compression_encodings;
699 let max_decoding_message_size = self.max_decoding_message_size;
700 let max_encoding_message_size = self.max_encoding_message_size;
701 let inner = self.inner.clone();
702 let fut = async move {
703 let inner = inner.0;
704 let method = CompactSvc(inner);
705 let codec = tonic::codec::ProstCodec::default();
706 let mut grpc = tonic::server::Grpc::new(codec)
707 .apply_compression_config(
708 accept_compression_encodings,
709 send_compression_encodings,
710 )
711 .apply_max_message_size_config(
712 max_decoding_message_size,
713 max_encoding_message_size,
714 );
715 let res = grpc.unary(method, req).await;
716 Ok(res)
717 };
718 Box::pin(fut)
719 }
720 "/rpcdb.Database/Close" => {
721 #[allow(non_camel_case_types)]
722 struct CloseSvc<T: Database>(pub Arc<T>);
723 impl<T: Database> tonic::server::UnaryService<super::CloseRequest>
724 for CloseSvc<T> {
725 type Response = super::CloseResponse;
726 type Future = BoxFuture<
727 tonic::Response<Self::Response>,
728 tonic::Status,
729 >;
730 fn call(
731 &mut self,
732 request: tonic::Request<super::CloseRequest>,
733 ) -> Self::Future {
734 let inner = Arc::clone(&self.0);
735 let fut = async move { (*inner).close(request).await };
736 Box::pin(fut)
737 }
738 }
739 let accept_compression_encodings = self.accept_compression_encodings;
740 let send_compression_encodings = self.send_compression_encodings;
741 let max_decoding_message_size = self.max_decoding_message_size;
742 let max_encoding_message_size = self.max_encoding_message_size;
743 let inner = self.inner.clone();
744 let fut = async move {
745 let inner = inner.0;
746 let method = CloseSvc(inner);
747 let codec = tonic::codec::ProstCodec::default();
748 let mut grpc = tonic::server::Grpc::new(codec)
749 .apply_compression_config(
750 accept_compression_encodings,
751 send_compression_encodings,
752 )
753 .apply_max_message_size_config(
754 max_decoding_message_size,
755 max_encoding_message_size,
756 );
757 let res = grpc.unary(method, req).await;
758 Ok(res)
759 };
760 Box::pin(fut)
761 }
762 "/rpcdb.Database/HealthCheck" => {
763 #[allow(non_camel_case_types)]
764 struct HealthCheckSvc<T: Database>(pub Arc<T>);
765 impl<
766 T: Database,
767 > tonic::server::UnaryService<super::super::google::protobuf::Empty>
768 for HealthCheckSvc<T> {
769 type Response = super::HealthCheckResponse;
770 type Future = BoxFuture<
771 tonic::Response<Self::Response>,
772 tonic::Status,
773 >;
774 fn call(
775 &mut self,
776 request: tonic::Request<
777 super::super::google::protobuf::Empty,
778 >,
779 ) -> Self::Future {
780 let inner = Arc::clone(&self.0);
781 let fut = async move {
782 (*inner).health_check(request).await
783 };
784 Box::pin(fut)
785 }
786 }
787 let accept_compression_encodings = self.accept_compression_encodings;
788 let send_compression_encodings = self.send_compression_encodings;
789 let max_decoding_message_size = self.max_decoding_message_size;
790 let max_encoding_message_size = self.max_encoding_message_size;
791 let inner = self.inner.clone();
792 let fut = async move {
793 let inner = inner.0;
794 let method = HealthCheckSvc(inner);
795 let codec = tonic::codec::ProstCodec::default();
796 let mut grpc = tonic::server::Grpc::new(codec)
797 .apply_compression_config(
798 accept_compression_encodings,
799 send_compression_encodings,
800 )
801 .apply_max_message_size_config(
802 max_decoding_message_size,
803 max_encoding_message_size,
804 );
805 let res = grpc.unary(method, req).await;
806 Ok(res)
807 };
808 Box::pin(fut)
809 }
810 "/rpcdb.Database/WriteBatch" => {
811 #[allow(non_camel_case_types)]
812 struct WriteBatchSvc<T: Database>(pub Arc<T>);
813 impl<
814 T: Database,
815 > tonic::server::UnaryService<super::WriteBatchRequest>
816 for WriteBatchSvc<T> {
817 type Response = super::WriteBatchResponse;
818 type Future = BoxFuture<
819 tonic::Response<Self::Response>,
820 tonic::Status,
821 >;
822 fn call(
823 &mut self,
824 request: tonic::Request<super::WriteBatchRequest>,
825 ) -> Self::Future {
826 let inner = Arc::clone(&self.0);
827 let fut = async move { (*inner).write_batch(request).await };
828 Box::pin(fut)
829 }
830 }
831 let accept_compression_encodings = self.accept_compression_encodings;
832 let send_compression_encodings = self.send_compression_encodings;
833 let max_decoding_message_size = self.max_decoding_message_size;
834 let max_encoding_message_size = self.max_encoding_message_size;
835 let inner = self.inner.clone();
836 let fut = async move {
837 let inner = inner.0;
838 let method = WriteBatchSvc(inner);
839 let codec = tonic::codec::ProstCodec::default();
840 let mut grpc = tonic::server::Grpc::new(codec)
841 .apply_compression_config(
842 accept_compression_encodings,
843 send_compression_encodings,
844 )
845 .apply_max_message_size_config(
846 max_decoding_message_size,
847 max_encoding_message_size,
848 );
849 let res = grpc.unary(method, req).await;
850 Ok(res)
851 };
852 Box::pin(fut)
853 }
854 "/rpcdb.Database/NewIteratorWithStartAndPrefix" => {
855 #[allow(non_camel_case_types)]
856 struct NewIteratorWithStartAndPrefixSvc<T: Database>(pub Arc<T>);
857 impl<
858 T: Database,
859 > tonic::server::UnaryService<
860 super::NewIteratorWithStartAndPrefixRequest,
861 > for NewIteratorWithStartAndPrefixSvc<T> {
862 type Response = super::NewIteratorWithStartAndPrefixResponse;
863 type Future = BoxFuture<
864 tonic::Response<Self::Response>,
865 tonic::Status,
866 >;
867 fn call(
868 &mut self,
869 request: tonic::Request<
870 super::NewIteratorWithStartAndPrefixRequest,
871 >,
872 ) -> Self::Future {
873 let inner = Arc::clone(&self.0);
874 let fut = async move {
875 (*inner).new_iterator_with_start_and_prefix(request).await
876 };
877 Box::pin(fut)
878 }
879 }
880 let accept_compression_encodings = self.accept_compression_encodings;
881 let send_compression_encodings = self.send_compression_encodings;
882 let max_decoding_message_size = self.max_decoding_message_size;
883 let max_encoding_message_size = self.max_encoding_message_size;
884 let inner = self.inner.clone();
885 let fut = async move {
886 let inner = inner.0;
887 let method = NewIteratorWithStartAndPrefixSvc(inner);
888 let codec = tonic::codec::ProstCodec::default();
889 let mut grpc = tonic::server::Grpc::new(codec)
890 .apply_compression_config(
891 accept_compression_encodings,
892 send_compression_encodings,
893 )
894 .apply_max_message_size_config(
895 max_decoding_message_size,
896 max_encoding_message_size,
897 );
898 let res = grpc.unary(method, req).await;
899 Ok(res)
900 };
901 Box::pin(fut)
902 }
903 "/rpcdb.Database/IteratorNext" => {
904 #[allow(non_camel_case_types)]
905 struct IteratorNextSvc<T: Database>(pub Arc<T>);
906 impl<
907 T: Database,
908 > tonic::server::UnaryService<super::IteratorNextRequest>
909 for IteratorNextSvc<T> {
910 type Response = super::IteratorNextResponse;
911 type Future = BoxFuture<
912 tonic::Response<Self::Response>,
913 tonic::Status,
914 >;
915 fn call(
916 &mut self,
917 request: tonic::Request<super::IteratorNextRequest>,
918 ) -> Self::Future {
919 let inner = Arc::clone(&self.0);
920 let fut = async move {
921 (*inner).iterator_next(request).await
922 };
923 Box::pin(fut)
924 }
925 }
926 let accept_compression_encodings = self.accept_compression_encodings;
927 let send_compression_encodings = self.send_compression_encodings;
928 let max_decoding_message_size = self.max_decoding_message_size;
929 let max_encoding_message_size = self.max_encoding_message_size;
930 let inner = self.inner.clone();
931 let fut = async move {
932 let inner = inner.0;
933 let method = IteratorNextSvc(inner);
934 let codec = tonic::codec::ProstCodec::default();
935 let mut grpc = tonic::server::Grpc::new(codec)
936 .apply_compression_config(
937 accept_compression_encodings,
938 send_compression_encodings,
939 )
940 .apply_max_message_size_config(
941 max_decoding_message_size,
942 max_encoding_message_size,
943 );
944 let res = grpc.unary(method, req).await;
945 Ok(res)
946 };
947 Box::pin(fut)
948 }
949 "/rpcdb.Database/IteratorError" => {
950 #[allow(non_camel_case_types)]
951 struct IteratorErrorSvc<T: Database>(pub Arc<T>);
952 impl<
953 T: Database,
954 > tonic::server::UnaryService<super::IteratorErrorRequest>
955 for IteratorErrorSvc<T> {
956 type Response = super::IteratorErrorResponse;
957 type Future = BoxFuture<
958 tonic::Response<Self::Response>,
959 tonic::Status,
960 >;
961 fn call(
962 &mut self,
963 request: tonic::Request<super::IteratorErrorRequest>,
964 ) -> Self::Future {
965 let inner = Arc::clone(&self.0);
966 let fut = async move {
967 (*inner).iterator_error(request).await
968 };
969 Box::pin(fut)
970 }
971 }
972 let accept_compression_encodings = self.accept_compression_encodings;
973 let send_compression_encodings = self.send_compression_encodings;
974 let max_decoding_message_size = self.max_decoding_message_size;
975 let max_encoding_message_size = self.max_encoding_message_size;
976 let inner = self.inner.clone();
977 let fut = async move {
978 let inner = inner.0;
979 let method = IteratorErrorSvc(inner);
980 let codec = tonic::codec::ProstCodec::default();
981 let mut grpc = tonic::server::Grpc::new(codec)
982 .apply_compression_config(
983 accept_compression_encodings,
984 send_compression_encodings,
985 )
986 .apply_max_message_size_config(
987 max_decoding_message_size,
988 max_encoding_message_size,
989 );
990 let res = grpc.unary(method, req).await;
991 Ok(res)
992 };
993 Box::pin(fut)
994 }
995 "/rpcdb.Database/IteratorRelease" => {
996 #[allow(non_camel_case_types)]
997 struct IteratorReleaseSvc<T: Database>(pub Arc<T>);
998 impl<
999 T: Database,
1000 > tonic::server::UnaryService<super::IteratorReleaseRequest>
1001 for IteratorReleaseSvc<T> {
1002 type Response = super::IteratorReleaseResponse;
1003 type Future = BoxFuture<
1004 tonic::Response<Self::Response>,
1005 tonic::Status,
1006 >;
1007 fn call(
1008 &mut self,
1009 request: tonic::Request<super::IteratorReleaseRequest>,
1010 ) -> Self::Future {
1011 let inner = Arc::clone(&self.0);
1012 let fut = async move {
1013 (*inner).iterator_release(request).await
1014 };
1015 Box::pin(fut)
1016 }
1017 }
1018 let accept_compression_encodings = self.accept_compression_encodings;
1019 let send_compression_encodings = self.send_compression_encodings;
1020 let max_decoding_message_size = self.max_decoding_message_size;
1021 let max_encoding_message_size = self.max_encoding_message_size;
1022 let inner = self.inner.clone();
1023 let fut = async move {
1024 let inner = inner.0;
1025 let method = IteratorReleaseSvc(inner);
1026 let codec = tonic::codec::ProstCodec::default();
1027 let mut grpc = tonic::server::Grpc::new(codec)
1028 .apply_compression_config(
1029 accept_compression_encodings,
1030 send_compression_encodings,
1031 )
1032 .apply_max_message_size_config(
1033 max_decoding_message_size,
1034 max_encoding_message_size,
1035 );
1036 let res = grpc.unary(method, req).await;
1037 Ok(res)
1038 };
1039 Box::pin(fut)
1040 }
1041 _ => {
1042 Box::pin(async move {
1043 Ok(
1044 http::Response::builder()
1045 .status(200)
1046 .header("grpc-status", "12")
1047 .header("content-type", "application/grpc")
1048 .body(empty_body())
1049 .unwrap(),
1050 )
1051 })
1052 }
1053 }
1054 }
1055 }
1056 impl<T: Database> Clone for DatabaseServer<T> {
1057 fn clone(&self) -> Self {
1058 let inner = self.inner.clone();
1059 Self {
1060 inner,
1061 accept_compression_encodings: self.accept_compression_encodings,
1062 send_compression_encodings: self.send_compression_encodings,
1063 max_decoding_message_size: self.max_decoding_message_size,
1064 max_encoding_message_size: self.max_encoding_message_size,
1065 }
1066 }
1067 }
1068 impl<T: Database> Clone for _Inner<T> {
1069 fn clone(&self) -> Self {
1070 Self(Arc::clone(&self.0))
1071 }
1072 }
1073 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
1074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1075 write!(f, "{:?}", self.0)
1076 }
1077 }
1078 impl<T: Database> tonic::server::NamedService for DatabaseServer<T> {
1079 const NAME: &'static str = "rpcdb.Database";
1080 }
1081}