1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct ProducerRequest {
5 #[prost(uint64, tag = "1")]
6 pub request_id: u64,
7 #[prost(string, tag = "2")]
8 pub producer_name: ::prost::alloc::string::String,
9 #[prost(string, tag = "3")]
10 pub topic_name: ::prost::alloc::string::String,
11 #[prost(message, optional, tag = "4")]
12 pub schema_ref: ::core::option::Option<SchemaReference>,
13 #[prost(enumeration = "ProducerAccessMode", tag = "5")]
14 pub producer_access_mode: i32,
15 #[prost(enumeration = "DispatchStrategy", tag = "6")]
16 pub dispatch_strategy: i32,
17}
18#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
20pub struct SchemaReference {
21 #[prost(string, tag = "1")]
23 pub subject: ::prost::alloc::string::String,
24 #[prost(oneof = "schema_reference::VersionRef", tags = "2, 3, 4")]
25 pub version_ref: ::core::option::Option<schema_reference::VersionRef>,
26}
27pub mod schema_reference {
29 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
30 pub enum VersionRef {
31 #[prost(bool, tag = "2")]
33 UseLatest(bool),
34 #[prost(uint32, tag = "3")]
36 PinnedVersion(u32),
37 #[prost(uint32, tag = "4")]
39 MinVersion(u32),
40 }
41}
42#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
44pub struct ProducerResponse {
45 #[prost(uint64, tag = "1")]
46 pub request_id: u64,
47 #[prost(uint64, tag = "2")]
48 pub producer_id: u64,
49 #[prost(string, tag = "3")]
50 pub producer_name: ::prost::alloc::string::String,
51}
52#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
54pub struct MessageResponse {
55 #[prost(uint64, tag = "1")]
56 pub request_id: u64,
57}
58#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
60pub struct ConsumerRequest {
61 #[prost(uint64, tag = "1")]
62 pub request_id: u64,
63 #[prost(string, tag = "2")]
64 pub topic_name: ::prost::alloc::string::String,
65 #[prost(string, tag = "3")]
66 pub consumer_name: ::prost::alloc::string::String,
67 #[prost(string, tag = "4")]
68 pub subscription: ::prost::alloc::string::String,
69 #[prost(enumeration = "consumer_request::SubscriptionType", tag = "5")]
70 pub subscription_type: i32,
71}
72pub mod consumer_request {
74 #[derive(
75 Clone,
76 Copy,
77 Debug,
78 PartialEq,
79 Eq,
80 Hash,
81 PartialOrd,
82 Ord,
83 ::prost::Enumeration
84 )]
85 #[repr(i32)]
86 pub enum SubscriptionType {
87 Exclusive = 0,
89 Shared = 1,
91 Failover = 2,
93 }
94 impl SubscriptionType {
95 pub fn as_str_name(&self) -> &'static str {
100 match self {
101 Self::Exclusive => "Exclusive",
102 Self::Shared => "Shared",
103 Self::Failover => "Failover",
104 }
105 }
106 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
108 match value {
109 "Exclusive" => Some(Self::Exclusive),
110 "Shared" => Some(Self::Shared),
111 "Failover" => Some(Self::Failover),
112 _ => None,
113 }
114 }
115 }
116}
117#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
119pub struct ConsumerResponse {
120 #[prost(uint64, tag = "1")]
121 pub request_id: u64,
122 #[prost(uint64, tag = "2")]
123 pub consumer_id: u64,
124 #[prost(string, tag = "3")]
125 pub consumer_name: ::prost::alloc::string::String,
126}
127#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
128pub struct ReceiveRequest {
129 #[prost(uint64, tag = "1")]
130 pub request_id: u64,
131 #[prost(uint64, tag = "2")]
132 pub consumer_id: u64,
133}
134#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct StreamMessage {
137 #[prost(uint64, tag = "1")]
139 pub request_id: u64,
140 #[prost(message, optional, tag = "2")]
142 pub msg_id: ::core::option::Option<MsgId>,
143 #[prost(bytes = "vec", tag = "3")]
145 pub payload: ::prost::alloc::vec::Vec<u8>,
146 #[prost(uint64, tag = "4")]
148 pub publish_time: u64,
149 #[prost(string, tag = "5")]
151 pub producer_name: ::prost::alloc::string::String,
152 #[prost(string, tag = "6")]
154 pub subscription_name: ::prost::alloc::string::String,
155 #[prost(map = "string, string", tag = "7")]
157 pub attributes: ::std::collections::HashMap<
158 ::prost::alloc::string::String,
159 ::prost::alloc::string::String,
160 >,
161 #[prost(uint64, optional, tag = "8")]
165 pub schema_id: ::core::option::Option<u64>,
166 #[prost(uint32, optional, tag = "9")]
168 pub schema_version: ::core::option::Option<u32>,
169}
170#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
172pub struct MsgId {
173 #[prost(uint64, tag = "1")]
175 pub producer_id: u64,
176 #[prost(string, tag = "2")]
178 pub topic_name: ::prost::alloc::string::String,
179 #[prost(string, tag = "3")]
181 pub broker_addr: ::prost::alloc::string::String,
182 #[prost(uint64, tag = "5")]
184 pub topic_offset: u64,
185}
186#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
187pub struct AckRequest {
188 #[prost(uint64, tag = "1")]
189 pub request_id: u64,
190 #[prost(message, optional, tag = "2")]
192 pub msg_id: ::core::option::Option<MsgId>,
193 #[prost(string, tag = "3")]
195 pub subscription_name: ::prost::alloc::string::String,
196}
197#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
198pub struct AckResponse {
199 #[prost(uint64, tag = "1")]
200 pub request_id: u64,
201}
202#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
203pub struct TopicLookupRequest {
204 #[prost(uint64, tag = "1")]
205 pub request_id: u64,
206 #[prost(string, tag = "2")]
207 pub topic: ::prost::alloc::string::String,
208}
209#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
210pub struct TopicLookupResponse {
211 #[prost(uint64, tag = "3")]
212 pub request_id: u64,
213 #[prost(enumeration = "topic_lookup_response::LookupType", tag = "4")]
214 pub response_type: i32,
215 #[prost(string, tag = "5")]
216 pub broker_service_url: ::prost::alloc::string::String,
217}
218pub mod topic_lookup_response {
220 #[derive(
221 Clone,
222 Copy,
223 Debug,
224 PartialEq,
225 Eq,
226 Hash,
227 PartialOrd,
228 Ord,
229 ::prost::Enumeration
230 )]
231 #[repr(i32)]
232 pub enum LookupType {
233 Redirect = 0,
234 Connect = 1,
235 Failed = 2,
236 }
237 impl LookupType {
238 pub fn as_str_name(&self) -> &'static str {
243 match self {
244 Self::Redirect => "Redirect",
245 Self::Connect => "Connect",
246 Self::Failed => "Failed",
247 }
248 }
249 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
251 match value {
252 "Redirect" => Some(Self::Redirect),
253 "Connect" => Some(Self::Connect),
254 "Failed" => Some(Self::Failed),
255 _ => None,
256 }
257 }
258 }
259}
260#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
261pub struct TopicPartitionsResponse {
262 #[prost(uint64, tag = "1")]
263 pub request_id: u64,
264 #[prost(string, repeated, tag = "2")]
265 pub partitions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
266}
267#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
268pub struct HealthCheckRequest {
269 #[prost(uint64, tag = "1")]
270 pub request_id: u64,
271 #[prost(enumeration = "health_check_request::ClientType", tag = "2")]
272 pub client: i32,
273 #[prost(uint64, tag = "3")]
274 pub id: u64,
275}
276pub mod health_check_request {
278 #[derive(
279 Clone,
280 Copy,
281 Debug,
282 PartialEq,
283 Eq,
284 Hash,
285 PartialOrd,
286 Ord,
287 ::prost::Enumeration
288 )]
289 #[repr(i32)]
290 pub enum ClientType {
291 Producer = 0,
292 Consumer = 1,
293 }
294 impl ClientType {
295 pub fn as_str_name(&self) -> &'static str {
300 match self {
301 Self::Producer => "Producer",
302 Self::Consumer => "Consumer",
303 }
304 }
305 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
307 match value {
308 "Producer" => Some(Self::Producer),
309 "Consumer" => Some(Self::Consumer),
310 _ => None,
311 }
312 }
313 }
314}
315#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
316pub struct HealthCheckResponse {
317 #[prost(enumeration = "health_check_response::ClientStatus", tag = "1")]
318 pub status: i32,
319}
320pub mod health_check_response {
322 #[derive(
323 Clone,
324 Copy,
325 Debug,
326 PartialEq,
327 Eq,
328 Hash,
329 PartialOrd,
330 Ord,
331 ::prost::Enumeration
332 )]
333 #[repr(i32)]
334 pub enum ClientStatus {
335 Ok = 0,
336 Close = 1,
337 }
338 impl ClientStatus {
339 pub fn as_str_name(&self) -> &'static str {
344 match self {
345 Self::Ok => "OK",
346 Self::Close => "CLOSE",
347 }
348 }
349 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
351 match value {
352 "OK" => Some(Self::Ok),
353 "CLOSE" => Some(Self::Close),
354 _ => None,
355 }
356 }
357 }
358}
359#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
360pub struct AuthRequest {
361 #[prost(string, tag = "1")]
362 pub api_key: ::prost::alloc::string::String,
363}
364#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
365pub struct AuthResponse {
366 #[prost(string, tag = "1")]
367 pub token: ::prost::alloc::string::String,
368}
369#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
371pub struct ErrorMessage {
372 #[prost(enumeration = "ErrorType", tag = "1")]
373 pub error_type: i32,
374 #[prost(string, tag = "2")]
375 pub error_message: ::prost::alloc::string::String,
376 #[prost(string, tag = "3")]
378 pub redirect_to: ::prost::alloc::string::String,
379}
380#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
381#[repr(i32)]
382pub enum ProducerAccessMode {
383 Shared = 0,
385 Exclusive = 1,
387}
388impl ProducerAccessMode {
389 pub fn as_str_name(&self) -> &'static str {
394 match self {
395 Self::Shared => "Shared",
396 Self::Exclusive => "Exclusive",
397 }
398 }
399 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
401 match value {
402 "Shared" => Some(Self::Shared),
403 "Exclusive" => Some(Self::Exclusive),
404 _ => None,
405 }
406 }
407}
408#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
409#[repr(i32)]
410pub enum DispatchStrategy {
411 NonReliable = 0,
412 Reliable = 1,
413}
414impl DispatchStrategy {
415 pub fn as_str_name(&self) -> &'static str {
420 match self {
421 Self::NonReliable => "NonReliable",
422 Self::Reliable => "Reliable",
423 }
424 }
425 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
427 match value {
428 "NonReliable" => Some(Self::NonReliable),
429 "Reliable" => Some(Self::Reliable),
430 _ => None,
431 }
432 }
433}
434#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
435#[repr(i32)]
436pub enum ErrorType {
437 UnknownError = 0,
438 InvalidTopicName = 1,
440 TopicNotFound = 2,
442 ServiceNotReady = 3,
444 ProducerAlreadyExists = 4,
445 SubscribePermissionDenied = 5,
446 SubscriptionNotFound = 6,
448}
449impl ErrorType {
450 pub fn as_str_name(&self) -> &'static str {
455 match self {
456 Self::UnknownError => "UNKNOWN_ERROR",
457 Self::InvalidTopicName => "INVALID_TOPIC_NAME",
458 Self::TopicNotFound => "TOPIC_NOT_FOUND",
459 Self::ServiceNotReady => "SERVICE_NOT_READY",
460 Self::ProducerAlreadyExists => "PRODUCER_ALREADY_EXISTS",
461 Self::SubscribePermissionDenied => "SUBSCRIBE_PERMISSION_DENIED",
462 Self::SubscriptionNotFound => "SUBSCRIPTION_NOT_FOUND",
463 }
464 }
465 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
467 match value {
468 "UNKNOWN_ERROR" => Some(Self::UnknownError),
469 "INVALID_TOPIC_NAME" => Some(Self::InvalidTopicName),
470 "TOPIC_NOT_FOUND" => Some(Self::TopicNotFound),
471 "SERVICE_NOT_READY" => Some(Self::ServiceNotReady),
472 "PRODUCER_ALREADY_EXISTS" => Some(Self::ProducerAlreadyExists),
473 "SUBSCRIBE_PERMISSION_DENIED" => Some(Self::SubscribePermissionDenied),
474 "SUBSCRIPTION_NOT_FOUND" => Some(Self::SubscriptionNotFound),
475 _ => None,
476 }
477 }
478}
479pub mod producer_service_client {
481 #![allow(
482 unused_variables,
483 dead_code,
484 missing_docs,
485 clippy::wildcard_imports,
486 clippy::let_unit_value,
487 )]
488 use tonic::codegen::*;
489 use tonic::codegen::http::Uri;
490 #[derive(Debug, Clone)]
491 pub struct ProducerServiceClient<T> {
492 inner: tonic::client::Grpc<T>,
493 }
494 impl ProducerServiceClient<tonic::transport::Channel> {
495 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
497 where
498 D: TryInto<tonic::transport::Endpoint>,
499 D::Error: Into<StdError>,
500 {
501 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
502 Ok(Self::new(conn))
503 }
504 }
505 impl<T> ProducerServiceClient<T>
506 where
507 T: tonic::client::GrpcService<tonic::body::Body>,
508 T::Error: Into<StdError>,
509 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
510 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
511 {
512 pub fn new(inner: T) -> Self {
513 let inner = tonic::client::Grpc::new(inner);
514 Self { inner }
515 }
516 pub fn with_origin(inner: T, origin: Uri) -> Self {
517 let inner = tonic::client::Grpc::with_origin(inner, origin);
518 Self { inner }
519 }
520 pub fn with_interceptor<F>(
521 inner: T,
522 interceptor: F,
523 ) -> ProducerServiceClient<InterceptedService<T, F>>
524 where
525 F: tonic::service::Interceptor,
526 T::ResponseBody: Default,
527 T: tonic::codegen::Service<
528 http::Request<tonic::body::Body>,
529 Response = http::Response<
530 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
531 >,
532 >,
533 <T as tonic::codegen::Service<
534 http::Request<tonic::body::Body>,
535 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
536 {
537 ProducerServiceClient::new(InterceptedService::new(inner, interceptor))
538 }
539 #[must_use]
544 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
545 self.inner = self.inner.send_compressed(encoding);
546 self
547 }
548 #[must_use]
550 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
551 self.inner = self.inner.accept_compressed(encoding);
552 self
553 }
554 #[must_use]
558 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
559 self.inner = self.inner.max_decoding_message_size(limit);
560 self
561 }
562 #[must_use]
566 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
567 self.inner = self.inner.max_encoding_message_size(limit);
568 self
569 }
570 pub async fn create_producer(
572 &mut self,
573 request: impl tonic::IntoRequest<super::ProducerRequest>,
574 ) -> std::result::Result<
575 tonic::Response<super::ProducerResponse>,
576 tonic::Status,
577 > {
578 self.inner
579 .ready()
580 .await
581 .map_err(|e| {
582 tonic::Status::unknown(
583 format!("Service was not ready: {}", e.into()),
584 )
585 })?;
586 let codec = tonic_prost::ProstCodec::default();
587 let path = http::uri::PathAndQuery::from_static(
588 "/danube.ProducerService/CreateProducer",
589 );
590 let mut req = request.into_request();
591 req.extensions_mut()
592 .insert(GrpcMethod::new("danube.ProducerService", "CreateProducer"));
593 self.inner.unary(req, path, codec).await
594 }
595 pub async fn send_message(
597 &mut self,
598 request: impl tonic::IntoRequest<super::StreamMessage>,
599 ) -> std::result::Result<
600 tonic::Response<super::MessageResponse>,
601 tonic::Status,
602 > {
603 self.inner
604 .ready()
605 .await
606 .map_err(|e| {
607 tonic::Status::unknown(
608 format!("Service was not ready: {}", e.into()),
609 )
610 })?;
611 let codec = tonic_prost::ProstCodec::default();
612 let path = http::uri::PathAndQuery::from_static(
613 "/danube.ProducerService/SendMessage",
614 );
615 let mut req = request.into_request();
616 req.extensions_mut()
617 .insert(GrpcMethod::new("danube.ProducerService", "SendMessage"));
618 self.inner.unary(req, path, codec).await
619 }
620 }
621}
622pub mod producer_service_server {
624 #![allow(
625 unused_variables,
626 dead_code,
627 missing_docs,
628 clippy::wildcard_imports,
629 clippy::let_unit_value,
630 )]
631 use tonic::codegen::*;
632 #[async_trait]
634 pub trait ProducerService: std::marker::Send + std::marker::Sync + 'static {
635 async fn create_producer(
637 &self,
638 request: tonic::Request<super::ProducerRequest>,
639 ) -> std::result::Result<
640 tonic::Response<super::ProducerResponse>,
641 tonic::Status,
642 >;
643 async fn send_message(
645 &self,
646 request: tonic::Request<super::StreamMessage>,
647 ) -> std::result::Result<tonic::Response<super::MessageResponse>, tonic::Status>;
648 }
649 #[derive(Debug)]
650 pub struct ProducerServiceServer<T> {
651 inner: Arc<T>,
652 accept_compression_encodings: EnabledCompressionEncodings,
653 send_compression_encodings: EnabledCompressionEncodings,
654 max_decoding_message_size: Option<usize>,
655 max_encoding_message_size: Option<usize>,
656 }
657 impl<T> ProducerServiceServer<T> {
658 pub fn new(inner: T) -> Self {
659 Self::from_arc(Arc::new(inner))
660 }
661 pub fn from_arc(inner: Arc<T>) -> Self {
662 Self {
663 inner,
664 accept_compression_encodings: Default::default(),
665 send_compression_encodings: Default::default(),
666 max_decoding_message_size: None,
667 max_encoding_message_size: None,
668 }
669 }
670 pub fn with_interceptor<F>(
671 inner: T,
672 interceptor: F,
673 ) -> InterceptedService<Self, F>
674 where
675 F: tonic::service::Interceptor,
676 {
677 InterceptedService::new(Self::new(inner), interceptor)
678 }
679 #[must_use]
681 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
682 self.accept_compression_encodings.enable(encoding);
683 self
684 }
685 #[must_use]
687 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
688 self.send_compression_encodings.enable(encoding);
689 self
690 }
691 #[must_use]
695 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
696 self.max_decoding_message_size = Some(limit);
697 self
698 }
699 #[must_use]
703 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
704 self.max_encoding_message_size = Some(limit);
705 self
706 }
707 }
708 impl<T, B> tonic::codegen::Service<http::Request<B>> for ProducerServiceServer<T>
709 where
710 T: ProducerService,
711 B: Body + std::marker::Send + 'static,
712 B::Error: Into<StdError> + std::marker::Send + 'static,
713 {
714 type Response = http::Response<tonic::body::Body>;
715 type Error = std::convert::Infallible;
716 type Future = BoxFuture<Self::Response, Self::Error>;
717 fn poll_ready(
718 &mut self,
719 _cx: &mut Context<'_>,
720 ) -> Poll<std::result::Result<(), Self::Error>> {
721 Poll::Ready(Ok(()))
722 }
723 fn call(&mut self, req: http::Request<B>) -> Self::Future {
724 match req.uri().path() {
725 "/danube.ProducerService/CreateProducer" => {
726 #[allow(non_camel_case_types)]
727 struct CreateProducerSvc<T: ProducerService>(pub Arc<T>);
728 impl<
729 T: ProducerService,
730 > tonic::server::UnaryService<super::ProducerRequest>
731 for CreateProducerSvc<T> {
732 type Response = super::ProducerResponse;
733 type Future = BoxFuture<
734 tonic::Response<Self::Response>,
735 tonic::Status,
736 >;
737 fn call(
738 &mut self,
739 request: tonic::Request<super::ProducerRequest>,
740 ) -> Self::Future {
741 let inner = Arc::clone(&self.0);
742 let fut = async move {
743 <T as ProducerService>::create_producer(&inner, request)
744 .await
745 };
746 Box::pin(fut)
747 }
748 }
749 let accept_compression_encodings = self.accept_compression_encodings;
750 let send_compression_encodings = self.send_compression_encodings;
751 let max_decoding_message_size = self.max_decoding_message_size;
752 let max_encoding_message_size = self.max_encoding_message_size;
753 let inner = self.inner.clone();
754 let fut = async move {
755 let method = CreateProducerSvc(inner);
756 let codec = tonic_prost::ProstCodec::default();
757 let mut grpc = tonic::server::Grpc::new(codec)
758 .apply_compression_config(
759 accept_compression_encodings,
760 send_compression_encodings,
761 )
762 .apply_max_message_size_config(
763 max_decoding_message_size,
764 max_encoding_message_size,
765 );
766 let res = grpc.unary(method, req).await;
767 Ok(res)
768 };
769 Box::pin(fut)
770 }
771 "/danube.ProducerService/SendMessage" => {
772 #[allow(non_camel_case_types)]
773 struct SendMessageSvc<T: ProducerService>(pub Arc<T>);
774 impl<
775 T: ProducerService,
776 > tonic::server::UnaryService<super::StreamMessage>
777 for SendMessageSvc<T> {
778 type Response = super::MessageResponse;
779 type Future = BoxFuture<
780 tonic::Response<Self::Response>,
781 tonic::Status,
782 >;
783 fn call(
784 &mut self,
785 request: tonic::Request<super::StreamMessage>,
786 ) -> Self::Future {
787 let inner = Arc::clone(&self.0);
788 let fut = async move {
789 <T as ProducerService>::send_message(&inner, request).await
790 };
791 Box::pin(fut)
792 }
793 }
794 let accept_compression_encodings = self.accept_compression_encodings;
795 let send_compression_encodings = self.send_compression_encodings;
796 let max_decoding_message_size = self.max_decoding_message_size;
797 let max_encoding_message_size = self.max_encoding_message_size;
798 let inner = self.inner.clone();
799 let fut = async move {
800 let method = SendMessageSvc(inner);
801 let codec = tonic_prost::ProstCodec::default();
802 let mut grpc = tonic::server::Grpc::new(codec)
803 .apply_compression_config(
804 accept_compression_encodings,
805 send_compression_encodings,
806 )
807 .apply_max_message_size_config(
808 max_decoding_message_size,
809 max_encoding_message_size,
810 );
811 let res = grpc.unary(method, req).await;
812 Ok(res)
813 };
814 Box::pin(fut)
815 }
816 _ => {
817 Box::pin(async move {
818 let mut response = http::Response::new(
819 tonic::body::Body::default(),
820 );
821 let headers = response.headers_mut();
822 headers
823 .insert(
824 tonic::Status::GRPC_STATUS,
825 (tonic::Code::Unimplemented as i32).into(),
826 );
827 headers
828 .insert(
829 http::header::CONTENT_TYPE,
830 tonic::metadata::GRPC_CONTENT_TYPE,
831 );
832 Ok(response)
833 })
834 }
835 }
836 }
837 }
838 impl<T> Clone for ProducerServiceServer<T> {
839 fn clone(&self) -> Self {
840 let inner = self.inner.clone();
841 Self {
842 inner,
843 accept_compression_encodings: self.accept_compression_encodings,
844 send_compression_encodings: self.send_compression_encodings,
845 max_decoding_message_size: self.max_decoding_message_size,
846 max_encoding_message_size: self.max_encoding_message_size,
847 }
848 }
849 }
850 pub const SERVICE_NAME: &str = "danube.ProducerService";
852 impl<T> tonic::server::NamedService for ProducerServiceServer<T> {
853 const NAME: &'static str = SERVICE_NAME;
854 }
855}
856pub mod consumer_service_client {
858 #![allow(
859 unused_variables,
860 dead_code,
861 missing_docs,
862 clippy::wildcard_imports,
863 clippy::let_unit_value,
864 )]
865 use tonic::codegen::*;
866 use tonic::codegen::http::Uri;
867 #[derive(Debug, Clone)]
868 pub struct ConsumerServiceClient<T> {
869 inner: tonic::client::Grpc<T>,
870 }
871 impl ConsumerServiceClient<tonic::transport::Channel> {
872 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
874 where
875 D: TryInto<tonic::transport::Endpoint>,
876 D::Error: Into<StdError>,
877 {
878 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
879 Ok(Self::new(conn))
880 }
881 }
882 impl<T> ConsumerServiceClient<T>
883 where
884 T: tonic::client::GrpcService<tonic::body::Body>,
885 T::Error: Into<StdError>,
886 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
887 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
888 {
889 pub fn new(inner: T) -> Self {
890 let inner = tonic::client::Grpc::new(inner);
891 Self { inner }
892 }
893 pub fn with_origin(inner: T, origin: Uri) -> Self {
894 let inner = tonic::client::Grpc::with_origin(inner, origin);
895 Self { inner }
896 }
897 pub fn with_interceptor<F>(
898 inner: T,
899 interceptor: F,
900 ) -> ConsumerServiceClient<InterceptedService<T, F>>
901 where
902 F: tonic::service::Interceptor,
903 T::ResponseBody: Default,
904 T: tonic::codegen::Service<
905 http::Request<tonic::body::Body>,
906 Response = http::Response<
907 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
908 >,
909 >,
910 <T as tonic::codegen::Service<
911 http::Request<tonic::body::Body>,
912 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
913 {
914 ConsumerServiceClient::new(InterceptedService::new(inner, interceptor))
915 }
916 #[must_use]
921 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
922 self.inner = self.inner.send_compressed(encoding);
923 self
924 }
925 #[must_use]
927 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
928 self.inner = self.inner.accept_compressed(encoding);
929 self
930 }
931 #[must_use]
935 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
936 self.inner = self.inner.max_decoding_message_size(limit);
937 self
938 }
939 #[must_use]
943 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
944 self.inner = self.inner.max_encoding_message_size(limit);
945 self
946 }
947 pub async fn subscribe(
949 &mut self,
950 request: impl tonic::IntoRequest<super::ConsumerRequest>,
951 ) -> std::result::Result<
952 tonic::Response<super::ConsumerResponse>,
953 tonic::Status,
954 > {
955 self.inner
956 .ready()
957 .await
958 .map_err(|e| {
959 tonic::Status::unknown(
960 format!("Service was not ready: {}", e.into()),
961 )
962 })?;
963 let codec = tonic_prost::ProstCodec::default();
964 let path = http::uri::PathAndQuery::from_static(
965 "/danube.ConsumerService/Subscribe",
966 );
967 let mut req = request.into_request();
968 req.extensions_mut()
969 .insert(GrpcMethod::new("danube.ConsumerService", "Subscribe"));
970 self.inner.unary(req, path, codec).await
971 }
972 pub async fn receive_messages(
974 &mut self,
975 request: impl tonic::IntoRequest<super::ReceiveRequest>,
976 ) -> std::result::Result<
977 tonic::Response<tonic::codec::Streaming<super::StreamMessage>>,
978 tonic::Status,
979 > {
980 self.inner
981 .ready()
982 .await
983 .map_err(|e| {
984 tonic::Status::unknown(
985 format!("Service was not ready: {}", e.into()),
986 )
987 })?;
988 let codec = tonic_prost::ProstCodec::default();
989 let path = http::uri::PathAndQuery::from_static(
990 "/danube.ConsumerService/ReceiveMessages",
991 );
992 let mut req = request.into_request();
993 req.extensions_mut()
994 .insert(GrpcMethod::new("danube.ConsumerService", "ReceiveMessages"));
995 self.inner.server_streaming(req, path, codec).await
996 }
997 pub async fn ack(
999 &mut self,
1000 request: impl tonic::IntoRequest<super::AckRequest>,
1001 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status> {
1002 self.inner
1003 .ready()
1004 .await
1005 .map_err(|e| {
1006 tonic::Status::unknown(
1007 format!("Service was not ready: {}", e.into()),
1008 )
1009 })?;
1010 let codec = tonic_prost::ProstCodec::default();
1011 let path = http::uri::PathAndQuery::from_static(
1012 "/danube.ConsumerService/Ack",
1013 );
1014 let mut req = request.into_request();
1015 req.extensions_mut()
1016 .insert(GrpcMethod::new("danube.ConsumerService", "Ack"));
1017 self.inner.unary(req, path, codec).await
1018 }
1019 }
1020}
1021pub mod consumer_service_server {
1023 #![allow(
1024 unused_variables,
1025 dead_code,
1026 missing_docs,
1027 clippy::wildcard_imports,
1028 clippy::let_unit_value,
1029 )]
1030 use tonic::codegen::*;
1031 #[async_trait]
1033 pub trait ConsumerService: std::marker::Send + std::marker::Sync + 'static {
1034 async fn subscribe(
1036 &self,
1037 request: tonic::Request<super::ConsumerRequest>,
1038 ) -> std::result::Result<
1039 tonic::Response<super::ConsumerResponse>,
1040 tonic::Status,
1041 >;
1042 type ReceiveMessagesStream: tonic::codegen::tokio_stream::Stream<
1044 Item = std::result::Result<super::StreamMessage, tonic::Status>,
1045 >
1046 + std::marker::Send
1047 + 'static;
1048 async fn receive_messages(
1050 &self,
1051 request: tonic::Request<super::ReceiveRequest>,
1052 ) -> std::result::Result<
1053 tonic::Response<Self::ReceiveMessagesStream>,
1054 tonic::Status,
1055 >;
1056 async fn ack(
1058 &self,
1059 request: tonic::Request<super::AckRequest>,
1060 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status>;
1061 }
1062 #[derive(Debug)]
1063 pub struct ConsumerServiceServer<T> {
1064 inner: Arc<T>,
1065 accept_compression_encodings: EnabledCompressionEncodings,
1066 send_compression_encodings: EnabledCompressionEncodings,
1067 max_decoding_message_size: Option<usize>,
1068 max_encoding_message_size: Option<usize>,
1069 }
1070 impl<T> ConsumerServiceServer<T> {
1071 pub fn new(inner: T) -> Self {
1072 Self::from_arc(Arc::new(inner))
1073 }
1074 pub fn from_arc(inner: Arc<T>) -> Self {
1075 Self {
1076 inner,
1077 accept_compression_encodings: Default::default(),
1078 send_compression_encodings: Default::default(),
1079 max_decoding_message_size: None,
1080 max_encoding_message_size: None,
1081 }
1082 }
1083 pub fn with_interceptor<F>(
1084 inner: T,
1085 interceptor: F,
1086 ) -> InterceptedService<Self, F>
1087 where
1088 F: tonic::service::Interceptor,
1089 {
1090 InterceptedService::new(Self::new(inner), interceptor)
1091 }
1092 #[must_use]
1094 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1095 self.accept_compression_encodings.enable(encoding);
1096 self
1097 }
1098 #[must_use]
1100 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1101 self.send_compression_encodings.enable(encoding);
1102 self
1103 }
1104 #[must_use]
1108 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1109 self.max_decoding_message_size = Some(limit);
1110 self
1111 }
1112 #[must_use]
1116 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1117 self.max_encoding_message_size = Some(limit);
1118 self
1119 }
1120 }
1121 impl<T, B> tonic::codegen::Service<http::Request<B>> for ConsumerServiceServer<T>
1122 where
1123 T: ConsumerService,
1124 B: Body + std::marker::Send + 'static,
1125 B::Error: Into<StdError> + std::marker::Send + 'static,
1126 {
1127 type Response = http::Response<tonic::body::Body>;
1128 type Error = std::convert::Infallible;
1129 type Future = BoxFuture<Self::Response, Self::Error>;
1130 fn poll_ready(
1131 &mut self,
1132 _cx: &mut Context<'_>,
1133 ) -> Poll<std::result::Result<(), Self::Error>> {
1134 Poll::Ready(Ok(()))
1135 }
1136 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1137 match req.uri().path() {
1138 "/danube.ConsumerService/Subscribe" => {
1139 #[allow(non_camel_case_types)]
1140 struct SubscribeSvc<T: ConsumerService>(pub Arc<T>);
1141 impl<
1142 T: ConsumerService,
1143 > tonic::server::UnaryService<super::ConsumerRequest>
1144 for SubscribeSvc<T> {
1145 type Response = super::ConsumerResponse;
1146 type Future = BoxFuture<
1147 tonic::Response<Self::Response>,
1148 tonic::Status,
1149 >;
1150 fn call(
1151 &mut self,
1152 request: tonic::Request<super::ConsumerRequest>,
1153 ) -> Self::Future {
1154 let inner = Arc::clone(&self.0);
1155 let fut = async move {
1156 <T as ConsumerService>::subscribe(&inner, request).await
1157 };
1158 Box::pin(fut)
1159 }
1160 }
1161 let accept_compression_encodings = self.accept_compression_encodings;
1162 let send_compression_encodings = self.send_compression_encodings;
1163 let max_decoding_message_size = self.max_decoding_message_size;
1164 let max_encoding_message_size = self.max_encoding_message_size;
1165 let inner = self.inner.clone();
1166 let fut = async move {
1167 let method = SubscribeSvc(inner);
1168 let codec = tonic_prost::ProstCodec::default();
1169 let mut grpc = tonic::server::Grpc::new(codec)
1170 .apply_compression_config(
1171 accept_compression_encodings,
1172 send_compression_encodings,
1173 )
1174 .apply_max_message_size_config(
1175 max_decoding_message_size,
1176 max_encoding_message_size,
1177 );
1178 let res = grpc.unary(method, req).await;
1179 Ok(res)
1180 };
1181 Box::pin(fut)
1182 }
1183 "/danube.ConsumerService/ReceiveMessages" => {
1184 #[allow(non_camel_case_types)]
1185 struct ReceiveMessagesSvc<T: ConsumerService>(pub Arc<T>);
1186 impl<
1187 T: ConsumerService,
1188 > tonic::server::ServerStreamingService<super::ReceiveRequest>
1189 for ReceiveMessagesSvc<T> {
1190 type Response = super::StreamMessage;
1191 type ResponseStream = T::ReceiveMessagesStream;
1192 type Future = BoxFuture<
1193 tonic::Response<Self::ResponseStream>,
1194 tonic::Status,
1195 >;
1196 fn call(
1197 &mut self,
1198 request: tonic::Request<super::ReceiveRequest>,
1199 ) -> Self::Future {
1200 let inner = Arc::clone(&self.0);
1201 let fut = async move {
1202 <T as ConsumerService>::receive_messages(&inner, request)
1203 .await
1204 };
1205 Box::pin(fut)
1206 }
1207 }
1208 let accept_compression_encodings = self.accept_compression_encodings;
1209 let send_compression_encodings = self.send_compression_encodings;
1210 let max_decoding_message_size = self.max_decoding_message_size;
1211 let max_encoding_message_size = self.max_encoding_message_size;
1212 let inner = self.inner.clone();
1213 let fut = async move {
1214 let method = ReceiveMessagesSvc(inner);
1215 let codec = tonic_prost::ProstCodec::default();
1216 let mut grpc = tonic::server::Grpc::new(codec)
1217 .apply_compression_config(
1218 accept_compression_encodings,
1219 send_compression_encodings,
1220 )
1221 .apply_max_message_size_config(
1222 max_decoding_message_size,
1223 max_encoding_message_size,
1224 );
1225 let res = grpc.server_streaming(method, req).await;
1226 Ok(res)
1227 };
1228 Box::pin(fut)
1229 }
1230 "/danube.ConsumerService/Ack" => {
1231 #[allow(non_camel_case_types)]
1232 struct AckSvc<T: ConsumerService>(pub Arc<T>);
1233 impl<
1234 T: ConsumerService,
1235 > tonic::server::UnaryService<super::AckRequest> for AckSvc<T> {
1236 type Response = super::AckResponse;
1237 type Future = BoxFuture<
1238 tonic::Response<Self::Response>,
1239 tonic::Status,
1240 >;
1241 fn call(
1242 &mut self,
1243 request: tonic::Request<super::AckRequest>,
1244 ) -> Self::Future {
1245 let inner = Arc::clone(&self.0);
1246 let fut = async move {
1247 <T as ConsumerService>::ack(&inner, request).await
1248 };
1249 Box::pin(fut)
1250 }
1251 }
1252 let accept_compression_encodings = self.accept_compression_encodings;
1253 let send_compression_encodings = self.send_compression_encodings;
1254 let max_decoding_message_size = self.max_decoding_message_size;
1255 let max_encoding_message_size = self.max_encoding_message_size;
1256 let inner = self.inner.clone();
1257 let fut = async move {
1258 let method = AckSvc(inner);
1259 let codec = tonic_prost::ProstCodec::default();
1260 let mut grpc = tonic::server::Grpc::new(codec)
1261 .apply_compression_config(
1262 accept_compression_encodings,
1263 send_compression_encodings,
1264 )
1265 .apply_max_message_size_config(
1266 max_decoding_message_size,
1267 max_encoding_message_size,
1268 );
1269 let res = grpc.unary(method, req).await;
1270 Ok(res)
1271 };
1272 Box::pin(fut)
1273 }
1274 _ => {
1275 Box::pin(async move {
1276 let mut response = http::Response::new(
1277 tonic::body::Body::default(),
1278 );
1279 let headers = response.headers_mut();
1280 headers
1281 .insert(
1282 tonic::Status::GRPC_STATUS,
1283 (tonic::Code::Unimplemented as i32).into(),
1284 );
1285 headers
1286 .insert(
1287 http::header::CONTENT_TYPE,
1288 tonic::metadata::GRPC_CONTENT_TYPE,
1289 );
1290 Ok(response)
1291 })
1292 }
1293 }
1294 }
1295 }
1296 impl<T> Clone for ConsumerServiceServer<T> {
1297 fn clone(&self) -> Self {
1298 let inner = self.inner.clone();
1299 Self {
1300 inner,
1301 accept_compression_encodings: self.accept_compression_encodings,
1302 send_compression_encodings: self.send_compression_encodings,
1303 max_decoding_message_size: self.max_decoding_message_size,
1304 max_encoding_message_size: self.max_encoding_message_size,
1305 }
1306 }
1307 }
1308 pub const SERVICE_NAME: &str = "danube.ConsumerService";
1310 impl<T> tonic::server::NamedService for ConsumerServiceServer<T> {
1311 const NAME: &'static str = SERVICE_NAME;
1312 }
1313}
1314pub mod discovery_client {
1316 #![allow(
1317 unused_variables,
1318 dead_code,
1319 missing_docs,
1320 clippy::wildcard_imports,
1321 clippy::let_unit_value,
1322 )]
1323 use tonic::codegen::*;
1324 use tonic::codegen::http::Uri;
1325 #[derive(Debug, Clone)]
1326 pub struct DiscoveryClient<T> {
1327 inner: tonic::client::Grpc<T>,
1328 }
1329 impl DiscoveryClient<tonic::transport::Channel> {
1330 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1332 where
1333 D: TryInto<tonic::transport::Endpoint>,
1334 D::Error: Into<StdError>,
1335 {
1336 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1337 Ok(Self::new(conn))
1338 }
1339 }
1340 impl<T> DiscoveryClient<T>
1341 where
1342 T: tonic::client::GrpcService<tonic::body::Body>,
1343 T::Error: Into<StdError>,
1344 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1345 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1346 {
1347 pub fn new(inner: T) -> Self {
1348 let inner = tonic::client::Grpc::new(inner);
1349 Self { inner }
1350 }
1351 pub fn with_origin(inner: T, origin: Uri) -> Self {
1352 let inner = tonic::client::Grpc::with_origin(inner, origin);
1353 Self { inner }
1354 }
1355 pub fn with_interceptor<F>(
1356 inner: T,
1357 interceptor: F,
1358 ) -> DiscoveryClient<InterceptedService<T, F>>
1359 where
1360 F: tonic::service::Interceptor,
1361 T::ResponseBody: Default,
1362 T: tonic::codegen::Service<
1363 http::Request<tonic::body::Body>,
1364 Response = http::Response<
1365 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1366 >,
1367 >,
1368 <T as tonic::codegen::Service<
1369 http::Request<tonic::body::Body>,
1370 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1371 {
1372 DiscoveryClient::new(InterceptedService::new(inner, interceptor))
1373 }
1374 #[must_use]
1379 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1380 self.inner = self.inner.send_compressed(encoding);
1381 self
1382 }
1383 #[must_use]
1385 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1386 self.inner = self.inner.accept_compressed(encoding);
1387 self
1388 }
1389 #[must_use]
1393 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1394 self.inner = self.inner.max_decoding_message_size(limit);
1395 self
1396 }
1397 #[must_use]
1401 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1402 self.inner = self.inner.max_encoding_message_size(limit);
1403 self
1404 }
1405 pub async fn topic_lookup(
1408 &mut self,
1409 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1410 ) -> std::result::Result<
1411 tonic::Response<super::TopicLookupResponse>,
1412 tonic::Status,
1413 > {
1414 self.inner
1415 .ready()
1416 .await
1417 .map_err(|e| {
1418 tonic::Status::unknown(
1419 format!("Service was not ready: {}", e.into()),
1420 )
1421 })?;
1422 let codec = tonic_prost::ProstCodec::default();
1423 let path = http::uri::PathAndQuery::from_static(
1424 "/danube.Discovery/TopicLookup",
1425 );
1426 let mut req = request.into_request();
1427 req.extensions_mut()
1428 .insert(GrpcMethod::new("danube.Discovery", "TopicLookup"));
1429 self.inner.unary(req, path, codec).await
1430 }
1431 pub async fn topic_partitions(
1434 &mut self,
1435 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1436 ) -> std::result::Result<
1437 tonic::Response<super::TopicPartitionsResponse>,
1438 tonic::Status,
1439 > {
1440 self.inner
1441 .ready()
1442 .await
1443 .map_err(|e| {
1444 tonic::Status::unknown(
1445 format!("Service was not ready: {}", e.into()),
1446 )
1447 })?;
1448 let codec = tonic_prost::ProstCodec::default();
1449 let path = http::uri::PathAndQuery::from_static(
1450 "/danube.Discovery/TopicPartitions",
1451 );
1452 let mut req = request.into_request();
1453 req.extensions_mut()
1454 .insert(GrpcMethod::new("danube.Discovery", "TopicPartitions"));
1455 self.inner.unary(req, path, codec).await
1456 }
1457 }
1458}
1459pub mod discovery_server {
1461 #![allow(
1462 unused_variables,
1463 dead_code,
1464 missing_docs,
1465 clippy::wildcard_imports,
1466 clippy::let_unit_value,
1467 )]
1468 use tonic::codegen::*;
1469 #[async_trait]
1471 pub trait Discovery: std::marker::Send + std::marker::Sync + 'static {
1472 async fn topic_lookup(
1475 &self,
1476 request: tonic::Request<super::TopicLookupRequest>,
1477 ) -> std::result::Result<
1478 tonic::Response<super::TopicLookupResponse>,
1479 tonic::Status,
1480 >;
1481 async fn topic_partitions(
1484 &self,
1485 request: tonic::Request<super::TopicLookupRequest>,
1486 ) -> std::result::Result<
1487 tonic::Response<super::TopicPartitionsResponse>,
1488 tonic::Status,
1489 >;
1490 }
1491 #[derive(Debug)]
1492 pub struct DiscoveryServer<T> {
1493 inner: Arc<T>,
1494 accept_compression_encodings: EnabledCompressionEncodings,
1495 send_compression_encodings: EnabledCompressionEncodings,
1496 max_decoding_message_size: Option<usize>,
1497 max_encoding_message_size: Option<usize>,
1498 }
1499 impl<T> DiscoveryServer<T> {
1500 pub fn new(inner: T) -> Self {
1501 Self::from_arc(Arc::new(inner))
1502 }
1503 pub fn from_arc(inner: Arc<T>) -> Self {
1504 Self {
1505 inner,
1506 accept_compression_encodings: Default::default(),
1507 send_compression_encodings: Default::default(),
1508 max_decoding_message_size: None,
1509 max_encoding_message_size: None,
1510 }
1511 }
1512 pub fn with_interceptor<F>(
1513 inner: T,
1514 interceptor: F,
1515 ) -> InterceptedService<Self, F>
1516 where
1517 F: tonic::service::Interceptor,
1518 {
1519 InterceptedService::new(Self::new(inner), interceptor)
1520 }
1521 #[must_use]
1523 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1524 self.accept_compression_encodings.enable(encoding);
1525 self
1526 }
1527 #[must_use]
1529 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1530 self.send_compression_encodings.enable(encoding);
1531 self
1532 }
1533 #[must_use]
1537 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1538 self.max_decoding_message_size = Some(limit);
1539 self
1540 }
1541 #[must_use]
1545 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1546 self.max_encoding_message_size = Some(limit);
1547 self
1548 }
1549 }
1550 impl<T, B> tonic::codegen::Service<http::Request<B>> for DiscoveryServer<T>
1551 where
1552 T: Discovery,
1553 B: Body + std::marker::Send + 'static,
1554 B::Error: Into<StdError> + std::marker::Send + 'static,
1555 {
1556 type Response = http::Response<tonic::body::Body>;
1557 type Error = std::convert::Infallible;
1558 type Future = BoxFuture<Self::Response, Self::Error>;
1559 fn poll_ready(
1560 &mut self,
1561 _cx: &mut Context<'_>,
1562 ) -> Poll<std::result::Result<(), Self::Error>> {
1563 Poll::Ready(Ok(()))
1564 }
1565 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1566 match req.uri().path() {
1567 "/danube.Discovery/TopicLookup" => {
1568 #[allow(non_camel_case_types)]
1569 struct TopicLookupSvc<T: Discovery>(pub Arc<T>);
1570 impl<
1571 T: Discovery,
1572 > tonic::server::UnaryService<super::TopicLookupRequest>
1573 for TopicLookupSvc<T> {
1574 type Response = super::TopicLookupResponse;
1575 type Future = BoxFuture<
1576 tonic::Response<Self::Response>,
1577 tonic::Status,
1578 >;
1579 fn call(
1580 &mut self,
1581 request: tonic::Request<super::TopicLookupRequest>,
1582 ) -> Self::Future {
1583 let inner = Arc::clone(&self.0);
1584 let fut = async move {
1585 <T as Discovery>::topic_lookup(&inner, request).await
1586 };
1587 Box::pin(fut)
1588 }
1589 }
1590 let accept_compression_encodings = self.accept_compression_encodings;
1591 let send_compression_encodings = self.send_compression_encodings;
1592 let max_decoding_message_size = self.max_decoding_message_size;
1593 let max_encoding_message_size = self.max_encoding_message_size;
1594 let inner = self.inner.clone();
1595 let fut = async move {
1596 let method = TopicLookupSvc(inner);
1597 let codec = tonic_prost::ProstCodec::default();
1598 let mut grpc = tonic::server::Grpc::new(codec)
1599 .apply_compression_config(
1600 accept_compression_encodings,
1601 send_compression_encodings,
1602 )
1603 .apply_max_message_size_config(
1604 max_decoding_message_size,
1605 max_encoding_message_size,
1606 );
1607 let res = grpc.unary(method, req).await;
1608 Ok(res)
1609 };
1610 Box::pin(fut)
1611 }
1612 "/danube.Discovery/TopicPartitions" => {
1613 #[allow(non_camel_case_types)]
1614 struct TopicPartitionsSvc<T: Discovery>(pub Arc<T>);
1615 impl<
1616 T: Discovery,
1617 > tonic::server::UnaryService<super::TopicLookupRequest>
1618 for TopicPartitionsSvc<T> {
1619 type Response = super::TopicPartitionsResponse;
1620 type Future = BoxFuture<
1621 tonic::Response<Self::Response>,
1622 tonic::Status,
1623 >;
1624 fn call(
1625 &mut self,
1626 request: tonic::Request<super::TopicLookupRequest>,
1627 ) -> Self::Future {
1628 let inner = Arc::clone(&self.0);
1629 let fut = async move {
1630 <T as Discovery>::topic_partitions(&inner, request).await
1631 };
1632 Box::pin(fut)
1633 }
1634 }
1635 let accept_compression_encodings = self.accept_compression_encodings;
1636 let send_compression_encodings = self.send_compression_encodings;
1637 let max_decoding_message_size = self.max_decoding_message_size;
1638 let max_encoding_message_size = self.max_encoding_message_size;
1639 let inner = self.inner.clone();
1640 let fut = async move {
1641 let method = TopicPartitionsSvc(inner);
1642 let codec = tonic_prost::ProstCodec::default();
1643 let mut grpc = tonic::server::Grpc::new(codec)
1644 .apply_compression_config(
1645 accept_compression_encodings,
1646 send_compression_encodings,
1647 )
1648 .apply_max_message_size_config(
1649 max_decoding_message_size,
1650 max_encoding_message_size,
1651 );
1652 let res = grpc.unary(method, req).await;
1653 Ok(res)
1654 };
1655 Box::pin(fut)
1656 }
1657 _ => {
1658 Box::pin(async move {
1659 let mut response = http::Response::new(
1660 tonic::body::Body::default(),
1661 );
1662 let headers = response.headers_mut();
1663 headers
1664 .insert(
1665 tonic::Status::GRPC_STATUS,
1666 (tonic::Code::Unimplemented as i32).into(),
1667 );
1668 headers
1669 .insert(
1670 http::header::CONTENT_TYPE,
1671 tonic::metadata::GRPC_CONTENT_TYPE,
1672 );
1673 Ok(response)
1674 })
1675 }
1676 }
1677 }
1678 }
1679 impl<T> Clone for DiscoveryServer<T> {
1680 fn clone(&self) -> Self {
1681 let inner = self.inner.clone();
1682 Self {
1683 inner,
1684 accept_compression_encodings: self.accept_compression_encodings,
1685 send_compression_encodings: self.send_compression_encodings,
1686 max_decoding_message_size: self.max_decoding_message_size,
1687 max_encoding_message_size: self.max_encoding_message_size,
1688 }
1689 }
1690 }
1691 pub const SERVICE_NAME: &str = "danube.Discovery";
1693 impl<T> tonic::server::NamedService for DiscoveryServer<T> {
1694 const NAME: &'static str = SERVICE_NAME;
1695 }
1696}
1697pub mod health_check_client {
1699 #![allow(
1700 unused_variables,
1701 dead_code,
1702 missing_docs,
1703 clippy::wildcard_imports,
1704 clippy::let_unit_value,
1705 )]
1706 use tonic::codegen::*;
1707 use tonic::codegen::http::Uri;
1708 #[derive(Debug, Clone)]
1709 pub struct HealthCheckClient<T> {
1710 inner: tonic::client::Grpc<T>,
1711 }
1712 impl HealthCheckClient<tonic::transport::Channel> {
1713 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1715 where
1716 D: TryInto<tonic::transport::Endpoint>,
1717 D::Error: Into<StdError>,
1718 {
1719 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1720 Ok(Self::new(conn))
1721 }
1722 }
1723 impl<T> HealthCheckClient<T>
1724 where
1725 T: tonic::client::GrpcService<tonic::body::Body>,
1726 T::Error: Into<StdError>,
1727 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1728 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1729 {
1730 pub fn new(inner: T) -> Self {
1731 let inner = tonic::client::Grpc::new(inner);
1732 Self { inner }
1733 }
1734 pub fn with_origin(inner: T, origin: Uri) -> Self {
1735 let inner = tonic::client::Grpc::with_origin(inner, origin);
1736 Self { inner }
1737 }
1738 pub fn with_interceptor<F>(
1739 inner: T,
1740 interceptor: F,
1741 ) -> HealthCheckClient<InterceptedService<T, F>>
1742 where
1743 F: tonic::service::Interceptor,
1744 T::ResponseBody: Default,
1745 T: tonic::codegen::Service<
1746 http::Request<tonic::body::Body>,
1747 Response = http::Response<
1748 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1749 >,
1750 >,
1751 <T as tonic::codegen::Service<
1752 http::Request<tonic::body::Body>,
1753 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1754 {
1755 HealthCheckClient::new(InterceptedService::new(inner, interceptor))
1756 }
1757 #[must_use]
1762 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1763 self.inner = self.inner.send_compressed(encoding);
1764 self
1765 }
1766 #[must_use]
1768 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1769 self.inner = self.inner.accept_compressed(encoding);
1770 self
1771 }
1772 #[must_use]
1776 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1777 self.inner = self.inner.max_decoding_message_size(limit);
1778 self
1779 }
1780 #[must_use]
1784 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1785 self.inner = self.inner.max_encoding_message_size(limit);
1786 self
1787 }
1788 pub async fn health_check(
1789 &mut self,
1790 request: impl tonic::IntoRequest<super::HealthCheckRequest>,
1791 ) -> std::result::Result<
1792 tonic::Response<super::HealthCheckResponse>,
1793 tonic::Status,
1794 > {
1795 self.inner
1796 .ready()
1797 .await
1798 .map_err(|e| {
1799 tonic::Status::unknown(
1800 format!("Service was not ready: {}", e.into()),
1801 )
1802 })?;
1803 let codec = tonic_prost::ProstCodec::default();
1804 let path = http::uri::PathAndQuery::from_static(
1805 "/danube.HealthCheck/HealthCheck",
1806 );
1807 let mut req = request.into_request();
1808 req.extensions_mut()
1809 .insert(GrpcMethod::new("danube.HealthCheck", "HealthCheck"));
1810 self.inner.unary(req, path, codec).await
1811 }
1812 }
1813}
1814pub mod health_check_server {
1816 #![allow(
1817 unused_variables,
1818 dead_code,
1819 missing_docs,
1820 clippy::wildcard_imports,
1821 clippy::let_unit_value,
1822 )]
1823 use tonic::codegen::*;
1824 #[async_trait]
1826 pub trait HealthCheck: std::marker::Send + std::marker::Sync + 'static {
1827 async fn health_check(
1828 &self,
1829 request: tonic::Request<super::HealthCheckRequest>,
1830 ) -> std::result::Result<
1831 tonic::Response<super::HealthCheckResponse>,
1832 tonic::Status,
1833 >;
1834 }
1835 #[derive(Debug)]
1836 pub struct HealthCheckServer<T> {
1837 inner: Arc<T>,
1838 accept_compression_encodings: EnabledCompressionEncodings,
1839 send_compression_encodings: EnabledCompressionEncodings,
1840 max_decoding_message_size: Option<usize>,
1841 max_encoding_message_size: Option<usize>,
1842 }
1843 impl<T> HealthCheckServer<T> {
1844 pub fn new(inner: T) -> Self {
1845 Self::from_arc(Arc::new(inner))
1846 }
1847 pub fn from_arc(inner: Arc<T>) -> Self {
1848 Self {
1849 inner,
1850 accept_compression_encodings: Default::default(),
1851 send_compression_encodings: Default::default(),
1852 max_decoding_message_size: None,
1853 max_encoding_message_size: None,
1854 }
1855 }
1856 pub fn with_interceptor<F>(
1857 inner: T,
1858 interceptor: F,
1859 ) -> InterceptedService<Self, F>
1860 where
1861 F: tonic::service::Interceptor,
1862 {
1863 InterceptedService::new(Self::new(inner), interceptor)
1864 }
1865 #[must_use]
1867 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1868 self.accept_compression_encodings.enable(encoding);
1869 self
1870 }
1871 #[must_use]
1873 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1874 self.send_compression_encodings.enable(encoding);
1875 self
1876 }
1877 #[must_use]
1881 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1882 self.max_decoding_message_size = Some(limit);
1883 self
1884 }
1885 #[must_use]
1889 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1890 self.max_encoding_message_size = Some(limit);
1891 self
1892 }
1893 }
1894 impl<T, B> tonic::codegen::Service<http::Request<B>> for HealthCheckServer<T>
1895 where
1896 T: HealthCheck,
1897 B: Body + std::marker::Send + 'static,
1898 B::Error: Into<StdError> + std::marker::Send + 'static,
1899 {
1900 type Response = http::Response<tonic::body::Body>;
1901 type Error = std::convert::Infallible;
1902 type Future = BoxFuture<Self::Response, Self::Error>;
1903 fn poll_ready(
1904 &mut self,
1905 _cx: &mut Context<'_>,
1906 ) -> Poll<std::result::Result<(), Self::Error>> {
1907 Poll::Ready(Ok(()))
1908 }
1909 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1910 match req.uri().path() {
1911 "/danube.HealthCheck/HealthCheck" => {
1912 #[allow(non_camel_case_types)]
1913 struct HealthCheckSvc<T: HealthCheck>(pub Arc<T>);
1914 impl<
1915 T: HealthCheck,
1916 > tonic::server::UnaryService<super::HealthCheckRequest>
1917 for HealthCheckSvc<T> {
1918 type Response = super::HealthCheckResponse;
1919 type Future = BoxFuture<
1920 tonic::Response<Self::Response>,
1921 tonic::Status,
1922 >;
1923 fn call(
1924 &mut self,
1925 request: tonic::Request<super::HealthCheckRequest>,
1926 ) -> Self::Future {
1927 let inner = Arc::clone(&self.0);
1928 let fut = async move {
1929 <T as HealthCheck>::health_check(&inner, request).await
1930 };
1931 Box::pin(fut)
1932 }
1933 }
1934 let accept_compression_encodings = self.accept_compression_encodings;
1935 let send_compression_encodings = self.send_compression_encodings;
1936 let max_decoding_message_size = self.max_decoding_message_size;
1937 let max_encoding_message_size = self.max_encoding_message_size;
1938 let inner = self.inner.clone();
1939 let fut = async move {
1940 let method = HealthCheckSvc(inner);
1941 let codec = tonic_prost::ProstCodec::default();
1942 let mut grpc = tonic::server::Grpc::new(codec)
1943 .apply_compression_config(
1944 accept_compression_encodings,
1945 send_compression_encodings,
1946 )
1947 .apply_max_message_size_config(
1948 max_decoding_message_size,
1949 max_encoding_message_size,
1950 );
1951 let res = grpc.unary(method, req).await;
1952 Ok(res)
1953 };
1954 Box::pin(fut)
1955 }
1956 _ => {
1957 Box::pin(async move {
1958 let mut response = http::Response::new(
1959 tonic::body::Body::default(),
1960 );
1961 let headers = response.headers_mut();
1962 headers
1963 .insert(
1964 tonic::Status::GRPC_STATUS,
1965 (tonic::Code::Unimplemented as i32).into(),
1966 );
1967 headers
1968 .insert(
1969 http::header::CONTENT_TYPE,
1970 tonic::metadata::GRPC_CONTENT_TYPE,
1971 );
1972 Ok(response)
1973 })
1974 }
1975 }
1976 }
1977 }
1978 impl<T> Clone for HealthCheckServer<T> {
1979 fn clone(&self) -> Self {
1980 let inner = self.inner.clone();
1981 Self {
1982 inner,
1983 accept_compression_encodings: self.accept_compression_encodings,
1984 send_compression_encodings: self.send_compression_encodings,
1985 max_decoding_message_size: self.max_decoding_message_size,
1986 max_encoding_message_size: self.max_encoding_message_size,
1987 }
1988 }
1989 }
1990 pub const SERVICE_NAME: &str = "danube.HealthCheck";
1992 impl<T> tonic::server::NamedService for HealthCheckServer<T> {
1993 const NAME: &'static str = SERVICE_NAME;
1994 }
1995}
1996pub mod auth_service_client {
1998 #![allow(
1999 unused_variables,
2000 dead_code,
2001 missing_docs,
2002 clippy::wildcard_imports,
2003 clippy::let_unit_value,
2004 )]
2005 use tonic::codegen::*;
2006 use tonic::codegen::http::Uri;
2007 #[derive(Debug, Clone)]
2008 pub struct AuthServiceClient<T> {
2009 inner: tonic::client::Grpc<T>,
2010 }
2011 impl AuthServiceClient<tonic::transport::Channel> {
2012 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2014 where
2015 D: TryInto<tonic::transport::Endpoint>,
2016 D::Error: Into<StdError>,
2017 {
2018 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2019 Ok(Self::new(conn))
2020 }
2021 }
2022 impl<T> AuthServiceClient<T>
2023 where
2024 T: tonic::client::GrpcService<tonic::body::Body>,
2025 T::Error: Into<StdError>,
2026 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2027 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2028 {
2029 pub fn new(inner: T) -> Self {
2030 let inner = tonic::client::Grpc::new(inner);
2031 Self { inner }
2032 }
2033 pub fn with_origin(inner: T, origin: Uri) -> Self {
2034 let inner = tonic::client::Grpc::with_origin(inner, origin);
2035 Self { inner }
2036 }
2037 pub fn with_interceptor<F>(
2038 inner: T,
2039 interceptor: F,
2040 ) -> AuthServiceClient<InterceptedService<T, F>>
2041 where
2042 F: tonic::service::Interceptor,
2043 T::ResponseBody: Default,
2044 T: tonic::codegen::Service<
2045 http::Request<tonic::body::Body>,
2046 Response = http::Response<
2047 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2048 >,
2049 >,
2050 <T as tonic::codegen::Service<
2051 http::Request<tonic::body::Body>,
2052 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2053 {
2054 AuthServiceClient::new(InterceptedService::new(inner, interceptor))
2055 }
2056 #[must_use]
2061 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2062 self.inner = self.inner.send_compressed(encoding);
2063 self
2064 }
2065 #[must_use]
2067 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2068 self.inner = self.inner.accept_compressed(encoding);
2069 self
2070 }
2071 #[must_use]
2075 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2076 self.inner = self.inner.max_decoding_message_size(limit);
2077 self
2078 }
2079 #[must_use]
2083 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2084 self.inner = self.inner.max_encoding_message_size(limit);
2085 self
2086 }
2087 pub async fn authenticate(
2088 &mut self,
2089 request: impl tonic::IntoRequest<super::AuthRequest>,
2090 ) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status> {
2091 self.inner
2092 .ready()
2093 .await
2094 .map_err(|e| {
2095 tonic::Status::unknown(
2096 format!("Service was not ready: {}", e.into()),
2097 )
2098 })?;
2099 let codec = tonic_prost::ProstCodec::default();
2100 let path = http::uri::PathAndQuery::from_static(
2101 "/danube.AuthService/Authenticate",
2102 );
2103 let mut req = request.into_request();
2104 req.extensions_mut()
2105 .insert(GrpcMethod::new("danube.AuthService", "Authenticate"));
2106 self.inner.unary(req, path, codec).await
2107 }
2108 }
2109}
2110pub mod auth_service_server {
2112 #![allow(
2113 unused_variables,
2114 dead_code,
2115 missing_docs,
2116 clippy::wildcard_imports,
2117 clippy::let_unit_value,
2118 )]
2119 use tonic::codegen::*;
2120 #[async_trait]
2122 pub trait AuthService: std::marker::Send + std::marker::Sync + 'static {
2123 async fn authenticate(
2124 &self,
2125 request: tonic::Request<super::AuthRequest>,
2126 ) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status>;
2127 }
2128 #[derive(Debug)]
2129 pub struct AuthServiceServer<T> {
2130 inner: Arc<T>,
2131 accept_compression_encodings: EnabledCompressionEncodings,
2132 send_compression_encodings: EnabledCompressionEncodings,
2133 max_decoding_message_size: Option<usize>,
2134 max_encoding_message_size: Option<usize>,
2135 }
2136 impl<T> AuthServiceServer<T> {
2137 pub fn new(inner: T) -> Self {
2138 Self::from_arc(Arc::new(inner))
2139 }
2140 pub fn from_arc(inner: Arc<T>) -> Self {
2141 Self {
2142 inner,
2143 accept_compression_encodings: Default::default(),
2144 send_compression_encodings: Default::default(),
2145 max_decoding_message_size: None,
2146 max_encoding_message_size: None,
2147 }
2148 }
2149 pub fn with_interceptor<F>(
2150 inner: T,
2151 interceptor: F,
2152 ) -> InterceptedService<Self, F>
2153 where
2154 F: tonic::service::Interceptor,
2155 {
2156 InterceptedService::new(Self::new(inner), interceptor)
2157 }
2158 #[must_use]
2160 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2161 self.accept_compression_encodings.enable(encoding);
2162 self
2163 }
2164 #[must_use]
2166 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2167 self.send_compression_encodings.enable(encoding);
2168 self
2169 }
2170 #[must_use]
2174 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2175 self.max_decoding_message_size = Some(limit);
2176 self
2177 }
2178 #[must_use]
2182 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2183 self.max_encoding_message_size = Some(limit);
2184 self
2185 }
2186 }
2187 impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthServiceServer<T>
2188 where
2189 T: AuthService,
2190 B: Body + std::marker::Send + 'static,
2191 B::Error: Into<StdError> + std::marker::Send + 'static,
2192 {
2193 type Response = http::Response<tonic::body::Body>;
2194 type Error = std::convert::Infallible;
2195 type Future = BoxFuture<Self::Response, Self::Error>;
2196 fn poll_ready(
2197 &mut self,
2198 _cx: &mut Context<'_>,
2199 ) -> Poll<std::result::Result<(), Self::Error>> {
2200 Poll::Ready(Ok(()))
2201 }
2202 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2203 match req.uri().path() {
2204 "/danube.AuthService/Authenticate" => {
2205 #[allow(non_camel_case_types)]
2206 struct AuthenticateSvc<T: AuthService>(pub Arc<T>);
2207 impl<T: AuthService> tonic::server::UnaryService<super::AuthRequest>
2208 for AuthenticateSvc<T> {
2209 type Response = super::AuthResponse;
2210 type Future = BoxFuture<
2211 tonic::Response<Self::Response>,
2212 tonic::Status,
2213 >;
2214 fn call(
2215 &mut self,
2216 request: tonic::Request<super::AuthRequest>,
2217 ) -> Self::Future {
2218 let inner = Arc::clone(&self.0);
2219 let fut = async move {
2220 <T as AuthService>::authenticate(&inner, request).await
2221 };
2222 Box::pin(fut)
2223 }
2224 }
2225 let accept_compression_encodings = self.accept_compression_encodings;
2226 let send_compression_encodings = self.send_compression_encodings;
2227 let max_decoding_message_size = self.max_decoding_message_size;
2228 let max_encoding_message_size = self.max_encoding_message_size;
2229 let inner = self.inner.clone();
2230 let fut = async move {
2231 let method = AuthenticateSvc(inner);
2232 let codec = tonic_prost::ProstCodec::default();
2233 let mut grpc = tonic::server::Grpc::new(codec)
2234 .apply_compression_config(
2235 accept_compression_encodings,
2236 send_compression_encodings,
2237 )
2238 .apply_max_message_size_config(
2239 max_decoding_message_size,
2240 max_encoding_message_size,
2241 );
2242 let res = grpc.unary(method, req).await;
2243 Ok(res)
2244 };
2245 Box::pin(fut)
2246 }
2247 _ => {
2248 Box::pin(async move {
2249 let mut response = http::Response::new(
2250 tonic::body::Body::default(),
2251 );
2252 let headers = response.headers_mut();
2253 headers
2254 .insert(
2255 tonic::Status::GRPC_STATUS,
2256 (tonic::Code::Unimplemented as i32).into(),
2257 );
2258 headers
2259 .insert(
2260 http::header::CONTENT_TYPE,
2261 tonic::metadata::GRPC_CONTENT_TYPE,
2262 );
2263 Ok(response)
2264 })
2265 }
2266 }
2267 }
2268 }
2269 impl<T> Clone for AuthServiceServer<T> {
2270 fn clone(&self) -> Self {
2271 let inner = self.inner.clone();
2272 Self {
2273 inner,
2274 accept_compression_encodings: self.accept_compression_encodings,
2275 send_compression_encodings: self.send_compression_encodings,
2276 max_decoding_message_size: self.max_decoding_message_size,
2277 max_encoding_message_size: self.max_encoding_message_size,
2278 }
2279 }
2280 }
2281 pub const SERVICE_NAME: &str = "danube.AuthService";
2283 impl<T> tonic::server::NamedService for AuthServiceServer<T> {
2284 const NAME: &'static str = SERVICE_NAME;
2285 }
2286}