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: std::convert::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 pub async fn has(
72 &mut self,
73 request: impl tonic::IntoRequest<super::HasRequest>,
74 ) -> Result<tonic::Response<super::HasResponse>, tonic::Status> {
75 self.inner
76 .ready()
77 .await
78 .map_err(|e| {
79 tonic::Status::new(
80 tonic::Code::Unknown,
81 format!("Service was not ready: {}", e.into()),
82 )
83 })?;
84 let codec = tonic::codec::ProstCodec::default();
85 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Has");
86 self.inner.unary(request.into_request(), path, codec).await
87 }
88 pub async fn get(
89 &mut self,
90 request: impl tonic::IntoRequest<super::GetRequest>,
91 ) -> Result<tonic::Response<super::GetResponse>, tonic::Status> {
92 self.inner
93 .ready()
94 .await
95 .map_err(|e| {
96 tonic::Status::new(
97 tonic::Code::Unknown,
98 format!("Service was not ready: {}", e.into()),
99 )
100 })?;
101 let codec = tonic::codec::ProstCodec::default();
102 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Get");
103 self.inner.unary(request.into_request(), path, codec).await
104 }
105 pub async fn put(
106 &mut self,
107 request: impl tonic::IntoRequest<super::PutRequest>,
108 ) -> Result<tonic::Response<super::PutResponse>, tonic::Status> {
109 self.inner
110 .ready()
111 .await
112 .map_err(|e| {
113 tonic::Status::new(
114 tonic::Code::Unknown,
115 format!("Service was not ready: {}", e.into()),
116 )
117 })?;
118 let codec = tonic::codec::ProstCodec::default();
119 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Put");
120 self.inner.unary(request.into_request(), path, codec).await
121 }
122 pub async fn delete(
123 &mut self,
124 request: impl tonic::IntoRequest<super::DeleteRequest>,
125 ) -> Result<tonic::Response<super::DeleteResponse>, tonic::Status> {
126 self.inner
127 .ready()
128 .await
129 .map_err(|e| {
130 tonic::Status::new(
131 tonic::Code::Unknown,
132 format!("Service was not ready: {}", e.into()),
133 )
134 })?;
135 let codec = tonic::codec::ProstCodec::default();
136 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Delete");
137 self.inner.unary(request.into_request(), path, codec).await
138 }
139 pub async fn compact(
140 &mut self,
141 request: impl tonic::IntoRequest<super::CompactRequest>,
142 ) -> Result<tonic::Response<super::CompactResponse>, tonic::Status> {
143 self.inner
144 .ready()
145 .await
146 .map_err(|e| {
147 tonic::Status::new(
148 tonic::Code::Unknown,
149 format!("Service was not ready: {}", e.into()),
150 )
151 })?;
152 let codec = tonic::codec::ProstCodec::default();
153 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Compact");
154 self.inner.unary(request.into_request(), path, codec).await
155 }
156 pub async fn close(
157 &mut self,
158 request: impl tonic::IntoRequest<super::CloseRequest>,
159 ) -> Result<tonic::Response<super::CloseResponse>, tonic::Status> {
160 self.inner
161 .ready()
162 .await
163 .map_err(|e| {
164 tonic::Status::new(
165 tonic::Code::Unknown,
166 format!("Service was not ready: {}", e.into()),
167 )
168 })?;
169 let codec = tonic::codec::ProstCodec::default();
170 let path = http::uri::PathAndQuery::from_static("/rpcdb.Database/Close");
171 self.inner.unary(request.into_request(), path, codec).await
172 }
173 pub async fn health_check(
174 &mut self,
175 request: impl tonic::IntoRequest<super::super::google::protobuf::Empty>,
176 ) -> Result<tonic::Response<super::HealthCheckResponse>, tonic::Status> {
177 self.inner
178 .ready()
179 .await
180 .map_err(|e| {
181 tonic::Status::new(
182 tonic::Code::Unknown,
183 format!("Service was not ready: {}", e.into()),
184 )
185 })?;
186 let codec = tonic::codec::ProstCodec::default();
187 let path = http::uri::PathAndQuery::from_static(
188 "/rpcdb.Database/HealthCheck",
189 );
190 self.inner.unary(request.into_request(), path, codec).await
191 }
192 pub async fn write_batch(
193 &mut self,
194 request: impl tonic::IntoRequest<super::WriteBatchRequest>,
195 ) -> Result<tonic::Response<super::WriteBatchResponse>, tonic::Status> {
196 self.inner
197 .ready()
198 .await
199 .map_err(|e| {
200 tonic::Status::new(
201 tonic::Code::Unknown,
202 format!("Service was not ready: {}", e.into()),
203 )
204 })?;
205 let codec = tonic::codec::ProstCodec::default();
206 let path = http::uri::PathAndQuery::from_static(
207 "/rpcdb.Database/WriteBatch",
208 );
209 self.inner.unary(request.into_request(), path, codec).await
210 }
211 pub async fn new_iterator_with_start_and_prefix(
212 &mut self,
213 request: impl tonic::IntoRequest<super::NewIteratorWithStartAndPrefixRequest>,
214 ) -> Result<
215 tonic::Response<super::NewIteratorWithStartAndPrefixResponse>,
216 tonic::Status,
217 > {
218 self.inner
219 .ready()
220 .await
221 .map_err(|e| {
222 tonic::Status::new(
223 tonic::Code::Unknown,
224 format!("Service was not ready: {}", e.into()),
225 )
226 })?;
227 let codec = tonic::codec::ProstCodec::default();
228 let path = http::uri::PathAndQuery::from_static(
229 "/rpcdb.Database/NewIteratorWithStartAndPrefix",
230 );
231 self.inner.unary(request.into_request(), path, codec).await
232 }
233 pub async fn iterator_next(
234 &mut self,
235 request: impl tonic::IntoRequest<super::IteratorNextRequest>,
236 ) -> Result<tonic::Response<super::IteratorNextResponse>, tonic::Status> {
237 self.inner
238 .ready()
239 .await
240 .map_err(|e| {
241 tonic::Status::new(
242 tonic::Code::Unknown,
243 format!("Service was not ready: {}", e.into()),
244 )
245 })?;
246 let codec = tonic::codec::ProstCodec::default();
247 let path = http::uri::PathAndQuery::from_static(
248 "/rpcdb.Database/IteratorNext",
249 );
250 self.inner.unary(request.into_request(), path, codec).await
251 }
252 pub async fn iterator_error(
253 &mut self,
254 request: impl tonic::IntoRequest<super::IteratorErrorRequest>,
255 ) -> Result<tonic::Response<super::IteratorErrorResponse>, tonic::Status> {
256 self.inner
257 .ready()
258 .await
259 .map_err(|e| {
260 tonic::Status::new(
261 tonic::Code::Unknown,
262 format!("Service was not ready: {}", e.into()),
263 )
264 })?;
265 let codec = tonic::codec::ProstCodec::default();
266 let path = http::uri::PathAndQuery::from_static(
267 "/rpcdb.Database/IteratorError",
268 );
269 self.inner.unary(request.into_request(), path, codec).await
270 }
271 pub async fn iterator_release(
272 &mut self,
273 request: impl tonic::IntoRequest<super::IteratorReleaseRequest>,
274 ) -> Result<tonic::Response<super::IteratorReleaseResponse>, tonic::Status> {
275 self.inner
276 .ready()
277 .await
278 .map_err(|e| {
279 tonic::Status::new(
280 tonic::Code::Unknown,
281 format!("Service was not ready: {}", e.into()),
282 )
283 })?;
284 let codec = tonic::codec::ProstCodec::default();
285 let path = http::uri::PathAndQuery::from_static(
286 "/rpcdb.Database/IteratorRelease",
287 );
288 self.inner.unary(request.into_request(), path, codec).await
289 }
290 }
291}
292pub mod database_server {
294 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
295 use tonic::codegen::*;
296 #[async_trait]
298 pub trait Database: Send + Sync + 'static {
299 async fn has(
300 &self,
301 request: tonic::Request<super::HasRequest>,
302 ) -> Result<tonic::Response<super::HasResponse>, tonic::Status>;
303 async fn get(
304 &self,
305 request: tonic::Request<super::GetRequest>,
306 ) -> Result<tonic::Response<super::GetResponse>, tonic::Status>;
307 async fn put(
308 &self,
309 request: tonic::Request<super::PutRequest>,
310 ) -> Result<tonic::Response<super::PutResponse>, tonic::Status>;
311 async fn delete(
312 &self,
313 request: tonic::Request<super::DeleteRequest>,
314 ) -> Result<tonic::Response<super::DeleteResponse>, tonic::Status>;
315 async fn compact(
316 &self,
317 request: tonic::Request<super::CompactRequest>,
318 ) -> Result<tonic::Response<super::CompactResponse>, tonic::Status>;
319 async fn close(
320 &self,
321 request: tonic::Request<super::CloseRequest>,
322 ) -> Result<tonic::Response<super::CloseResponse>, tonic::Status>;
323 async fn health_check(
324 &self,
325 request: tonic::Request<super::super::google::protobuf::Empty>,
326 ) -> Result<tonic::Response<super::HealthCheckResponse>, tonic::Status>;
327 async fn write_batch(
328 &self,
329 request: tonic::Request<super::WriteBatchRequest>,
330 ) -> Result<tonic::Response<super::WriteBatchResponse>, tonic::Status>;
331 async fn new_iterator_with_start_and_prefix(
332 &self,
333 request: tonic::Request<super::NewIteratorWithStartAndPrefixRequest>,
334 ) -> Result<
335 tonic::Response<super::NewIteratorWithStartAndPrefixResponse>,
336 tonic::Status,
337 >;
338 async fn iterator_next(
339 &self,
340 request: tonic::Request<super::IteratorNextRequest>,
341 ) -> Result<tonic::Response<super::IteratorNextResponse>, tonic::Status>;
342 async fn iterator_error(
343 &self,
344 request: tonic::Request<super::IteratorErrorRequest>,
345 ) -> Result<tonic::Response<super::IteratorErrorResponse>, tonic::Status>;
346 async fn iterator_release(
347 &self,
348 request: tonic::Request<super::IteratorReleaseRequest>,
349 ) -> Result<tonic::Response<super::IteratorReleaseResponse>, tonic::Status>;
350 }
351 #[derive(Debug)]
352 pub struct DatabaseServer<T: Database> {
353 inner: _Inner<T>,
354 accept_compression_encodings: EnabledCompressionEncodings,
355 send_compression_encodings: EnabledCompressionEncodings,
356 }
357 struct _Inner<T>(Arc<T>);
358 impl<T: Database> DatabaseServer<T> {
359 pub fn new(inner: T) -> Self {
360 Self::from_arc(Arc::new(inner))
361 }
362 pub fn from_arc(inner: Arc<T>) -> Self {
363 let inner = _Inner(inner);
364 Self {
365 inner,
366 accept_compression_encodings: Default::default(),
367 send_compression_encodings: Default::default(),
368 }
369 }
370 pub fn with_interceptor<F>(
371 inner: T,
372 interceptor: F,
373 ) -> InterceptedService<Self, F>
374 where
375 F: tonic::service::Interceptor,
376 {
377 InterceptedService::new(Self::new(inner), interceptor)
378 }
379 #[must_use]
381 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
382 self.accept_compression_encodings.enable(encoding);
383 self
384 }
385 #[must_use]
387 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
388 self.send_compression_encodings.enable(encoding);
389 self
390 }
391 }
392 impl<T, B> tonic::codegen::Service<http::Request<B>> for DatabaseServer<T>
393 where
394 T: Database,
395 B: Body + Send + 'static,
396 B::Error: Into<StdError> + Send + 'static,
397 {
398 type Response = http::Response<tonic::body::BoxBody>;
399 type Error = std::convert::Infallible;
400 type Future = BoxFuture<Self::Response, Self::Error>;
401 fn poll_ready(
402 &mut self,
403 _cx: &mut Context<'_>,
404 ) -> Poll<Result<(), Self::Error>> {
405 Poll::Ready(Ok(()))
406 }
407 fn call(&mut self, req: http::Request<B>) -> Self::Future {
408 let inner = self.inner.clone();
409 match req.uri().path() {
410 "/rpcdb.Database/Has" => {
411 #[allow(non_camel_case_types)]
412 struct HasSvc<T: Database>(pub Arc<T>);
413 impl<T: Database> tonic::server::UnaryService<super::HasRequest>
414 for HasSvc<T> {
415 type Response = super::HasResponse;
416 type Future = BoxFuture<
417 tonic::Response<Self::Response>,
418 tonic::Status,
419 >;
420 fn call(
421 &mut self,
422 request: tonic::Request<super::HasRequest>,
423 ) -> Self::Future {
424 let inner = self.0.clone();
425 let fut = async move { (*inner).has(request).await };
426 Box::pin(fut)
427 }
428 }
429 let accept_compression_encodings = self.accept_compression_encodings;
430 let send_compression_encodings = self.send_compression_encodings;
431 let inner = self.inner.clone();
432 let fut = async move {
433 let inner = inner.0;
434 let method = HasSvc(inner);
435 let codec = tonic::codec::ProstCodec::default();
436 let mut grpc = tonic::server::Grpc::new(codec)
437 .apply_compression_config(
438 accept_compression_encodings,
439 send_compression_encodings,
440 );
441 let res = grpc.unary(method, req).await;
442 Ok(res)
443 };
444 Box::pin(fut)
445 }
446 "/rpcdb.Database/Get" => {
447 #[allow(non_camel_case_types)]
448 struct GetSvc<T: Database>(pub Arc<T>);
449 impl<T: Database> tonic::server::UnaryService<super::GetRequest>
450 for GetSvc<T> {
451 type Response = super::GetResponse;
452 type Future = BoxFuture<
453 tonic::Response<Self::Response>,
454 tonic::Status,
455 >;
456 fn call(
457 &mut self,
458 request: tonic::Request<super::GetRequest>,
459 ) -> Self::Future {
460 let inner = self.0.clone();
461 let fut = async move { (*inner).get(request).await };
462 Box::pin(fut)
463 }
464 }
465 let accept_compression_encodings = self.accept_compression_encodings;
466 let send_compression_encodings = self.send_compression_encodings;
467 let inner = self.inner.clone();
468 let fut = async move {
469 let inner = inner.0;
470 let method = GetSvc(inner);
471 let codec = tonic::codec::ProstCodec::default();
472 let mut grpc = tonic::server::Grpc::new(codec)
473 .apply_compression_config(
474 accept_compression_encodings,
475 send_compression_encodings,
476 );
477 let res = grpc.unary(method, req).await;
478 Ok(res)
479 };
480 Box::pin(fut)
481 }
482 "/rpcdb.Database/Put" => {
483 #[allow(non_camel_case_types)]
484 struct PutSvc<T: Database>(pub Arc<T>);
485 impl<T: Database> tonic::server::UnaryService<super::PutRequest>
486 for PutSvc<T> {
487 type Response = super::PutResponse;
488 type Future = BoxFuture<
489 tonic::Response<Self::Response>,
490 tonic::Status,
491 >;
492 fn call(
493 &mut self,
494 request: tonic::Request<super::PutRequest>,
495 ) -> Self::Future {
496 let inner = self.0.clone();
497 let fut = async move { (*inner).put(request).await };
498 Box::pin(fut)
499 }
500 }
501 let accept_compression_encodings = self.accept_compression_encodings;
502 let send_compression_encodings = self.send_compression_encodings;
503 let inner = self.inner.clone();
504 let fut = async move {
505 let inner = inner.0;
506 let method = PutSvc(inner);
507 let codec = tonic::codec::ProstCodec::default();
508 let mut grpc = tonic::server::Grpc::new(codec)
509 .apply_compression_config(
510 accept_compression_encodings,
511 send_compression_encodings,
512 );
513 let res = grpc.unary(method, req).await;
514 Ok(res)
515 };
516 Box::pin(fut)
517 }
518 "/rpcdb.Database/Delete" => {
519 #[allow(non_camel_case_types)]
520 struct DeleteSvc<T: Database>(pub Arc<T>);
521 impl<T: Database> tonic::server::UnaryService<super::DeleteRequest>
522 for DeleteSvc<T> {
523 type Response = super::DeleteResponse;
524 type Future = BoxFuture<
525 tonic::Response<Self::Response>,
526 tonic::Status,
527 >;
528 fn call(
529 &mut self,
530 request: tonic::Request<super::DeleteRequest>,
531 ) -> Self::Future {
532 let inner = self.0.clone();
533 let fut = async move { (*inner).delete(request).await };
534 Box::pin(fut)
535 }
536 }
537 let accept_compression_encodings = self.accept_compression_encodings;
538 let send_compression_encodings = self.send_compression_encodings;
539 let inner = self.inner.clone();
540 let fut = async move {
541 let inner = inner.0;
542 let method = DeleteSvc(inner);
543 let codec = tonic::codec::ProstCodec::default();
544 let mut grpc = tonic::server::Grpc::new(codec)
545 .apply_compression_config(
546 accept_compression_encodings,
547 send_compression_encodings,
548 );
549 let res = grpc.unary(method, req).await;
550 Ok(res)
551 };
552 Box::pin(fut)
553 }
554 "/rpcdb.Database/Compact" => {
555 #[allow(non_camel_case_types)]
556 struct CompactSvc<T: Database>(pub Arc<T>);
557 impl<T: Database> tonic::server::UnaryService<super::CompactRequest>
558 for CompactSvc<T> {
559 type Response = super::CompactResponse;
560 type Future = BoxFuture<
561 tonic::Response<Self::Response>,
562 tonic::Status,
563 >;
564 fn call(
565 &mut self,
566 request: tonic::Request<super::CompactRequest>,
567 ) -> Self::Future {
568 let inner = self.0.clone();
569 let fut = async move { (*inner).compact(request).await };
570 Box::pin(fut)
571 }
572 }
573 let accept_compression_encodings = self.accept_compression_encodings;
574 let send_compression_encodings = self.send_compression_encodings;
575 let inner = self.inner.clone();
576 let fut = async move {
577 let inner = inner.0;
578 let method = CompactSvc(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 let res = grpc.unary(method, req).await;
586 Ok(res)
587 };
588 Box::pin(fut)
589 }
590 "/rpcdb.Database/Close" => {
591 #[allow(non_camel_case_types)]
592 struct CloseSvc<T: Database>(pub Arc<T>);
593 impl<T: Database> tonic::server::UnaryService<super::CloseRequest>
594 for CloseSvc<T> {
595 type Response = super::CloseResponse;
596 type Future = BoxFuture<
597 tonic::Response<Self::Response>,
598 tonic::Status,
599 >;
600 fn call(
601 &mut self,
602 request: tonic::Request<super::CloseRequest>,
603 ) -> Self::Future {
604 let inner = self.0.clone();
605 let fut = async move { (*inner).close(request).await };
606 Box::pin(fut)
607 }
608 }
609 let accept_compression_encodings = self.accept_compression_encodings;
610 let send_compression_encodings = self.send_compression_encodings;
611 let inner = self.inner.clone();
612 let fut = async move {
613 let inner = inner.0;
614 let method = CloseSvc(inner);
615 let codec = tonic::codec::ProstCodec::default();
616 let mut grpc = tonic::server::Grpc::new(codec)
617 .apply_compression_config(
618 accept_compression_encodings,
619 send_compression_encodings,
620 );
621 let res = grpc.unary(method, req).await;
622 Ok(res)
623 };
624 Box::pin(fut)
625 }
626 "/rpcdb.Database/HealthCheck" => {
627 #[allow(non_camel_case_types)]
628 struct HealthCheckSvc<T: Database>(pub Arc<T>);
629 impl<
630 T: Database,
631 > tonic::server::UnaryService<super::super::google::protobuf::Empty>
632 for HealthCheckSvc<T> {
633 type Response = super::HealthCheckResponse;
634 type Future = BoxFuture<
635 tonic::Response<Self::Response>,
636 tonic::Status,
637 >;
638 fn call(
639 &mut self,
640 request: tonic::Request<
641 super::super::google::protobuf::Empty,
642 >,
643 ) -> Self::Future {
644 let inner = self.0.clone();
645 let fut = async move {
646 (*inner).health_check(request).await
647 };
648 Box::pin(fut)
649 }
650 }
651 let accept_compression_encodings = self.accept_compression_encodings;
652 let send_compression_encodings = self.send_compression_encodings;
653 let inner = self.inner.clone();
654 let fut = async move {
655 let inner = inner.0;
656 let method = HealthCheckSvc(inner);
657 let codec = tonic::codec::ProstCodec::default();
658 let mut grpc = tonic::server::Grpc::new(codec)
659 .apply_compression_config(
660 accept_compression_encodings,
661 send_compression_encodings,
662 );
663 let res = grpc.unary(method, req).await;
664 Ok(res)
665 };
666 Box::pin(fut)
667 }
668 "/rpcdb.Database/WriteBatch" => {
669 #[allow(non_camel_case_types)]
670 struct WriteBatchSvc<T: Database>(pub Arc<T>);
671 impl<
672 T: Database,
673 > tonic::server::UnaryService<super::WriteBatchRequest>
674 for WriteBatchSvc<T> {
675 type Response = super::WriteBatchResponse;
676 type Future = BoxFuture<
677 tonic::Response<Self::Response>,
678 tonic::Status,
679 >;
680 fn call(
681 &mut self,
682 request: tonic::Request<super::WriteBatchRequest>,
683 ) -> Self::Future {
684 let inner = self.0.clone();
685 let fut = async move { (*inner).write_batch(request).await };
686 Box::pin(fut)
687 }
688 }
689 let accept_compression_encodings = self.accept_compression_encodings;
690 let send_compression_encodings = self.send_compression_encodings;
691 let inner = self.inner.clone();
692 let fut = async move {
693 let inner = inner.0;
694 let method = WriteBatchSvc(inner);
695 let codec = tonic::codec::ProstCodec::default();
696 let mut grpc = tonic::server::Grpc::new(codec)
697 .apply_compression_config(
698 accept_compression_encodings,
699 send_compression_encodings,
700 );
701 let res = grpc.unary(method, req).await;
702 Ok(res)
703 };
704 Box::pin(fut)
705 }
706 "/rpcdb.Database/NewIteratorWithStartAndPrefix" => {
707 #[allow(non_camel_case_types)]
708 struct NewIteratorWithStartAndPrefixSvc<T: Database>(pub Arc<T>);
709 impl<
710 T: Database,
711 > tonic::server::UnaryService<
712 super::NewIteratorWithStartAndPrefixRequest,
713 > for NewIteratorWithStartAndPrefixSvc<T> {
714 type Response = super::NewIteratorWithStartAndPrefixResponse;
715 type Future = BoxFuture<
716 tonic::Response<Self::Response>,
717 tonic::Status,
718 >;
719 fn call(
720 &mut self,
721 request: tonic::Request<
722 super::NewIteratorWithStartAndPrefixRequest,
723 >,
724 ) -> Self::Future {
725 let inner = self.0.clone();
726 let fut = async move {
727 (*inner).new_iterator_with_start_and_prefix(request).await
728 };
729 Box::pin(fut)
730 }
731 }
732 let accept_compression_encodings = self.accept_compression_encodings;
733 let send_compression_encodings = self.send_compression_encodings;
734 let inner = self.inner.clone();
735 let fut = async move {
736 let inner = inner.0;
737 let method = NewIteratorWithStartAndPrefixSvc(inner);
738 let codec = tonic::codec::ProstCodec::default();
739 let mut grpc = tonic::server::Grpc::new(codec)
740 .apply_compression_config(
741 accept_compression_encodings,
742 send_compression_encodings,
743 );
744 let res = grpc.unary(method, req).await;
745 Ok(res)
746 };
747 Box::pin(fut)
748 }
749 "/rpcdb.Database/IteratorNext" => {
750 #[allow(non_camel_case_types)]
751 struct IteratorNextSvc<T: Database>(pub Arc<T>);
752 impl<
753 T: Database,
754 > tonic::server::UnaryService<super::IteratorNextRequest>
755 for IteratorNextSvc<T> {
756 type Response = super::IteratorNextResponse;
757 type Future = BoxFuture<
758 tonic::Response<Self::Response>,
759 tonic::Status,
760 >;
761 fn call(
762 &mut self,
763 request: tonic::Request<super::IteratorNextRequest>,
764 ) -> Self::Future {
765 let inner = self.0.clone();
766 let fut = async move {
767 (*inner).iterator_next(request).await
768 };
769 Box::pin(fut)
770 }
771 }
772 let accept_compression_encodings = self.accept_compression_encodings;
773 let send_compression_encodings = self.send_compression_encodings;
774 let inner = self.inner.clone();
775 let fut = async move {
776 let inner = inner.0;
777 let method = IteratorNextSvc(inner);
778 let codec = tonic::codec::ProstCodec::default();
779 let mut grpc = tonic::server::Grpc::new(codec)
780 .apply_compression_config(
781 accept_compression_encodings,
782 send_compression_encodings,
783 );
784 let res = grpc.unary(method, req).await;
785 Ok(res)
786 };
787 Box::pin(fut)
788 }
789 "/rpcdb.Database/IteratorError" => {
790 #[allow(non_camel_case_types)]
791 struct IteratorErrorSvc<T: Database>(pub Arc<T>);
792 impl<
793 T: Database,
794 > tonic::server::UnaryService<super::IteratorErrorRequest>
795 for IteratorErrorSvc<T> {
796 type Response = super::IteratorErrorResponse;
797 type Future = BoxFuture<
798 tonic::Response<Self::Response>,
799 tonic::Status,
800 >;
801 fn call(
802 &mut self,
803 request: tonic::Request<super::IteratorErrorRequest>,
804 ) -> Self::Future {
805 let inner = self.0.clone();
806 let fut = async move {
807 (*inner).iterator_error(request).await
808 };
809 Box::pin(fut)
810 }
811 }
812 let accept_compression_encodings = self.accept_compression_encodings;
813 let send_compression_encodings = self.send_compression_encodings;
814 let inner = self.inner.clone();
815 let fut = async move {
816 let inner = inner.0;
817 let method = IteratorErrorSvc(inner);
818 let codec = tonic::codec::ProstCodec::default();
819 let mut grpc = tonic::server::Grpc::new(codec)
820 .apply_compression_config(
821 accept_compression_encodings,
822 send_compression_encodings,
823 );
824 let res = grpc.unary(method, req).await;
825 Ok(res)
826 };
827 Box::pin(fut)
828 }
829 "/rpcdb.Database/IteratorRelease" => {
830 #[allow(non_camel_case_types)]
831 struct IteratorReleaseSvc<T: Database>(pub Arc<T>);
832 impl<
833 T: Database,
834 > tonic::server::UnaryService<super::IteratorReleaseRequest>
835 for IteratorReleaseSvc<T> {
836 type Response = super::IteratorReleaseResponse;
837 type Future = BoxFuture<
838 tonic::Response<Self::Response>,
839 tonic::Status,
840 >;
841 fn call(
842 &mut self,
843 request: tonic::Request<super::IteratorReleaseRequest>,
844 ) -> Self::Future {
845 let inner = self.0.clone();
846 let fut = async move {
847 (*inner).iterator_release(request).await
848 };
849 Box::pin(fut)
850 }
851 }
852 let accept_compression_encodings = self.accept_compression_encodings;
853 let send_compression_encodings = self.send_compression_encodings;
854 let inner = self.inner.clone();
855 let fut = async move {
856 let inner = inner.0;
857 let method = IteratorReleaseSvc(inner);
858 let codec = tonic::codec::ProstCodec::default();
859 let mut grpc = tonic::server::Grpc::new(codec)
860 .apply_compression_config(
861 accept_compression_encodings,
862 send_compression_encodings,
863 );
864 let res = grpc.unary(method, req).await;
865 Ok(res)
866 };
867 Box::pin(fut)
868 }
869 _ => {
870 Box::pin(async move {
871 Ok(
872 http::Response::builder()
873 .status(200)
874 .header("grpc-status", "12")
875 .header("content-type", "application/grpc")
876 .body(empty_body())
877 .unwrap(),
878 )
879 })
880 }
881 }
882 }
883 }
884 impl<T: Database> Clone for DatabaseServer<T> {
885 fn clone(&self) -> Self {
886 let inner = self.inner.clone();
887 Self {
888 inner,
889 accept_compression_encodings: self.accept_compression_encodings,
890 send_compression_encodings: self.send_compression_encodings,
891 }
892 }
893 }
894 impl<T: Database> Clone for _Inner<T> {
895 fn clone(&self) -> Self {
896 Self(self.0.clone())
897 }
898 }
899 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
900 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
901 write!(f, "{:?}", self.0)
902 }
903 }
904 impl<T: Database> tonic::server::NamedService for DatabaseServer<T> {
905 const NAME: &'static str = "rpcdb.Database";
906 }
907}