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