1#[allow(clippy::derive_partial_eq_without_eq)]
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct NamespaceList {
4 #[prost(string, repeated, tag = "1")]
5 pub namespaces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
6}
7#[allow(clippy::derive_partial_eq_without_eq)]
8#[derive(Clone, PartialEq, ::prost::Message)]
9pub struct PartitionsList {
10 #[prost(message, repeated, tag = "1")]
11 pub partitions: ::prost::alloc::vec::Vec<
12 super::super::models::util::lock::NodePartition,
13 >,
14}
15#[allow(clippy::derive_partial_eq_without_eq)]
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct NodeStateList {
18 #[prost(message, repeated, tag = "1")]
19 pub nodes: ::prost::alloc::vec::Vec<super::super::models::util::lock::NodeState>,
20}
21#[allow(clippy::derive_partial_eq_without_eq)]
22#[derive(Clone, PartialEq, ::prost::Message)]
23pub struct CreateNamespaceRequest {
24 #[prost(string, tag = "1")]
25 pub name: ::prost::alloc::string::String,
26}
27#[allow(clippy::derive_partial_eq_without_eq)]
28#[derive(Clone, PartialEq, ::prost::Message)]
29pub struct CreatePartitionRequest {
30 #[prost(string, tag = "1")]
31 pub name: ::prost::alloc::string::String,
32 #[prost(int32, tag = "2")]
33 pub partition: i32,
34}
35pub mod lock_client {
37 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
38 use tonic::codegen::*;
39 use tonic::codegen::http::Uri;
40 #[derive(Debug, Clone)]
41 pub struct LockClient<T> {
42 inner: tonic::client::Grpc<T>,
43 }
44 impl LockClient<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> LockClient<T>
56 where
57 T: tonic::client::GrpcService<tonic::body::BoxBody>,
58 T::Error: Into<StdError>,
59 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
60 <T::ResponseBody as Body>::Error: Into<StdError> + 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 ) -> LockClient<InterceptedService<T, F>>
74 where
75 F: tonic::service::Interceptor,
76 T::ResponseBody: Default,
77 T: tonic::codegen::Service<
78 http::Request<tonic::body::BoxBody>,
79 Response = http::Response<
80 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
81 >,
82 >,
83 <T as tonic::codegen::Service<
84 http::Request<tonic::body::BoxBody>,
85 >>::Error: Into<StdError> + Send + Sync,
86 {
87 LockClient::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 claim_lock(
123 &mut self,
124 request: impl tonic::IntoRequest<
125 super::super::super::requests::util::lock::LockRequestProto,
126 >,
127 ) -> std::result::Result<
128 tonic::Response<
129 super::super::super::requests::util::lock::LockResponseProto,
130 >,
131 tonic::Status,
132 > {
133 self.inner
134 .ready()
135 .await
136 .map_err(|e| {
137 tonic::Status::new(
138 tonic::Code::Unknown,
139 format!("Service was not ready: {}", e.into()),
140 )
141 })?;
142 let codec = tonic::codec::ProstCodec::default();
143 let path = http::uri::PathAndQuery::from_static(
144 "/fintekkers.services.lock_service.Lock/ClaimLock",
145 );
146 let mut req = request.into_request();
147 req.extensions_mut()
148 .insert(
149 GrpcMethod::new("fintekkers.services.lock_service.Lock", "ClaimLock"),
150 );
151 self.inner.unary(req, path, codec).await
152 }
153 pub async fn subscribe_to_lock_updates(
157 &mut self,
158 request: impl tonic::IntoRequest<()>,
159 ) -> std::result::Result<
160 tonic::Response<
161 tonic::codec::Streaming<
162 super::super::super::models::util::lock::NodeState,
163 >,
164 >,
165 tonic::Status,
166 > {
167 self.inner
168 .ready()
169 .await
170 .map_err(|e| {
171 tonic::Status::new(
172 tonic::Code::Unknown,
173 format!("Service was not ready: {}", e.into()),
174 )
175 })?;
176 let codec = tonic::codec::ProstCodec::default();
177 let path = http::uri::PathAndQuery::from_static(
178 "/fintekkers.services.lock_service.Lock/SubscribeToLockUpdates",
179 );
180 let mut req = request.into_request();
181 req.extensions_mut()
182 .insert(
183 GrpcMethod::new(
184 "fintekkers.services.lock_service.Lock",
185 "SubscribeToLockUpdates",
186 ),
187 );
188 self.inner.server_streaming(req, path, codec).await
189 }
190 pub async fn create_namespace(
192 &mut self,
193 request: impl tonic::IntoRequest<super::CreateNamespaceRequest>,
194 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
195 self.inner
196 .ready()
197 .await
198 .map_err(|e| {
199 tonic::Status::new(
200 tonic::Code::Unknown,
201 format!("Service was not ready: {}", e.into()),
202 )
203 })?;
204 let codec = tonic::codec::ProstCodec::default();
205 let path = http::uri::PathAndQuery::from_static(
206 "/fintekkers.services.lock_service.Lock/CreateNamespace",
207 );
208 let mut req = request.into_request();
209 req.extensions_mut()
210 .insert(
211 GrpcMethod::new(
212 "fintekkers.services.lock_service.Lock",
213 "CreateNamespace",
214 ),
215 );
216 self.inner.unary(req, path, codec).await
217 }
218 pub async fn create_partition(
220 &mut self,
221 request: impl tonic::IntoRequest<super::CreatePartitionRequest>,
222 ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
223 self.inner
224 .ready()
225 .await
226 .map_err(|e| {
227 tonic::Status::new(
228 tonic::Code::Unknown,
229 format!("Service was not ready: {}", e.into()),
230 )
231 })?;
232 let codec = tonic::codec::ProstCodec::default();
233 let path = http::uri::PathAndQuery::from_static(
234 "/fintekkers.services.lock_service.Lock/CreatePartition",
235 );
236 let mut req = request.into_request();
237 req.extensions_mut()
238 .insert(
239 GrpcMethod::new(
240 "fintekkers.services.lock_service.Lock",
241 "CreatePartition",
242 ),
243 );
244 self.inner.unary(req, path, codec).await
245 }
246 pub async fn list_namespaces(
248 &mut self,
249 request: impl tonic::IntoRequest<()>,
250 ) -> std::result::Result<tonic::Response<super::NamespaceList>, tonic::Status> {
251 self.inner
252 .ready()
253 .await
254 .map_err(|e| {
255 tonic::Status::new(
256 tonic::Code::Unknown,
257 format!("Service was not ready: {}", e.into()),
258 )
259 })?;
260 let codec = tonic::codec::ProstCodec::default();
261 let path = http::uri::PathAndQuery::from_static(
262 "/fintekkers.services.lock_service.Lock/ListNamespaces",
263 );
264 let mut req = request.into_request();
265 req.extensions_mut()
266 .insert(
267 GrpcMethod::new(
268 "fintekkers.services.lock_service.Lock",
269 "ListNamespaces",
270 ),
271 );
272 self.inner.unary(req, path, codec).await
273 }
274 pub async fn list_partitions(
276 &mut self,
277 request: impl tonic::IntoRequest<super::NamespaceList>,
278 ) -> std::result::Result<tonic::Response<super::PartitionsList>, tonic::Status> {
279 self.inner
280 .ready()
281 .await
282 .map_err(|e| {
283 tonic::Status::new(
284 tonic::Code::Unknown,
285 format!("Service was not ready: {}", e.into()),
286 )
287 })?;
288 let codec = tonic::codec::ProstCodec::default();
289 let path = http::uri::PathAndQuery::from_static(
290 "/fintekkers.services.lock_service.Lock/ListPartitions",
291 );
292 let mut req = request.into_request();
293 req.extensions_mut()
294 .insert(
295 GrpcMethod::new(
296 "fintekkers.services.lock_service.Lock",
297 "ListPartitions",
298 ),
299 );
300 self.inner.unary(req, path, codec).await
301 }
302 pub async fn get_all_partition_status(
304 &mut self,
305 request: impl tonic::IntoRequest<()>,
306 ) -> std::result::Result<tonic::Response<super::NodeStateList>, tonic::Status> {
307 self.inner
308 .ready()
309 .await
310 .map_err(|e| {
311 tonic::Status::new(
312 tonic::Code::Unknown,
313 format!("Service was not ready: {}", e.into()),
314 )
315 })?;
316 let codec = tonic::codec::ProstCodec::default();
317 let path = http::uri::PathAndQuery::from_static(
318 "/fintekkers.services.lock_service.Lock/GetAllPartitionStatus",
319 );
320 let mut req = request.into_request();
321 req.extensions_mut()
322 .insert(
323 GrpcMethod::new(
324 "fintekkers.services.lock_service.Lock",
325 "GetAllPartitionStatus",
326 ),
327 );
328 self.inner.unary(req, path, codec).await
329 }
330 pub async fn get_all_partition_status_for_namespaces(
332 &mut self,
333 request: impl tonic::IntoRequest<super::NamespaceList>,
334 ) -> std::result::Result<tonic::Response<super::NodeStateList>, tonic::Status> {
335 self.inner
336 .ready()
337 .await
338 .map_err(|e| {
339 tonic::Status::new(
340 tonic::Code::Unknown,
341 format!("Service was not ready: {}", e.into()),
342 )
343 })?;
344 let codec = tonic::codec::ProstCodec::default();
345 let path = http::uri::PathAndQuery::from_static(
346 "/fintekkers.services.lock_service.Lock/GetAllPartitionStatusForNamespaces",
347 );
348 let mut req = request.into_request();
349 req.extensions_mut()
350 .insert(
351 GrpcMethod::new(
352 "fintekkers.services.lock_service.Lock",
353 "GetAllPartitionStatusForNamespaces",
354 ),
355 );
356 self.inner.unary(req, path, codec).await
357 }
358 pub async fn get_partition_status(
360 &mut self,
361 request: impl tonic::IntoRequest<
362 super::super::super::models::util::lock::NodePartition,
363 >,
364 ) -> std::result::Result<
365 tonic::Response<super::super::super::models::util::lock::NodeState>,
366 tonic::Status,
367 > {
368 self.inner
369 .ready()
370 .await
371 .map_err(|e| {
372 tonic::Status::new(
373 tonic::Code::Unknown,
374 format!("Service was not ready: {}", e.into()),
375 )
376 })?;
377 let codec = tonic::codec::ProstCodec::default();
378 let path = http::uri::PathAndQuery::from_static(
379 "/fintekkers.services.lock_service.Lock/GetPartitionStatus",
380 );
381 let mut req = request.into_request();
382 req.extensions_mut()
383 .insert(
384 GrpcMethod::new(
385 "fintekkers.services.lock_service.Lock",
386 "GetPartitionStatus",
387 ),
388 );
389 self.inner.unary(req, path, codec).await
390 }
391 }
392}
393pub mod lock_server {
395 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
396 use tonic::codegen::*;
397 #[async_trait]
399 pub trait Lock: Send + Sync + 'static {
400 async fn claim_lock(
403 &self,
404 request: tonic::Request<
405 super::super::super::requests::util::lock::LockRequestProto,
406 >,
407 ) -> std::result::Result<
408 tonic::Response<
409 super::super::super::requests::util::lock::LockResponseProto,
410 >,
411 tonic::Status,
412 >;
413 type SubscribeToLockUpdatesStream: futures_core::Stream<
415 Item = std::result::Result<
416 super::super::super::models::util::lock::NodeState,
417 tonic::Status,
418 >,
419 >
420 + Send
421 + 'static;
422 async fn subscribe_to_lock_updates(
426 &self,
427 request: tonic::Request<()>,
428 ) -> std::result::Result<
429 tonic::Response<Self::SubscribeToLockUpdatesStream>,
430 tonic::Status,
431 >;
432 async fn create_namespace(
434 &self,
435 request: tonic::Request<super::CreateNamespaceRequest>,
436 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
437 async fn create_partition(
439 &self,
440 request: tonic::Request<super::CreatePartitionRequest>,
441 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
442 async fn list_namespaces(
444 &self,
445 request: tonic::Request<()>,
446 ) -> std::result::Result<tonic::Response<super::NamespaceList>, tonic::Status>;
447 async fn list_partitions(
449 &self,
450 request: tonic::Request<super::NamespaceList>,
451 ) -> std::result::Result<tonic::Response<super::PartitionsList>, tonic::Status>;
452 async fn get_all_partition_status(
454 &self,
455 request: tonic::Request<()>,
456 ) -> std::result::Result<tonic::Response<super::NodeStateList>, tonic::Status>;
457 async fn get_all_partition_status_for_namespaces(
459 &self,
460 request: tonic::Request<super::NamespaceList>,
461 ) -> std::result::Result<tonic::Response<super::NodeStateList>, tonic::Status>;
462 async fn get_partition_status(
464 &self,
465 request: tonic::Request<
466 super::super::super::models::util::lock::NodePartition,
467 >,
468 ) -> std::result::Result<
469 tonic::Response<super::super::super::models::util::lock::NodeState>,
470 tonic::Status,
471 >;
472 }
473 #[derive(Debug)]
474 pub struct LockServer<T: Lock> {
475 inner: _Inner<T>,
476 accept_compression_encodings: EnabledCompressionEncodings,
477 send_compression_encodings: EnabledCompressionEncodings,
478 max_decoding_message_size: Option<usize>,
479 max_encoding_message_size: Option<usize>,
480 }
481 struct _Inner<T>(Arc<T>);
482 impl<T: Lock> LockServer<T> {
483 pub fn new(inner: T) -> Self {
484 Self::from_arc(Arc::new(inner))
485 }
486 pub fn from_arc(inner: Arc<T>) -> Self {
487 let inner = _Inner(inner);
488 Self {
489 inner,
490 accept_compression_encodings: Default::default(),
491 send_compression_encodings: Default::default(),
492 max_decoding_message_size: None,
493 max_encoding_message_size: None,
494 }
495 }
496 pub fn with_interceptor<F>(
497 inner: T,
498 interceptor: F,
499 ) -> InterceptedService<Self, F>
500 where
501 F: tonic::service::Interceptor,
502 {
503 InterceptedService::new(Self::new(inner), interceptor)
504 }
505 #[must_use]
507 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
508 self.accept_compression_encodings.enable(encoding);
509 self
510 }
511 #[must_use]
513 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
514 self.send_compression_encodings.enable(encoding);
515 self
516 }
517 #[must_use]
521 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
522 self.max_decoding_message_size = Some(limit);
523 self
524 }
525 #[must_use]
529 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
530 self.max_encoding_message_size = Some(limit);
531 self
532 }
533 }
534 impl<T, B> tonic::codegen::Service<http::Request<B>> for LockServer<T>
535 where
536 T: Lock,
537 B: Body + Send + 'static,
538 B::Error: Into<StdError> + Send + 'static,
539 {
540 type Response = http::Response<tonic::body::BoxBody>;
541 type Error = std::convert::Infallible;
542 type Future = BoxFuture<Self::Response, Self::Error>;
543 fn poll_ready(
544 &mut self,
545 _cx: &mut Context<'_>,
546 ) -> Poll<std::result::Result<(), Self::Error>> {
547 Poll::Ready(Ok(()))
548 }
549 fn call(&mut self, req: http::Request<B>) -> Self::Future {
550 let inner = self.inner.clone();
551 match req.uri().path() {
552 "/fintekkers.services.lock_service.Lock/ClaimLock" => {
553 #[allow(non_camel_case_types)]
554 struct ClaimLockSvc<T: Lock>(pub Arc<T>);
555 impl<
556 T: Lock,
557 > tonic::server::UnaryService<
558 super::super::super::requests::util::lock::LockRequestProto,
559 > for ClaimLockSvc<T> {
560 type Response = super::super::super::requests::util::lock::LockResponseProto;
561 type Future = BoxFuture<
562 tonic::Response<Self::Response>,
563 tonic::Status,
564 >;
565 fn call(
566 &mut self,
567 request: tonic::Request<
568 super::super::super::requests::util::lock::LockRequestProto,
569 >,
570 ) -> Self::Future {
571 let inner = Arc::clone(&self.0);
572 let fut = async move { (*inner).claim_lock(request).await };
573 Box::pin(fut)
574 }
575 }
576 let accept_compression_encodings = self.accept_compression_encodings;
577 let send_compression_encodings = self.send_compression_encodings;
578 let max_decoding_message_size = self.max_decoding_message_size;
579 let max_encoding_message_size = self.max_encoding_message_size;
580 let inner = self.inner.clone();
581 let fut = async move {
582 let inner = inner.0;
583 let method = ClaimLockSvc(inner);
584 let codec = tonic::codec::ProstCodec::default();
585 let mut grpc = tonic::server::Grpc::new(codec)
586 .apply_compression_config(
587 accept_compression_encodings,
588 send_compression_encodings,
589 )
590 .apply_max_message_size_config(
591 max_decoding_message_size,
592 max_encoding_message_size,
593 );
594 let res = grpc.unary(method, req).await;
595 Ok(res)
596 };
597 Box::pin(fut)
598 }
599 "/fintekkers.services.lock_service.Lock/SubscribeToLockUpdates" => {
600 #[allow(non_camel_case_types)]
601 struct SubscribeToLockUpdatesSvc<T: Lock>(pub Arc<T>);
602 impl<T: Lock> tonic::server::ServerStreamingService<()>
603 for SubscribeToLockUpdatesSvc<T> {
604 type Response = super::super::super::models::util::lock::NodeState;
605 type ResponseStream = T::SubscribeToLockUpdatesStream;
606 type Future = BoxFuture<
607 tonic::Response<Self::ResponseStream>,
608 tonic::Status,
609 >;
610 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
611 let inner = Arc::clone(&self.0);
612 let fut = async move {
613 (*inner).subscribe_to_lock_updates(request).await
614 };
615 Box::pin(fut)
616 }
617 }
618 let accept_compression_encodings = self.accept_compression_encodings;
619 let send_compression_encodings = self.send_compression_encodings;
620 let max_decoding_message_size = self.max_decoding_message_size;
621 let max_encoding_message_size = self.max_encoding_message_size;
622 let inner = self.inner.clone();
623 let fut = async move {
624 let inner = inner.0;
625 let method = SubscribeToLockUpdatesSvc(inner);
626 let codec = tonic::codec::ProstCodec::default();
627 let mut grpc = tonic::server::Grpc::new(codec)
628 .apply_compression_config(
629 accept_compression_encodings,
630 send_compression_encodings,
631 )
632 .apply_max_message_size_config(
633 max_decoding_message_size,
634 max_encoding_message_size,
635 );
636 let res = grpc.server_streaming(method, req).await;
637 Ok(res)
638 };
639 Box::pin(fut)
640 }
641 "/fintekkers.services.lock_service.Lock/CreateNamespace" => {
642 #[allow(non_camel_case_types)]
643 struct CreateNamespaceSvc<T: Lock>(pub Arc<T>);
644 impl<
645 T: Lock,
646 > tonic::server::UnaryService<super::CreateNamespaceRequest>
647 for CreateNamespaceSvc<T> {
648 type Response = ();
649 type Future = BoxFuture<
650 tonic::Response<Self::Response>,
651 tonic::Status,
652 >;
653 fn call(
654 &mut self,
655 request: tonic::Request<super::CreateNamespaceRequest>,
656 ) -> Self::Future {
657 let inner = Arc::clone(&self.0);
658 let fut = async move {
659 (*inner).create_namespace(request).await
660 };
661 Box::pin(fut)
662 }
663 }
664 let accept_compression_encodings = self.accept_compression_encodings;
665 let send_compression_encodings = self.send_compression_encodings;
666 let max_decoding_message_size = self.max_decoding_message_size;
667 let max_encoding_message_size = self.max_encoding_message_size;
668 let inner = self.inner.clone();
669 let fut = async move {
670 let inner = inner.0;
671 let method = CreateNamespaceSvc(inner);
672 let codec = tonic::codec::ProstCodec::default();
673 let mut grpc = tonic::server::Grpc::new(codec)
674 .apply_compression_config(
675 accept_compression_encodings,
676 send_compression_encodings,
677 )
678 .apply_max_message_size_config(
679 max_decoding_message_size,
680 max_encoding_message_size,
681 );
682 let res = grpc.unary(method, req).await;
683 Ok(res)
684 };
685 Box::pin(fut)
686 }
687 "/fintekkers.services.lock_service.Lock/CreatePartition" => {
688 #[allow(non_camel_case_types)]
689 struct CreatePartitionSvc<T: Lock>(pub Arc<T>);
690 impl<
691 T: Lock,
692 > tonic::server::UnaryService<super::CreatePartitionRequest>
693 for CreatePartitionSvc<T> {
694 type Response = ();
695 type Future = BoxFuture<
696 tonic::Response<Self::Response>,
697 tonic::Status,
698 >;
699 fn call(
700 &mut self,
701 request: tonic::Request<super::CreatePartitionRequest>,
702 ) -> Self::Future {
703 let inner = Arc::clone(&self.0);
704 let fut = async move {
705 (*inner).create_partition(request).await
706 };
707 Box::pin(fut)
708 }
709 }
710 let accept_compression_encodings = self.accept_compression_encodings;
711 let send_compression_encodings = self.send_compression_encodings;
712 let max_decoding_message_size = self.max_decoding_message_size;
713 let max_encoding_message_size = self.max_encoding_message_size;
714 let inner = self.inner.clone();
715 let fut = async move {
716 let inner = inner.0;
717 let method = CreatePartitionSvc(inner);
718 let codec = tonic::codec::ProstCodec::default();
719 let mut grpc = tonic::server::Grpc::new(codec)
720 .apply_compression_config(
721 accept_compression_encodings,
722 send_compression_encodings,
723 )
724 .apply_max_message_size_config(
725 max_decoding_message_size,
726 max_encoding_message_size,
727 );
728 let res = grpc.unary(method, req).await;
729 Ok(res)
730 };
731 Box::pin(fut)
732 }
733 "/fintekkers.services.lock_service.Lock/ListNamespaces" => {
734 #[allow(non_camel_case_types)]
735 struct ListNamespacesSvc<T: Lock>(pub Arc<T>);
736 impl<T: Lock> tonic::server::UnaryService<()>
737 for ListNamespacesSvc<T> {
738 type Response = super::NamespaceList;
739 type Future = BoxFuture<
740 tonic::Response<Self::Response>,
741 tonic::Status,
742 >;
743 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
744 let inner = Arc::clone(&self.0);
745 let fut = async move {
746 (*inner).list_namespaces(request).await
747 };
748 Box::pin(fut)
749 }
750 }
751 let accept_compression_encodings = self.accept_compression_encodings;
752 let send_compression_encodings = self.send_compression_encodings;
753 let max_decoding_message_size = self.max_decoding_message_size;
754 let max_encoding_message_size = self.max_encoding_message_size;
755 let inner = self.inner.clone();
756 let fut = async move {
757 let inner = inner.0;
758 let method = ListNamespacesSvc(inner);
759 let codec = tonic::codec::ProstCodec::default();
760 let mut grpc = tonic::server::Grpc::new(codec)
761 .apply_compression_config(
762 accept_compression_encodings,
763 send_compression_encodings,
764 )
765 .apply_max_message_size_config(
766 max_decoding_message_size,
767 max_encoding_message_size,
768 );
769 let res = grpc.unary(method, req).await;
770 Ok(res)
771 };
772 Box::pin(fut)
773 }
774 "/fintekkers.services.lock_service.Lock/ListPartitions" => {
775 #[allow(non_camel_case_types)]
776 struct ListPartitionsSvc<T: Lock>(pub Arc<T>);
777 impl<T: Lock> tonic::server::UnaryService<super::NamespaceList>
778 for ListPartitionsSvc<T> {
779 type Response = super::PartitionsList;
780 type Future = BoxFuture<
781 tonic::Response<Self::Response>,
782 tonic::Status,
783 >;
784 fn call(
785 &mut self,
786 request: tonic::Request<super::NamespaceList>,
787 ) -> Self::Future {
788 let inner = Arc::clone(&self.0);
789 let fut = async move {
790 (*inner).list_partitions(request).await
791 };
792 Box::pin(fut)
793 }
794 }
795 let accept_compression_encodings = self.accept_compression_encodings;
796 let send_compression_encodings = self.send_compression_encodings;
797 let max_decoding_message_size = self.max_decoding_message_size;
798 let max_encoding_message_size = self.max_encoding_message_size;
799 let inner = self.inner.clone();
800 let fut = async move {
801 let inner = inner.0;
802 let method = ListPartitionsSvc(inner);
803 let codec = tonic::codec::ProstCodec::default();
804 let mut grpc = tonic::server::Grpc::new(codec)
805 .apply_compression_config(
806 accept_compression_encodings,
807 send_compression_encodings,
808 )
809 .apply_max_message_size_config(
810 max_decoding_message_size,
811 max_encoding_message_size,
812 );
813 let res = grpc.unary(method, req).await;
814 Ok(res)
815 };
816 Box::pin(fut)
817 }
818 "/fintekkers.services.lock_service.Lock/GetAllPartitionStatus" => {
819 #[allow(non_camel_case_types)]
820 struct GetAllPartitionStatusSvc<T: Lock>(pub Arc<T>);
821 impl<T: Lock> tonic::server::UnaryService<()>
822 for GetAllPartitionStatusSvc<T> {
823 type Response = super::NodeStateList;
824 type Future = BoxFuture<
825 tonic::Response<Self::Response>,
826 tonic::Status,
827 >;
828 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
829 let inner = Arc::clone(&self.0);
830 let fut = async move {
831 (*inner).get_all_partition_status(request).await
832 };
833 Box::pin(fut)
834 }
835 }
836 let accept_compression_encodings = self.accept_compression_encodings;
837 let send_compression_encodings = self.send_compression_encodings;
838 let max_decoding_message_size = self.max_decoding_message_size;
839 let max_encoding_message_size = self.max_encoding_message_size;
840 let inner = self.inner.clone();
841 let fut = async move {
842 let inner = inner.0;
843 let method = GetAllPartitionStatusSvc(inner);
844 let codec = tonic::codec::ProstCodec::default();
845 let mut grpc = tonic::server::Grpc::new(codec)
846 .apply_compression_config(
847 accept_compression_encodings,
848 send_compression_encodings,
849 )
850 .apply_max_message_size_config(
851 max_decoding_message_size,
852 max_encoding_message_size,
853 );
854 let res = grpc.unary(method, req).await;
855 Ok(res)
856 };
857 Box::pin(fut)
858 }
859 "/fintekkers.services.lock_service.Lock/GetAllPartitionStatusForNamespaces" => {
860 #[allow(non_camel_case_types)]
861 struct GetAllPartitionStatusForNamespacesSvc<T: Lock>(pub Arc<T>);
862 impl<T: Lock> tonic::server::UnaryService<super::NamespaceList>
863 for GetAllPartitionStatusForNamespacesSvc<T> {
864 type Response = super::NodeStateList;
865 type Future = BoxFuture<
866 tonic::Response<Self::Response>,
867 tonic::Status,
868 >;
869 fn call(
870 &mut self,
871 request: tonic::Request<super::NamespaceList>,
872 ) -> Self::Future {
873 let inner = Arc::clone(&self.0);
874 let fut = async move {
875 (*inner)
876 .get_all_partition_status_for_namespaces(request)
877 .await
878 };
879 Box::pin(fut)
880 }
881 }
882 let accept_compression_encodings = self.accept_compression_encodings;
883 let send_compression_encodings = self.send_compression_encodings;
884 let max_decoding_message_size = self.max_decoding_message_size;
885 let max_encoding_message_size = self.max_encoding_message_size;
886 let inner = self.inner.clone();
887 let fut = async move {
888 let inner = inner.0;
889 let method = GetAllPartitionStatusForNamespacesSvc(inner);
890 let codec = tonic::codec::ProstCodec::default();
891 let mut grpc = tonic::server::Grpc::new(codec)
892 .apply_compression_config(
893 accept_compression_encodings,
894 send_compression_encodings,
895 )
896 .apply_max_message_size_config(
897 max_decoding_message_size,
898 max_encoding_message_size,
899 );
900 let res = grpc.unary(method, req).await;
901 Ok(res)
902 };
903 Box::pin(fut)
904 }
905 "/fintekkers.services.lock_service.Lock/GetPartitionStatus" => {
906 #[allow(non_camel_case_types)]
907 struct GetPartitionStatusSvc<T: Lock>(pub Arc<T>);
908 impl<
909 T: Lock,
910 > tonic::server::UnaryService<
911 super::super::super::models::util::lock::NodePartition,
912 > for GetPartitionStatusSvc<T> {
913 type Response = super::super::super::models::util::lock::NodeState;
914 type Future = BoxFuture<
915 tonic::Response<Self::Response>,
916 tonic::Status,
917 >;
918 fn call(
919 &mut self,
920 request: tonic::Request<
921 super::super::super::models::util::lock::NodePartition,
922 >,
923 ) -> Self::Future {
924 let inner = Arc::clone(&self.0);
925 let fut = async move {
926 (*inner).get_partition_status(request).await
927 };
928 Box::pin(fut)
929 }
930 }
931 let accept_compression_encodings = self.accept_compression_encodings;
932 let send_compression_encodings = self.send_compression_encodings;
933 let max_decoding_message_size = self.max_decoding_message_size;
934 let max_encoding_message_size = self.max_encoding_message_size;
935 let inner = self.inner.clone();
936 let fut = async move {
937 let inner = inner.0;
938 let method = GetPartitionStatusSvc(inner);
939 let codec = tonic::codec::ProstCodec::default();
940 let mut grpc = tonic::server::Grpc::new(codec)
941 .apply_compression_config(
942 accept_compression_encodings,
943 send_compression_encodings,
944 )
945 .apply_max_message_size_config(
946 max_decoding_message_size,
947 max_encoding_message_size,
948 );
949 let res = grpc.unary(method, req).await;
950 Ok(res)
951 };
952 Box::pin(fut)
953 }
954 _ => {
955 Box::pin(async move {
956 Ok(
957 http::Response::builder()
958 .status(200)
959 .header("grpc-status", "12")
960 .header("content-type", "application/grpc")
961 .body(empty_body())
962 .unwrap(),
963 )
964 })
965 }
966 }
967 }
968 }
969 impl<T: Lock> Clone for LockServer<T> {
970 fn clone(&self) -> Self {
971 let inner = self.inner.clone();
972 Self {
973 inner,
974 accept_compression_encodings: self.accept_compression_encodings,
975 send_compression_encodings: self.send_compression_encodings,
976 max_decoding_message_size: self.max_decoding_message_size,
977 max_encoding_message_size: self.max_encoding_message_size,
978 }
979 }
980 }
981 impl<T: Lock> Clone for _Inner<T> {
982 fn clone(&self) -> Self {
983 Self(Arc::clone(&self.0))
984 }
985 }
986 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
987 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
988 write!(f, "{:?}", self.0)
989 }
990 }
991 impl<T: Lock> tonic::server::NamedService for LockServer<T> {
992 const NAME: &'static str = "fintekkers.services.lock_service.Lock";
993 }
994}