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