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 #[prost(string, repeated, tag = "6")]
75 pub key_filters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
76}
77pub mod consumer_request {
79 #[derive(
80 Clone,
81 Copy,
82 Debug,
83 PartialEq,
84 Eq,
85 Hash,
86 PartialOrd,
87 Ord,
88 ::prost::Enumeration
89 )]
90 #[repr(i32)]
91 pub enum SubscriptionType {
92 Exclusive = 0,
94 Shared = 1,
96 Failover = 2,
98 KeyShared = 3,
100 }
101 impl SubscriptionType {
102 pub fn as_str_name(&self) -> &'static str {
107 match self {
108 Self::Exclusive => "Exclusive",
109 Self::Shared => "Shared",
110 Self::Failover => "Failover",
111 Self::KeyShared => "KeyShared",
112 }
113 }
114 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
116 match value {
117 "Exclusive" => Some(Self::Exclusive),
118 "Shared" => Some(Self::Shared),
119 "Failover" => Some(Self::Failover),
120 "KeyShared" => Some(Self::KeyShared),
121 _ => None,
122 }
123 }
124 }
125}
126#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
128pub struct ConsumerResponse {
129 #[prost(uint64, tag = "1")]
130 pub request_id: u64,
131 #[prost(uint64, tag = "2")]
132 pub consumer_id: u64,
133 #[prost(string, tag = "3")]
134 pub consumer_name: ::prost::alloc::string::String,
135}
136#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
137pub struct ReceiveRequest {
138 #[prost(uint64, tag = "1")]
139 pub request_id: u64,
140 #[prost(uint64, tag = "2")]
141 pub consumer_id: u64,
142}
143#[derive(Clone, PartialEq, ::prost::Message)]
145pub struct StreamMessage {
146 #[prost(uint64, tag = "1")]
148 pub request_id: u64,
149 #[prost(message, optional, tag = "2")]
151 pub msg_id: ::core::option::Option<MsgId>,
152 #[prost(bytes = "vec", tag = "3")]
154 pub payload: ::prost::alloc::vec::Vec<u8>,
155 #[prost(uint64, tag = "4")]
157 pub publish_time: u64,
158 #[prost(string, tag = "5")]
160 pub producer_name: ::prost::alloc::string::String,
161 #[prost(string, tag = "6")]
163 pub subscription_name: ::prost::alloc::string::String,
164 #[prost(map = "string, string", tag = "7")]
166 pub attributes: ::std::collections::HashMap<
167 ::prost::alloc::string::String,
168 ::prost::alloc::string::String,
169 >,
170 #[prost(uint64, optional, tag = "8")]
174 pub schema_id: ::core::option::Option<u64>,
175 #[prost(uint32, optional, tag = "9")]
177 pub schema_version: ::core::option::Option<u32>,
178 #[prost(string, optional, tag = "10")]
181 pub routing_key: ::core::option::Option<::prost::alloc::string::String>,
182}
183#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
185pub struct MsgId {
186 #[prost(uint64, tag = "1")]
188 pub producer_id: u64,
189 #[prost(string, tag = "2")]
191 pub topic_name: ::prost::alloc::string::String,
192 #[prost(string, tag = "3")]
194 pub broker_addr: ::prost::alloc::string::String,
195 #[prost(uint64, tag = "5")]
197 pub topic_offset: u64,
198}
199#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
200pub struct AckRequest {
201 #[prost(uint64, tag = "1")]
202 pub request_id: u64,
203 #[prost(message, optional, tag = "2")]
205 pub msg_id: ::core::option::Option<MsgId>,
206 #[prost(string, tag = "3")]
208 pub subscription_name: ::prost::alloc::string::String,
209}
210#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
211pub struct AckResponse {
212 #[prost(uint64, tag = "1")]
213 pub request_id: u64,
214}
215#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
216pub struct NackRequest {
217 #[prost(uint64, tag = "1")]
218 pub request_id: u64,
219 #[prost(message, optional, tag = "2")]
221 pub msg_id: ::core::option::Option<MsgId>,
222 #[prost(string, tag = "3")]
224 pub subscription_name: ::prost::alloc::string::String,
225 #[prost(uint64, optional, tag = "4")]
226 pub delay_ms: ::core::option::Option<u64>,
227 #[prost(string, optional, tag = "5")]
228 pub reason: ::core::option::Option<::prost::alloc::string::String>,
229}
230#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
231pub struct NackResponse {
232 #[prost(uint64, tag = "1")]
233 pub request_id: u64,
234}
235#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
236pub struct TopicLookupRequest {
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, Eq, Hash, ::prost::Message)]
243pub struct TopicLookupResponse {
244 #[prost(uint64, tag = "3")]
245 pub request_id: u64,
246 #[prost(enumeration = "topic_lookup_response::LookupType", tag = "4")]
247 pub response_type: i32,
248 #[prost(string, tag = "5")]
249 pub connect_url: ::prost::alloc::string::String,
250 #[prost(string, tag = "6")]
251 pub broker_url: ::prost::alloc::string::String,
252 #[prost(bool, tag = "7")]
253 pub proxy: bool,
254}
255pub mod topic_lookup_response {
257 #[derive(
258 Clone,
259 Copy,
260 Debug,
261 PartialEq,
262 Eq,
263 Hash,
264 PartialOrd,
265 Ord,
266 ::prost::Enumeration
267 )]
268 #[repr(i32)]
269 pub enum LookupType {
270 Redirect = 0,
271 Connect = 1,
272 Failed = 2,
273 }
274 impl LookupType {
275 pub fn as_str_name(&self) -> &'static str {
280 match self {
281 Self::Redirect => "Redirect",
282 Self::Connect => "Connect",
283 Self::Failed => "Failed",
284 }
285 }
286 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
288 match value {
289 "Redirect" => Some(Self::Redirect),
290 "Connect" => Some(Self::Connect),
291 "Failed" => Some(Self::Failed),
292 _ => None,
293 }
294 }
295 }
296}
297#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
298pub struct TopicPartitionsResponse {
299 #[prost(uint64, tag = "1")]
300 pub request_id: u64,
301 #[prost(string, repeated, tag = "2")]
302 pub partitions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
303}
304#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
305pub struct HealthCheckRequest {
306 #[prost(uint64, tag = "1")]
307 pub request_id: u64,
308 #[prost(enumeration = "health_check_request::ClientType", tag = "2")]
309 pub client: i32,
310 #[prost(uint64, tag = "3")]
311 pub id: u64,
312}
313pub mod health_check_request {
315 #[derive(
316 Clone,
317 Copy,
318 Debug,
319 PartialEq,
320 Eq,
321 Hash,
322 PartialOrd,
323 Ord,
324 ::prost::Enumeration
325 )]
326 #[repr(i32)]
327 pub enum ClientType {
328 Producer = 0,
329 Consumer = 1,
330 }
331 impl ClientType {
332 pub fn as_str_name(&self) -> &'static str {
337 match self {
338 Self::Producer => "Producer",
339 Self::Consumer => "Consumer",
340 }
341 }
342 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
344 match value {
345 "Producer" => Some(Self::Producer),
346 "Consumer" => Some(Self::Consumer),
347 _ => None,
348 }
349 }
350 }
351}
352#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
353pub struct HealthCheckResponse {
354 #[prost(enumeration = "health_check_response::ClientStatus", tag = "1")]
355 pub status: i32,
356}
357pub mod health_check_response {
359 #[derive(
360 Clone,
361 Copy,
362 Debug,
363 PartialEq,
364 Eq,
365 Hash,
366 PartialOrd,
367 Ord,
368 ::prost::Enumeration
369 )]
370 #[repr(i32)]
371 pub enum ClientStatus {
372 Ok = 0,
373 Close = 1,
374 }
375 impl ClientStatus {
376 pub fn as_str_name(&self) -> &'static str {
381 match self {
382 Self::Ok => "OK",
383 Self::Close => "CLOSE",
384 }
385 }
386 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
388 match value {
389 "OK" => Some(Self::Ok),
390 "CLOSE" => Some(Self::Close),
391 _ => None,
392 }
393 }
394 }
395}
396#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
397#[repr(i32)]
398pub enum ProducerAccessMode {
399 Shared = 0,
401 Exclusive = 1,
403}
404impl ProducerAccessMode {
405 pub fn as_str_name(&self) -> &'static str {
410 match self {
411 Self::Shared => "Shared",
412 Self::Exclusive => "Exclusive",
413 }
414 }
415 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
417 match value {
418 "Shared" => Some(Self::Shared),
419 "Exclusive" => Some(Self::Exclusive),
420 _ => None,
421 }
422 }
423}
424#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
425#[repr(i32)]
426pub enum DispatchStrategy {
427 NonReliable = 0,
428 Reliable = 1,
429}
430impl DispatchStrategy {
431 pub fn as_str_name(&self) -> &'static str {
436 match self {
437 Self::NonReliable => "NonReliable",
438 Self::Reliable => "Reliable",
439 }
440 }
441 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
443 match value {
444 "NonReliable" => Some(Self::NonReliable),
445 "Reliable" => Some(Self::Reliable),
446 _ => None,
447 }
448 }
449}
450pub mod producer_service_client {
452 #![allow(
453 unused_variables,
454 dead_code,
455 missing_docs,
456 clippy::wildcard_imports,
457 clippy::let_unit_value,
458 )]
459 use tonic::codegen::*;
460 use tonic::codegen::http::Uri;
461 #[derive(Debug, Clone)]
462 pub struct ProducerServiceClient<T> {
463 inner: tonic::client::Grpc<T>,
464 }
465 impl ProducerServiceClient<tonic::transport::Channel> {
466 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
468 where
469 D: TryInto<tonic::transport::Endpoint>,
470 D::Error: Into<StdError>,
471 {
472 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
473 Ok(Self::new(conn))
474 }
475 }
476 impl<T> ProducerServiceClient<T>
477 where
478 T: tonic::client::GrpcService<tonic::body::Body>,
479 T::Error: Into<StdError>,
480 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
481 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
482 {
483 pub fn new(inner: T) -> Self {
484 let inner = tonic::client::Grpc::new(inner);
485 Self { inner }
486 }
487 pub fn with_origin(inner: T, origin: Uri) -> Self {
488 let inner = tonic::client::Grpc::with_origin(inner, origin);
489 Self { inner }
490 }
491 pub fn with_interceptor<F>(
492 inner: T,
493 interceptor: F,
494 ) -> ProducerServiceClient<InterceptedService<T, F>>
495 where
496 F: tonic::service::Interceptor,
497 T::ResponseBody: Default,
498 T: tonic::codegen::Service<
499 http::Request<tonic::body::Body>,
500 Response = http::Response<
501 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
502 >,
503 >,
504 <T as tonic::codegen::Service<
505 http::Request<tonic::body::Body>,
506 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
507 {
508 ProducerServiceClient::new(InterceptedService::new(inner, interceptor))
509 }
510 #[must_use]
515 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
516 self.inner = self.inner.send_compressed(encoding);
517 self
518 }
519 #[must_use]
521 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
522 self.inner = self.inner.accept_compressed(encoding);
523 self
524 }
525 #[must_use]
529 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
530 self.inner = self.inner.max_decoding_message_size(limit);
531 self
532 }
533 #[must_use]
537 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
538 self.inner = self.inner.max_encoding_message_size(limit);
539 self
540 }
541 pub async fn create_producer(
543 &mut self,
544 request: impl tonic::IntoRequest<super::ProducerRequest>,
545 ) -> std::result::Result<
546 tonic::Response<super::ProducerResponse>,
547 tonic::Status,
548 > {
549 self.inner
550 .ready()
551 .await
552 .map_err(|e| {
553 tonic::Status::unknown(
554 format!("Service was not ready: {}", e.into()),
555 )
556 })?;
557 let codec = tonic_prost::ProstCodec::default();
558 let path = http::uri::PathAndQuery::from_static(
559 "/danube.ProducerService/CreateProducer",
560 );
561 let mut req = request.into_request();
562 req.extensions_mut()
563 .insert(GrpcMethod::new("danube.ProducerService", "CreateProducer"));
564 self.inner.unary(req, path, codec).await
565 }
566 pub async fn send_message(
568 &mut self,
569 request: impl tonic::IntoRequest<super::StreamMessage>,
570 ) -> std::result::Result<
571 tonic::Response<super::MessageResponse>,
572 tonic::Status,
573 > {
574 self.inner
575 .ready()
576 .await
577 .map_err(|e| {
578 tonic::Status::unknown(
579 format!("Service was not ready: {}", e.into()),
580 )
581 })?;
582 let codec = tonic_prost::ProstCodec::default();
583 let path = http::uri::PathAndQuery::from_static(
584 "/danube.ProducerService/SendMessage",
585 );
586 let mut req = request.into_request();
587 req.extensions_mut()
588 .insert(GrpcMethod::new("danube.ProducerService", "SendMessage"));
589 self.inner.unary(req, path, codec).await
590 }
591 }
592}
593pub mod producer_service_server {
595 #![allow(
596 unused_variables,
597 dead_code,
598 missing_docs,
599 clippy::wildcard_imports,
600 clippy::let_unit_value,
601 )]
602 use tonic::codegen::*;
603 #[async_trait]
605 pub trait ProducerService: std::marker::Send + std::marker::Sync + 'static {
606 async fn create_producer(
608 &self,
609 request: tonic::Request<super::ProducerRequest>,
610 ) -> std::result::Result<
611 tonic::Response<super::ProducerResponse>,
612 tonic::Status,
613 >;
614 async fn send_message(
616 &self,
617 request: tonic::Request<super::StreamMessage>,
618 ) -> std::result::Result<tonic::Response<super::MessageResponse>, tonic::Status>;
619 }
620 #[derive(Debug)]
621 pub struct ProducerServiceServer<T> {
622 inner: Arc<T>,
623 accept_compression_encodings: EnabledCompressionEncodings,
624 send_compression_encodings: EnabledCompressionEncodings,
625 max_decoding_message_size: Option<usize>,
626 max_encoding_message_size: Option<usize>,
627 }
628 impl<T> ProducerServiceServer<T> {
629 pub fn new(inner: T) -> Self {
630 Self::from_arc(Arc::new(inner))
631 }
632 pub fn from_arc(inner: Arc<T>) -> Self {
633 Self {
634 inner,
635 accept_compression_encodings: Default::default(),
636 send_compression_encodings: Default::default(),
637 max_decoding_message_size: None,
638 max_encoding_message_size: None,
639 }
640 }
641 pub fn with_interceptor<F>(
642 inner: T,
643 interceptor: F,
644 ) -> InterceptedService<Self, F>
645 where
646 F: tonic::service::Interceptor,
647 {
648 InterceptedService::new(Self::new(inner), interceptor)
649 }
650 #[must_use]
652 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
653 self.accept_compression_encodings.enable(encoding);
654 self
655 }
656 #[must_use]
658 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
659 self.send_compression_encodings.enable(encoding);
660 self
661 }
662 #[must_use]
666 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
667 self.max_decoding_message_size = Some(limit);
668 self
669 }
670 #[must_use]
674 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
675 self.max_encoding_message_size = Some(limit);
676 self
677 }
678 }
679 impl<T, B> tonic::codegen::Service<http::Request<B>> for ProducerServiceServer<T>
680 where
681 T: ProducerService,
682 B: Body + std::marker::Send + 'static,
683 B::Error: Into<StdError> + std::marker::Send + 'static,
684 {
685 type Response = http::Response<tonic::body::Body>;
686 type Error = std::convert::Infallible;
687 type Future = BoxFuture<Self::Response, Self::Error>;
688 fn poll_ready(
689 &mut self,
690 _cx: &mut Context<'_>,
691 ) -> Poll<std::result::Result<(), Self::Error>> {
692 Poll::Ready(Ok(()))
693 }
694 fn call(&mut self, req: http::Request<B>) -> Self::Future {
695 match req.uri().path() {
696 "/danube.ProducerService/CreateProducer" => {
697 #[allow(non_camel_case_types)]
698 struct CreateProducerSvc<T: ProducerService>(pub Arc<T>);
699 impl<
700 T: ProducerService,
701 > tonic::server::UnaryService<super::ProducerRequest>
702 for CreateProducerSvc<T> {
703 type Response = super::ProducerResponse;
704 type Future = BoxFuture<
705 tonic::Response<Self::Response>,
706 tonic::Status,
707 >;
708 fn call(
709 &mut self,
710 request: tonic::Request<super::ProducerRequest>,
711 ) -> Self::Future {
712 let inner = Arc::clone(&self.0);
713 let fut = async move {
714 <T as ProducerService>::create_producer(&inner, request)
715 .await
716 };
717 Box::pin(fut)
718 }
719 }
720 let accept_compression_encodings = self.accept_compression_encodings;
721 let send_compression_encodings = self.send_compression_encodings;
722 let max_decoding_message_size = self.max_decoding_message_size;
723 let max_encoding_message_size = self.max_encoding_message_size;
724 let inner = self.inner.clone();
725 let fut = async move {
726 let method = CreateProducerSvc(inner);
727 let codec = tonic_prost::ProstCodec::default();
728 let mut grpc = tonic::server::Grpc::new(codec)
729 .apply_compression_config(
730 accept_compression_encodings,
731 send_compression_encodings,
732 )
733 .apply_max_message_size_config(
734 max_decoding_message_size,
735 max_encoding_message_size,
736 );
737 let res = grpc.unary(method, req).await;
738 Ok(res)
739 };
740 Box::pin(fut)
741 }
742 "/danube.ProducerService/SendMessage" => {
743 #[allow(non_camel_case_types)]
744 struct SendMessageSvc<T: ProducerService>(pub Arc<T>);
745 impl<
746 T: ProducerService,
747 > tonic::server::UnaryService<super::StreamMessage>
748 for SendMessageSvc<T> {
749 type Response = super::MessageResponse;
750 type Future = BoxFuture<
751 tonic::Response<Self::Response>,
752 tonic::Status,
753 >;
754 fn call(
755 &mut self,
756 request: tonic::Request<super::StreamMessage>,
757 ) -> Self::Future {
758 let inner = Arc::clone(&self.0);
759 let fut = async move {
760 <T as ProducerService>::send_message(&inner, request).await
761 };
762 Box::pin(fut)
763 }
764 }
765 let accept_compression_encodings = self.accept_compression_encodings;
766 let send_compression_encodings = self.send_compression_encodings;
767 let max_decoding_message_size = self.max_decoding_message_size;
768 let max_encoding_message_size = self.max_encoding_message_size;
769 let inner = self.inner.clone();
770 let fut = async move {
771 let method = SendMessageSvc(inner);
772 let codec = tonic_prost::ProstCodec::default();
773 let mut grpc = tonic::server::Grpc::new(codec)
774 .apply_compression_config(
775 accept_compression_encodings,
776 send_compression_encodings,
777 )
778 .apply_max_message_size_config(
779 max_decoding_message_size,
780 max_encoding_message_size,
781 );
782 let res = grpc.unary(method, req).await;
783 Ok(res)
784 };
785 Box::pin(fut)
786 }
787 _ => {
788 Box::pin(async move {
789 let mut response = http::Response::new(
790 tonic::body::Body::default(),
791 );
792 let headers = response.headers_mut();
793 headers
794 .insert(
795 tonic::Status::GRPC_STATUS,
796 (tonic::Code::Unimplemented as i32).into(),
797 );
798 headers
799 .insert(
800 http::header::CONTENT_TYPE,
801 tonic::metadata::GRPC_CONTENT_TYPE,
802 );
803 Ok(response)
804 })
805 }
806 }
807 }
808 }
809 impl<T> Clone for ProducerServiceServer<T> {
810 fn clone(&self) -> Self {
811 let inner = self.inner.clone();
812 Self {
813 inner,
814 accept_compression_encodings: self.accept_compression_encodings,
815 send_compression_encodings: self.send_compression_encodings,
816 max_decoding_message_size: self.max_decoding_message_size,
817 max_encoding_message_size: self.max_encoding_message_size,
818 }
819 }
820 }
821 pub const SERVICE_NAME: &str = "danube.ProducerService";
823 impl<T> tonic::server::NamedService for ProducerServiceServer<T> {
824 const NAME: &'static str = SERVICE_NAME;
825 }
826}
827pub mod consumer_service_client {
829 #![allow(
830 unused_variables,
831 dead_code,
832 missing_docs,
833 clippy::wildcard_imports,
834 clippy::let_unit_value,
835 )]
836 use tonic::codegen::*;
837 use tonic::codegen::http::Uri;
838 #[derive(Debug, Clone)]
839 pub struct ConsumerServiceClient<T> {
840 inner: tonic::client::Grpc<T>,
841 }
842 impl ConsumerServiceClient<tonic::transport::Channel> {
843 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
845 where
846 D: TryInto<tonic::transport::Endpoint>,
847 D::Error: Into<StdError>,
848 {
849 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
850 Ok(Self::new(conn))
851 }
852 }
853 impl<T> ConsumerServiceClient<T>
854 where
855 T: tonic::client::GrpcService<tonic::body::Body>,
856 T::Error: Into<StdError>,
857 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
858 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
859 {
860 pub fn new(inner: T) -> Self {
861 let inner = tonic::client::Grpc::new(inner);
862 Self { inner }
863 }
864 pub fn with_origin(inner: T, origin: Uri) -> Self {
865 let inner = tonic::client::Grpc::with_origin(inner, origin);
866 Self { inner }
867 }
868 pub fn with_interceptor<F>(
869 inner: T,
870 interceptor: F,
871 ) -> ConsumerServiceClient<InterceptedService<T, F>>
872 where
873 F: tonic::service::Interceptor,
874 T::ResponseBody: Default,
875 T: tonic::codegen::Service<
876 http::Request<tonic::body::Body>,
877 Response = http::Response<
878 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
879 >,
880 >,
881 <T as tonic::codegen::Service<
882 http::Request<tonic::body::Body>,
883 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
884 {
885 ConsumerServiceClient::new(InterceptedService::new(inner, interceptor))
886 }
887 #[must_use]
892 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
893 self.inner = self.inner.send_compressed(encoding);
894 self
895 }
896 #[must_use]
898 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
899 self.inner = self.inner.accept_compressed(encoding);
900 self
901 }
902 #[must_use]
906 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
907 self.inner = self.inner.max_decoding_message_size(limit);
908 self
909 }
910 #[must_use]
914 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
915 self.inner = self.inner.max_encoding_message_size(limit);
916 self
917 }
918 pub async fn subscribe(
920 &mut self,
921 request: impl tonic::IntoRequest<super::ConsumerRequest>,
922 ) -> std::result::Result<
923 tonic::Response<super::ConsumerResponse>,
924 tonic::Status,
925 > {
926 self.inner
927 .ready()
928 .await
929 .map_err(|e| {
930 tonic::Status::unknown(
931 format!("Service was not ready: {}", e.into()),
932 )
933 })?;
934 let codec = tonic_prost::ProstCodec::default();
935 let path = http::uri::PathAndQuery::from_static(
936 "/danube.ConsumerService/Subscribe",
937 );
938 let mut req = request.into_request();
939 req.extensions_mut()
940 .insert(GrpcMethod::new("danube.ConsumerService", "Subscribe"));
941 self.inner.unary(req, path, codec).await
942 }
943 pub async fn receive_messages(
945 &mut self,
946 request: impl tonic::IntoRequest<super::ReceiveRequest>,
947 ) -> std::result::Result<
948 tonic::Response<tonic::codec::Streaming<super::StreamMessage>>,
949 tonic::Status,
950 > {
951 self.inner
952 .ready()
953 .await
954 .map_err(|e| {
955 tonic::Status::unknown(
956 format!("Service was not ready: {}", e.into()),
957 )
958 })?;
959 let codec = tonic_prost::ProstCodec::default();
960 let path = http::uri::PathAndQuery::from_static(
961 "/danube.ConsumerService/ReceiveMessages",
962 );
963 let mut req = request.into_request();
964 req.extensions_mut()
965 .insert(GrpcMethod::new("danube.ConsumerService", "ReceiveMessages"));
966 self.inner.server_streaming(req, path, codec).await
967 }
968 pub async fn ack(
970 &mut self,
971 request: impl tonic::IntoRequest<super::AckRequest>,
972 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status> {
973 self.inner
974 .ready()
975 .await
976 .map_err(|e| {
977 tonic::Status::unknown(
978 format!("Service was not ready: {}", e.into()),
979 )
980 })?;
981 let codec = tonic_prost::ProstCodec::default();
982 let path = http::uri::PathAndQuery::from_static(
983 "/danube.ConsumerService/Ack",
984 );
985 let mut req = request.into_request();
986 req.extensions_mut()
987 .insert(GrpcMethod::new("danube.ConsumerService", "Ack"));
988 self.inner.unary(req, path, codec).await
989 }
990 pub async fn nack(
992 &mut self,
993 request: impl tonic::IntoRequest<super::NackRequest>,
994 ) -> std::result::Result<tonic::Response<super::NackResponse>, tonic::Status> {
995 self.inner
996 .ready()
997 .await
998 .map_err(|e| {
999 tonic::Status::unknown(
1000 format!("Service was not ready: {}", e.into()),
1001 )
1002 })?;
1003 let codec = tonic_prost::ProstCodec::default();
1004 let path = http::uri::PathAndQuery::from_static(
1005 "/danube.ConsumerService/Nack",
1006 );
1007 let mut req = request.into_request();
1008 req.extensions_mut()
1009 .insert(GrpcMethod::new("danube.ConsumerService", "Nack"));
1010 self.inner.unary(req, path, codec).await
1011 }
1012 }
1013}
1014pub mod consumer_service_server {
1016 #![allow(
1017 unused_variables,
1018 dead_code,
1019 missing_docs,
1020 clippy::wildcard_imports,
1021 clippy::let_unit_value,
1022 )]
1023 use tonic::codegen::*;
1024 #[async_trait]
1026 pub trait ConsumerService: std::marker::Send + std::marker::Sync + 'static {
1027 async fn subscribe(
1029 &self,
1030 request: tonic::Request<super::ConsumerRequest>,
1031 ) -> std::result::Result<
1032 tonic::Response<super::ConsumerResponse>,
1033 tonic::Status,
1034 >;
1035 type ReceiveMessagesStream: tonic::codegen::tokio_stream::Stream<
1037 Item = std::result::Result<super::StreamMessage, tonic::Status>,
1038 >
1039 + std::marker::Send
1040 + 'static;
1041 async fn receive_messages(
1043 &self,
1044 request: tonic::Request<super::ReceiveRequest>,
1045 ) -> std::result::Result<
1046 tonic::Response<Self::ReceiveMessagesStream>,
1047 tonic::Status,
1048 >;
1049 async fn ack(
1051 &self,
1052 request: tonic::Request<super::AckRequest>,
1053 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status>;
1054 async fn nack(
1056 &self,
1057 request: tonic::Request<super::NackRequest>,
1058 ) -> std::result::Result<tonic::Response<super::NackResponse>, tonic::Status>;
1059 }
1060 #[derive(Debug)]
1061 pub struct ConsumerServiceServer<T> {
1062 inner: Arc<T>,
1063 accept_compression_encodings: EnabledCompressionEncodings,
1064 send_compression_encodings: EnabledCompressionEncodings,
1065 max_decoding_message_size: Option<usize>,
1066 max_encoding_message_size: Option<usize>,
1067 }
1068 impl<T> ConsumerServiceServer<T> {
1069 pub fn new(inner: T) -> Self {
1070 Self::from_arc(Arc::new(inner))
1071 }
1072 pub fn from_arc(inner: Arc<T>) -> Self {
1073 Self {
1074 inner,
1075 accept_compression_encodings: Default::default(),
1076 send_compression_encodings: Default::default(),
1077 max_decoding_message_size: None,
1078 max_encoding_message_size: None,
1079 }
1080 }
1081 pub fn with_interceptor<F>(
1082 inner: T,
1083 interceptor: F,
1084 ) -> InterceptedService<Self, F>
1085 where
1086 F: tonic::service::Interceptor,
1087 {
1088 InterceptedService::new(Self::new(inner), interceptor)
1089 }
1090 #[must_use]
1092 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1093 self.accept_compression_encodings.enable(encoding);
1094 self
1095 }
1096 #[must_use]
1098 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1099 self.send_compression_encodings.enable(encoding);
1100 self
1101 }
1102 #[must_use]
1106 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1107 self.max_decoding_message_size = Some(limit);
1108 self
1109 }
1110 #[must_use]
1114 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1115 self.max_encoding_message_size = Some(limit);
1116 self
1117 }
1118 }
1119 impl<T, B> tonic::codegen::Service<http::Request<B>> for ConsumerServiceServer<T>
1120 where
1121 T: ConsumerService,
1122 B: Body + std::marker::Send + 'static,
1123 B::Error: Into<StdError> + std::marker::Send + 'static,
1124 {
1125 type Response = http::Response<tonic::body::Body>;
1126 type Error = std::convert::Infallible;
1127 type Future = BoxFuture<Self::Response, Self::Error>;
1128 fn poll_ready(
1129 &mut self,
1130 _cx: &mut Context<'_>,
1131 ) -> Poll<std::result::Result<(), Self::Error>> {
1132 Poll::Ready(Ok(()))
1133 }
1134 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1135 match req.uri().path() {
1136 "/danube.ConsumerService/Subscribe" => {
1137 #[allow(non_camel_case_types)]
1138 struct SubscribeSvc<T: ConsumerService>(pub Arc<T>);
1139 impl<
1140 T: ConsumerService,
1141 > tonic::server::UnaryService<super::ConsumerRequest>
1142 for SubscribeSvc<T> {
1143 type Response = super::ConsumerResponse;
1144 type Future = BoxFuture<
1145 tonic::Response<Self::Response>,
1146 tonic::Status,
1147 >;
1148 fn call(
1149 &mut self,
1150 request: tonic::Request<super::ConsumerRequest>,
1151 ) -> Self::Future {
1152 let inner = Arc::clone(&self.0);
1153 let fut = async move {
1154 <T as ConsumerService>::subscribe(&inner, request).await
1155 };
1156 Box::pin(fut)
1157 }
1158 }
1159 let accept_compression_encodings = self.accept_compression_encodings;
1160 let send_compression_encodings = self.send_compression_encodings;
1161 let max_decoding_message_size = self.max_decoding_message_size;
1162 let max_encoding_message_size = self.max_encoding_message_size;
1163 let inner = self.inner.clone();
1164 let fut = async move {
1165 let method = SubscribeSvc(inner);
1166 let codec = tonic_prost::ProstCodec::default();
1167 let mut grpc = tonic::server::Grpc::new(codec)
1168 .apply_compression_config(
1169 accept_compression_encodings,
1170 send_compression_encodings,
1171 )
1172 .apply_max_message_size_config(
1173 max_decoding_message_size,
1174 max_encoding_message_size,
1175 );
1176 let res = grpc.unary(method, req).await;
1177 Ok(res)
1178 };
1179 Box::pin(fut)
1180 }
1181 "/danube.ConsumerService/ReceiveMessages" => {
1182 #[allow(non_camel_case_types)]
1183 struct ReceiveMessagesSvc<T: ConsumerService>(pub Arc<T>);
1184 impl<
1185 T: ConsumerService,
1186 > tonic::server::ServerStreamingService<super::ReceiveRequest>
1187 for ReceiveMessagesSvc<T> {
1188 type Response = super::StreamMessage;
1189 type ResponseStream = T::ReceiveMessagesStream;
1190 type Future = BoxFuture<
1191 tonic::Response<Self::ResponseStream>,
1192 tonic::Status,
1193 >;
1194 fn call(
1195 &mut self,
1196 request: tonic::Request<super::ReceiveRequest>,
1197 ) -> Self::Future {
1198 let inner = Arc::clone(&self.0);
1199 let fut = async move {
1200 <T as ConsumerService>::receive_messages(&inner, request)
1201 .await
1202 };
1203 Box::pin(fut)
1204 }
1205 }
1206 let accept_compression_encodings = self.accept_compression_encodings;
1207 let send_compression_encodings = self.send_compression_encodings;
1208 let max_decoding_message_size = self.max_decoding_message_size;
1209 let max_encoding_message_size = self.max_encoding_message_size;
1210 let inner = self.inner.clone();
1211 let fut = async move {
1212 let method = ReceiveMessagesSvc(inner);
1213 let codec = tonic_prost::ProstCodec::default();
1214 let mut grpc = tonic::server::Grpc::new(codec)
1215 .apply_compression_config(
1216 accept_compression_encodings,
1217 send_compression_encodings,
1218 )
1219 .apply_max_message_size_config(
1220 max_decoding_message_size,
1221 max_encoding_message_size,
1222 );
1223 let res = grpc.server_streaming(method, req).await;
1224 Ok(res)
1225 };
1226 Box::pin(fut)
1227 }
1228 "/danube.ConsumerService/Ack" => {
1229 #[allow(non_camel_case_types)]
1230 struct AckSvc<T: ConsumerService>(pub Arc<T>);
1231 impl<
1232 T: ConsumerService,
1233 > tonic::server::UnaryService<super::AckRequest> for AckSvc<T> {
1234 type Response = super::AckResponse;
1235 type Future = BoxFuture<
1236 tonic::Response<Self::Response>,
1237 tonic::Status,
1238 >;
1239 fn call(
1240 &mut self,
1241 request: tonic::Request<super::AckRequest>,
1242 ) -> Self::Future {
1243 let inner = Arc::clone(&self.0);
1244 let fut = async move {
1245 <T as ConsumerService>::ack(&inner, request).await
1246 };
1247 Box::pin(fut)
1248 }
1249 }
1250 let accept_compression_encodings = self.accept_compression_encodings;
1251 let send_compression_encodings = self.send_compression_encodings;
1252 let max_decoding_message_size = self.max_decoding_message_size;
1253 let max_encoding_message_size = self.max_encoding_message_size;
1254 let inner = self.inner.clone();
1255 let fut = async move {
1256 let method = AckSvc(inner);
1257 let codec = tonic_prost::ProstCodec::default();
1258 let mut grpc = tonic::server::Grpc::new(codec)
1259 .apply_compression_config(
1260 accept_compression_encodings,
1261 send_compression_encodings,
1262 )
1263 .apply_max_message_size_config(
1264 max_decoding_message_size,
1265 max_encoding_message_size,
1266 );
1267 let res = grpc.unary(method, req).await;
1268 Ok(res)
1269 };
1270 Box::pin(fut)
1271 }
1272 "/danube.ConsumerService/Nack" => {
1273 #[allow(non_camel_case_types)]
1274 struct NackSvc<T: ConsumerService>(pub Arc<T>);
1275 impl<
1276 T: ConsumerService,
1277 > tonic::server::UnaryService<super::NackRequest> for NackSvc<T> {
1278 type Response = super::NackResponse;
1279 type Future = BoxFuture<
1280 tonic::Response<Self::Response>,
1281 tonic::Status,
1282 >;
1283 fn call(
1284 &mut self,
1285 request: tonic::Request<super::NackRequest>,
1286 ) -> Self::Future {
1287 let inner = Arc::clone(&self.0);
1288 let fut = async move {
1289 <T as ConsumerService>::nack(&inner, request).await
1290 };
1291 Box::pin(fut)
1292 }
1293 }
1294 let accept_compression_encodings = self.accept_compression_encodings;
1295 let send_compression_encodings = self.send_compression_encodings;
1296 let max_decoding_message_size = self.max_decoding_message_size;
1297 let max_encoding_message_size = self.max_encoding_message_size;
1298 let inner = self.inner.clone();
1299 let fut = async move {
1300 let method = NackSvc(inner);
1301 let codec = tonic_prost::ProstCodec::default();
1302 let mut grpc = tonic::server::Grpc::new(codec)
1303 .apply_compression_config(
1304 accept_compression_encodings,
1305 send_compression_encodings,
1306 )
1307 .apply_max_message_size_config(
1308 max_decoding_message_size,
1309 max_encoding_message_size,
1310 );
1311 let res = grpc.unary(method, req).await;
1312 Ok(res)
1313 };
1314 Box::pin(fut)
1315 }
1316 _ => {
1317 Box::pin(async move {
1318 let mut response = http::Response::new(
1319 tonic::body::Body::default(),
1320 );
1321 let headers = response.headers_mut();
1322 headers
1323 .insert(
1324 tonic::Status::GRPC_STATUS,
1325 (tonic::Code::Unimplemented as i32).into(),
1326 );
1327 headers
1328 .insert(
1329 http::header::CONTENT_TYPE,
1330 tonic::metadata::GRPC_CONTENT_TYPE,
1331 );
1332 Ok(response)
1333 })
1334 }
1335 }
1336 }
1337 }
1338 impl<T> Clone for ConsumerServiceServer<T> {
1339 fn clone(&self) -> Self {
1340 let inner = self.inner.clone();
1341 Self {
1342 inner,
1343 accept_compression_encodings: self.accept_compression_encodings,
1344 send_compression_encodings: self.send_compression_encodings,
1345 max_decoding_message_size: self.max_decoding_message_size,
1346 max_encoding_message_size: self.max_encoding_message_size,
1347 }
1348 }
1349 }
1350 pub const SERVICE_NAME: &str = "danube.ConsumerService";
1352 impl<T> tonic::server::NamedService for ConsumerServiceServer<T> {
1353 const NAME: &'static str = SERVICE_NAME;
1354 }
1355}
1356pub mod discovery_client {
1358 #![allow(
1359 unused_variables,
1360 dead_code,
1361 missing_docs,
1362 clippy::wildcard_imports,
1363 clippy::let_unit_value,
1364 )]
1365 use tonic::codegen::*;
1366 use tonic::codegen::http::Uri;
1367 #[derive(Debug, Clone)]
1368 pub struct DiscoveryClient<T> {
1369 inner: tonic::client::Grpc<T>,
1370 }
1371 impl DiscoveryClient<tonic::transport::Channel> {
1372 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1374 where
1375 D: TryInto<tonic::transport::Endpoint>,
1376 D::Error: Into<StdError>,
1377 {
1378 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1379 Ok(Self::new(conn))
1380 }
1381 }
1382 impl<T> DiscoveryClient<T>
1383 where
1384 T: tonic::client::GrpcService<tonic::body::Body>,
1385 T::Error: Into<StdError>,
1386 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1387 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1388 {
1389 pub fn new(inner: T) -> Self {
1390 let inner = tonic::client::Grpc::new(inner);
1391 Self { inner }
1392 }
1393 pub fn with_origin(inner: T, origin: Uri) -> Self {
1394 let inner = tonic::client::Grpc::with_origin(inner, origin);
1395 Self { inner }
1396 }
1397 pub fn with_interceptor<F>(
1398 inner: T,
1399 interceptor: F,
1400 ) -> DiscoveryClient<InterceptedService<T, F>>
1401 where
1402 F: tonic::service::Interceptor,
1403 T::ResponseBody: Default,
1404 T: tonic::codegen::Service<
1405 http::Request<tonic::body::Body>,
1406 Response = http::Response<
1407 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1408 >,
1409 >,
1410 <T as tonic::codegen::Service<
1411 http::Request<tonic::body::Body>,
1412 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1413 {
1414 DiscoveryClient::new(InterceptedService::new(inner, interceptor))
1415 }
1416 #[must_use]
1421 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1422 self.inner = self.inner.send_compressed(encoding);
1423 self
1424 }
1425 #[must_use]
1427 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1428 self.inner = self.inner.accept_compressed(encoding);
1429 self
1430 }
1431 #[must_use]
1435 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1436 self.inner = self.inner.max_decoding_message_size(limit);
1437 self
1438 }
1439 #[must_use]
1443 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1444 self.inner = self.inner.max_encoding_message_size(limit);
1445 self
1446 }
1447 pub async fn topic_lookup(
1450 &mut self,
1451 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1452 ) -> std::result::Result<
1453 tonic::Response<super::TopicLookupResponse>,
1454 tonic::Status,
1455 > {
1456 self.inner
1457 .ready()
1458 .await
1459 .map_err(|e| {
1460 tonic::Status::unknown(
1461 format!("Service was not ready: {}", e.into()),
1462 )
1463 })?;
1464 let codec = tonic_prost::ProstCodec::default();
1465 let path = http::uri::PathAndQuery::from_static(
1466 "/danube.Discovery/TopicLookup",
1467 );
1468 let mut req = request.into_request();
1469 req.extensions_mut()
1470 .insert(GrpcMethod::new("danube.Discovery", "TopicLookup"));
1471 self.inner.unary(req, path, codec).await
1472 }
1473 pub async fn topic_partitions(
1476 &mut self,
1477 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1478 ) -> std::result::Result<
1479 tonic::Response<super::TopicPartitionsResponse>,
1480 tonic::Status,
1481 > {
1482 self.inner
1483 .ready()
1484 .await
1485 .map_err(|e| {
1486 tonic::Status::unknown(
1487 format!("Service was not ready: {}", e.into()),
1488 )
1489 })?;
1490 let codec = tonic_prost::ProstCodec::default();
1491 let path = http::uri::PathAndQuery::from_static(
1492 "/danube.Discovery/TopicPartitions",
1493 );
1494 let mut req = request.into_request();
1495 req.extensions_mut()
1496 .insert(GrpcMethod::new("danube.Discovery", "TopicPartitions"));
1497 self.inner.unary(req, path, codec).await
1498 }
1499 }
1500}
1501pub mod discovery_server {
1503 #![allow(
1504 unused_variables,
1505 dead_code,
1506 missing_docs,
1507 clippy::wildcard_imports,
1508 clippy::let_unit_value,
1509 )]
1510 use tonic::codegen::*;
1511 #[async_trait]
1513 pub trait Discovery: std::marker::Send + std::marker::Sync + 'static {
1514 async fn topic_lookup(
1517 &self,
1518 request: tonic::Request<super::TopicLookupRequest>,
1519 ) -> std::result::Result<
1520 tonic::Response<super::TopicLookupResponse>,
1521 tonic::Status,
1522 >;
1523 async fn topic_partitions(
1526 &self,
1527 request: tonic::Request<super::TopicLookupRequest>,
1528 ) -> std::result::Result<
1529 tonic::Response<super::TopicPartitionsResponse>,
1530 tonic::Status,
1531 >;
1532 }
1533 #[derive(Debug)]
1534 pub struct DiscoveryServer<T> {
1535 inner: Arc<T>,
1536 accept_compression_encodings: EnabledCompressionEncodings,
1537 send_compression_encodings: EnabledCompressionEncodings,
1538 max_decoding_message_size: Option<usize>,
1539 max_encoding_message_size: Option<usize>,
1540 }
1541 impl<T> DiscoveryServer<T> {
1542 pub fn new(inner: T) -> Self {
1543 Self::from_arc(Arc::new(inner))
1544 }
1545 pub fn from_arc(inner: Arc<T>) -> Self {
1546 Self {
1547 inner,
1548 accept_compression_encodings: Default::default(),
1549 send_compression_encodings: Default::default(),
1550 max_decoding_message_size: None,
1551 max_encoding_message_size: None,
1552 }
1553 }
1554 pub fn with_interceptor<F>(
1555 inner: T,
1556 interceptor: F,
1557 ) -> InterceptedService<Self, F>
1558 where
1559 F: tonic::service::Interceptor,
1560 {
1561 InterceptedService::new(Self::new(inner), interceptor)
1562 }
1563 #[must_use]
1565 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1566 self.accept_compression_encodings.enable(encoding);
1567 self
1568 }
1569 #[must_use]
1571 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1572 self.send_compression_encodings.enable(encoding);
1573 self
1574 }
1575 #[must_use]
1579 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1580 self.max_decoding_message_size = Some(limit);
1581 self
1582 }
1583 #[must_use]
1587 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1588 self.max_encoding_message_size = Some(limit);
1589 self
1590 }
1591 }
1592 impl<T, B> tonic::codegen::Service<http::Request<B>> for DiscoveryServer<T>
1593 where
1594 T: Discovery,
1595 B: Body + std::marker::Send + 'static,
1596 B::Error: Into<StdError> + std::marker::Send + 'static,
1597 {
1598 type Response = http::Response<tonic::body::Body>;
1599 type Error = std::convert::Infallible;
1600 type Future = BoxFuture<Self::Response, Self::Error>;
1601 fn poll_ready(
1602 &mut self,
1603 _cx: &mut Context<'_>,
1604 ) -> Poll<std::result::Result<(), Self::Error>> {
1605 Poll::Ready(Ok(()))
1606 }
1607 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1608 match req.uri().path() {
1609 "/danube.Discovery/TopicLookup" => {
1610 #[allow(non_camel_case_types)]
1611 struct TopicLookupSvc<T: Discovery>(pub Arc<T>);
1612 impl<
1613 T: Discovery,
1614 > tonic::server::UnaryService<super::TopicLookupRequest>
1615 for TopicLookupSvc<T> {
1616 type Response = super::TopicLookupResponse;
1617 type Future = BoxFuture<
1618 tonic::Response<Self::Response>,
1619 tonic::Status,
1620 >;
1621 fn call(
1622 &mut self,
1623 request: tonic::Request<super::TopicLookupRequest>,
1624 ) -> Self::Future {
1625 let inner = Arc::clone(&self.0);
1626 let fut = async move {
1627 <T as Discovery>::topic_lookup(&inner, request).await
1628 };
1629 Box::pin(fut)
1630 }
1631 }
1632 let accept_compression_encodings = self.accept_compression_encodings;
1633 let send_compression_encodings = self.send_compression_encodings;
1634 let max_decoding_message_size = self.max_decoding_message_size;
1635 let max_encoding_message_size = self.max_encoding_message_size;
1636 let inner = self.inner.clone();
1637 let fut = async move {
1638 let method = TopicLookupSvc(inner);
1639 let codec = tonic_prost::ProstCodec::default();
1640 let mut grpc = tonic::server::Grpc::new(codec)
1641 .apply_compression_config(
1642 accept_compression_encodings,
1643 send_compression_encodings,
1644 )
1645 .apply_max_message_size_config(
1646 max_decoding_message_size,
1647 max_encoding_message_size,
1648 );
1649 let res = grpc.unary(method, req).await;
1650 Ok(res)
1651 };
1652 Box::pin(fut)
1653 }
1654 "/danube.Discovery/TopicPartitions" => {
1655 #[allow(non_camel_case_types)]
1656 struct TopicPartitionsSvc<T: Discovery>(pub Arc<T>);
1657 impl<
1658 T: Discovery,
1659 > tonic::server::UnaryService<super::TopicLookupRequest>
1660 for TopicPartitionsSvc<T> {
1661 type Response = super::TopicPartitionsResponse;
1662 type Future = BoxFuture<
1663 tonic::Response<Self::Response>,
1664 tonic::Status,
1665 >;
1666 fn call(
1667 &mut self,
1668 request: tonic::Request<super::TopicLookupRequest>,
1669 ) -> Self::Future {
1670 let inner = Arc::clone(&self.0);
1671 let fut = async move {
1672 <T as Discovery>::topic_partitions(&inner, request).await
1673 };
1674 Box::pin(fut)
1675 }
1676 }
1677 let accept_compression_encodings = self.accept_compression_encodings;
1678 let send_compression_encodings = self.send_compression_encodings;
1679 let max_decoding_message_size = self.max_decoding_message_size;
1680 let max_encoding_message_size = self.max_encoding_message_size;
1681 let inner = self.inner.clone();
1682 let fut = async move {
1683 let method = TopicPartitionsSvc(inner);
1684 let codec = tonic_prost::ProstCodec::default();
1685 let mut grpc = tonic::server::Grpc::new(codec)
1686 .apply_compression_config(
1687 accept_compression_encodings,
1688 send_compression_encodings,
1689 )
1690 .apply_max_message_size_config(
1691 max_decoding_message_size,
1692 max_encoding_message_size,
1693 );
1694 let res = grpc.unary(method, req).await;
1695 Ok(res)
1696 };
1697 Box::pin(fut)
1698 }
1699 _ => {
1700 Box::pin(async move {
1701 let mut response = http::Response::new(
1702 tonic::body::Body::default(),
1703 );
1704 let headers = response.headers_mut();
1705 headers
1706 .insert(
1707 tonic::Status::GRPC_STATUS,
1708 (tonic::Code::Unimplemented as i32).into(),
1709 );
1710 headers
1711 .insert(
1712 http::header::CONTENT_TYPE,
1713 tonic::metadata::GRPC_CONTENT_TYPE,
1714 );
1715 Ok(response)
1716 })
1717 }
1718 }
1719 }
1720 }
1721 impl<T> Clone for DiscoveryServer<T> {
1722 fn clone(&self) -> Self {
1723 let inner = self.inner.clone();
1724 Self {
1725 inner,
1726 accept_compression_encodings: self.accept_compression_encodings,
1727 send_compression_encodings: self.send_compression_encodings,
1728 max_decoding_message_size: self.max_decoding_message_size,
1729 max_encoding_message_size: self.max_encoding_message_size,
1730 }
1731 }
1732 }
1733 pub const SERVICE_NAME: &str = "danube.Discovery";
1735 impl<T> tonic::server::NamedService for DiscoveryServer<T> {
1736 const NAME: &'static str = SERVICE_NAME;
1737 }
1738}
1739pub mod health_check_client {
1741 #![allow(
1742 unused_variables,
1743 dead_code,
1744 missing_docs,
1745 clippy::wildcard_imports,
1746 clippy::let_unit_value,
1747 )]
1748 use tonic::codegen::*;
1749 use tonic::codegen::http::Uri;
1750 #[derive(Debug, Clone)]
1751 pub struct HealthCheckClient<T> {
1752 inner: tonic::client::Grpc<T>,
1753 }
1754 impl HealthCheckClient<tonic::transport::Channel> {
1755 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1757 where
1758 D: TryInto<tonic::transport::Endpoint>,
1759 D::Error: Into<StdError>,
1760 {
1761 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1762 Ok(Self::new(conn))
1763 }
1764 }
1765 impl<T> HealthCheckClient<T>
1766 where
1767 T: tonic::client::GrpcService<tonic::body::Body>,
1768 T::Error: Into<StdError>,
1769 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1770 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1771 {
1772 pub fn new(inner: T) -> Self {
1773 let inner = tonic::client::Grpc::new(inner);
1774 Self { inner }
1775 }
1776 pub fn with_origin(inner: T, origin: Uri) -> Self {
1777 let inner = tonic::client::Grpc::with_origin(inner, origin);
1778 Self { inner }
1779 }
1780 pub fn with_interceptor<F>(
1781 inner: T,
1782 interceptor: F,
1783 ) -> HealthCheckClient<InterceptedService<T, F>>
1784 where
1785 F: tonic::service::Interceptor,
1786 T::ResponseBody: Default,
1787 T: tonic::codegen::Service<
1788 http::Request<tonic::body::Body>,
1789 Response = http::Response<
1790 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1791 >,
1792 >,
1793 <T as tonic::codegen::Service<
1794 http::Request<tonic::body::Body>,
1795 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1796 {
1797 HealthCheckClient::new(InterceptedService::new(inner, interceptor))
1798 }
1799 #[must_use]
1804 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1805 self.inner = self.inner.send_compressed(encoding);
1806 self
1807 }
1808 #[must_use]
1810 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1811 self.inner = self.inner.accept_compressed(encoding);
1812 self
1813 }
1814 #[must_use]
1818 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1819 self.inner = self.inner.max_decoding_message_size(limit);
1820 self
1821 }
1822 #[must_use]
1826 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1827 self.inner = self.inner.max_encoding_message_size(limit);
1828 self
1829 }
1830 pub async fn health_check(
1831 &mut self,
1832 request: impl tonic::IntoRequest<super::HealthCheckRequest>,
1833 ) -> std::result::Result<
1834 tonic::Response<super::HealthCheckResponse>,
1835 tonic::Status,
1836 > {
1837 self.inner
1838 .ready()
1839 .await
1840 .map_err(|e| {
1841 tonic::Status::unknown(
1842 format!("Service was not ready: {}", e.into()),
1843 )
1844 })?;
1845 let codec = tonic_prost::ProstCodec::default();
1846 let path = http::uri::PathAndQuery::from_static(
1847 "/danube.HealthCheck/HealthCheck",
1848 );
1849 let mut req = request.into_request();
1850 req.extensions_mut()
1851 .insert(GrpcMethod::new("danube.HealthCheck", "HealthCheck"));
1852 self.inner.unary(req, path, codec).await
1853 }
1854 }
1855}
1856pub mod health_check_server {
1858 #![allow(
1859 unused_variables,
1860 dead_code,
1861 missing_docs,
1862 clippy::wildcard_imports,
1863 clippy::let_unit_value,
1864 )]
1865 use tonic::codegen::*;
1866 #[async_trait]
1868 pub trait HealthCheck: std::marker::Send + std::marker::Sync + 'static {
1869 async fn health_check(
1870 &self,
1871 request: tonic::Request<super::HealthCheckRequest>,
1872 ) -> std::result::Result<
1873 tonic::Response<super::HealthCheckResponse>,
1874 tonic::Status,
1875 >;
1876 }
1877 #[derive(Debug)]
1878 pub struct HealthCheckServer<T> {
1879 inner: Arc<T>,
1880 accept_compression_encodings: EnabledCompressionEncodings,
1881 send_compression_encodings: EnabledCompressionEncodings,
1882 max_decoding_message_size: Option<usize>,
1883 max_encoding_message_size: Option<usize>,
1884 }
1885 impl<T> HealthCheckServer<T> {
1886 pub fn new(inner: T) -> Self {
1887 Self::from_arc(Arc::new(inner))
1888 }
1889 pub fn from_arc(inner: Arc<T>) -> Self {
1890 Self {
1891 inner,
1892 accept_compression_encodings: Default::default(),
1893 send_compression_encodings: Default::default(),
1894 max_decoding_message_size: None,
1895 max_encoding_message_size: None,
1896 }
1897 }
1898 pub fn with_interceptor<F>(
1899 inner: T,
1900 interceptor: F,
1901 ) -> InterceptedService<Self, F>
1902 where
1903 F: tonic::service::Interceptor,
1904 {
1905 InterceptedService::new(Self::new(inner), interceptor)
1906 }
1907 #[must_use]
1909 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1910 self.accept_compression_encodings.enable(encoding);
1911 self
1912 }
1913 #[must_use]
1915 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1916 self.send_compression_encodings.enable(encoding);
1917 self
1918 }
1919 #[must_use]
1923 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1924 self.max_decoding_message_size = Some(limit);
1925 self
1926 }
1927 #[must_use]
1931 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1932 self.max_encoding_message_size = Some(limit);
1933 self
1934 }
1935 }
1936 impl<T, B> tonic::codegen::Service<http::Request<B>> for HealthCheckServer<T>
1937 where
1938 T: HealthCheck,
1939 B: Body + std::marker::Send + 'static,
1940 B::Error: Into<StdError> + std::marker::Send + 'static,
1941 {
1942 type Response = http::Response<tonic::body::Body>;
1943 type Error = std::convert::Infallible;
1944 type Future = BoxFuture<Self::Response, Self::Error>;
1945 fn poll_ready(
1946 &mut self,
1947 _cx: &mut Context<'_>,
1948 ) -> Poll<std::result::Result<(), Self::Error>> {
1949 Poll::Ready(Ok(()))
1950 }
1951 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1952 match req.uri().path() {
1953 "/danube.HealthCheck/HealthCheck" => {
1954 #[allow(non_camel_case_types)]
1955 struct HealthCheckSvc<T: HealthCheck>(pub Arc<T>);
1956 impl<
1957 T: HealthCheck,
1958 > tonic::server::UnaryService<super::HealthCheckRequest>
1959 for HealthCheckSvc<T> {
1960 type Response = super::HealthCheckResponse;
1961 type Future = BoxFuture<
1962 tonic::Response<Self::Response>,
1963 tonic::Status,
1964 >;
1965 fn call(
1966 &mut self,
1967 request: tonic::Request<super::HealthCheckRequest>,
1968 ) -> Self::Future {
1969 let inner = Arc::clone(&self.0);
1970 let fut = async move {
1971 <T as HealthCheck>::health_check(&inner, request).await
1972 };
1973 Box::pin(fut)
1974 }
1975 }
1976 let accept_compression_encodings = self.accept_compression_encodings;
1977 let send_compression_encodings = self.send_compression_encodings;
1978 let max_decoding_message_size = self.max_decoding_message_size;
1979 let max_encoding_message_size = self.max_encoding_message_size;
1980 let inner = self.inner.clone();
1981 let fut = async move {
1982 let method = HealthCheckSvc(inner);
1983 let codec = tonic_prost::ProstCodec::default();
1984 let mut grpc = tonic::server::Grpc::new(codec)
1985 .apply_compression_config(
1986 accept_compression_encodings,
1987 send_compression_encodings,
1988 )
1989 .apply_max_message_size_config(
1990 max_decoding_message_size,
1991 max_encoding_message_size,
1992 );
1993 let res = grpc.unary(method, req).await;
1994 Ok(res)
1995 };
1996 Box::pin(fut)
1997 }
1998 _ => {
1999 Box::pin(async move {
2000 let mut response = http::Response::new(
2001 tonic::body::Body::default(),
2002 );
2003 let headers = response.headers_mut();
2004 headers
2005 .insert(
2006 tonic::Status::GRPC_STATUS,
2007 (tonic::Code::Unimplemented as i32).into(),
2008 );
2009 headers
2010 .insert(
2011 http::header::CONTENT_TYPE,
2012 tonic::metadata::GRPC_CONTENT_TYPE,
2013 );
2014 Ok(response)
2015 })
2016 }
2017 }
2018 }
2019 }
2020 impl<T> Clone for HealthCheckServer<T> {
2021 fn clone(&self) -> Self {
2022 let inner = self.inner.clone();
2023 Self {
2024 inner,
2025 accept_compression_encodings: self.accept_compression_encodings,
2026 send_compression_encodings: self.send_compression_encodings,
2027 max_decoding_message_size: self.max_decoding_message_size,
2028 max_encoding_message_size: self.max_encoding_message_size,
2029 }
2030 }
2031 }
2032 pub const SERVICE_NAME: &str = "danube.HealthCheck";
2034 impl<T> tonic::server::NamedService for HealthCheckServer<T> {
2035 const NAME: &'static str = SERVICE_NAME;
2036 }
2037}