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, PartialEq, Eq, Hash, ::prost::Message)]
397pub struct ListSegmentDescriptorsRequest {
398 #[prost(string, tag = "1")]
400 pub topic: ::prost::alloc::string::String,
401 #[prost(uint64, tag = "2")]
403 pub after_offset: u64,
404}
405#[derive(Clone, PartialEq, ::prost::Message)]
406pub struct ListSegmentDescriptorsResponse {
407 #[prost(message, repeated, tag = "1")]
408 pub segments: ::prost::alloc::vec::Vec<SegmentDescriptorProto>,
409}
410#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
411pub struct SegmentDescriptorProto {
412 #[prost(string, tag = "1")]
413 pub segment_id: ::prost::alloc::string::String,
414 #[prost(uint64, tag = "2")]
415 pub start_offset: u64,
416 #[prost(uint64, tag = "3")]
417 pub end_offset: u64,
418 #[prost(uint64, tag = "4")]
419 pub size: u64,
420 #[prost(string, tag = "5")]
421 pub etag: ::prost::alloc::string::String,
422 #[prost(uint64, tag = "6")]
423 pub created_at: u64,
424}
425#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
426#[repr(i32)]
427pub enum ProducerAccessMode {
428 Shared = 0,
430 Exclusive = 1,
432}
433impl ProducerAccessMode {
434 pub fn as_str_name(&self) -> &'static str {
439 match self {
440 Self::Shared => "Shared",
441 Self::Exclusive => "Exclusive",
442 }
443 }
444 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
446 match value {
447 "Shared" => Some(Self::Shared),
448 "Exclusive" => Some(Self::Exclusive),
449 _ => None,
450 }
451 }
452}
453#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
454#[repr(i32)]
455pub enum DispatchStrategy {
456 NonReliable = 0,
457 Reliable = 1,
458}
459impl DispatchStrategy {
460 pub fn as_str_name(&self) -> &'static str {
465 match self {
466 Self::NonReliable => "NonReliable",
467 Self::Reliable => "Reliable",
468 }
469 }
470 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
472 match value {
473 "NonReliable" => Some(Self::NonReliable),
474 "Reliable" => Some(Self::Reliable),
475 _ => None,
476 }
477 }
478}
479pub mod producer_service_client {
481 #![allow(
482 unused_variables,
483 dead_code,
484 missing_docs,
485 clippy::wildcard_imports,
486 clippy::let_unit_value,
487 )]
488 use tonic::codegen::*;
489 use tonic::codegen::http::Uri;
490 #[derive(Debug, Clone)]
491 pub struct ProducerServiceClient<T> {
492 inner: tonic::client::Grpc<T>,
493 }
494 impl ProducerServiceClient<tonic::transport::Channel> {
495 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
497 where
498 D: TryInto<tonic::transport::Endpoint>,
499 D::Error: Into<StdError>,
500 {
501 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
502 Ok(Self::new(conn))
503 }
504 }
505 impl<T> ProducerServiceClient<T>
506 where
507 T: tonic::client::GrpcService<tonic::body::Body>,
508 T::Error: Into<StdError>,
509 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
510 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
511 {
512 pub fn new(inner: T) -> Self {
513 let inner = tonic::client::Grpc::new(inner);
514 Self { inner }
515 }
516 pub fn with_origin(inner: T, origin: Uri) -> Self {
517 let inner = tonic::client::Grpc::with_origin(inner, origin);
518 Self { inner }
519 }
520 pub fn with_interceptor<F>(
521 inner: T,
522 interceptor: F,
523 ) -> ProducerServiceClient<InterceptedService<T, F>>
524 where
525 F: tonic::service::Interceptor,
526 T::ResponseBody: Default,
527 T: tonic::codegen::Service<
528 http::Request<tonic::body::Body>,
529 Response = http::Response<
530 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
531 >,
532 >,
533 <T as tonic::codegen::Service<
534 http::Request<tonic::body::Body>,
535 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
536 {
537 ProducerServiceClient::new(InterceptedService::new(inner, interceptor))
538 }
539 #[must_use]
544 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
545 self.inner = self.inner.send_compressed(encoding);
546 self
547 }
548 #[must_use]
550 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
551 self.inner = self.inner.accept_compressed(encoding);
552 self
553 }
554 #[must_use]
558 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
559 self.inner = self.inner.max_decoding_message_size(limit);
560 self
561 }
562 #[must_use]
566 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
567 self.inner = self.inner.max_encoding_message_size(limit);
568 self
569 }
570 pub async fn create_producer(
572 &mut self,
573 request: impl tonic::IntoRequest<super::ProducerRequest>,
574 ) -> std::result::Result<
575 tonic::Response<super::ProducerResponse>,
576 tonic::Status,
577 > {
578 self.inner
579 .ready()
580 .await
581 .map_err(|e| {
582 tonic::Status::unknown(
583 format!("Service was not ready: {}", e.into()),
584 )
585 })?;
586 let codec = tonic_prost::ProstCodec::default();
587 let path = http::uri::PathAndQuery::from_static(
588 "/danube.ProducerService/CreateProducer",
589 );
590 let mut req = request.into_request();
591 req.extensions_mut()
592 .insert(GrpcMethod::new("danube.ProducerService", "CreateProducer"));
593 self.inner.unary(req, path, codec).await
594 }
595 pub async fn send_message(
597 &mut self,
598 request: impl tonic::IntoRequest<super::StreamMessage>,
599 ) -> std::result::Result<
600 tonic::Response<super::MessageResponse>,
601 tonic::Status,
602 > {
603 self.inner
604 .ready()
605 .await
606 .map_err(|e| {
607 tonic::Status::unknown(
608 format!("Service was not ready: {}", e.into()),
609 )
610 })?;
611 let codec = tonic_prost::ProstCodec::default();
612 let path = http::uri::PathAndQuery::from_static(
613 "/danube.ProducerService/SendMessage",
614 );
615 let mut req = request.into_request();
616 req.extensions_mut()
617 .insert(GrpcMethod::new("danube.ProducerService", "SendMessage"));
618 self.inner.unary(req, path, codec).await
619 }
620 }
621}
622pub mod producer_service_server {
624 #![allow(
625 unused_variables,
626 dead_code,
627 missing_docs,
628 clippy::wildcard_imports,
629 clippy::let_unit_value,
630 )]
631 use tonic::codegen::*;
632 #[async_trait]
634 pub trait ProducerService: std::marker::Send + std::marker::Sync + 'static {
635 async fn create_producer(
637 &self,
638 request: tonic::Request<super::ProducerRequest>,
639 ) -> std::result::Result<
640 tonic::Response<super::ProducerResponse>,
641 tonic::Status,
642 >;
643 async fn send_message(
645 &self,
646 request: tonic::Request<super::StreamMessage>,
647 ) -> std::result::Result<tonic::Response<super::MessageResponse>, tonic::Status>;
648 }
649 #[derive(Debug)]
650 pub struct ProducerServiceServer<T> {
651 inner: Arc<T>,
652 accept_compression_encodings: EnabledCompressionEncodings,
653 send_compression_encodings: EnabledCompressionEncodings,
654 max_decoding_message_size: Option<usize>,
655 max_encoding_message_size: Option<usize>,
656 }
657 impl<T> ProducerServiceServer<T> {
658 pub fn new(inner: T) -> Self {
659 Self::from_arc(Arc::new(inner))
660 }
661 pub fn from_arc(inner: Arc<T>) -> Self {
662 Self {
663 inner,
664 accept_compression_encodings: Default::default(),
665 send_compression_encodings: Default::default(),
666 max_decoding_message_size: None,
667 max_encoding_message_size: None,
668 }
669 }
670 pub fn with_interceptor<F>(
671 inner: T,
672 interceptor: F,
673 ) -> InterceptedService<Self, F>
674 where
675 F: tonic::service::Interceptor,
676 {
677 InterceptedService::new(Self::new(inner), interceptor)
678 }
679 #[must_use]
681 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
682 self.accept_compression_encodings.enable(encoding);
683 self
684 }
685 #[must_use]
687 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
688 self.send_compression_encodings.enable(encoding);
689 self
690 }
691 #[must_use]
695 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
696 self.max_decoding_message_size = Some(limit);
697 self
698 }
699 #[must_use]
703 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
704 self.max_encoding_message_size = Some(limit);
705 self
706 }
707 }
708 impl<T, B> tonic::codegen::Service<http::Request<B>> for ProducerServiceServer<T>
709 where
710 T: ProducerService,
711 B: Body + std::marker::Send + 'static,
712 B::Error: Into<StdError> + std::marker::Send + 'static,
713 {
714 type Response = http::Response<tonic::body::Body>;
715 type Error = std::convert::Infallible;
716 type Future = BoxFuture<Self::Response, Self::Error>;
717 fn poll_ready(
718 &mut self,
719 _cx: &mut Context<'_>,
720 ) -> Poll<std::result::Result<(), Self::Error>> {
721 Poll::Ready(Ok(()))
722 }
723 fn call(&mut self, req: http::Request<B>) -> Self::Future {
724 match req.uri().path() {
725 "/danube.ProducerService/CreateProducer" => {
726 #[allow(non_camel_case_types)]
727 struct CreateProducerSvc<T: ProducerService>(pub Arc<T>);
728 impl<
729 T: ProducerService,
730 > tonic::server::UnaryService<super::ProducerRequest>
731 for CreateProducerSvc<T> {
732 type Response = super::ProducerResponse;
733 type Future = BoxFuture<
734 tonic::Response<Self::Response>,
735 tonic::Status,
736 >;
737 fn call(
738 &mut self,
739 request: tonic::Request<super::ProducerRequest>,
740 ) -> Self::Future {
741 let inner = Arc::clone(&self.0);
742 let fut = async move {
743 <T as ProducerService>::create_producer(&inner, request)
744 .await
745 };
746 Box::pin(fut)
747 }
748 }
749 let accept_compression_encodings = self.accept_compression_encodings;
750 let send_compression_encodings = self.send_compression_encodings;
751 let max_decoding_message_size = self.max_decoding_message_size;
752 let max_encoding_message_size = self.max_encoding_message_size;
753 let inner = self.inner.clone();
754 let fut = async move {
755 let method = CreateProducerSvc(inner);
756 let codec = tonic_prost::ProstCodec::default();
757 let mut grpc = tonic::server::Grpc::new(codec)
758 .apply_compression_config(
759 accept_compression_encodings,
760 send_compression_encodings,
761 )
762 .apply_max_message_size_config(
763 max_decoding_message_size,
764 max_encoding_message_size,
765 );
766 let res = grpc.unary(method, req).await;
767 Ok(res)
768 };
769 Box::pin(fut)
770 }
771 "/danube.ProducerService/SendMessage" => {
772 #[allow(non_camel_case_types)]
773 struct SendMessageSvc<T: ProducerService>(pub Arc<T>);
774 impl<
775 T: ProducerService,
776 > tonic::server::UnaryService<super::StreamMessage>
777 for SendMessageSvc<T> {
778 type Response = super::MessageResponse;
779 type Future = BoxFuture<
780 tonic::Response<Self::Response>,
781 tonic::Status,
782 >;
783 fn call(
784 &mut self,
785 request: tonic::Request<super::StreamMessage>,
786 ) -> Self::Future {
787 let inner = Arc::clone(&self.0);
788 let fut = async move {
789 <T as ProducerService>::send_message(&inner, request).await
790 };
791 Box::pin(fut)
792 }
793 }
794 let accept_compression_encodings = self.accept_compression_encodings;
795 let send_compression_encodings = self.send_compression_encodings;
796 let max_decoding_message_size = self.max_decoding_message_size;
797 let max_encoding_message_size = self.max_encoding_message_size;
798 let inner = self.inner.clone();
799 let fut = async move {
800 let method = SendMessageSvc(inner);
801 let codec = tonic_prost::ProstCodec::default();
802 let mut grpc = tonic::server::Grpc::new(codec)
803 .apply_compression_config(
804 accept_compression_encodings,
805 send_compression_encodings,
806 )
807 .apply_max_message_size_config(
808 max_decoding_message_size,
809 max_encoding_message_size,
810 );
811 let res = grpc.unary(method, req).await;
812 Ok(res)
813 };
814 Box::pin(fut)
815 }
816 _ => {
817 Box::pin(async move {
818 let mut response = http::Response::new(
819 tonic::body::Body::default(),
820 );
821 let headers = response.headers_mut();
822 headers
823 .insert(
824 tonic::Status::GRPC_STATUS,
825 (tonic::Code::Unimplemented as i32).into(),
826 );
827 headers
828 .insert(
829 http::header::CONTENT_TYPE,
830 tonic::metadata::GRPC_CONTENT_TYPE,
831 );
832 Ok(response)
833 })
834 }
835 }
836 }
837 }
838 impl<T> Clone for ProducerServiceServer<T> {
839 fn clone(&self) -> Self {
840 let inner = self.inner.clone();
841 Self {
842 inner,
843 accept_compression_encodings: self.accept_compression_encodings,
844 send_compression_encodings: self.send_compression_encodings,
845 max_decoding_message_size: self.max_decoding_message_size,
846 max_encoding_message_size: self.max_encoding_message_size,
847 }
848 }
849 }
850 pub const SERVICE_NAME: &str = "danube.ProducerService";
852 impl<T> tonic::server::NamedService for ProducerServiceServer<T> {
853 const NAME: &'static str = SERVICE_NAME;
854 }
855}
856pub mod consumer_service_client {
858 #![allow(
859 unused_variables,
860 dead_code,
861 missing_docs,
862 clippy::wildcard_imports,
863 clippy::let_unit_value,
864 )]
865 use tonic::codegen::*;
866 use tonic::codegen::http::Uri;
867 #[derive(Debug, Clone)]
868 pub struct ConsumerServiceClient<T> {
869 inner: tonic::client::Grpc<T>,
870 }
871 impl ConsumerServiceClient<tonic::transport::Channel> {
872 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
874 where
875 D: TryInto<tonic::transport::Endpoint>,
876 D::Error: Into<StdError>,
877 {
878 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
879 Ok(Self::new(conn))
880 }
881 }
882 impl<T> ConsumerServiceClient<T>
883 where
884 T: tonic::client::GrpcService<tonic::body::Body>,
885 T::Error: Into<StdError>,
886 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
887 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
888 {
889 pub fn new(inner: T) -> Self {
890 let inner = tonic::client::Grpc::new(inner);
891 Self { inner }
892 }
893 pub fn with_origin(inner: T, origin: Uri) -> Self {
894 let inner = tonic::client::Grpc::with_origin(inner, origin);
895 Self { inner }
896 }
897 pub fn with_interceptor<F>(
898 inner: T,
899 interceptor: F,
900 ) -> ConsumerServiceClient<InterceptedService<T, F>>
901 where
902 F: tonic::service::Interceptor,
903 T::ResponseBody: Default,
904 T: tonic::codegen::Service<
905 http::Request<tonic::body::Body>,
906 Response = http::Response<
907 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
908 >,
909 >,
910 <T as tonic::codegen::Service<
911 http::Request<tonic::body::Body>,
912 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
913 {
914 ConsumerServiceClient::new(InterceptedService::new(inner, interceptor))
915 }
916 #[must_use]
921 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
922 self.inner = self.inner.send_compressed(encoding);
923 self
924 }
925 #[must_use]
927 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
928 self.inner = self.inner.accept_compressed(encoding);
929 self
930 }
931 #[must_use]
935 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
936 self.inner = self.inner.max_decoding_message_size(limit);
937 self
938 }
939 #[must_use]
943 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
944 self.inner = self.inner.max_encoding_message_size(limit);
945 self
946 }
947 pub async fn subscribe(
949 &mut self,
950 request: impl tonic::IntoRequest<super::ConsumerRequest>,
951 ) -> std::result::Result<
952 tonic::Response<super::ConsumerResponse>,
953 tonic::Status,
954 > {
955 self.inner
956 .ready()
957 .await
958 .map_err(|e| {
959 tonic::Status::unknown(
960 format!("Service was not ready: {}", e.into()),
961 )
962 })?;
963 let codec = tonic_prost::ProstCodec::default();
964 let path = http::uri::PathAndQuery::from_static(
965 "/danube.ConsumerService/Subscribe",
966 );
967 let mut req = request.into_request();
968 req.extensions_mut()
969 .insert(GrpcMethod::new("danube.ConsumerService", "Subscribe"));
970 self.inner.unary(req, path, codec).await
971 }
972 pub async fn receive_messages(
974 &mut self,
975 request: impl tonic::IntoRequest<super::ReceiveRequest>,
976 ) -> std::result::Result<
977 tonic::Response<tonic::codec::Streaming<super::StreamMessage>>,
978 tonic::Status,
979 > {
980 self.inner
981 .ready()
982 .await
983 .map_err(|e| {
984 tonic::Status::unknown(
985 format!("Service was not ready: {}", e.into()),
986 )
987 })?;
988 let codec = tonic_prost::ProstCodec::default();
989 let path = http::uri::PathAndQuery::from_static(
990 "/danube.ConsumerService/ReceiveMessages",
991 );
992 let mut req = request.into_request();
993 req.extensions_mut()
994 .insert(GrpcMethod::new("danube.ConsumerService", "ReceiveMessages"));
995 self.inner.server_streaming(req, path, codec).await
996 }
997 pub async fn ack(
999 &mut self,
1000 request: impl tonic::IntoRequest<super::AckRequest>,
1001 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status> {
1002 self.inner
1003 .ready()
1004 .await
1005 .map_err(|e| {
1006 tonic::Status::unknown(
1007 format!("Service was not ready: {}", e.into()),
1008 )
1009 })?;
1010 let codec = tonic_prost::ProstCodec::default();
1011 let path = http::uri::PathAndQuery::from_static(
1012 "/danube.ConsumerService/Ack",
1013 );
1014 let mut req = request.into_request();
1015 req.extensions_mut()
1016 .insert(GrpcMethod::new("danube.ConsumerService", "Ack"));
1017 self.inner.unary(req, path, codec).await
1018 }
1019 pub async fn nack(
1021 &mut self,
1022 request: impl tonic::IntoRequest<super::NackRequest>,
1023 ) -> std::result::Result<tonic::Response<super::NackResponse>, tonic::Status> {
1024 self.inner
1025 .ready()
1026 .await
1027 .map_err(|e| {
1028 tonic::Status::unknown(
1029 format!("Service was not ready: {}", e.into()),
1030 )
1031 })?;
1032 let codec = tonic_prost::ProstCodec::default();
1033 let path = http::uri::PathAndQuery::from_static(
1034 "/danube.ConsumerService/Nack",
1035 );
1036 let mut req = request.into_request();
1037 req.extensions_mut()
1038 .insert(GrpcMethod::new("danube.ConsumerService", "Nack"));
1039 self.inner.unary(req, path, codec).await
1040 }
1041 }
1042}
1043pub mod consumer_service_server {
1045 #![allow(
1046 unused_variables,
1047 dead_code,
1048 missing_docs,
1049 clippy::wildcard_imports,
1050 clippy::let_unit_value,
1051 )]
1052 use tonic::codegen::*;
1053 #[async_trait]
1055 pub trait ConsumerService: std::marker::Send + std::marker::Sync + 'static {
1056 async fn subscribe(
1058 &self,
1059 request: tonic::Request<super::ConsumerRequest>,
1060 ) -> std::result::Result<
1061 tonic::Response<super::ConsumerResponse>,
1062 tonic::Status,
1063 >;
1064 type ReceiveMessagesStream: tonic::codegen::tokio_stream::Stream<
1066 Item = std::result::Result<super::StreamMessage, tonic::Status>,
1067 >
1068 + std::marker::Send
1069 + 'static;
1070 async fn receive_messages(
1072 &self,
1073 request: tonic::Request<super::ReceiveRequest>,
1074 ) -> std::result::Result<
1075 tonic::Response<Self::ReceiveMessagesStream>,
1076 tonic::Status,
1077 >;
1078 async fn ack(
1080 &self,
1081 request: tonic::Request<super::AckRequest>,
1082 ) -> std::result::Result<tonic::Response<super::AckResponse>, tonic::Status>;
1083 async fn nack(
1085 &self,
1086 request: tonic::Request<super::NackRequest>,
1087 ) -> std::result::Result<tonic::Response<super::NackResponse>, tonic::Status>;
1088 }
1089 #[derive(Debug)]
1090 pub struct ConsumerServiceServer<T> {
1091 inner: Arc<T>,
1092 accept_compression_encodings: EnabledCompressionEncodings,
1093 send_compression_encodings: EnabledCompressionEncodings,
1094 max_decoding_message_size: Option<usize>,
1095 max_encoding_message_size: Option<usize>,
1096 }
1097 impl<T> ConsumerServiceServer<T> {
1098 pub fn new(inner: T) -> Self {
1099 Self::from_arc(Arc::new(inner))
1100 }
1101 pub fn from_arc(inner: Arc<T>) -> Self {
1102 Self {
1103 inner,
1104 accept_compression_encodings: Default::default(),
1105 send_compression_encodings: Default::default(),
1106 max_decoding_message_size: None,
1107 max_encoding_message_size: None,
1108 }
1109 }
1110 pub fn with_interceptor<F>(
1111 inner: T,
1112 interceptor: F,
1113 ) -> InterceptedService<Self, F>
1114 where
1115 F: tonic::service::Interceptor,
1116 {
1117 InterceptedService::new(Self::new(inner), interceptor)
1118 }
1119 #[must_use]
1121 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1122 self.accept_compression_encodings.enable(encoding);
1123 self
1124 }
1125 #[must_use]
1127 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1128 self.send_compression_encodings.enable(encoding);
1129 self
1130 }
1131 #[must_use]
1135 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1136 self.max_decoding_message_size = Some(limit);
1137 self
1138 }
1139 #[must_use]
1143 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1144 self.max_encoding_message_size = Some(limit);
1145 self
1146 }
1147 }
1148 impl<T, B> tonic::codegen::Service<http::Request<B>> for ConsumerServiceServer<T>
1149 where
1150 T: ConsumerService,
1151 B: Body + std::marker::Send + 'static,
1152 B::Error: Into<StdError> + std::marker::Send + 'static,
1153 {
1154 type Response = http::Response<tonic::body::Body>;
1155 type Error = std::convert::Infallible;
1156 type Future = BoxFuture<Self::Response, Self::Error>;
1157 fn poll_ready(
1158 &mut self,
1159 _cx: &mut Context<'_>,
1160 ) -> Poll<std::result::Result<(), Self::Error>> {
1161 Poll::Ready(Ok(()))
1162 }
1163 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1164 match req.uri().path() {
1165 "/danube.ConsumerService/Subscribe" => {
1166 #[allow(non_camel_case_types)]
1167 struct SubscribeSvc<T: ConsumerService>(pub Arc<T>);
1168 impl<
1169 T: ConsumerService,
1170 > tonic::server::UnaryService<super::ConsumerRequest>
1171 for SubscribeSvc<T> {
1172 type Response = super::ConsumerResponse;
1173 type Future = BoxFuture<
1174 tonic::Response<Self::Response>,
1175 tonic::Status,
1176 >;
1177 fn call(
1178 &mut self,
1179 request: tonic::Request<super::ConsumerRequest>,
1180 ) -> Self::Future {
1181 let inner = Arc::clone(&self.0);
1182 let fut = async move {
1183 <T as ConsumerService>::subscribe(&inner, request).await
1184 };
1185 Box::pin(fut)
1186 }
1187 }
1188 let accept_compression_encodings = self.accept_compression_encodings;
1189 let send_compression_encodings = self.send_compression_encodings;
1190 let max_decoding_message_size = self.max_decoding_message_size;
1191 let max_encoding_message_size = self.max_encoding_message_size;
1192 let inner = self.inner.clone();
1193 let fut = async move {
1194 let method = SubscribeSvc(inner);
1195 let codec = tonic_prost::ProstCodec::default();
1196 let mut grpc = tonic::server::Grpc::new(codec)
1197 .apply_compression_config(
1198 accept_compression_encodings,
1199 send_compression_encodings,
1200 )
1201 .apply_max_message_size_config(
1202 max_decoding_message_size,
1203 max_encoding_message_size,
1204 );
1205 let res = grpc.unary(method, req).await;
1206 Ok(res)
1207 };
1208 Box::pin(fut)
1209 }
1210 "/danube.ConsumerService/ReceiveMessages" => {
1211 #[allow(non_camel_case_types)]
1212 struct ReceiveMessagesSvc<T: ConsumerService>(pub Arc<T>);
1213 impl<
1214 T: ConsumerService,
1215 > tonic::server::ServerStreamingService<super::ReceiveRequest>
1216 for ReceiveMessagesSvc<T> {
1217 type Response = super::StreamMessage;
1218 type ResponseStream = T::ReceiveMessagesStream;
1219 type Future = BoxFuture<
1220 tonic::Response<Self::ResponseStream>,
1221 tonic::Status,
1222 >;
1223 fn call(
1224 &mut self,
1225 request: tonic::Request<super::ReceiveRequest>,
1226 ) -> Self::Future {
1227 let inner = Arc::clone(&self.0);
1228 let fut = async move {
1229 <T as ConsumerService>::receive_messages(&inner, request)
1230 .await
1231 };
1232 Box::pin(fut)
1233 }
1234 }
1235 let accept_compression_encodings = self.accept_compression_encodings;
1236 let send_compression_encodings = self.send_compression_encodings;
1237 let max_decoding_message_size = self.max_decoding_message_size;
1238 let max_encoding_message_size = self.max_encoding_message_size;
1239 let inner = self.inner.clone();
1240 let fut = async move {
1241 let method = ReceiveMessagesSvc(inner);
1242 let codec = tonic_prost::ProstCodec::default();
1243 let mut grpc = tonic::server::Grpc::new(codec)
1244 .apply_compression_config(
1245 accept_compression_encodings,
1246 send_compression_encodings,
1247 )
1248 .apply_max_message_size_config(
1249 max_decoding_message_size,
1250 max_encoding_message_size,
1251 );
1252 let res = grpc.server_streaming(method, req).await;
1253 Ok(res)
1254 };
1255 Box::pin(fut)
1256 }
1257 "/danube.ConsumerService/Ack" => {
1258 #[allow(non_camel_case_types)]
1259 struct AckSvc<T: ConsumerService>(pub Arc<T>);
1260 impl<
1261 T: ConsumerService,
1262 > tonic::server::UnaryService<super::AckRequest> for AckSvc<T> {
1263 type Response = super::AckResponse;
1264 type Future = BoxFuture<
1265 tonic::Response<Self::Response>,
1266 tonic::Status,
1267 >;
1268 fn call(
1269 &mut self,
1270 request: tonic::Request<super::AckRequest>,
1271 ) -> Self::Future {
1272 let inner = Arc::clone(&self.0);
1273 let fut = async move {
1274 <T as ConsumerService>::ack(&inner, request).await
1275 };
1276 Box::pin(fut)
1277 }
1278 }
1279 let accept_compression_encodings = self.accept_compression_encodings;
1280 let send_compression_encodings = self.send_compression_encodings;
1281 let max_decoding_message_size = self.max_decoding_message_size;
1282 let max_encoding_message_size = self.max_encoding_message_size;
1283 let inner = self.inner.clone();
1284 let fut = async move {
1285 let method = AckSvc(inner);
1286 let codec = tonic_prost::ProstCodec::default();
1287 let mut grpc = tonic::server::Grpc::new(codec)
1288 .apply_compression_config(
1289 accept_compression_encodings,
1290 send_compression_encodings,
1291 )
1292 .apply_max_message_size_config(
1293 max_decoding_message_size,
1294 max_encoding_message_size,
1295 );
1296 let res = grpc.unary(method, req).await;
1297 Ok(res)
1298 };
1299 Box::pin(fut)
1300 }
1301 "/danube.ConsumerService/Nack" => {
1302 #[allow(non_camel_case_types)]
1303 struct NackSvc<T: ConsumerService>(pub Arc<T>);
1304 impl<
1305 T: ConsumerService,
1306 > tonic::server::UnaryService<super::NackRequest> for NackSvc<T> {
1307 type Response = super::NackResponse;
1308 type Future = BoxFuture<
1309 tonic::Response<Self::Response>,
1310 tonic::Status,
1311 >;
1312 fn call(
1313 &mut self,
1314 request: tonic::Request<super::NackRequest>,
1315 ) -> Self::Future {
1316 let inner = Arc::clone(&self.0);
1317 let fut = async move {
1318 <T as ConsumerService>::nack(&inner, request).await
1319 };
1320 Box::pin(fut)
1321 }
1322 }
1323 let accept_compression_encodings = self.accept_compression_encodings;
1324 let send_compression_encodings = self.send_compression_encodings;
1325 let max_decoding_message_size = self.max_decoding_message_size;
1326 let max_encoding_message_size = self.max_encoding_message_size;
1327 let inner = self.inner.clone();
1328 let fut = async move {
1329 let method = NackSvc(inner);
1330 let codec = tonic_prost::ProstCodec::default();
1331 let mut grpc = tonic::server::Grpc::new(codec)
1332 .apply_compression_config(
1333 accept_compression_encodings,
1334 send_compression_encodings,
1335 )
1336 .apply_max_message_size_config(
1337 max_decoding_message_size,
1338 max_encoding_message_size,
1339 );
1340 let res = grpc.unary(method, req).await;
1341 Ok(res)
1342 };
1343 Box::pin(fut)
1344 }
1345 _ => {
1346 Box::pin(async move {
1347 let mut response = http::Response::new(
1348 tonic::body::Body::default(),
1349 );
1350 let headers = response.headers_mut();
1351 headers
1352 .insert(
1353 tonic::Status::GRPC_STATUS,
1354 (tonic::Code::Unimplemented as i32).into(),
1355 );
1356 headers
1357 .insert(
1358 http::header::CONTENT_TYPE,
1359 tonic::metadata::GRPC_CONTENT_TYPE,
1360 );
1361 Ok(response)
1362 })
1363 }
1364 }
1365 }
1366 }
1367 impl<T> Clone for ConsumerServiceServer<T> {
1368 fn clone(&self) -> Self {
1369 let inner = self.inner.clone();
1370 Self {
1371 inner,
1372 accept_compression_encodings: self.accept_compression_encodings,
1373 send_compression_encodings: self.send_compression_encodings,
1374 max_decoding_message_size: self.max_decoding_message_size,
1375 max_encoding_message_size: self.max_encoding_message_size,
1376 }
1377 }
1378 }
1379 pub const SERVICE_NAME: &str = "danube.ConsumerService";
1381 impl<T> tonic::server::NamedService for ConsumerServiceServer<T> {
1382 const NAME: &'static str = SERVICE_NAME;
1383 }
1384}
1385pub mod discovery_client {
1387 #![allow(
1388 unused_variables,
1389 dead_code,
1390 missing_docs,
1391 clippy::wildcard_imports,
1392 clippy::let_unit_value,
1393 )]
1394 use tonic::codegen::*;
1395 use tonic::codegen::http::Uri;
1396 #[derive(Debug, Clone)]
1397 pub struct DiscoveryClient<T> {
1398 inner: tonic::client::Grpc<T>,
1399 }
1400 impl DiscoveryClient<tonic::transport::Channel> {
1401 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1403 where
1404 D: TryInto<tonic::transport::Endpoint>,
1405 D::Error: Into<StdError>,
1406 {
1407 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1408 Ok(Self::new(conn))
1409 }
1410 }
1411 impl<T> DiscoveryClient<T>
1412 where
1413 T: tonic::client::GrpcService<tonic::body::Body>,
1414 T::Error: Into<StdError>,
1415 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1416 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1417 {
1418 pub fn new(inner: T) -> Self {
1419 let inner = tonic::client::Grpc::new(inner);
1420 Self { inner }
1421 }
1422 pub fn with_origin(inner: T, origin: Uri) -> Self {
1423 let inner = tonic::client::Grpc::with_origin(inner, origin);
1424 Self { inner }
1425 }
1426 pub fn with_interceptor<F>(
1427 inner: T,
1428 interceptor: F,
1429 ) -> DiscoveryClient<InterceptedService<T, F>>
1430 where
1431 F: tonic::service::Interceptor,
1432 T::ResponseBody: Default,
1433 T: tonic::codegen::Service<
1434 http::Request<tonic::body::Body>,
1435 Response = http::Response<
1436 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1437 >,
1438 >,
1439 <T as tonic::codegen::Service<
1440 http::Request<tonic::body::Body>,
1441 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1442 {
1443 DiscoveryClient::new(InterceptedService::new(inner, interceptor))
1444 }
1445 #[must_use]
1450 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1451 self.inner = self.inner.send_compressed(encoding);
1452 self
1453 }
1454 #[must_use]
1456 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1457 self.inner = self.inner.accept_compressed(encoding);
1458 self
1459 }
1460 #[must_use]
1464 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1465 self.inner = self.inner.max_decoding_message_size(limit);
1466 self
1467 }
1468 #[must_use]
1472 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1473 self.inner = self.inner.max_encoding_message_size(limit);
1474 self
1475 }
1476 pub async fn topic_lookup(
1479 &mut self,
1480 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1481 ) -> std::result::Result<
1482 tonic::Response<super::TopicLookupResponse>,
1483 tonic::Status,
1484 > {
1485 self.inner
1486 .ready()
1487 .await
1488 .map_err(|e| {
1489 tonic::Status::unknown(
1490 format!("Service was not ready: {}", e.into()),
1491 )
1492 })?;
1493 let codec = tonic_prost::ProstCodec::default();
1494 let path = http::uri::PathAndQuery::from_static(
1495 "/danube.Discovery/TopicLookup",
1496 );
1497 let mut req = request.into_request();
1498 req.extensions_mut()
1499 .insert(GrpcMethod::new("danube.Discovery", "TopicLookup"));
1500 self.inner.unary(req, path, codec).await
1501 }
1502 pub async fn topic_partitions(
1505 &mut self,
1506 request: impl tonic::IntoRequest<super::TopicLookupRequest>,
1507 ) -> std::result::Result<
1508 tonic::Response<super::TopicPartitionsResponse>,
1509 tonic::Status,
1510 > {
1511 self.inner
1512 .ready()
1513 .await
1514 .map_err(|e| {
1515 tonic::Status::unknown(
1516 format!("Service was not ready: {}", e.into()),
1517 )
1518 })?;
1519 let codec = tonic_prost::ProstCodec::default();
1520 let path = http::uri::PathAndQuery::from_static(
1521 "/danube.Discovery/TopicPartitions",
1522 );
1523 let mut req = request.into_request();
1524 req.extensions_mut()
1525 .insert(GrpcMethod::new("danube.Discovery", "TopicPartitions"));
1526 self.inner.unary(req, path, codec).await
1527 }
1528 }
1529}
1530pub mod discovery_server {
1532 #![allow(
1533 unused_variables,
1534 dead_code,
1535 missing_docs,
1536 clippy::wildcard_imports,
1537 clippy::let_unit_value,
1538 )]
1539 use tonic::codegen::*;
1540 #[async_trait]
1542 pub trait Discovery: std::marker::Send + std::marker::Sync + 'static {
1543 async fn topic_lookup(
1546 &self,
1547 request: tonic::Request<super::TopicLookupRequest>,
1548 ) -> std::result::Result<
1549 tonic::Response<super::TopicLookupResponse>,
1550 tonic::Status,
1551 >;
1552 async fn topic_partitions(
1555 &self,
1556 request: tonic::Request<super::TopicLookupRequest>,
1557 ) -> std::result::Result<
1558 tonic::Response<super::TopicPartitionsResponse>,
1559 tonic::Status,
1560 >;
1561 }
1562 #[derive(Debug)]
1563 pub struct DiscoveryServer<T> {
1564 inner: Arc<T>,
1565 accept_compression_encodings: EnabledCompressionEncodings,
1566 send_compression_encodings: EnabledCompressionEncodings,
1567 max_decoding_message_size: Option<usize>,
1568 max_encoding_message_size: Option<usize>,
1569 }
1570 impl<T> DiscoveryServer<T> {
1571 pub fn new(inner: T) -> Self {
1572 Self::from_arc(Arc::new(inner))
1573 }
1574 pub fn from_arc(inner: Arc<T>) -> Self {
1575 Self {
1576 inner,
1577 accept_compression_encodings: Default::default(),
1578 send_compression_encodings: Default::default(),
1579 max_decoding_message_size: None,
1580 max_encoding_message_size: None,
1581 }
1582 }
1583 pub fn with_interceptor<F>(
1584 inner: T,
1585 interceptor: F,
1586 ) -> InterceptedService<Self, F>
1587 where
1588 F: tonic::service::Interceptor,
1589 {
1590 InterceptedService::new(Self::new(inner), interceptor)
1591 }
1592 #[must_use]
1594 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1595 self.accept_compression_encodings.enable(encoding);
1596 self
1597 }
1598 #[must_use]
1600 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1601 self.send_compression_encodings.enable(encoding);
1602 self
1603 }
1604 #[must_use]
1608 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1609 self.max_decoding_message_size = Some(limit);
1610 self
1611 }
1612 #[must_use]
1616 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1617 self.max_encoding_message_size = Some(limit);
1618 self
1619 }
1620 }
1621 impl<T, B> tonic::codegen::Service<http::Request<B>> for DiscoveryServer<T>
1622 where
1623 T: Discovery,
1624 B: Body + std::marker::Send + 'static,
1625 B::Error: Into<StdError> + std::marker::Send + 'static,
1626 {
1627 type Response = http::Response<tonic::body::Body>;
1628 type Error = std::convert::Infallible;
1629 type Future = BoxFuture<Self::Response, Self::Error>;
1630 fn poll_ready(
1631 &mut self,
1632 _cx: &mut Context<'_>,
1633 ) -> Poll<std::result::Result<(), Self::Error>> {
1634 Poll::Ready(Ok(()))
1635 }
1636 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1637 match req.uri().path() {
1638 "/danube.Discovery/TopicLookup" => {
1639 #[allow(non_camel_case_types)]
1640 struct TopicLookupSvc<T: Discovery>(pub Arc<T>);
1641 impl<
1642 T: Discovery,
1643 > tonic::server::UnaryService<super::TopicLookupRequest>
1644 for TopicLookupSvc<T> {
1645 type Response = super::TopicLookupResponse;
1646 type Future = BoxFuture<
1647 tonic::Response<Self::Response>,
1648 tonic::Status,
1649 >;
1650 fn call(
1651 &mut self,
1652 request: tonic::Request<super::TopicLookupRequest>,
1653 ) -> Self::Future {
1654 let inner = Arc::clone(&self.0);
1655 let fut = async move {
1656 <T as Discovery>::topic_lookup(&inner, request).await
1657 };
1658 Box::pin(fut)
1659 }
1660 }
1661 let accept_compression_encodings = self.accept_compression_encodings;
1662 let send_compression_encodings = self.send_compression_encodings;
1663 let max_decoding_message_size = self.max_decoding_message_size;
1664 let max_encoding_message_size = self.max_encoding_message_size;
1665 let inner = self.inner.clone();
1666 let fut = async move {
1667 let method = TopicLookupSvc(inner);
1668 let codec = tonic_prost::ProstCodec::default();
1669 let mut grpc = tonic::server::Grpc::new(codec)
1670 .apply_compression_config(
1671 accept_compression_encodings,
1672 send_compression_encodings,
1673 )
1674 .apply_max_message_size_config(
1675 max_decoding_message_size,
1676 max_encoding_message_size,
1677 );
1678 let res = grpc.unary(method, req).await;
1679 Ok(res)
1680 };
1681 Box::pin(fut)
1682 }
1683 "/danube.Discovery/TopicPartitions" => {
1684 #[allow(non_camel_case_types)]
1685 struct TopicPartitionsSvc<T: Discovery>(pub Arc<T>);
1686 impl<
1687 T: Discovery,
1688 > tonic::server::UnaryService<super::TopicLookupRequest>
1689 for TopicPartitionsSvc<T> {
1690 type Response = super::TopicPartitionsResponse;
1691 type Future = BoxFuture<
1692 tonic::Response<Self::Response>,
1693 tonic::Status,
1694 >;
1695 fn call(
1696 &mut self,
1697 request: tonic::Request<super::TopicLookupRequest>,
1698 ) -> Self::Future {
1699 let inner = Arc::clone(&self.0);
1700 let fut = async move {
1701 <T as Discovery>::topic_partitions(&inner, request).await
1702 };
1703 Box::pin(fut)
1704 }
1705 }
1706 let accept_compression_encodings = self.accept_compression_encodings;
1707 let send_compression_encodings = self.send_compression_encodings;
1708 let max_decoding_message_size = self.max_decoding_message_size;
1709 let max_encoding_message_size = self.max_encoding_message_size;
1710 let inner = self.inner.clone();
1711 let fut = async move {
1712 let method = TopicPartitionsSvc(inner);
1713 let codec = tonic_prost::ProstCodec::default();
1714 let mut grpc = tonic::server::Grpc::new(codec)
1715 .apply_compression_config(
1716 accept_compression_encodings,
1717 send_compression_encodings,
1718 )
1719 .apply_max_message_size_config(
1720 max_decoding_message_size,
1721 max_encoding_message_size,
1722 );
1723 let res = grpc.unary(method, req).await;
1724 Ok(res)
1725 };
1726 Box::pin(fut)
1727 }
1728 _ => {
1729 Box::pin(async move {
1730 let mut response = http::Response::new(
1731 tonic::body::Body::default(),
1732 );
1733 let headers = response.headers_mut();
1734 headers
1735 .insert(
1736 tonic::Status::GRPC_STATUS,
1737 (tonic::Code::Unimplemented as i32).into(),
1738 );
1739 headers
1740 .insert(
1741 http::header::CONTENT_TYPE,
1742 tonic::metadata::GRPC_CONTENT_TYPE,
1743 );
1744 Ok(response)
1745 })
1746 }
1747 }
1748 }
1749 }
1750 impl<T> Clone for DiscoveryServer<T> {
1751 fn clone(&self) -> Self {
1752 let inner = self.inner.clone();
1753 Self {
1754 inner,
1755 accept_compression_encodings: self.accept_compression_encodings,
1756 send_compression_encodings: self.send_compression_encodings,
1757 max_decoding_message_size: self.max_decoding_message_size,
1758 max_encoding_message_size: self.max_encoding_message_size,
1759 }
1760 }
1761 }
1762 pub const SERVICE_NAME: &str = "danube.Discovery";
1764 impl<T> tonic::server::NamedService for DiscoveryServer<T> {
1765 const NAME: &'static str = SERVICE_NAME;
1766 }
1767}
1768pub mod health_check_client {
1770 #![allow(
1771 unused_variables,
1772 dead_code,
1773 missing_docs,
1774 clippy::wildcard_imports,
1775 clippy::let_unit_value,
1776 )]
1777 use tonic::codegen::*;
1778 use tonic::codegen::http::Uri;
1779 #[derive(Debug, Clone)]
1780 pub struct HealthCheckClient<T> {
1781 inner: tonic::client::Grpc<T>,
1782 }
1783 impl HealthCheckClient<tonic::transport::Channel> {
1784 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1786 where
1787 D: TryInto<tonic::transport::Endpoint>,
1788 D::Error: Into<StdError>,
1789 {
1790 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1791 Ok(Self::new(conn))
1792 }
1793 }
1794 impl<T> HealthCheckClient<T>
1795 where
1796 T: tonic::client::GrpcService<tonic::body::Body>,
1797 T::Error: Into<StdError>,
1798 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1799 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1800 {
1801 pub fn new(inner: T) -> Self {
1802 let inner = tonic::client::Grpc::new(inner);
1803 Self { inner }
1804 }
1805 pub fn with_origin(inner: T, origin: Uri) -> Self {
1806 let inner = tonic::client::Grpc::with_origin(inner, origin);
1807 Self { inner }
1808 }
1809 pub fn with_interceptor<F>(
1810 inner: T,
1811 interceptor: F,
1812 ) -> HealthCheckClient<InterceptedService<T, F>>
1813 where
1814 F: tonic::service::Interceptor,
1815 T::ResponseBody: Default,
1816 T: tonic::codegen::Service<
1817 http::Request<tonic::body::Body>,
1818 Response = http::Response<
1819 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1820 >,
1821 >,
1822 <T as tonic::codegen::Service<
1823 http::Request<tonic::body::Body>,
1824 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1825 {
1826 HealthCheckClient::new(InterceptedService::new(inner, interceptor))
1827 }
1828 #[must_use]
1833 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1834 self.inner = self.inner.send_compressed(encoding);
1835 self
1836 }
1837 #[must_use]
1839 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1840 self.inner = self.inner.accept_compressed(encoding);
1841 self
1842 }
1843 #[must_use]
1847 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1848 self.inner = self.inner.max_decoding_message_size(limit);
1849 self
1850 }
1851 #[must_use]
1855 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1856 self.inner = self.inner.max_encoding_message_size(limit);
1857 self
1858 }
1859 pub async fn health_check(
1860 &mut self,
1861 request: impl tonic::IntoRequest<super::HealthCheckRequest>,
1862 ) -> std::result::Result<
1863 tonic::Response<super::HealthCheckResponse>,
1864 tonic::Status,
1865 > {
1866 self.inner
1867 .ready()
1868 .await
1869 .map_err(|e| {
1870 tonic::Status::unknown(
1871 format!("Service was not ready: {}", e.into()),
1872 )
1873 })?;
1874 let codec = tonic_prost::ProstCodec::default();
1875 let path = http::uri::PathAndQuery::from_static(
1876 "/danube.HealthCheck/HealthCheck",
1877 );
1878 let mut req = request.into_request();
1879 req.extensions_mut()
1880 .insert(GrpcMethod::new("danube.HealthCheck", "HealthCheck"));
1881 self.inner.unary(req, path, codec).await
1882 }
1883 }
1884}
1885pub mod health_check_server {
1887 #![allow(
1888 unused_variables,
1889 dead_code,
1890 missing_docs,
1891 clippy::wildcard_imports,
1892 clippy::let_unit_value,
1893 )]
1894 use tonic::codegen::*;
1895 #[async_trait]
1897 pub trait HealthCheck: std::marker::Send + std::marker::Sync + 'static {
1898 async fn health_check(
1899 &self,
1900 request: tonic::Request<super::HealthCheckRequest>,
1901 ) -> std::result::Result<
1902 tonic::Response<super::HealthCheckResponse>,
1903 tonic::Status,
1904 >;
1905 }
1906 #[derive(Debug)]
1907 pub struct HealthCheckServer<T> {
1908 inner: Arc<T>,
1909 accept_compression_encodings: EnabledCompressionEncodings,
1910 send_compression_encodings: EnabledCompressionEncodings,
1911 max_decoding_message_size: Option<usize>,
1912 max_encoding_message_size: Option<usize>,
1913 }
1914 impl<T> HealthCheckServer<T> {
1915 pub fn new(inner: T) -> Self {
1916 Self::from_arc(Arc::new(inner))
1917 }
1918 pub fn from_arc(inner: Arc<T>) -> Self {
1919 Self {
1920 inner,
1921 accept_compression_encodings: Default::default(),
1922 send_compression_encodings: Default::default(),
1923 max_decoding_message_size: None,
1924 max_encoding_message_size: None,
1925 }
1926 }
1927 pub fn with_interceptor<F>(
1928 inner: T,
1929 interceptor: F,
1930 ) -> InterceptedService<Self, F>
1931 where
1932 F: tonic::service::Interceptor,
1933 {
1934 InterceptedService::new(Self::new(inner), interceptor)
1935 }
1936 #[must_use]
1938 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1939 self.accept_compression_encodings.enable(encoding);
1940 self
1941 }
1942 #[must_use]
1944 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1945 self.send_compression_encodings.enable(encoding);
1946 self
1947 }
1948 #[must_use]
1952 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1953 self.max_decoding_message_size = Some(limit);
1954 self
1955 }
1956 #[must_use]
1960 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1961 self.max_encoding_message_size = Some(limit);
1962 self
1963 }
1964 }
1965 impl<T, B> tonic::codegen::Service<http::Request<B>> for HealthCheckServer<T>
1966 where
1967 T: HealthCheck,
1968 B: Body + std::marker::Send + 'static,
1969 B::Error: Into<StdError> + std::marker::Send + 'static,
1970 {
1971 type Response = http::Response<tonic::body::Body>;
1972 type Error = std::convert::Infallible;
1973 type Future = BoxFuture<Self::Response, Self::Error>;
1974 fn poll_ready(
1975 &mut self,
1976 _cx: &mut Context<'_>,
1977 ) -> Poll<std::result::Result<(), Self::Error>> {
1978 Poll::Ready(Ok(()))
1979 }
1980 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1981 match req.uri().path() {
1982 "/danube.HealthCheck/HealthCheck" => {
1983 #[allow(non_camel_case_types)]
1984 struct HealthCheckSvc<T: HealthCheck>(pub Arc<T>);
1985 impl<
1986 T: HealthCheck,
1987 > tonic::server::UnaryService<super::HealthCheckRequest>
1988 for HealthCheckSvc<T> {
1989 type Response = super::HealthCheckResponse;
1990 type Future = BoxFuture<
1991 tonic::Response<Self::Response>,
1992 tonic::Status,
1993 >;
1994 fn call(
1995 &mut self,
1996 request: tonic::Request<super::HealthCheckRequest>,
1997 ) -> Self::Future {
1998 let inner = Arc::clone(&self.0);
1999 let fut = async move {
2000 <T as HealthCheck>::health_check(&inner, request).await
2001 };
2002 Box::pin(fut)
2003 }
2004 }
2005 let accept_compression_encodings = self.accept_compression_encodings;
2006 let send_compression_encodings = self.send_compression_encodings;
2007 let max_decoding_message_size = self.max_decoding_message_size;
2008 let max_encoding_message_size = self.max_encoding_message_size;
2009 let inner = self.inner.clone();
2010 let fut = async move {
2011 let method = HealthCheckSvc(inner);
2012 let codec = tonic_prost::ProstCodec::default();
2013 let mut grpc = tonic::server::Grpc::new(codec)
2014 .apply_compression_config(
2015 accept_compression_encodings,
2016 send_compression_encodings,
2017 )
2018 .apply_max_message_size_config(
2019 max_decoding_message_size,
2020 max_encoding_message_size,
2021 );
2022 let res = grpc.unary(method, req).await;
2023 Ok(res)
2024 };
2025 Box::pin(fut)
2026 }
2027 _ => {
2028 Box::pin(async move {
2029 let mut response = http::Response::new(
2030 tonic::body::Body::default(),
2031 );
2032 let headers = response.headers_mut();
2033 headers
2034 .insert(
2035 tonic::Status::GRPC_STATUS,
2036 (tonic::Code::Unimplemented as i32).into(),
2037 );
2038 headers
2039 .insert(
2040 http::header::CONTENT_TYPE,
2041 tonic::metadata::GRPC_CONTENT_TYPE,
2042 );
2043 Ok(response)
2044 })
2045 }
2046 }
2047 }
2048 }
2049 impl<T> Clone for HealthCheckServer<T> {
2050 fn clone(&self) -> Self {
2051 let inner = self.inner.clone();
2052 Self {
2053 inner,
2054 accept_compression_encodings: self.accept_compression_encodings,
2055 send_compression_encodings: self.send_compression_encodings,
2056 max_decoding_message_size: self.max_decoding_message_size,
2057 max_encoding_message_size: self.max_encoding_message_size,
2058 }
2059 }
2060 }
2061 pub const SERVICE_NAME: &str = "danube.HealthCheck";
2063 impl<T> tonic::server::NamedService for HealthCheckServer<T> {
2064 const NAME: &'static str = SERVICE_NAME;
2065 }
2066}
2067pub mod storage_service_client {
2069 #![allow(
2070 unused_variables,
2071 dead_code,
2072 missing_docs,
2073 clippy::wildcard_imports,
2074 clippy::let_unit_value,
2075 )]
2076 use tonic::codegen::*;
2077 use tonic::codegen::http::Uri;
2078 #[derive(Debug, Clone)]
2080 pub struct StorageServiceClient<T> {
2081 inner: tonic::client::Grpc<T>,
2082 }
2083 impl StorageServiceClient<tonic::transport::Channel> {
2084 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2086 where
2087 D: TryInto<tonic::transport::Endpoint>,
2088 D::Error: Into<StdError>,
2089 {
2090 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2091 Ok(Self::new(conn))
2092 }
2093 }
2094 impl<T> StorageServiceClient<T>
2095 where
2096 T: tonic::client::GrpcService<tonic::body::Body>,
2097 T::Error: Into<StdError>,
2098 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2099 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2100 {
2101 pub fn new(inner: T) -> Self {
2102 let inner = tonic::client::Grpc::new(inner);
2103 Self { inner }
2104 }
2105 pub fn with_origin(inner: T, origin: Uri) -> Self {
2106 let inner = tonic::client::Grpc::with_origin(inner, origin);
2107 Self { inner }
2108 }
2109 pub fn with_interceptor<F>(
2110 inner: T,
2111 interceptor: F,
2112 ) -> StorageServiceClient<InterceptedService<T, F>>
2113 where
2114 F: tonic::service::Interceptor,
2115 T::ResponseBody: Default,
2116 T: tonic::codegen::Service<
2117 http::Request<tonic::body::Body>,
2118 Response = http::Response<
2119 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2120 >,
2121 >,
2122 <T as tonic::codegen::Service<
2123 http::Request<tonic::body::Body>,
2124 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2125 {
2126 StorageServiceClient::new(InterceptedService::new(inner, interceptor))
2127 }
2128 #[must_use]
2133 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2134 self.inner = self.inner.send_compressed(encoding);
2135 self
2136 }
2137 #[must_use]
2139 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2140 self.inner = self.inner.accept_compressed(encoding);
2141 self
2142 }
2143 #[must_use]
2147 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2148 self.inner = self.inner.max_decoding_message_size(limit);
2149 self
2150 }
2151 #[must_use]
2155 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2156 self.inner = self.inner.max_encoding_message_size(limit);
2157 self
2158 }
2159 pub async fn list_segment_descriptors(
2162 &mut self,
2163 request: impl tonic::IntoRequest<super::ListSegmentDescriptorsRequest>,
2164 ) -> std::result::Result<
2165 tonic::Response<super::ListSegmentDescriptorsResponse>,
2166 tonic::Status,
2167 > {
2168 self.inner
2169 .ready()
2170 .await
2171 .map_err(|e| {
2172 tonic::Status::unknown(
2173 format!("Service was not ready: {}", e.into()),
2174 )
2175 })?;
2176 let codec = tonic_prost::ProstCodec::default();
2177 let path = http::uri::PathAndQuery::from_static(
2178 "/danube.StorageService/ListSegmentDescriptors",
2179 );
2180 let mut req = request.into_request();
2181 req.extensions_mut()
2182 .insert(
2183 GrpcMethod::new("danube.StorageService", "ListSegmentDescriptors"),
2184 );
2185 self.inner.unary(req, path, codec).await
2186 }
2187 }
2188}
2189pub mod storage_service_server {
2191 #![allow(
2192 unused_variables,
2193 dead_code,
2194 missing_docs,
2195 clippy::wildcard_imports,
2196 clippy::let_unit_value,
2197 )]
2198 use tonic::codegen::*;
2199 #[async_trait]
2201 pub trait StorageService: std::marker::Send + std::marker::Sync + 'static {
2202 async fn list_segment_descriptors(
2205 &self,
2206 request: tonic::Request<super::ListSegmentDescriptorsRequest>,
2207 ) -> std::result::Result<
2208 tonic::Response<super::ListSegmentDescriptorsResponse>,
2209 tonic::Status,
2210 >;
2211 }
2212 #[derive(Debug)]
2214 pub struct StorageServiceServer<T> {
2215 inner: Arc<T>,
2216 accept_compression_encodings: EnabledCompressionEncodings,
2217 send_compression_encodings: EnabledCompressionEncodings,
2218 max_decoding_message_size: Option<usize>,
2219 max_encoding_message_size: Option<usize>,
2220 }
2221 impl<T> StorageServiceServer<T> {
2222 pub fn new(inner: T) -> Self {
2223 Self::from_arc(Arc::new(inner))
2224 }
2225 pub fn from_arc(inner: Arc<T>) -> Self {
2226 Self {
2227 inner,
2228 accept_compression_encodings: Default::default(),
2229 send_compression_encodings: Default::default(),
2230 max_decoding_message_size: None,
2231 max_encoding_message_size: None,
2232 }
2233 }
2234 pub fn with_interceptor<F>(
2235 inner: T,
2236 interceptor: F,
2237 ) -> InterceptedService<Self, F>
2238 where
2239 F: tonic::service::Interceptor,
2240 {
2241 InterceptedService::new(Self::new(inner), interceptor)
2242 }
2243 #[must_use]
2245 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2246 self.accept_compression_encodings.enable(encoding);
2247 self
2248 }
2249 #[must_use]
2251 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2252 self.send_compression_encodings.enable(encoding);
2253 self
2254 }
2255 #[must_use]
2259 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2260 self.max_decoding_message_size = Some(limit);
2261 self
2262 }
2263 #[must_use]
2267 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2268 self.max_encoding_message_size = Some(limit);
2269 self
2270 }
2271 }
2272 impl<T, B> tonic::codegen::Service<http::Request<B>> for StorageServiceServer<T>
2273 where
2274 T: StorageService,
2275 B: Body + std::marker::Send + 'static,
2276 B::Error: Into<StdError> + std::marker::Send + 'static,
2277 {
2278 type Response = http::Response<tonic::body::Body>;
2279 type Error = std::convert::Infallible;
2280 type Future = BoxFuture<Self::Response, Self::Error>;
2281 fn poll_ready(
2282 &mut self,
2283 _cx: &mut Context<'_>,
2284 ) -> Poll<std::result::Result<(), Self::Error>> {
2285 Poll::Ready(Ok(()))
2286 }
2287 fn call(&mut self, req: http::Request<B>) -> Self::Future {
2288 match req.uri().path() {
2289 "/danube.StorageService/ListSegmentDescriptors" => {
2290 #[allow(non_camel_case_types)]
2291 struct ListSegmentDescriptorsSvc<T: StorageService>(pub Arc<T>);
2292 impl<
2293 T: StorageService,
2294 > tonic::server::UnaryService<super::ListSegmentDescriptorsRequest>
2295 for ListSegmentDescriptorsSvc<T> {
2296 type Response = super::ListSegmentDescriptorsResponse;
2297 type Future = BoxFuture<
2298 tonic::Response<Self::Response>,
2299 tonic::Status,
2300 >;
2301 fn call(
2302 &mut self,
2303 request: tonic::Request<super::ListSegmentDescriptorsRequest>,
2304 ) -> Self::Future {
2305 let inner = Arc::clone(&self.0);
2306 let fut = async move {
2307 <T as StorageService>::list_segment_descriptors(
2308 &inner,
2309 request,
2310 )
2311 .await
2312 };
2313 Box::pin(fut)
2314 }
2315 }
2316 let accept_compression_encodings = self.accept_compression_encodings;
2317 let send_compression_encodings = self.send_compression_encodings;
2318 let max_decoding_message_size = self.max_decoding_message_size;
2319 let max_encoding_message_size = self.max_encoding_message_size;
2320 let inner = self.inner.clone();
2321 let fut = async move {
2322 let method = ListSegmentDescriptorsSvc(inner);
2323 let codec = tonic_prost::ProstCodec::default();
2324 let mut grpc = tonic::server::Grpc::new(codec)
2325 .apply_compression_config(
2326 accept_compression_encodings,
2327 send_compression_encodings,
2328 )
2329 .apply_max_message_size_config(
2330 max_decoding_message_size,
2331 max_encoding_message_size,
2332 );
2333 let res = grpc.unary(method, req).await;
2334 Ok(res)
2335 };
2336 Box::pin(fut)
2337 }
2338 _ => {
2339 Box::pin(async move {
2340 let mut response = http::Response::new(
2341 tonic::body::Body::default(),
2342 );
2343 let headers = response.headers_mut();
2344 headers
2345 .insert(
2346 tonic::Status::GRPC_STATUS,
2347 (tonic::Code::Unimplemented as i32).into(),
2348 );
2349 headers
2350 .insert(
2351 http::header::CONTENT_TYPE,
2352 tonic::metadata::GRPC_CONTENT_TYPE,
2353 );
2354 Ok(response)
2355 })
2356 }
2357 }
2358 }
2359 }
2360 impl<T> Clone for StorageServiceServer<T> {
2361 fn clone(&self) -> Self {
2362 let inner = self.inner.clone();
2363 Self {
2364 inner,
2365 accept_compression_encodings: self.accept_compression_encodings,
2366 send_compression_encodings: self.send_compression_encodings,
2367 max_decoding_message_size: self.max_decoding_message_size,
2368 max_encoding_message_size: self.max_encoding_message_size,
2369 }
2370 }
2371 }
2372 pub const SERVICE_NAME: &str = "danube.StorageService";
2374 impl<T> tonic::server::NamedService for StorageServiceServer<T> {
2375 const NAME: &'static str = SERVICE_NAME;
2376 }
2377}