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, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
370#[repr(i32)]
371pub enum ProducerAccessMode {
372 Shared = 0,
374 Exclusive = 1,
376}
377impl ProducerAccessMode {
378 pub fn as_str_name(&self) -> &'static str {
383 match self {
384 Self::Shared => "Shared",
385 Self::Exclusive => "Exclusive",
386 }
387 }
388 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
390 match value {
391 "Shared" => Some(Self::Shared),
392 "Exclusive" => Some(Self::Exclusive),
393 _ => None,
394 }
395 }
396}
397#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
398#[repr(i32)]
399pub enum DispatchStrategy {
400 NonReliable = 0,
401 Reliable = 1,
402}
403impl DispatchStrategy {
404 pub fn as_str_name(&self) -> &'static str {
409 match self {
410 Self::NonReliable => "NonReliable",
411 Self::Reliable => "Reliable",
412 }
413 }
414 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
416 match value {
417 "NonReliable" => Some(Self::NonReliable),
418 "Reliable" => Some(Self::Reliable),
419 _ => None,
420 }
421 }
422}
423pub mod producer_service_client {
425 #![allow(
426 unused_variables,
427 dead_code,
428 missing_docs,
429 clippy::wildcard_imports,
430 clippy::let_unit_value,
431 )]
432 use tonic::codegen::*;
433 use tonic::codegen::http::Uri;
434 #[derive(Debug, Clone)]
435 pub struct ProducerServiceClient<T> {
436 inner: tonic::client::Grpc<T>,
437 }
438 impl ProducerServiceClient<tonic::transport::Channel> {
439 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
441 where
442 D: TryInto<tonic::transport::Endpoint>,
443 D::Error: Into<StdError>,
444 {
445 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
446 Ok(Self::new(conn))
447 }
448 }
449 impl<T> ProducerServiceClient<T>
450 where
451 T: tonic::client::GrpcService<tonic::body::Body>,
452 T::Error: Into<StdError>,
453 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
454 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
455 {
456 pub fn new(inner: T) -> Self {
457 let inner = tonic::client::Grpc::new(inner);
458 Self { inner }
459 }
460 pub fn with_origin(inner: T, origin: Uri) -> Self {
461 let inner = tonic::client::Grpc::with_origin(inner, origin);
462 Self { inner }
463 }
464 pub fn with_interceptor<F>(
465 inner: T,
466 interceptor: F,
467 ) -> ProducerServiceClient<InterceptedService<T, F>>
468 where
469 F: tonic::service::Interceptor,
470 T::ResponseBody: Default,
471 T: tonic::codegen::Service<
472 http::Request<tonic::body::Body>,
473 Response = http::Response<
474 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
475 >,
476 >,
477 <T as tonic::codegen::Service<
478 http::Request<tonic::body::Body>,
479 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
480 {
481 ProducerServiceClient::new(InterceptedService::new(inner, interceptor))
482 }
483 #[must_use]
488 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
489 self.inner = self.inner.send_compressed(encoding);
490 self
491 }
492 #[must_use]
494 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
495 self.inner = self.inner.accept_compressed(encoding);
496 self
497 }
498 #[must_use]
502 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
503 self.inner = self.inner.max_decoding_message_size(limit);
504 self
505 }
506 #[must_use]
510 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
511 self.inner = self.inner.max_encoding_message_size(limit);
512 self
513 }
514 pub async fn create_producer(
516 &mut self,
517 request: impl tonic::IntoRequest<super::ProducerRequest>,
518 ) -> std::result::Result<
519 tonic::Response<super::ProducerResponse>,
520 tonic::Status,
521 > {
522 self.inner
523 .ready()
524 .await
525 .map_err(|e| {
526 tonic::Status::unknown(
527 format!("Service was not ready: {}", e.into()),
528 )
529 })?;
530 let codec = tonic_prost::ProstCodec::default();
531 let path = http::uri::PathAndQuery::from_static(
532 "/danube.ProducerService/CreateProducer",
533 );
534 let mut req = request.into_request();
535 req.extensions_mut()
536 .insert(GrpcMethod::new("danube.ProducerService", "CreateProducer"));
537 self.inner.unary(req, path, codec).await
538 }
539 pub async fn send_message(
541 &mut self,
542 request: impl tonic::IntoRequest<super::StreamMessage>,
543 ) -> std::result::Result<
544 tonic::Response<super::MessageResponse>,
545 tonic::Status,
546 > {
547 self.inner
548 .ready()
549 .await
550 .map_err(|e| {
551 tonic::Status::unknown(
552 format!("Service was not ready: {}", e.into()),
553 )
554 })?;
555 let codec = tonic_prost::ProstCodec::default();
556 let path = http::uri::PathAndQuery::from_static(
557 "/danube.ProducerService/SendMessage",
558 );
559 let mut req = request.into_request();
560 req.extensions_mut()
561 .insert(GrpcMethod::new("danube.ProducerService", "SendMessage"));
562 self.inner.unary(req, path, codec).await
563 }
564 }
565}
566pub mod producer_service_server {
568 #![allow(
569 unused_variables,
570 dead_code,
571 missing_docs,
572 clippy::wildcard_imports,
573 clippy::let_unit_value,
574 )]
575 use tonic::codegen::*;
576 #[async_trait]
578 pub trait ProducerService: std::marker::Send + std::marker::Sync + 'static {
579 async fn create_producer(
581 &self,
582 request: tonic::Request<super::ProducerRequest>,
583 ) -> std::result::Result<
584 tonic::Response<super::ProducerResponse>,
585 tonic::Status,
586 >;
587 async fn send_message(
589 &self,
590 request: tonic::Request<super::StreamMessage>,
591 ) -> std::result::Result<tonic::Response<super::MessageResponse>, tonic::Status>;
592 }
593 #[derive(Debug)]
594 pub struct ProducerServiceServer<T> {
595 inner: Arc<T>,
596 accept_compression_encodings: EnabledCompressionEncodings,
597 send_compression_encodings: EnabledCompressionEncodings,
598 max_decoding_message_size: Option<usize>,
599 max_encoding_message_size: Option<usize>,
600 }
601 impl<T> ProducerServiceServer<T> {
602 pub fn new(inner: T) -> Self {
603 Self::from_arc(Arc::new(inner))
604 }
605 pub fn from_arc(inner: Arc<T>) -> Self {
606 Self {
607 inner,
608 accept_compression_encodings: Default::default(),
609 send_compression_encodings: Default::default(),
610 max_decoding_message_size: None,
611 max_encoding_message_size: None,
612 }
613 }
614 pub fn with_interceptor<F>(
615 inner: T,
616 interceptor: F,
617 ) -> InterceptedService<Self, F>
618 where
619 F: tonic::service::Interceptor,
620 {
621 InterceptedService::new(Self::new(inner), interceptor)
622 }
623 #[must_use]
625 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
626 self.accept_compression_encodings.enable(encoding);
627 self
628 }
629 #[must_use]
631 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
632 self.send_compression_encodings.enable(encoding);
633 self
634 }
635 #[must_use]
639 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
640 self.max_decoding_message_size = Some(limit);
641 self
642 }
643 #[must_use]
647 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
648 self.max_encoding_message_size = Some(limit);
649 self
650 }
651 }
652 impl<T, B> tonic::codegen::Service<http::Request<B>> for ProducerServiceServer<T>
653 where
654 T: ProducerService,
655 B: Body + std::marker::Send + 'static,
656 B::Error: Into<StdError> + std::marker::Send + 'static,
657 {
658 type Response = http::Response<tonic::body::Body>;
659 type Error = std::convert::Infallible;
660 type Future = BoxFuture<Self::Response, Self::Error>;
661 fn poll_ready(
662 &mut self,
663 _cx: &mut Context<'_>,
664 ) -> Poll<std::result::Result<(), Self::Error>> {
665 Poll::Ready(Ok(()))
666 }
667 fn call(&mut self, req: http::Request<B>) -> Self::Future {
668 match req.uri().path() {
669 "/danube.ProducerService/CreateProducer" => {
670 #[allow(non_camel_case_types)]
671 struct CreateProducerSvc<T: ProducerService>(pub Arc<T>);
672 impl<
673 T: ProducerService,
674 > tonic::server::UnaryService<super::ProducerRequest>
675 for CreateProducerSvc<T> {
676 type Response = super::ProducerResponse;
677 type Future = BoxFuture<
678 tonic::Response<Self::Response>,
679 tonic::Status,
680 >;
681 fn call(
682 &mut self,
683 request: tonic::Request<super::ProducerRequest>,
684 ) -> Self::Future {
685 let inner = Arc::clone(&self.0);
686 let fut = async move {
687 <T as ProducerService>::create_producer(&inner, request)
688 .await
689 };
690 Box::pin(fut)
691 }
692 }
693 let accept_compression_encodings = self.accept_compression_encodings;
694 let send_compression_encodings = self.send_compression_encodings;
695 let max_decoding_message_size = self.max_decoding_message_size;
696 let max_encoding_message_size = self.max_encoding_message_size;
697 let inner = self.inner.clone();
698 let fut = async move {
699 let method = CreateProducerSvc(inner);
700 let codec = tonic_prost::ProstCodec::default();
701 let mut grpc = tonic::server::Grpc::new(codec)
702 .apply_compression_config(
703 accept_compression_encodings,
704 send_compression_encodings,
705 )
706 .apply_max_message_size_config(
707 max_decoding_message_size,
708 max_encoding_message_size,
709 );
710 let res = grpc.unary(method, req).await;
711 Ok(res)
712 };
713 Box::pin(fut)
714 }
715 "/danube.ProducerService/SendMessage" => {
716 #[allow(non_camel_case_types)]
717 struct SendMessageSvc<T: ProducerService>(pub Arc<T>);
718 impl<
719 T: ProducerService,
720 > tonic::server::UnaryService<super::StreamMessage>
721 for SendMessageSvc<T> {
722 type Response = super::MessageResponse;
723 type Future = BoxFuture<
724 tonic::Response<Self::Response>,
725 tonic::Status,
726 >;
727 fn call(
728 &mut self,
729 request: tonic::Request<super::StreamMessage>,
730 ) -> Self::Future {
731 let inner = Arc::clone(&self.0);
732 let fut = async move {
733 <T as ProducerService>::send_message(&inner, request).await
734 };
735 Box::pin(fut)
736 }
737 }
738 let accept_compression_encodings = self.accept_compression_encodings;
739 let send_compression_encodings = self.send_compression_encodings;
740 let max_decoding_message_size = self.max_decoding_message_size;
741 let max_encoding_message_size = self.max_encoding_message_size;
742 let inner = self.inner.clone();
743 let fut = async move {
744 let method = SendMessageSvc(inner);
745 let codec = tonic_prost::ProstCodec::default();
746 let mut grpc = tonic::server::Grpc::new(codec)
747 .apply_compression_config(
748 accept_compression_encodings,
749 send_compression_encodings,
750 )
751 .apply_max_message_size_config(
752 max_decoding_message_size,
753 max_encoding_message_size,
754 );
755 let res = grpc.unary(method, req).await;
756 Ok(res)
757 };
758 Box::pin(fut)
759 }
760 _ => {
761 Box::pin(async move {
762 let mut response = http::Response::new(
763 tonic::body::Body::default(),
764 );
765 let headers = response.headers_mut();
766 headers
767 .insert(
768 tonic::Status::GRPC_STATUS,
769 (tonic::Code::Unimplemented as i32).into(),
770 );
771 headers
772 .insert(
773 http::header::CONTENT_TYPE,
774 tonic::metadata::GRPC_CONTENT_TYPE,
775 );
776 Ok(response)
777 })
778 }
779 }
780 }
781 }
782 impl<T> Clone for ProducerServiceServer<T> {
783 fn clone(&self) -> Self {
784 let inner = self.inner.clone();
785 Self {
786 inner,
787 accept_compression_encodings: self.accept_compression_encodings,
788 send_compression_encodings: self.send_compression_encodings,
789 max_decoding_message_size: self.max_decoding_message_size,
790 max_encoding_message_size: self.max_encoding_message_size,
791 }
792 }
793 }
794 pub const SERVICE_NAME: &str = "danube.ProducerService";
796 impl<T> tonic::server::NamedService for ProducerServiceServer<T> {
797 const NAME: &'static str = SERVICE_NAME;
798 }
799}
800pub mod consumer_service_client {
802 #![allow(
803 unused_variables,
804 dead_code,
805 missing_docs,
806 clippy::wildcard_imports,
807 clippy::let_unit_value,
808 )]
809 use tonic::codegen::*;
810 use tonic::codegen::http::Uri;
811 #[derive(Debug, Clone)]
812 pub struct ConsumerServiceClient<T> {
813 inner: tonic::client::Grpc<T>,
814 }
815 impl ConsumerServiceClient<tonic::transport::Channel> {
816 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
818 where
819 D: TryInto<tonic::transport::Endpoint>,
820 D::Error: Into<StdError>,
821 {
822 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
823 Ok(Self::new(conn))
824 }
825 }
826 impl<T> ConsumerServiceClient<T>
827 where
828 T: tonic::client::GrpcService<tonic::body::Body>,
829 T::Error: Into<StdError>,
830 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
831 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
832 {
833 pub fn new(inner: T) -> Self {
834 let inner = tonic::client::Grpc::new(inner);
835 Self { inner }
836 }
837 pub fn with_origin(inner: T, origin: Uri) -> Self {
838 let inner = tonic::client::Grpc::with_origin(inner, origin);
839 Self { inner }
840 }
841 pub fn with_interceptor<F>(
842 inner: T,
843 interceptor: F,
844 ) -> ConsumerServiceClient<InterceptedService<T, F>>
845 where
846 F: tonic::service::Interceptor,
847 T::ResponseBody: Default,
848 T: tonic::codegen::Service<
849 http::Request<tonic::body::Body>,
850 Response = http::Response<
851 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
852 >,
853 >,
854 <T as tonic::codegen::Service<
855 http::Request<tonic::body::Body>,
856 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
857 {
858 ConsumerServiceClient::new(InterceptedService::new(inner, interceptor))
859 }
860 #[must_use]
865 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
866 self.inner = self.inner.send_compressed(encoding);
867 self
868 }
869 #[must_use]
871 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
872 self.inner = self.inner.accept_compressed(encoding);
873 self
874 }
875 #[must_use]
879 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
880 self.inner = self.inner.max_decoding_message_size(limit);
881 self
882 }
883 #[must_use]
887 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
888 self.inner = self.inner.max_encoding_message_size(limit);
889 self
890 }
891 pub async fn subscribe(
893 &mut self,
894 request: impl tonic::IntoRequest<super::ConsumerRequest>,
895 ) -> std::result::Result<
896 tonic::Response<super::ConsumerResponse>,
897 tonic::Status,
898 > {
899 self.inner
900 .ready()
901 .await
902 .map_err(|e| {
903 tonic::Status::unknown(
904 format!("Service was not ready: {}", e.into()),
905 )
906 })?;
907 let codec = tonic_prost::ProstCodec::default();
908 let path = http::uri::PathAndQuery::from_static(
909 "/danube.ConsumerService/Subscribe",
910 );
911 let mut req = request.into_request();
912 req.extensions_mut()
913 .insert(GrpcMethod::new("danube.ConsumerService", "Subscribe"));
914 self.inner.unary(req, path, codec).await
915 }
916 pub async fn receive_messages(
918 &mut self,
919 request: impl tonic::IntoRequest<super::ReceiveRequest>,
920 ) -> std::result::Result<
921 tonic::Response<tonic::codec::Streaming<super::StreamMessage>>,
922 tonic::Status,
923 > {
924 self.inner
925 .ready()
926 .await
927 .map_err(|e| {
928 tonic::Status::unknown(
929 format!("Service was not ready: {}", e.into()),
930 )
931 })?;
932 let codec = tonic_prost::ProstCodec::default();
933 let path = http::uri::PathAndQuery::from_static(
934 "/danube.ConsumerService/ReceiveMessages",
935 );
936 let mut req = request.into_request();
937 req.extensions_mut()
938 .insert(GrpcMethod::new("danube.ConsumerService", "ReceiveMessages"));
939 self.inner.server_streaming(req, path, codec).await
940 }
941 pub async fn ack(
943 &mut self,
944 request: impl tonic::IntoRequest<super::AckRequest>,
945 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status> {
946 self.inner
947 .ready()
948 .await
949 .map_err(|e| {
950 tonic::Status::unknown(
951 format!("Service was not ready: {}", e.into()),
952 )
953 })?;
954 let codec = tonic_prost::ProstCodec::default();
955 let path = http::uri::PathAndQuery::from_static(
956 "/danube.ConsumerService/Ack",
957 );
958 let mut req = request.into_request();
959 req.extensions_mut()
960 .insert(GrpcMethod::new("danube.ConsumerService", "Ack"));
961 self.inner.unary(req, path, codec).await
962 }
963 }
964}
965pub mod consumer_service_server {
967 #![allow(
968 unused_variables,
969 dead_code,
970 missing_docs,
971 clippy::wildcard_imports,
972 clippy::let_unit_value,
973 )]
974 use tonic::codegen::*;
975 #[async_trait]
977 pub trait ConsumerService: std::marker::Send + std::marker::Sync + 'static {
978 async fn subscribe(
980 &self,
981 request: tonic::Request<super::ConsumerRequest>,
982 ) -> std::result::Result<
983 tonic::Response<super::ConsumerResponse>,
984 tonic::Status,
985 >;
986 type ReceiveMessagesStream: tonic::codegen::tokio_stream::Stream<
988 Item = std::result::Result<super::StreamMessage, tonic::Status>,
989 >
990 + std::marker::Send
991 + 'static;
992 async fn receive_messages(
994 &self,
995 request: tonic::Request<super::ReceiveRequest>,
996 ) -> std::result::Result<
997 tonic::Response<Self::ReceiveMessagesStream>,
998 tonic::Status,
999 >;
1000 async fn ack(
1002 &self,
1003 request: tonic::Request<super::AckRequest>,
1004 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status>;
1005 }
1006 #[derive(Debug)]
1007 pub struct ConsumerServiceServer<T> {
1008 inner: Arc<T>,
1009 accept_compression_encodings: EnabledCompressionEncodings,
1010 send_compression_encodings: EnabledCompressionEncodings,
1011 max_decoding_message_size: Option<usize>,
1012 max_encoding_message_size: Option<usize>,
1013 }
1014 impl<T> ConsumerServiceServer<T> {
1015 pub fn new(inner: T) -> Self {
1016 Self::from_arc(Arc::new(inner))
1017 }
1018 pub fn from_arc(inner: Arc<T>) -> Self {
1019 Self {
1020 inner,
1021 accept_compression_encodings: Default::default(),
1022 send_compression_encodings: Default::default(),
1023 max_decoding_message_size: None,
1024 max_encoding_message_size: None,
1025 }
1026 }
1027 pub fn with_interceptor<F>(
1028 inner: T,
1029 interceptor: F,
1030 ) -> InterceptedService<Self, F>
1031 where
1032 F: tonic::service::Interceptor,
1033 {
1034 InterceptedService::new(Self::new(inner), interceptor)
1035 }
1036 #[must_use]
1038 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1039 self.accept_compression_encodings.enable(encoding);
1040 self
1041 }
1042 #[must_use]
1044 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1045 self.send_compression_encodings.enable(encoding);
1046 self
1047 }
1048 #[must_use]
1052 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1053 self.max_decoding_message_size = Some(limit);
1054 self
1055 }
1056 #[must_use]
1060 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1061 self.max_encoding_message_size = Some(limit);
1062 self
1063 }
1064 }
1065 impl<T, B> tonic::codegen::Service<http::Request<B>> for ConsumerServiceServer<T>
1066 where
1067 T: ConsumerService,
1068 B: Body + std::marker::Send + 'static,
1069 B::Error: Into<StdError> + std::marker::Send + 'static,
1070 {
1071 type Response = http::Response<tonic::body::Body>;
1072 type Error = std::convert::Infallible;
1073 type Future = BoxFuture<Self::Response, Self::Error>;
1074 fn poll_ready(
1075 &mut self,
1076 _cx: &mut Context<'_>,
1077 ) -> Poll<std::result::Result<(), Self::Error>> {
1078 Poll::Ready(Ok(()))
1079 }
1080 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1081 match req.uri().path() {
1082 "/danube.ConsumerService/Subscribe" => {
1083 #[allow(non_camel_case_types)]
1084 struct SubscribeSvc<T: ConsumerService>(pub Arc<T>);
1085 impl<
1086 T: ConsumerService,
1087 > tonic::server::UnaryService<super::ConsumerRequest>
1088 for SubscribeSvc<T> {
1089 type Response = super::ConsumerResponse;
1090 type Future = BoxFuture<
1091 tonic::Response<Self::Response>,
1092 tonic::Status,
1093 >;
1094 fn call(
1095 &mut self,
1096 request: tonic::Request<super::ConsumerRequest>,
1097 ) -> Self::Future {
1098 let inner = Arc::clone(&self.0);
1099 let fut = async move {
1100 <T as ConsumerService>::subscribe(&inner, request).await
1101 };
1102 Box::pin(fut)
1103 }
1104 }
1105 let accept_compression_encodings = self.accept_compression_encodings;
1106 let send_compression_encodings = self.send_compression_encodings;
1107 let max_decoding_message_size = self.max_decoding_message_size;
1108 let max_encoding_message_size = self.max_encoding_message_size;
1109 let inner = self.inner.clone();
1110 let fut = async move {
1111 let method = SubscribeSvc(inner);
1112 let codec = tonic_prost::ProstCodec::default();
1113 let mut grpc = tonic::server::Grpc::new(codec)
1114 .apply_compression_config(
1115 accept_compression_encodings,
1116 send_compression_encodings,
1117 )
1118 .apply_max_message_size_config(
1119 max_decoding_message_size,
1120 max_encoding_message_size,
1121 );
1122 let res = grpc.unary(method, req).await;
1123 Ok(res)
1124 };
1125 Box::pin(fut)
1126 }
1127 "/danube.ConsumerService/ReceiveMessages" => {
1128 #[allow(non_camel_case_types)]
1129 struct ReceiveMessagesSvc<T: ConsumerService>(pub Arc<T>);
1130 impl<
1131 T: ConsumerService,
1132 > tonic::server::ServerStreamingService<super::ReceiveRequest>
1133 for ReceiveMessagesSvc<T> {
1134 type Response = super::StreamMessage;
1135 type ResponseStream = T::ReceiveMessagesStream;
1136 type Future = BoxFuture<
1137 tonic::Response<Self::ResponseStream>,
1138 tonic::Status,
1139 >;
1140 fn call(
1141 &mut self,
1142 request: tonic::Request<super::ReceiveRequest>,
1143 ) -> Self::Future {
1144 let inner = Arc::clone(&self.0);
1145 let fut = async move {
1146 <T as ConsumerService>::receive_messages(&inner, request)
1147 .await
1148 };
1149 Box::pin(fut)
1150 }
1151 }
1152 let accept_compression_encodings = self.accept_compression_encodings;
1153 let send_compression_encodings = self.send_compression_encodings;
1154 let max_decoding_message_size = self.max_decoding_message_size;
1155 let max_encoding_message_size = self.max_encoding_message_size;
1156 let inner = self.inner.clone();
1157 let fut = async move {
1158 let method = ReceiveMessagesSvc(inner);
1159 let codec = tonic_prost::ProstCodec::default();
1160 let mut grpc = tonic::server::Grpc::new(codec)
1161 .apply_compression_config(
1162 accept_compression_encodings,
1163 send_compression_encodings,
1164 )
1165 .apply_max_message_size_config(
1166 max_decoding_message_size,
1167 max_encoding_message_size,
1168 );
1169 let res = grpc.server_streaming(method, req).await;
1170 Ok(res)
1171 };
1172 Box::pin(fut)
1173 }
1174 "/danube.ConsumerService/Ack" => {
1175 #[allow(non_camel_case_types)]
1176 struct AckSvc<T: ConsumerService>(pub Arc<T>);
1177 impl<
1178 T: ConsumerService,
1179 > tonic::server::UnaryService<super::AckRequest> for AckSvc<T> {
1180 type Response = super::AckResponse;
1181 type Future = BoxFuture<
1182 tonic::Response<Self::Response>,
1183 tonic::Status,
1184 >;
1185 fn call(
1186 &mut self,
1187 request: tonic::Request<super::AckRequest>,
1188 ) -> Self::Future {
1189 let inner = Arc::clone(&self.0);
1190 let fut = async move {
1191 <T as ConsumerService>::ack(&inner, request).await
1192 };
1193 Box::pin(fut)
1194 }
1195 }
1196 let accept_compression_encodings = self.accept_compression_encodings;
1197 let send_compression_encodings = self.send_compression_encodings;
1198 let max_decoding_message_size = self.max_decoding_message_size;
1199 let max_encoding_message_size = self.max_encoding_message_size;
1200 let inner = self.inner.clone();
1201 let fut = async move {
1202 let method = AckSvc(inner);
1203 let codec = tonic_prost::ProstCodec::default();
1204 let mut grpc = tonic::server::Grpc::new(codec)
1205 .apply_compression_config(
1206 accept_compression_encodings,
1207 send_compression_encodings,
1208 )
1209 .apply_max_message_size_config(
1210 max_decoding_message_size,
1211 max_encoding_message_size,
1212 );
1213 let res = grpc.unary(method, req).await;
1214 Ok(res)
1215 };
1216 Box::pin(fut)
1217 }
1218 _ => {
1219 Box::pin(async move {
1220 let mut response = http::Response::new(
1221 tonic::body::Body::default(),
1222 );
1223 let headers = response.headers_mut();
1224 headers
1225 .insert(
1226 tonic::Status::GRPC_STATUS,
1227 (tonic::Code::Unimplemented as i32).into(),
1228 );
1229 headers
1230 .insert(
1231 http::header::CONTENT_TYPE,
1232 tonic::metadata::GRPC_CONTENT_TYPE,
1233 );
1234 Ok(response)
1235 })
1236 }
1237 }
1238 }
1239 }
1240 impl<T> Clone for ConsumerServiceServer<T> {
1241 fn clone(&self) -> Self {
1242 let inner = self.inner.clone();
1243 Self {
1244 inner,
1245 accept_compression_encodings: self.accept_compression_encodings,
1246 send_compression_encodings: self.send_compression_encodings,
1247 max_decoding_message_size: self.max_decoding_message_size,
1248 max_encoding_message_size: self.max_encoding_message_size,
1249 }
1250 }
1251 }
1252 pub const SERVICE_NAME: &str = "danube.ConsumerService";
1254 impl<T> tonic::server::NamedService for ConsumerServiceServer<T> {
1255 const NAME: &'static str = SERVICE_NAME;
1256 }
1257}
1258pub mod discovery_client {
1260 #![allow(
1261 unused_variables,
1262 dead_code,
1263 missing_docs,
1264 clippy::wildcard_imports,
1265 clippy::let_unit_value,
1266 )]
1267 use tonic::codegen::*;
1268 use tonic::codegen::http::Uri;
1269 #[derive(Debug, Clone)]
1270 pub struct DiscoveryClient<T> {
1271 inner: tonic::client::Grpc<T>,
1272 }
1273 impl DiscoveryClient<tonic::transport::Channel> {
1274 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1276 where
1277 D: TryInto<tonic::transport::Endpoint>,
1278 D::Error: Into<StdError>,
1279 {
1280 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1281 Ok(Self::new(conn))
1282 }
1283 }
1284 impl<T> DiscoveryClient<T>
1285 where
1286 T: tonic::client::GrpcService<tonic::body::Body>,
1287 T::Error: Into<StdError>,
1288 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1289 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1290 {
1291 pub fn new(inner: T) -> Self {
1292 let inner = tonic::client::Grpc::new(inner);
1293 Self { inner }
1294 }
1295 pub fn with_origin(inner: T, origin: Uri) -> Self {
1296 let inner = tonic::client::Grpc::with_origin(inner, origin);
1297 Self { inner }
1298 }
1299 pub fn with_interceptor<F>(
1300 inner: T,
1301 interceptor: F,
1302 ) -> DiscoveryClient<InterceptedService<T, F>>
1303 where
1304 F: tonic::service::Interceptor,
1305 T::ResponseBody: Default,
1306 T: tonic::codegen::Service<
1307 http::Request<tonic::body::Body>,
1308 Response = http::Response<
1309 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1310 >,
1311 >,
1312 <T as tonic::codegen::Service<
1313 http::Request<tonic::body::Body>,
1314 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1315 {
1316 DiscoveryClient::new(InterceptedService::new(inner, interceptor))
1317 }
1318 #[must_use]
1323 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1324 self.inner = self.inner.send_compressed(encoding);
1325 self
1326 }
1327 #[must_use]
1329 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1330 self.inner = self.inner.accept_compressed(encoding);
1331 self
1332 }
1333 #[must_use]
1337 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1338 self.inner = self.inner.max_decoding_message_size(limit);
1339 self
1340 }
1341 #[must_use]
1345 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1346 self.inner = self.inner.max_encoding_message_size(limit);
1347 self
1348 }
1349 pub async fn topic_lookup(
1352 &mut self,
1353 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1354 ) -> std::result::Result<
1355 tonic::Response<super::TopicLookupResponse>,
1356 tonic::Status,
1357 > {
1358 self.inner
1359 .ready()
1360 .await
1361 .map_err(|e| {
1362 tonic::Status::unknown(
1363 format!("Service was not ready: {}", e.into()),
1364 )
1365 })?;
1366 let codec = tonic_prost::ProstCodec::default();
1367 let path = http::uri::PathAndQuery::from_static(
1368 "/danube.Discovery/TopicLookup",
1369 );
1370 let mut req = request.into_request();
1371 req.extensions_mut()
1372 .insert(GrpcMethod::new("danube.Discovery", "TopicLookup"));
1373 self.inner.unary(req, path, codec).await
1374 }
1375 pub async fn topic_partitions(
1378 &mut self,
1379 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1380 ) -> std::result::Result<
1381 tonic::Response<super::TopicPartitionsResponse>,
1382 tonic::Status,
1383 > {
1384 self.inner
1385 .ready()
1386 .await
1387 .map_err(|e| {
1388 tonic::Status::unknown(
1389 format!("Service was not ready: {}", e.into()),
1390 )
1391 })?;
1392 let codec = tonic_prost::ProstCodec::default();
1393 let path = http::uri::PathAndQuery::from_static(
1394 "/danube.Discovery/TopicPartitions",
1395 );
1396 let mut req = request.into_request();
1397 req.extensions_mut()
1398 .insert(GrpcMethod::new("danube.Discovery", "TopicPartitions"));
1399 self.inner.unary(req, path, codec).await
1400 }
1401 }
1402}
1403pub mod discovery_server {
1405 #![allow(
1406 unused_variables,
1407 dead_code,
1408 missing_docs,
1409 clippy::wildcard_imports,
1410 clippy::let_unit_value,
1411 )]
1412 use tonic::codegen::*;
1413 #[async_trait]
1415 pub trait Discovery: std::marker::Send + std::marker::Sync + 'static {
1416 async fn topic_lookup(
1419 &self,
1420 request: tonic::Request<super::TopicLookupRequest>,
1421 ) -> std::result::Result<
1422 tonic::Response<super::TopicLookupResponse>,
1423 tonic::Status,
1424 >;
1425 async fn topic_partitions(
1428 &self,
1429 request: tonic::Request<super::TopicLookupRequest>,
1430 ) -> std::result::Result<
1431 tonic::Response<super::TopicPartitionsResponse>,
1432 tonic::Status,
1433 >;
1434 }
1435 #[derive(Debug)]
1436 pub struct DiscoveryServer<T> {
1437 inner: Arc<T>,
1438 accept_compression_encodings: EnabledCompressionEncodings,
1439 send_compression_encodings: EnabledCompressionEncodings,
1440 max_decoding_message_size: Option<usize>,
1441 max_encoding_message_size: Option<usize>,
1442 }
1443 impl<T> DiscoveryServer<T> {
1444 pub fn new(inner: T) -> Self {
1445 Self::from_arc(Arc::new(inner))
1446 }
1447 pub fn from_arc(inner: Arc<T>) -> Self {
1448 Self {
1449 inner,
1450 accept_compression_encodings: Default::default(),
1451 send_compression_encodings: Default::default(),
1452 max_decoding_message_size: None,
1453 max_encoding_message_size: None,
1454 }
1455 }
1456 pub fn with_interceptor<F>(
1457 inner: T,
1458 interceptor: F,
1459 ) -> InterceptedService<Self, F>
1460 where
1461 F: tonic::service::Interceptor,
1462 {
1463 InterceptedService::new(Self::new(inner), interceptor)
1464 }
1465 #[must_use]
1467 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1468 self.accept_compression_encodings.enable(encoding);
1469 self
1470 }
1471 #[must_use]
1473 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1474 self.send_compression_encodings.enable(encoding);
1475 self
1476 }
1477 #[must_use]
1481 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1482 self.max_decoding_message_size = Some(limit);
1483 self
1484 }
1485 #[must_use]
1489 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1490 self.max_encoding_message_size = Some(limit);
1491 self
1492 }
1493 }
1494 impl<T, B> tonic::codegen::Service<http::Request<B>> for DiscoveryServer<T>
1495 where
1496 T: Discovery,
1497 B: Body + std::marker::Send + 'static,
1498 B::Error: Into<StdError> + std::marker::Send + 'static,
1499 {
1500 type Response = http::Response<tonic::body::Body>;
1501 type Error = std::convert::Infallible;
1502 type Future = BoxFuture<Self::Response, Self::Error>;
1503 fn poll_ready(
1504 &mut self,
1505 _cx: &mut Context<'_>,
1506 ) -> Poll<std::result::Result<(), Self::Error>> {
1507 Poll::Ready(Ok(()))
1508 }
1509 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1510 match req.uri().path() {
1511 "/danube.Discovery/TopicLookup" => {
1512 #[allow(non_camel_case_types)]
1513 struct TopicLookupSvc<T: Discovery>(pub Arc<T>);
1514 impl<
1515 T: Discovery,
1516 > tonic::server::UnaryService<super::TopicLookupRequest>
1517 for TopicLookupSvc<T> {
1518 type Response = super::TopicLookupResponse;
1519 type Future = BoxFuture<
1520 tonic::Response<Self::Response>,
1521 tonic::Status,
1522 >;
1523 fn call(
1524 &mut self,
1525 request: tonic::Request<super::TopicLookupRequest>,
1526 ) -> Self::Future {
1527 let inner = Arc::clone(&self.0);
1528 let fut = async move {
1529 <T as Discovery>::topic_lookup(&inner, request).await
1530 };
1531 Box::pin(fut)
1532 }
1533 }
1534 let accept_compression_encodings = self.accept_compression_encodings;
1535 let send_compression_encodings = self.send_compression_encodings;
1536 let max_decoding_message_size = self.max_decoding_message_size;
1537 let max_encoding_message_size = self.max_encoding_message_size;
1538 let inner = self.inner.clone();
1539 let fut = async move {
1540 let method = TopicLookupSvc(inner);
1541 let codec = tonic_prost::ProstCodec::default();
1542 let mut grpc = tonic::server::Grpc::new(codec)
1543 .apply_compression_config(
1544 accept_compression_encodings,
1545 send_compression_encodings,
1546 )
1547 .apply_max_message_size_config(
1548 max_decoding_message_size,
1549 max_encoding_message_size,
1550 );
1551 let res = grpc.unary(method, req).await;
1552 Ok(res)
1553 };
1554 Box::pin(fut)
1555 }
1556 "/danube.Discovery/TopicPartitions" => {
1557 #[allow(non_camel_case_types)]
1558 struct TopicPartitionsSvc<T: Discovery>(pub Arc<T>);
1559 impl<
1560 T: Discovery,
1561 > tonic::server::UnaryService<super::TopicLookupRequest>
1562 for TopicPartitionsSvc<T> {
1563 type Response = super::TopicPartitionsResponse;
1564 type Future = BoxFuture<
1565 tonic::Response<Self::Response>,
1566 tonic::Status,
1567 >;
1568 fn call(
1569 &mut self,
1570 request: tonic::Request<super::TopicLookupRequest>,
1571 ) -> Self::Future {
1572 let inner = Arc::clone(&self.0);
1573 let fut = async move {
1574 <T as Discovery>::topic_partitions(&inner, request).await
1575 };
1576 Box::pin(fut)
1577 }
1578 }
1579 let accept_compression_encodings = self.accept_compression_encodings;
1580 let send_compression_encodings = self.send_compression_encodings;
1581 let max_decoding_message_size = self.max_decoding_message_size;
1582 let max_encoding_message_size = self.max_encoding_message_size;
1583 let inner = self.inner.clone();
1584 let fut = async move {
1585 let method = TopicPartitionsSvc(inner);
1586 let codec = tonic_prost::ProstCodec::default();
1587 let mut grpc = tonic::server::Grpc::new(codec)
1588 .apply_compression_config(
1589 accept_compression_encodings,
1590 send_compression_encodings,
1591 )
1592 .apply_max_message_size_config(
1593 max_decoding_message_size,
1594 max_encoding_message_size,
1595 );
1596 let res = grpc.unary(method, req).await;
1597 Ok(res)
1598 };
1599 Box::pin(fut)
1600 }
1601 _ => {
1602 Box::pin(async move {
1603 let mut response = http::Response::new(
1604 tonic::body::Body::default(),
1605 );
1606 let headers = response.headers_mut();
1607 headers
1608 .insert(
1609 tonic::Status::GRPC_STATUS,
1610 (tonic::Code::Unimplemented as i32).into(),
1611 );
1612 headers
1613 .insert(
1614 http::header::CONTENT_TYPE,
1615 tonic::metadata::GRPC_CONTENT_TYPE,
1616 );
1617 Ok(response)
1618 })
1619 }
1620 }
1621 }
1622 }
1623 impl<T> Clone for DiscoveryServer<T> {
1624 fn clone(&self) -> Self {
1625 let inner = self.inner.clone();
1626 Self {
1627 inner,
1628 accept_compression_encodings: self.accept_compression_encodings,
1629 send_compression_encodings: self.send_compression_encodings,
1630 max_decoding_message_size: self.max_decoding_message_size,
1631 max_encoding_message_size: self.max_encoding_message_size,
1632 }
1633 }
1634 }
1635 pub const SERVICE_NAME: &str = "danube.Discovery";
1637 impl<T> tonic::server::NamedService for DiscoveryServer<T> {
1638 const NAME: &'static str = SERVICE_NAME;
1639 }
1640}
1641pub mod health_check_client {
1643 #![allow(
1644 unused_variables,
1645 dead_code,
1646 missing_docs,
1647 clippy::wildcard_imports,
1648 clippy::let_unit_value,
1649 )]
1650 use tonic::codegen::*;
1651 use tonic::codegen::http::Uri;
1652 #[derive(Debug, Clone)]
1653 pub struct HealthCheckClient<T> {
1654 inner: tonic::client::Grpc<T>,
1655 }
1656 impl HealthCheckClient<tonic::transport::Channel> {
1657 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1659 where
1660 D: TryInto<tonic::transport::Endpoint>,
1661 D::Error: Into<StdError>,
1662 {
1663 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1664 Ok(Self::new(conn))
1665 }
1666 }
1667 impl<T> HealthCheckClient<T>
1668 where
1669 T: tonic::client::GrpcService<tonic::body::Body>,
1670 T::Error: Into<StdError>,
1671 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1672 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1673 {
1674 pub fn new(inner: T) -> Self {
1675 let inner = tonic::client::Grpc::new(inner);
1676 Self { inner }
1677 }
1678 pub fn with_origin(inner: T, origin: Uri) -> Self {
1679 let inner = tonic::client::Grpc::with_origin(inner, origin);
1680 Self { inner }
1681 }
1682 pub fn with_interceptor<F>(
1683 inner: T,
1684 interceptor: F,
1685 ) -> HealthCheckClient<InterceptedService<T, F>>
1686 where
1687 F: tonic::service::Interceptor,
1688 T::ResponseBody: Default,
1689 T: tonic::codegen::Service<
1690 http::Request<tonic::body::Body>,
1691 Response = http::Response<
1692 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1693 >,
1694 >,
1695 <T as tonic::codegen::Service<
1696 http::Request<tonic::body::Body>,
1697 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1698 {
1699 HealthCheckClient::new(InterceptedService::new(inner, interceptor))
1700 }
1701 #[must_use]
1706 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1707 self.inner = self.inner.send_compressed(encoding);
1708 self
1709 }
1710 #[must_use]
1712 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1713 self.inner = self.inner.accept_compressed(encoding);
1714 self
1715 }
1716 #[must_use]
1720 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1721 self.inner = self.inner.max_decoding_message_size(limit);
1722 self
1723 }
1724 #[must_use]
1728 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1729 self.inner = self.inner.max_encoding_message_size(limit);
1730 self
1731 }
1732 pub async fn health_check(
1733 &mut self,
1734 request: impl tonic::IntoRequest<super::HealthCheckRequest>,
1735 ) -> std::result::Result<
1736 tonic::Response<super::HealthCheckResponse>,
1737 tonic::Status,
1738 > {
1739 self.inner
1740 .ready()
1741 .await
1742 .map_err(|e| {
1743 tonic::Status::unknown(
1744 format!("Service was not ready: {}", e.into()),
1745 )
1746 })?;
1747 let codec = tonic_prost::ProstCodec::default();
1748 let path = http::uri::PathAndQuery::from_static(
1749 "/danube.HealthCheck/HealthCheck",
1750 );
1751 let mut req = request.into_request();
1752 req.extensions_mut()
1753 .insert(GrpcMethod::new("danube.HealthCheck", "HealthCheck"));
1754 self.inner.unary(req, path, codec).await
1755 }
1756 }
1757}
1758pub mod health_check_server {
1760 #![allow(
1761 unused_variables,
1762 dead_code,
1763 missing_docs,
1764 clippy::wildcard_imports,
1765 clippy::let_unit_value,
1766 )]
1767 use tonic::codegen::*;
1768 #[async_trait]
1770 pub trait HealthCheck: std::marker::Send + std::marker::Sync + 'static {
1771 async fn health_check(
1772 &self,
1773 request: tonic::Request<super::HealthCheckRequest>,
1774 ) -> std::result::Result<
1775 tonic::Response<super::HealthCheckResponse>,
1776 tonic::Status,
1777 >;
1778 }
1779 #[derive(Debug)]
1780 pub struct HealthCheckServer<T> {
1781 inner: Arc<T>,
1782 accept_compression_encodings: EnabledCompressionEncodings,
1783 send_compression_encodings: EnabledCompressionEncodings,
1784 max_decoding_message_size: Option<usize>,
1785 max_encoding_message_size: Option<usize>,
1786 }
1787 impl<T> HealthCheckServer<T> {
1788 pub fn new(inner: T) -> Self {
1789 Self::from_arc(Arc::new(inner))
1790 }
1791 pub fn from_arc(inner: Arc<T>) -> Self {
1792 Self {
1793 inner,
1794 accept_compression_encodings: Default::default(),
1795 send_compression_encodings: Default::default(),
1796 max_decoding_message_size: None,
1797 max_encoding_message_size: None,
1798 }
1799 }
1800 pub fn with_interceptor<F>(
1801 inner: T,
1802 interceptor: F,
1803 ) -> InterceptedService<Self, F>
1804 where
1805 F: tonic::service::Interceptor,
1806 {
1807 InterceptedService::new(Self::new(inner), interceptor)
1808 }
1809 #[must_use]
1811 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1812 self.accept_compression_encodings.enable(encoding);
1813 self
1814 }
1815 #[must_use]
1817 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1818 self.send_compression_encodings.enable(encoding);
1819 self
1820 }
1821 #[must_use]
1825 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1826 self.max_decoding_message_size = Some(limit);
1827 self
1828 }
1829 #[must_use]
1833 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1834 self.max_encoding_message_size = Some(limit);
1835 self
1836 }
1837 }
1838 impl<T, B> tonic::codegen::Service<http::Request<B>> for HealthCheckServer<T>
1839 where
1840 T: HealthCheck,
1841 B: Body + std::marker::Send + 'static,
1842 B::Error: Into<StdError> + std::marker::Send + 'static,
1843 {
1844 type Response = http::Response<tonic::body::Body>;
1845 type Error = std::convert::Infallible;
1846 type Future = BoxFuture<Self::Response, Self::Error>;
1847 fn poll_ready(
1848 &mut self,
1849 _cx: &mut Context<'_>,
1850 ) -> Poll<std::result::Result<(), Self::Error>> {
1851 Poll::Ready(Ok(()))
1852 }
1853 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1854 match req.uri().path() {
1855 "/danube.HealthCheck/HealthCheck" => {
1856 #[allow(non_camel_case_types)]
1857 struct HealthCheckSvc<T: HealthCheck>(pub Arc<T>);
1858 impl<
1859 T: HealthCheck,
1860 > tonic::server::UnaryService<super::HealthCheckRequest>
1861 for HealthCheckSvc<T> {
1862 type Response = super::HealthCheckResponse;
1863 type Future = BoxFuture<
1864 tonic::Response<Self::Response>,
1865 tonic::Status,
1866 >;
1867 fn call(
1868 &mut self,
1869 request: tonic::Request<super::HealthCheckRequest>,
1870 ) -> Self::Future {
1871 let inner = Arc::clone(&self.0);
1872 let fut = async move {
1873 <T as HealthCheck>::health_check(&inner, request).await
1874 };
1875 Box::pin(fut)
1876 }
1877 }
1878 let accept_compression_encodings = self.accept_compression_encodings;
1879 let send_compression_encodings = self.send_compression_encodings;
1880 let max_decoding_message_size = self.max_decoding_message_size;
1881 let max_encoding_message_size = self.max_encoding_message_size;
1882 let inner = self.inner.clone();
1883 let fut = async move {
1884 let method = HealthCheckSvc(inner);
1885 let codec = tonic_prost::ProstCodec::default();
1886 let mut grpc = tonic::server::Grpc::new(codec)
1887 .apply_compression_config(
1888 accept_compression_encodings,
1889 send_compression_encodings,
1890 )
1891 .apply_max_message_size_config(
1892 max_decoding_message_size,
1893 max_encoding_message_size,
1894 );
1895 let res = grpc.unary(method, req).await;
1896 Ok(res)
1897 };
1898 Box::pin(fut)
1899 }
1900 _ => {
1901 Box::pin(async move {
1902 let mut response = http::Response::new(
1903 tonic::body::Body::default(),
1904 );
1905 let headers = response.headers_mut();
1906 headers
1907 .insert(
1908 tonic::Status::GRPC_STATUS,
1909 (tonic::Code::Unimplemented as i32).into(),
1910 );
1911 headers
1912 .insert(
1913 http::header::CONTENT_TYPE,
1914 tonic::metadata::GRPC_CONTENT_TYPE,
1915 );
1916 Ok(response)
1917 })
1918 }
1919 }
1920 }
1921 }
1922 impl<T> Clone for HealthCheckServer<T> {
1923 fn clone(&self) -> Self {
1924 let inner = self.inner.clone();
1925 Self {
1926 inner,
1927 accept_compression_encodings: self.accept_compression_encodings,
1928 send_compression_encodings: self.send_compression_encodings,
1929 max_decoding_message_size: self.max_decoding_message_size,
1930 max_encoding_message_size: self.max_encoding_message_size,
1931 }
1932 }
1933 }
1934 pub const SERVICE_NAME: &str = "danube.HealthCheck";
1936 impl<T> tonic::server::NamedService for HealthCheckServer<T> {
1937 const NAME: &'static str = SERVICE_NAME;
1938 }
1939}
1940pub mod auth_service_client {
1942 #![allow(
1943 unused_variables,
1944 dead_code,
1945 missing_docs,
1946 clippy::wildcard_imports,
1947 clippy::let_unit_value,
1948 )]
1949 use tonic::codegen::*;
1950 use tonic::codegen::http::Uri;
1951 #[derive(Debug, Clone)]
1952 pub struct AuthServiceClient<T> {
1953 inner: tonic::client::Grpc<T>,
1954 }
1955 impl AuthServiceClient<tonic::transport::Channel> {
1956 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1958 where
1959 D: TryInto<tonic::transport::Endpoint>,
1960 D::Error: Into<StdError>,
1961 {
1962 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1963 Ok(Self::new(conn))
1964 }
1965 }
1966 impl<T> AuthServiceClient<T>
1967 where
1968 T: tonic::client::GrpcService<tonic::body::Body>,
1969 T::Error: Into<StdError>,
1970 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1971 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1972 {
1973 pub fn new(inner: T) -> Self {
1974 let inner = tonic::client::Grpc::new(inner);
1975 Self { inner }
1976 }
1977 pub fn with_origin(inner: T, origin: Uri) -> Self {
1978 let inner = tonic::client::Grpc::with_origin(inner, origin);
1979 Self { inner }
1980 }
1981 pub fn with_interceptor<F>(
1982 inner: T,
1983 interceptor: F,
1984 ) -> AuthServiceClient<InterceptedService<T, F>>
1985 where
1986 F: tonic::service::Interceptor,
1987 T::ResponseBody: Default,
1988 T: tonic::codegen::Service<
1989 http::Request<tonic::body::Body>,
1990 Response = http::Response<
1991 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1992 >,
1993 >,
1994 <T as tonic::codegen::Service<
1995 http::Request<tonic::body::Body>,
1996 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1997 {
1998 AuthServiceClient::new(InterceptedService::new(inner, interceptor))
1999 }
2000 #[must_use]
2005 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2006 self.inner = self.inner.send_compressed(encoding);
2007 self
2008 }
2009 #[must_use]
2011 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2012 self.inner = self.inner.accept_compressed(encoding);
2013 self
2014 }
2015 #[must_use]
2019 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2020 self.inner = self.inner.max_decoding_message_size(limit);
2021 self
2022 }
2023 #[must_use]
2027 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2028 self.inner = self.inner.max_encoding_message_size(limit);
2029 self
2030 }
2031 pub async fn authenticate(
2032 &mut self,
2033 request: impl tonic::IntoRequest<super::AuthRequest>,
2034 ) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status> {
2035 self.inner
2036 .ready()
2037 .await
2038 .map_err(|e| {
2039 tonic::Status::unknown(
2040 format!("Service was not ready: {}", e.into()),
2041 )
2042 })?;
2043 let codec = tonic_prost::ProstCodec::default();
2044 let path = http::uri::PathAndQuery::from_static(
2045 "/danube.AuthService/Authenticate",
2046 );
2047 let mut req = request.into_request();
2048 req.extensions_mut()
2049 .insert(GrpcMethod::new("danube.AuthService", "Authenticate"));
2050 self.inner.unary(req, path, codec).await
2051 }
2052 }
2053}
2054pub mod auth_service_server {
2056 #![allow(
2057 unused_variables,
2058 dead_code,
2059 missing_docs,
2060 clippy::wildcard_imports,
2061 clippy::let_unit_value,
2062 )]
2063 use tonic::codegen::*;
2064 #[async_trait]
2066 pub trait AuthService: std::marker::Send + std::marker::Sync + 'static {
2067 async fn authenticate(
2068 &self,
2069 request: tonic::Request<super::AuthRequest>,
2070 ) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status>;
2071 }
2072 #[derive(Debug)]
2073 pub struct AuthServiceServer<T> {
2074 inner: Arc<T>,
2075 accept_compression_encodings: EnabledCompressionEncodings,
2076 send_compression_encodings: EnabledCompressionEncodings,
2077 max_decoding_message_size: Option<usize>,
2078 max_encoding_message_size: Option<usize>,
2079 }
2080 impl<T> AuthServiceServer<T> {
2081 pub fn new(inner: T) -> Self {
2082 Self::from_arc(Arc::new(inner))
2083 }
2084 pub fn from_arc(inner: Arc<T>) -> Self {
2085 Self {
2086 inner,
2087 accept_compression_encodings: Default::default(),
2088 send_compression_encodings: Default::default(),
2089 max_decoding_message_size: None,
2090 max_encoding_message_size: None,
2091 }
2092 }
2093 pub fn with_interceptor<F>(
2094 inner: T,
2095 interceptor: F,
2096 ) -> InterceptedService<Self, F>
2097 where
2098 F: tonic::service::Interceptor,
2099 {
2100 InterceptedService::new(Self::new(inner), interceptor)
2101 }
2102 #[must_use]
2104 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2105 self.accept_compression_encodings.enable(encoding);
2106 self
2107 }
2108 #[must_use]
2110 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2111 self.send_compression_encodings.enable(encoding);
2112 self
2113 }
2114 #[must_use]
2118 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2119 self.max_decoding_message_size = Some(limit);
2120 self
2121 }
2122 #[must_use]
2126 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2127 self.max_encoding_message_size = Some(limit);
2128 self
2129 }
2130 }
2131 impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthServiceServer<T>
2132 where
2133 T: AuthService,
2134 B: Body + std::marker::Send + 'static,
2135 B::Error: Into<StdError> + std::marker::Send + 'static,
2136 {
2137 type Response = http::Response<tonic::body::Body>;
2138 type Error = std::convert::Infallible;
2139 type Future = BoxFuture<Self::Response, Self::Error>;
2140 fn poll_ready(
2141 &mut self,
2142 _cx: &mut Context<'_>,
2143 ) -> Poll<std::result::Result<(), Self::Error>> {
2144 Poll::Ready(Ok(()))
2145 }
2146 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2147 match req.uri().path() {
2148 "/danube.AuthService/Authenticate" => {
2149 #[allow(non_camel_case_types)]
2150 struct AuthenticateSvc<T: AuthService>(pub Arc<T>);
2151 impl<T: AuthService> tonic::server::UnaryService<super::AuthRequest>
2152 for AuthenticateSvc<T> {
2153 type Response = super::AuthResponse;
2154 type Future = BoxFuture<
2155 tonic::Response<Self::Response>,
2156 tonic::Status,
2157 >;
2158 fn call(
2159 &mut self,
2160 request: tonic::Request<super::AuthRequest>,
2161 ) -> Self::Future {
2162 let inner = Arc::clone(&self.0);
2163 let fut = async move {
2164 <T as AuthService>::authenticate(&inner, request).await
2165 };
2166 Box::pin(fut)
2167 }
2168 }
2169 let accept_compression_encodings = self.accept_compression_encodings;
2170 let send_compression_encodings = self.send_compression_encodings;
2171 let max_decoding_message_size = self.max_decoding_message_size;
2172 let max_encoding_message_size = self.max_encoding_message_size;
2173 let inner = self.inner.clone();
2174 let fut = async move {
2175 let method = AuthenticateSvc(inner);
2176 let codec = tonic_prost::ProstCodec::default();
2177 let mut grpc = tonic::server::Grpc::new(codec)
2178 .apply_compression_config(
2179 accept_compression_encodings,
2180 send_compression_encodings,
2181 )
2182 .apply_max_message_size_config(
2183 max_decoding_message_size,
2184 max_encoding_message_size,
2185 );
2186 let res = grpc.unary(method, req).await;
2187 Ok(res)
2188 };
2189 Box::pin(fut)
2190 }
2191 _ => {
2192 Box::pin(async move {
2193 let mut response = http::Response::new(
2194 tonic::body::Body::default(),
2195 );
2196 let headers = response.headers_mut();
2197 headers
2198 .insert(
2199 tonic::Status::GRPC_STATUS,
2200 (tonic::Code::Unimplemented as i32).into(),
2201 );
2202 headers
2203 .insert(
2204 http::header::CONTENT_TYPE,
2205 tonic::metadata::GRPC_CONTENT_TYPE,
2206 );
2207 Ok(response)
2208 })
2209 }
2210 }
2211 }
2212 }
2213 impl<T> Clone for AuthServiceServer<T> {
2214 fn clone(&self) -> Self {
2215 let inner = self.inner.clone();
2216 Self {
2217 inner,
2218 accept_compression_encodings: self.accept_compression_encodings,
2219 send_compression_encodings: self.send_compression_encodings,
2220 max_decoding_message_size: self.max_decoding_message_size,
2221 max_encoding_message_size: self.max_encoding_message_size,
2222 }
2223 }
2224 }
2225 pub const SERVICE_NAME: &str = "danube.AuthService";
2227 impl<T> tonic::server::NamedService for AuthServiceServer<T> {
2228 const NAME: &'static str = SERVICE_NAME;
2229 }
2230}