1#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct Empty {}
5#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6pub struct NamespaceRequest {
7 #[prost(string, tag = "1")]
8 pub name: ::prost::alloc::string::String,
9}
10#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
11pub struct NamespaceResponse {
12 #[prost(bool, tag = "1")]
13 pub success: bool,
14}
15#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
16pub struct NewTopicRequest {
17 #[prost(string, tag = "1")]
18 pub name: ::prost::alloc::string::String,
19 #[prost(string, optional, tag = "2")]
21 pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
22 #[prost(enumeration = "DispatchStrategy", tag = "3")]
23 pub dispatch_strategy: i32,
24}
25#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
26pub struct TopicRequest {
27 #[prost(string, tag = "1")]
28 pub name: ::prost::alloc::string::String,
29}
30#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
31pub struct TopicResponse {
32 #[prost(bool, tag = "1")]
33 pub success: bool,
34}
35#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
36pub struct PartitionedTopicRequest {
37 #[prost(string, tag = "1")]
39 pub base_name: ::prost::alloc::string::String,
40 #[prost(uint32, tag = "2")]
42 pub partitions: u32,
43 #[prost(string, optional, tag = "3")]
45 pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
46 #[prost(enumeration = "DispatchStrategy", tag = "4")]
47 pub dispatch_strategy: i32,
48}
49#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
50pub struct SubscriptionRequest {
51 #[prost(string, tag = "1")]
52 pub topic: ::prost::alloc::string::String,
53 #[prost(string, tag = "2")]
54 pub subscription: ::prost::alloc::string::String,
55}
56#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
57pub struct SubscriptionResponse {
58 #[prost(bool, tag = "1")]
59 pub success: bool,
60}
61#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct BrokerListResponse {
64 #[prost(message, repeated, tag = "1")]
65 pub brokers: ::prost::alloc::vec::Vec<BrokerInfo>,
66}
67#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
68pub struct BrokerInfo {
69 #[prost(string, tag = "1")]
70 pub broker_id: ::prost::alloc::string::String,
71 #[prost(string, tag = "2")]
72 pub broker_addr: ::prost::alloc::string::String,
73 #[prost(string, tag = "3")]
74 pub broker_role: ::prost::alloc::string::String,
75 #[prost(string, tag = "4")]
76 pub admin_addr: ::prost::alloc::string::String,
77 #[prost(string, tag = "5")]
78 pub metrics_addr: ::prost::alloc::string::String,
79 #[prost(string, tag = "6")]
80 pub broker_status: ::prost::alloc::string::String,
81}
82#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
83pub struct BrokerResponse {
84 #[prost(string, tag = "1")]
85 pub leader: ::prost::alloc::string::String,
86}
87#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
88pub struct NamespaceListResponse {
89 #[prost(string, repeated, tag = "1")]
90 pub namespaces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
91}
92#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
93pub struct TopicListResponse {
94 #[prost(string, repeated, tag = "1")]
95 pub topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
96}
97#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
99pub struct TopicInfo {
100 #[prost(string, tag = "1")]
102 pub name: ::prost::alloc::string::String,
103 #[prost(string, tag = "2")]
105 pub broker_id: ::prost::alloc::string::String,
106 #[prost(string, tag = "3")]
108 pub delivery: ::prost::alloc::string::String,
109}
110#[derive(Clone, PartialEq, ::prost::Message)]
111pub struct TopicInfoListResponse {
112 #[prost(message, repeated, tag = "1")]
113 pub topics: ::prost::alloc::vec::Vec<TopicInfo>,
114}
115#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
117pub struct BrokerRequest {
118 #[prost(string, tag = "1")]
119 pub broker_id: ::prost::alloc::string::String,
120}
121#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
122pub struct PolicyResponse {
123 #[prost(string, tag = "1")]
124 pub policies: ::prost::alloc::string::String,
125}
126#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
127pub struct SubscriptionListResponse {
128 #[prost(string, repeated, tag = "1")]
129 pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
130}
131#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
133pub struct DescribeTopicRequest {
134 #[prost(string, tag = "1")]
136 pub name: ::prost::alloc::string::String,
137}
138#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
139pub struct DescribeTopicResponse {
140 #[prost(string, tag = "1")]
141 pub name: ::prost::alloc::string::String,
142 #[prost(string, repeated, tag = "2")]
143 pub subscriptions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
144 #[prost(string, tag = "3")]
145 pub broker_id: ::prost::alloc::string::String,
146 #[prost(string, tag = "4")]
148 pub delivery: ::prost::alloc::string::String,
149 #[prost(string, optional, tag = "5")]
153 pub schema_subject: ::core::option::Option<::prost::alloc::string::String>,
154 #[prost(uint64, optional, tag = "6")]
156 pub schema_id: ::core::option::Option<u64>,
157 #[prost(uint32, optional, tag = "7")]
159 pub schema_version: ::core::option::Option<u32>,
160 #[prost(string, optional, tag = "8")]
162 pub schema_type: ::core::option::Option<::prost::alloc::string::String>,
163 #[prost(string, optional, tag = "9")]
165 pub compatibility_mode: ::core::option::Option<::prost::alloc::string::String>,
166}
167#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
169pub struct UnloadBrokerRequest {
170 #[prost(string, tag = "1")]
172 pub broker_id: ::prost::alloc::string::String,
173 #[prost(uint32, tag = "2")]
175 pub max_parallel: u32,
176 #[prost(string, repeated, tag = "3")]
178 pub namespaces_include: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
179 #[prost(string, repeated, tag = "4")]
180 pub namespaces_exclude: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
181 #[prost(bool, tag = "5")]
183 pub dry_run: bool,
184 #[prost(uint32, tag = "6")]
186 pub timeout_seconds: u32,
187}
188#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
189pub struct UnloadBrokerResponse {
190 #[prost(bool, tag = "1")]
192 pub started: bool,
193 #[prost(uint32, tag = "2")]
194 pub total: u32,
195 #[prost(uint32, tag = "3")]
196 pub succeeded: u32,
197 #[prost(uint32, tag = "4")]
198 pub failed: u32,
199 #[prost(uint32, tag = "5")]
200 pub pending: u32,
201 #[prost(string, repeated, tag = "6")]
202 pub failed_topics: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
203}
204#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
206pub struct ActivateBrokerRequest {
207 #[prost(string, tag = "1")]
209 pub broker_id: ::prost::alloc::string::String,
210 #[prost(string, tag = "2")]
212 pub reason: ::prost::alloc::string::String,
213}
214#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
215pub struct ActivateBrokerResponse {
216 #[prost(bool, tag = "1")]
217 pub success: bool,
218}
219#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
221#[repr(i32)]
222pub enum DispatchStrategy {
223 NonReliable = 0,
224 Reliable = 1,
225}
226impl DispatchStrategy {
227 pub fn as_str_name(&self) -> &'static str {
232 match self {
233 Self::NonReliable => "NonReliable",
234 Self::Reliable => "Reliable",
235 }
236 }
237 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
239 match value {
240 "NonReliable" => Some(Self::NonReliable),
241 "Reliable" => Some(Self::Reliable),
242 _ => None,
243 }
244 }
245}
246pub mod broker_admin_client {
248 #![allow(
249 unused_variables,
250 dead_code,
251 missing_docs,
252 clippy::wildcard_imports,
253 clippy::let_unit_value,
254 )]
255 use tonic::codegen::*;
256 use tonic::codegen::http::Uri;
257 #[derive(Debug, Clone)]
258 pub struct BrokerAdminClient<T> {
259 inner: tonic::client::Grpc<T>,
260 }
261 impl BrokerAdminClient<tonic::transport::Channel> {
262 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
264 where
265 D: TryInto<tonic::transport::Endpoint>,
266 D::Error: Into<StdError>,
267 {
268 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
269 Ok(Self::new(conn))
270 }
271 }
272 impl<T> BrokerAdminClient<T>
273 where
274 T: tonic::client::GrpcService<tonic::body::Body>,
275 T::Error: Into<StdError>,
276 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
277 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
278 {
279 pub fn new(inner: T) -> Self {
280 let inner = tonic::client::Grpc::new(inner);
281 Self { inner }
282 }
283 pub fn with_origin(inner: T, origin: Uri) -> Self {
284 let inner = tonic::client::Grpc::with_origin(inner, origin);
285 Self { inner }
286 }
287 pub fn with_interceptor<F>(
288 inner: T,
289 interceptor: F,
290 ) -> BrokerAdminClient<InterceptedService<T, F>>
291 where
292 F: tonic::service::Interceptor,
293 T::ResponseBody: Default,
294 T: tonic::codegen::Service<
295 http::Request<tonic::body::Body>,
296 Response = http::Response<
297 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
298 >,
299 >,
300 <T as tonic::codegen::Service<
301 http::Request<tonic::body::Body>,
302 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
303 {
304 BrokerAdminClient::new(InterceptedService::new(inner, interceptor))
305 }
306 #[must_use]
311 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
312 self.inner = self.inner.send_compressed(encoding);
313 self
314 }
315 #[must_use]
317 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
318 self.inner = self.inner.accept_compressed(encoding);
319 self
320 }
321 #[must_use]
325 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
326 self.inner = self.inner.max_decoding_message_size(limit);
327 self
328 }
329 #[must_use]
333 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
334 self.inner = self.inner.max_encoding_message_size(limit);
335 self
336 }
337 pub async fn list_brokers(
339 &mut self,
340 request: impl tonic::IntoRequest<super::Empty>,
341 ) -> std::result::Result<
342 tonic::Response<super::BrokerListResponse>,
343 tonic::Status,
344 > {
345 self.inner
346 .ready()
347 .await
348 .map_err(|e| {
349 tonic::Status::unknown(
350 format!("Service was not ready: {}", e.into()),
351 )
352 })?;
353 let codec = tonic_prost::ProstCodec::default();
354 let path = http::uri::PathAndQuery::from_static(
355 "/danube_admin.BrokerAdmin/ListBrokers",
356 );
357 let mut req = request.into_request();
358 req.extensions_mut()
359 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ListBrokers"));
360 self.inner.unary(req, path, codec).await
361 }
362 pub async fn get_leader_broker(
363 &mut self,
364 request: impl tonic::IntoRequest<super::Empty>,
365 ) -> std::result::Result<tonic::Response<super::BrokerResponse>, tonic::Status> {
366 self.inner
367 .ready()
368 .await
369 .map_err(|e| {
370 tonic::Status::unknown(
371 format!("Service was not ready: {}", e.into()),
372 )
373 })?;
374 let codec = tonic_prost::ProstCodec::default();
375 let path = http::uri::PathAndQuery::from_static(
376 "/danube_admin.BrokerAdmin/GetLeaderBroker",
377 );
378 let mut req = request.into_request();
379 req.extensions_mut()
380 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "GetLeaderBroker"));
381 self.inner.unary(req, path, codec).await
382 }
383 pub async fn list_namespaces(
384 &mut self,
385 request: impl tonic::IntoRequest<super::Empty>,
386 ) -> std::result::Result<
387 tonic::Response<super::NamespaceListResponse>,
388 tonic::Status,
389 > {
390 self.inner
391 .ready()
392 .await
393 .map_err(|e| {
394 tonic::Status::unknown(
395 format!("Service was not ready: {}", e.into()),
396 )
397 })?;
398 let codec = tonic_prost::ProstCodec::default();
399 let path = http::uri::PathAndQuery::from_static(
400 "/danube_admin.BrokerAdmin/ListNamespaces",
401 );
402 let mut req = request.into_request();
403 req.extensions_mut()
404 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ListNamespaces"));
405 self.inner.unary(req, path, codec).await
406 }
407 pub async fn unload_broker(
408 &mut self,
409 request: impl tonic::IntoRequest<super::UnloadBrokerRequest>,
410 ) -> std::result::Result<
411 tonic::Response<super::UnloadBrokerResponse>,
412 tonic::Status,
413 > {
414 self.inner
415 .ready()
416 .await
417 .map_err(|e| {
418 tonic::Status::unknown(
419 format!("Service was not ready: {}", e.into()),
420 )
421 })?;
422 let codec = tonic_prost::ProstCodec::default();
423 let path = http::uri::PathAndQuery::from_static(
424 "/danube_admin.BrokerAdmin/UnloadBroker",
425 );
426 let mut req = request.into_request();
427 req.extensions_mut()
428 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "UnloadBroker"));
429 self.inner.unary(req, path, codec).await
430 }
431 pub async fn activate_broker(
432 &mut self,
433 request: impl tonic::IntoRequest<super::ActivateBrokerRequest>,
434 ) -> std::result::Result<
435 tonic::Response<super::ActivateBrokerResponse>,
436 tonic::Status,
437 > {
438 self.inner
439 .ready()
440 .await
441 .map_err(|e| {
442 tonic::Status::unknown(
443 format!("Service was not ready: {}", e.into()),
444 )
445 })?;
446 let codec = tonic_prost::ProstCodec::default();
447 let path = http::uri::PathAndQuery::from_static(
448 "/danube_admin.BrokerAdmin/ActivateBroker",
449 );
450 let mut req = request.into_request();
451 req.extensions_mut()
452 .insert(GrpcMethod::new("danube_admin.BrokerAdmin", "ActivateBroker"));
453 self.inner.unary(req, path, codec).await
454 }
455 }
456}
457pub mod broker_admin_server {
459 #![allow(
460 unused_variables,
461 dead_code,
462 missing_docs,
463 clippy::wildcard_imports,
464 clippy::let_unit_value,
465 )]
466 use tonic::codegen::*;
467 #[async_trait]
469 pub trait BrokerAdmin: std::marker::Send + std::marker::Sync + 'static {
470 async fn list_brokers(
472 &self,
473 request: tonic::Request<super::Empty>,
474 ) -> std::result::Result<
475 tonic::Response<super::BrokerListResponse>,
476 tonic::Status,
477 >;
478 async fn get_leader_broker(
479 &self,
480 request: tonic::Request<super::Empty>,
481 ) -> std::result::Result<tonic::Response<super::BrokerResponse>, tonic::Status>;
482 async fn list_namespaces(
483 &self,
484 request: tonic::Request<super::Empty>,
485 ) -> std::result::Result<
486 tonic::Response<super::NamespaceListResponse>,
487 tonic::Status,
488 >;
489 async fn unload_broker(
490 &self,
491 request: tonic::Request<super::UnloadBrokerRequest>,
492 ) -> std::result::Result<
493 tonic::Response<super::UnloadBrokerResponse>,
494 tonic::Status,
495 >;
496 async fn activate_broker(
497 &self,
498 request: tonic::Request<super::ActivateBrokerRequest>,
499 ) -> std::result::Result<
500 tonic::Response<super::ActivateBrokerResponse>,
501 tonic::Status,
502 >;
503 }
504 #[derive(Debug)]
505 pub struct BrokerAdminServer<T> {
506 inner: Arc<T>,
507 accept_compression_encodings: EnabledCompressionEncodings,
508 send_compression_encodings: EnabledCompressionEncodings,
509 max_decoding_message_size: Option<usize>,
510 max_encoding_message_size: Option<usize>,
511 }
512 impl<T> BrokerAdminServer<T> {
513 pub fn new(inner: T) -> Self {
514 Self::from_arc(Arc::new(inner))
515 }
516 pub fn from_arc(inner: Arc<T>) -> Self {
517 Self {
518 inner,
519 accept_compression_encodings: Default::default(),
520 send_compression_encodings: Default::default(),
521 max_decoding_message_size: None,
522 max_encoding_message_size: None,
523 }
524 }
525 pub fn with_interceptor<F>(
526 inner: T,
527 interceptor: F,
528 ) -> InterceptedService<Self, F>
529 where
530 F: tonic::service::Interceptor,
531 {
532 InterceptedService::new(Self::new(inner), interceptor)
533 }
534 #[must_use]
536 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
537 self.accept_compression_encodings.enable(encoding);
538 self
539 }
540 #[must_use]
542 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
543 self.send_compression_encodings.enable(encoding);
544 self
545 }
546 #[must_use]
550 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
551 self.max_decoding_message_size = Some(limit);
552 self
553 }
554 #[must_use]
558 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
559 self.max_encoding_message_size = Some(limit);
560 self
561 }
562 }
563 impl<T, B> tonic::codegen::Service<http::Request<B>> for BrokerAdminServer<T>
564 where
565 T: BrokerAdmin,
566 B: Body + std::marker::Send + 'static,
567 B::Error: Into<StdError> + std::marker::Send + 'static,
568 {
569 type Response = http::Response<tonic::body::Body>;
570 type Error = std::convert::Infallible;
571 type Future = BoxFuture<Self::Response, Self::Error>;
572 fn poll_ready(
573 &mut self,
574 _cx: &mut Context<'_>,
575 ) -> Poll<std::result::Result<(), Self::Error>> {
576 Poll::Ready(Ok(()))
577 }
578 fn call(&mut self, req: http::Request<B>) -> Self::Future {
579 match req.uri().path() {
580 "/danube_admin.BrokerAdmin/ListBrokers" => {
581 #[allow(non_camel_case_types)]
582 struct ListBrokersSvc<T: BrokerAdmin>(pub Arc<T>);
583 impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
584 for ListBrokersSvc<T> {
585 type Response = super::BrokerListResponse;
586 type Future = BoxFuture<
587 tonic::Response<Self::Response>,
588 tonic::Status,
589 >;
590 fn call(
591 &mut self,
592 request: tonic::Request<super::Empty>,
593 ) -> Self::Future {
594 let inner = Arc::clone(&self.0);
595 let fut = async move {
596 <T as BrokerAdmin>::list_brokers(&inner, request).await
597 };
598 Box::pin(fut)
599 }
600 }
601 let accept_compression_encodings = self.accept_compression_encodings;
602 let send_compression_encodings = self.send_compression_encodings;
603 let max_decoding_message_size = self.max_decoding_message_size;
604 let max_encoding_message_size = self.max_encoding_message_size;
605 let inner = self.inner.clone();
606 let fut = async move {
607 let method = ListBrokersSvc(inner);
608 let codec = tonic_prost::ProstCodec::default();
609 let mut grpc = tonic::server::Grpc::new(codec)
610 .apply_compression_config(
611 accept_compression_encodings,
612 send_compression_encodings,
613 )
614 .apply_max_message_size_config(
615 max_decoding_message_size,
616 max_encoding_message_size,
617 );
618 let res = grpc.unary(method, req).await;
619 Ok(res)
620 };
621 Box::pin(fut)
622 }
623 "/danube_admin.BrokerAdmin/GetLeaderBroker" => {
624 #[allow(non_camel_case_types)]
625 struct GetLeaderBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
626 impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
627 for GetLeaderBrokerSvc<T> {
628 type Response = super::BrokerResponse;
629 type Future = BoxFuture<
630 tonic::Response<Self::Response>,
631 tonic::Status,
632 >;
633 fn call(
634 &mut self,
635 request: tonic::Request<super::Empty>,
636 ) -> Self::Future {
637 let inner = Arc::clone(&self.0);
638 let fut = async move {
639 <T as BrokerAdmin>::get_leader_broker(&inner, request).await
640 };
641 Box::pin(fut)
642 }
643 }
644 let accept_compression_encodings = self.accept_compression_encodings;
645 let send_compression_encodings = self.send_compression_encodings;
646 let max_decoding_message_size = self.max_decoding_message_size;
647 let max_encoding_message_size = self.max_encoding_message_size;
648 let inner = self.inner.clone();
649 let fut = async move {
650 let method = GetLeaderBrokerSvc(inner);
651 let codec = tonic_prost::ProstCodec::default();
652 let mut grpc = tonic::server::Grpc::new(codec)
653 .apply_compression_config(
654 accept_compression_encodings,
655 send_compression_encodings,
656 )
657 .apply_max_message_size_config(
658 max_decoding_message_size,
659 max_encoding_message_size,
660 );
661 let res = grpc.unary(method, req).await;
662 Ok(res)
663 };
664 Box::pin(fut)
665 }
666 "/danube_admin.BrokerAdmin/ListNamespaces" => {
667 #[allow(non_camel_case_types)]
668 struct ListNamespacesSvc<T: BrokerAdmin>(pub Arc<T>);
669 impl<T: BrokerAdmin> tonic::server::UnaryService<super::Empty>
670 for ListNamespacesSvc<T> {
671 type Response = super::NamespaceListResponse;
672 type Future = BoxFuture<
673 tonic::Response<Self::Response>,
674 tonic::Status,
675 >;
676 fn call(
677 &mut self,
678 request: tonic::Request<super::Empty>,
679 ) -> Self::Future {
680 let inner = Arc::clone(&self.0);
681 let fut = async move {
682 <T as BrokerAdmin>::list_namespaces(&inner, request).await
683 };
684 Box::pin(fut)
685 }
686 }
687 let accept_compression_encodings = self.accept_compression_encodings;
688 let send_compression_encodings = self.send_compression_encodings;
689 let max_decoding_message_size = self.max_decoding_message_size;
690 let max_encoding_message_size = self.max_encoding_message_size;
691 let inner = self.inner.clone();
692 let fut = async move {
693 let method = ListNamespacesSvc(inner);
694 let codec = tonic_prost::ProstCodec::default();
695 let mut grpc = tonic::server::Grpc::new(codec)
696 .apply_compression_config(
697 accept_compression_encodings,
698 send_compression_encodings,
699 )
700 .apply_max_message_size_config(
701 max_decoding_message_size,
702 max_encoding_message_size,
703 );
704 let res = grpc.unary(method, req).await;
705 Ok(res)
706 };
707 Box::pin(fut)
708 }
709 "/danube_admin.BrokerAdmin/UnloadBroker" => {
710 #[allow(non_camel_case_types)]
711 struct UnloadBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
712 impl<
713 T: BrokerAdmin,
714 > tonic::server::UnaryService<super::UnloadBrokerRequest>
715 for UnloadBrokerSvc<T> {
716 type Response = super::UnloadBrokerResponse;
717 type Future = BoxFuture<
718 tonic::Response<Self::Response>,
719 tonic::Status,
720 >;
721 fn call(
722 &mut self,
723 request: tonic::Request<super::UnloadBrokerRequest>,
724 ) -> Self::Future {
725 let inner = Arc::clone(&self.0);
726 let fut = async move {
727 <T as BrokerAdmin>::unload_broker(&inner, request).await
728 };
729 Box::pin(fut)
730 }
731 }
732 let accept_compression_encodings = self.accept_compression_encodings;
733 let send_compression_encodings = self.send_compression_encodings;
734 let max_decoding_message_size = self.max_decoding_message_size;
735 let max_encoding_message_size = self.max_encoding_message_size;
736 let inner = self.inner.clone();
737 let fut = async move {
738 let method = UnloadBrokerSvc(inner);
739 let codec = tonic_prost::ProstCodec::default();
740 let mut grpc = tonic::server::Grpc::new(codec)
741 .apply_compression_config(
742 accept_compression_encodings,
743 send_compression_encodings,
744 )
745 .apply_max_message_size_config(
746 max_decoding_message_size,
747 max_encoding_message_size,
748 );
749 let res = grpc.unary(method, req).await;
750 Ok(res)
751 };
752 Box::pin(fut)
753 }
754 "/danube_admin.BrokerAdmin/ActivateBroker" => {
755 #[allow(non_camel_case_types)]
756 struct ActivateBrokerSvc<T: BrokerAdmin>(pub Arc<T>);
757 impl<
758 T: BrokerAdmin,
759 > tonic::server::UnaryService<super::ActivateBrokerRequest>
760 for ActivateBrokerSvc<T> {
761 type Response = super::ActivateBrokerResponse;
762 type Future = BoxFuture<
763 tonic::Response<Self::Response>,
764 tonic::Status,
765 >;
766 fn call(
767 &mut self,
768 request: tonic::Request<super::ActivateBrokerRequest>,
769 ) -> Self::Future {
770 let inner = Arc::clone(&self.0);
771 let fut = async move {
772 <T as BrokerAdmin>::activate_broker(&inner, request).await
773 };
774 Box::pin(fut)
775 }
776 }
777 let accept_compression_encodings = self.accept_compression_encodings;
778 let send_compression_encodings = self.send_compression_encodings;
779 let max_decoding_message_size = self.max_decoding_message_size;
780 let max_encoding_message_size = self.max_encoding_message_size;
781 let inner = self.inner.clone();
782 let fut = async move {
783 let method = ActivateBrokerSvc(inner);
784 let codec = tonic_prost::ProstCodec::default();
785 let mut grpc = tonic::server::Grpc::new(codec)
786 .apply_compression_config(
787 accept_compression_encodings,
788 send_compression_encodings,
789 )
790 .apply_max_message_size_config(
791 max_decoding_message_size,
792 max_encoding_message_size,
793 );
794 let res = grpc.unary(method, req).await;
795 Ok(res)
796 };
797 Box::pin(fut)
798 }
799 _ => {
800 Box::pin(async move {
801 let mut response = http::Response::new(
802 tonic::body::Body::default(),
803 );
804 let headers = response.headers_mut();
805 headers
806 .insert(
807 tonic::Status::GRPC_STATUS,
808 (tonic::Code::Unimplemented as i32).into(),
809 );
810 headers
811 .insert(
812 http::header::CONTENT_TYPE,
813 tonic::metadata::GRPC_CONTENT_TYPE,
814 );
815 Ok(response)
816 })
817 }
818 }
819 }
820 }
821 impl<T> Clone for BrokerAdminServer<T> {
822 fn clone(&self) -> Self {
823 let inner = self.inner.clone();
824 Self {
825 inner,
826 accept_compression_encodings: self.accept_compression_encodings,
827 send_compression_encodings: self.send_compression_encodings,
828 max_decoding_message_size: self.max_decoding_message_size,
829 max_encoding_message_size: self.max_encoding_message_size,
830 }
831 }
832 }
833 pub const SERVICE_NAME: &str = "danube_admin.BrokerAdmin";
835 impl<T> tonic::server::NamedService for BrokerAdminServer<T> {
836 const NAME: &'static str = SERVICE_NAME;
837 }
838}
839pub mod namespace_admin_client {
841 #![allow(
842 unused_variables,
843 dead_code,
844 missing_docs,
845 clippy::wildcard_imports,
846 clippy::let_unit_value,
847 )]
848 use tonic::codegen::*;
849 use tonic::codegen::http::Uri;
850 #[derive(Debug, Clone)]
851 pub struct NamespaceAdminClient<T> {
852 inner: tonic::client::Grpc<T>,
853 }
854 impl NamespaceAdminClient<tonic::transport::Channel> {
855 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
857 where
858 D: TryInto<tonic::transport::Endpoint>,
859 D::Error: Into<StdError>,
860 {
861 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
862 Ok(Self::new(conn))
863 }
864 }
865 impl<T> NamespaceAdminClient<T>
866 where
867 T: tonic::client::GrpcService<tonic::body::Body>,
868 T::Error: Into<StdError>,
869 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
870 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
871 {
872 pub fn new(inner: T) -> Self {
873 let inner = tonic::client::Grpc::new(inner);
874 Self { inner }
875 }
876 pub fn with_origin(inner: T, origin: Uri) -> Self {
877 let inner = tonic::client::Grpc::with_origin(inner, origin);
878 Self { inner }
879 }
880 pub fn with_interceptor<F>(
881 inner: T,
882 interceptor: F,
883 ) -> NamespaceAdminClient<InterceptedService<T, F>>
884 where
885 F: tonic::service::Interceptor,
886 T::ResponseBody: Default,
887 T: tonic::codegen::Service<
888 http::Request<tonic::body::Body>,
889 Response = http::Response<
890 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
891 >,
892 >,
893 <T as tonic::codegen::Service<
894 http::Request<tonic::body::Body>,
895 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
896 {
897 NamespaceAdminClient::new(InterceptedService::new(inner, interceptor))
898 }
899 #[must_use]
904 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
905 self.inner = self.inner.send_compressed(encoding);
906 self
907 }
908 #[must_use]
910 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
911 self.inner = self.inner.accept_compressed(encoding);
912 self
913 }
914 #[must_use]
918 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
919 self.inner = self.inner.max_decoding_message_size(limit);
920 self
921 }
922 #[must_use]
926 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
927 self.inner = self.inner.max_encoding_message_size(limit);
928 self
929 }
930 pub async fn get_namespace_topics(
932 &mut self,
933 request: impl tonic::IntoRequest<super::NamespaceRequest>,
934 ) -> std::result::Result<
935 tonic::Response<super::TopicListResponse>,
936 tonic::Status,
937 > {
938 self.inner
939 .ready()
940 .await
941 .map_err(|e| {
942 tonic::Status::unknown(
943 format!("Service was not ready: {}", e.into()),
944 )
945 })?;
946 let codec = tonic_prost::ProstCodec::default();
947 let path = http::uri::PathAndQuery::from_static(
948 "/danube_admin.NamespaceAdmin/GetNamespaceTopics",
949 );
950 let mut req = request.into_request();
951 req.extensions_mut()
952 .insert(
953 GrpcMethod::new("danube_admin.NamespaceAdmin", "GetNamespaceTopics"),
954 );
955 self.inner.unary(req, path, codec).await
956 }
957 pub async fn get_namespace_policies(
958 &mut self,
959 request: impl tonic::IntoRequest<super::NamespaceRequest>,
960 ) -> std::result::Result<tonic::Response<super::PolicyResponse>, tonic::Status> {
961 self.inner
962 .ready()
963 .await
964 .map_err(|e| {
965 tonic::Status::unknown(
966 format!("Service was not ready: {}", e.into()),
967 )
968 })?;
969 let codec = tonic_prost::ProstCodec::default();
970 let path = http::uri::PathAndQuery::from_static(
971 "/danube_admin.NamespaceAdmin/GetNamespacePolicies",
972 );
973 let mut req = request.into_request();
974 req.extensions_mut()
975 .insert(
976 GrpcMethod::new(
977 "danube_admin.NamespaceAdmin",
978 "GetNamespacePolicies",
979 ),
980 );
981 self.inner.unary(req, path, codec).await
982 }
983 pub async fn create_namespace(
984 &mut self,
985 request: impl tonic::IntoRequest<super::NamespaceRequest>,
986 ) -> std::result::Result<
987 tonic::Response<super::NamespaceResponse>,
988 tonic::Status,
989 > {
990 self.inner
991 .ready()
992 .await
993 .map_err(|e| {
994 tonic::Status::unknown(
995 format!("Service was not ready: {}", e.into()),
996 )
997 })?;
998 let codec = tonic_prost::ProstCodec::default();
999 let path = http::uri::PathAndQuery::from_static(
1000 "/danube_admin.NamespaceAdmin/CreateNamespace",
1001 );
1002 let mut req = request.into_request();
1003 req.extensions_mut()
1004 .insert(
1005 GrpcMethod::new("danube_admin.NamespaceAdmin", "CreateNamespace"),
1006 );
1007 self.inner.unary(req, path, codec).await
1008 }
1009 pub async fn delete_namespace(
1010 &mut self,
1011 request: impl tonic::IntoRequest<super::NamespaceRequest>,
1012 ) -> std::result::Result<
1013 tonic::Response<super::NamespaceResponse>,
1014 tonic::Status,
1015 > {
1016 self.inner
1017 .ready()
1018 .await
1019 .map_err(|e| {
1020 tonic::Status::unknown(
1021 format!("Service was not ready: {}", e.into()),
1022 )
1023 })?;
1024 let codec = tonic_prost::ProstCodec::default();
1025 let path = http::uri::PathAndQuery::from_static(
1026 "/danube_admin.NamespaceAdmin/DeleteNamespace",
1027 );
1028 let mut req = request.into_request();
1029 req.extensions_mut()
1030 .insert(
1031 GrpcMethod::new("danube_admin.NamespaceAdmin", "DeleteNamespace"),
1032 );
1033 self.inner.unary(req, path, codec).await
1034 }
1035 }
1036}
1037pub mod namespace_admin_server {
1039 #![allow(
1040 unused_variables,
1041 dead_code,
1042 missing_docs,
1043 clippy::wildcard_imports,
1044 clippy::let_unit_value,
1045 )]
1046 use tonic::codegen::*;
1047 #[async_trait]
1049 pub trait NamespaceAdmin: std::marker::Send + std::marker::Sync + 'static {
1050 async fn get_namespace_topics(
1052 &self,
1053 request: tonic::Request<super::NamespaceRequest>,
1054 ) -> std::result::Result<
1055 tonic::Response<super::TopicListResponse>,
1056 tonic::Status,
1057 >;
1058 async fn get_namespace_policies(
1059 &self,
1060 request: tonic::Request<super::NamespaceRequest>,
1061 ) -> std::result::Result<tonic::Response<super::PolicyResponse>, tonic::Status>;
1062 async fn create_namespace(
1063 &self,
1064 request: tonic::Request<super::NamespaceRequest>,
1065 ) -> std::result::Result<
1066 tonic::Response<super::NamespaceResponse>,
1067 tonic::Status,
1068 >;
1069 async fn delete_namespace(
1070 &self,
1071 request: tonic::Request<super::NamespaceRequest>,
1072 ) -> std::result::Result<
1073 tonic::Response<super::NamespaceResponse>,
1074 tonic::Status,
1075 >;
1076 }
1077 #[derive(Debug)]
1078 pub struct NamespaceAdminServer<T> {
1079 inner: Arc<T>,
1080 accept_compression_encodings: EnabledCompressionEncodings,
1081 send_compression_encodings: EnabledCompressionEncodings,
1082 max_decoding_message_size: Option<usize>,
1083 max_encoding_message_size: Option<usize>,
1084 }
1085 impl<T> NamespaceAdminServer<T> {
1086 pub fn new(inner: T) -> Self {
1087 Self::from_arc(Arc::new(inner))
1088 }
1089 pub fn from_arc(inner: Arc<T>) -> Self {
1090 Self {
1091 inner,
1092 accept_compression_encodings: Default::default(),
1093 send_compression_encodings: Default::default(),
1094 max_decoding_message_size: None,
1095 max_encoding_message_size: None,
1096 }
1097 }
1098 pub fn with_interceptor<F>(
1099 inner: T,
1100 interceptor: F,
1101 ) -> InterceptedService<Self, F>
1102 where
1103 F: tonic::service::Interceptor,
1104 {
1105 InterceptedService::new(Self::new(inner), interceptor)
1106 }
1107 #[must_use]
1109 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1110 self.accept_compression_encodings.enable(encoding);
1111 self
1112 }
1113 #[must_use]
1115 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1116 self.send_compression_encodings.enable(encoding);
1117 self
1118 }
1119 #[must_use]
1123 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1124 self.max_decoding_message_size = Some(limit);
1125 self
1126 }
1127 #[must_use]
1131 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1132 self.max_encoding_message_size = Some(limit);
1133 self
1134 }
1135 }
1136 impl<T, B> tonic::codegen::Service<http::Request<B>> for NamespaceAdminServer<T>
1137 where
1138 T: NamespaceAdmin,
1139 B: Body + std::marker::Send + 'static,
1140 B::Error: Into<StdError> + std::marker::Send + 'static,
1141 {
1142 type Response = http::Response<tonic::body::Body>;
1143 type Error = std::convert::Infallible;
1144 type Future = BoxFuture<Self::Response, Self::Error>;
1145 fn poll_ready(
1146 &mut self,
1147 _cx: &mut Context<'_>,
1148 ) -> Poll<std::result::Result<(), Self::Error>> {
1149 Poll::Ready(Ok(()))
1150 }
1151 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1152 match req.uri().path() {
1153 "/danube_admin.NamespaceAdmin/GetNamespaceTopics" => {
1154 #[allow(non_camel_case_types)]
1155 struct GetNamespaceTopicsSvc<T: NamespaceAdmin>(pub Arc<T>);
1156 impl<
1157 T: NamespaceAdmin,
1158 > tonic::server::UnaryService<super::NamespaceRequest>
1159 for GetNamespaceTopicsSvc<T> {
1160 type Response = super::TopicListResponse;
1161 type Future = BoxFuture<
1162 tonic::Response<Self::Response>,
1163 tonic::Status,
1164 >;
1165 fn call(
1166 &mut self,
1167 request: tonic::Request<super::NamespaceRequest>,
1168 ) -> Self::Future {
1169 let inner = Arc::clone(&self.0);
1170 let fut = async move {
1171 <T as NamespaceAdmin>::get_namespace_topics(&inner, request)
1172 .await
1173 };
1174 Box::pin(fut)
1175 }
1176 }
1177 let accept_compression_encodings = self.accept_compression_encodings;
1178 let send_compression_encodings = self.send_compression_encodings;
1179 let max_decoding_message_size = self.max_decoding_message_size;
1180 let max_encoding_message_size = self.max_encoding_message_size;
1181 let inner = self.inner.clone();
1182 let fut = async move {
1183 let method = GetNamespaceTopicsSvc(inner);
1184 let codec = tonic_prost::ProstCodec::default();
1185 let mut grpc = tonic::server::Grpc::new(codec)
1186 .apply_compression_config(
1187 accept_compression_encodings,
1188 send_compression_encodings,
1189 )
1190 .apply_max_message_size_config(
1191 max_decoding_message_size,
1192 max_encoding_message_size,
1193 );
1194 let res = grpc.unary(method, req).await;
1195 Ok(res)
1196 };
1197 Box::pin(fut)
1198 }
1199 "/danube_admin.NamespaceAdmin/GetNamespacePolicies" => {
1200 #[allow(non_camel_case_types)]
1201 struct GetNamespacePoliciesSvc<T: NamespaceAdmin>(pub Arc<T>);
1202 impl<
1203 T: NamespaceAdmin,
1204 > tonic::server::UnaryService<super::NamespaceRequest>
1205 for GetNamespacePoliciesSvc<T> {
1206 type Response = super::PolicyResponse;
1207 type Future = BoxFuture<
1208 tonic::Response<Self::Response>,
1209 tonic::Status,
1210 >;
1211 fn call(
1212 &mut self,
1213 request: tonic::Request<super::NamespaceRequest>,
1214 ) -> Self::Future {
1215 let inner = Arc::clone(&self.0);
1216 let fut = async move {
1217 <T as NamespaceAdmin>::get_namespace_policies(
1218 &inner,
1219 request,
1220 )
1221 .await
1222 };
1223 Box::pin(fut)
1224 }
1225 }
1226 let accept_compression_encodings = self.accept_compression_encodings;
1227 let send_compression_encodings = self.send_compression_encodings;
1228 let max_decoding_message_size = self.max_decoding_message_size;
1229 let max_encoding_message_size = self.max_encoding_message_size;
1230 let inner = self.inner.clone();
1231 let fut = async move {
1232 let method = GetNamespacePoliciesSvc(inner);
1233 let codec = tonic_prost::ProstCodec::default();
1234 let mut grpc = tonic::server::Grpc::new(codec)
1235 .apply_compression_config(
1236 accept_compression_encodings,
1237 send_compression_encodings,
1238 )
1239 .apply_max_message_size_config(
1240 max_decoding_message_size,
1241 max_encoding_message_size,
1242 );
1243 let res = grpc.unary(method, req).await;
1244 Ok(res)
1245 };
1246 Box::pin(fut)
1247 }
1248 "/danube_admin.NamespaceAdmin/CreateNamespace" => {
1249 #[allow(non_camel_case_types)]
1250 struct CreateNamespaceSvc<T: NamespaceAdmin>(pub Arc<T>);
1251 impl<
1252 T: NamespaceAdmin,
1253 > tonic::server::UnaryService<super::NamespaceRequest>
1254 for CreateNamespaceSvc<T> {
1255 type Response = super::NamespaceResponse;
1256 type Future = BoxFuture<
1257 tonic::Response<Self::Response>,
1258 tonic::Status,
1259 >;
1260 fn call(
1261 &mut self,
1262 request: tonic::Request<super::NamespaceRequest>,
1263 ) -> Self::Future {
1264 let inner = Arc::clone(&self.0);
1265 let fut = async move {
1266 <T as NamespaceAdmin>::create_namespace(&inner, request)
1267 .await
1268 };
1269 Box::pin(fut)
1270 }
1271 }
1272 let accept_compression_encodings = self.accept_compression_encodings;
1273 let send_compression_encodings = self.send_compression_encodings;
1274 let max_decoding_message_size = self.max_decoding_message_size;
1275 let max_encoding_message_size = self.max_encoding_message_size;
1276 let inner = self.inner.clone();
1277 let fut = async move {
1278 let method = CreateNamespaceSvc(inner);
1279 let codec = tonic_prost::ProstCodec::default();
1280 let mut grpc = tonic::server::Grpc::new(codec)
1281 .apply_compression_config(
1282 accept_compression_encodings,
1283 send_compression_encodings,
1284 )
1285 .apply_max_message_size_config(
1286 max_decoding_message_size,
1287 max_encoding_message_size,
1288 );
1289 let res = grpc.unary(method, req).await;
1290 Ok(res)
1291 };
1292 Box::pin(fut)
1293 }
1294 "/danube_admin.NamespaceAdmin/DeleteNamespace" => {
1295 #[allow(non_camel_case_types)]
1296 struct DeleteNamespaceSvc<T: NamespaceAdmin>(pub Arc<T>);
1297 impl<
1298 T: NamespaceAdmin,
1299 > tonic::server::UnaryService<super::NamespaceRequest>
1300 for DeleteNamespaceSvc<T> {
1301 type Response = super::NamespaceResponse;
1302 type Future = BoxFuture<
1303 tonic::Response<Self::Response>,
1304 tonic::Status,
1305 >;
1306 fn call(
1307 &mut self,
1308 request: tonic::Request<super::NamespaceRequest>,
1309 ) -> Self::Future {
1310 let inner = Arc::clone(&self.0);
1311 let fut = async move {
1312 <T as NamespaceAdmin>::delete_namespace(&inner, request)
1313 .await
1314 };
1315 Box::pin(fut)
1316 }
1317 }
1318 let accept_compression_encodings = self.accept_compression_encodings;
1319 let send_compression_encodings = self.send_compression_encodings;
1320 let max_decoding_message_size = self.max_decoding_message_size;
1321 let max_encoding_message_size = self.max_encoding_message_size;
1322 let inner = self.inner.clone();
1323 let fut = async move {
1324 let method = DeleteNamespaceSvc(inner);
1325 let codec = tonic_prost::ProstCodec::default();
1326 let mut grpc = tonic::server::Grpc::new(codec)
1327 .apply_compression_config(
1328 accept_compression_encodings,
1329 send_compression_encodings,
1330 )
1331 .apply_max_message_size_config(
1332 max_decoding_message_size,
1333 max_encoding_message_size,
1334 );
1335 let res = grpc.unary(method, req).await;
1336 Ok(res)
1337 };
1338 Box::pin(fut)
1339 }
1340 _ => {
1341 Box::pin(async move {
1342 let mut response = http::Response::new(
1343 tonic::body::Body::default(),
1344 );
1345 let headers = response.headers_mut();
1346 headers
1347 .insert(
1348 tonic::Status::GRPC_STATUS,
1349 (tonic::Code::Unimplemented as i32).into(),
1350 );
1351 headers
1352 .insert(
1353 http::header::CONTENT_TYPE,
1354 tonic::metadata::GRPC_CONTENT_TYPE,
1355 );
1356 Ok(response)
1357 })
1358 }
1359 }
1360 }
1361 }
1362 impl<T> Clone for NamespaceAdminServer<T> {
1363 fn clone(&self) -> Self {
1364 let inner = self.inner.clone();
1365 Self {
1366 inner,
1367 accept_compression_encodings: self.accept_compression_encodings,
1368 send_compression_encodings: self.send_compression_encodings,
1369 max_decoding_message_size: self.max_decoding_message_size,
1370 max_encoding_message_size: self.max_encoding_message_size,
1371 }
1372 }
1373 }
1374 pub const SERVICE_NAME: &str = "danube_admin.NamespaceAdmin";
1376 impl<T> tonic::server::NamedService for NamespaceAdminServer<T> {
1377 const NAME: &'static str = SERVICE_NAME;
1378 }
1379}
1380pub mod topic_admin_client {
1382 #![allow(
1383 unused_variables,
1384 dead_code,
1385 missing_docs,
1386 clippy::wildcard_imports,
1387 clippy::let_unit_value,
1388 )]
1389 use tonic::codegen::*;
1390 use tonic::codegen::http::Uri;
1391 #[derive(Debug, Clone)]
1392 pub struct TopicAdminClient<T> {
1393 inner: tonic::client::Grpc<T>,
1394 }
1395 impl TopicAdminClient<tonic::transport::Channel> {
1396 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1398 where
1399 D: TryInto<tonic::transport::Endpoint>,
1400 D::Error: Into<StdError>,
1401 {
1402 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1403 Ok(Self::new(conn))
1404 }
1405 }
1406 impl<T> TopicAdminClient<T>
1407 where
1408 T: tonic::client::GrpcService<tonic::body::Body>,
1409 T::Error: Into<StdError>,
1410 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1411 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1412 {
1413 pub fn new(inner: T) -> Self {
1414 let inner = tonic::client::Grpc::new(inner);
1415 Self { inner }
1416 }
1417 pub fn with_origin(inner: T, origin: Uri) -> Self {
1418 let inner = tonic::client::Grpc::with_origin(inner, origin);
1419 Self { inner }
1420 }
1421 pub fn with_interceptor<F>(
1422 inner: T,
1423 interceptor: F,
1424 ) -> TopicAdminClient<InterceptedService<T, F>>
1425 where
1426 F: tonic::service::Interceptor,
1427 T::ResponseBody: Default,
1428 T: tonic::codegen::Service<
1429 http::Request<tonic::body::Body>,
1430 Response = http::Response<
1431 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1432 >,
1433 >,
1434 <T as tonic::codegen::Service<
1435 http::Request<tonic::body::Body>,
1436 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1437 {
1438 TopicAdminClient::new(InterceptedService::new(inner, interceptor))
1439 }
1440 #[must_use]
1445 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1446 self.inner = self.inner.send_compressed(encoding);
1447 self
1448 }
1449 #[must_use]
1451 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1452 self.inner = self.inner.accept_compressed(encoding);
1453 self
1454 }
1455 #[must_use]
1459 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1460 self.inner = self.inner.max_decoding_message_size(limit);
1461 self
1462 }
1463 #[must_use]
1467 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1468 self.inner = self.inner.max_encoding_message_size(limit);
1469 self
1470 }
1471 pub async fn list_namespace_topics(
1473 &mut self,
1474 request: impl tonic::IntoRequest<super::NamespaceRequest>,
1475 ) -> std::result::Result<
1476 tonic::Response<super::TopicInfoListResponse>,
1477 tonic::Status,
1478 > {
1479 self.inner
1480 .ready()
1481 .await
1482 .map_err(|e| {
1483 tonic::Status::unknown(
1484 format!("Service was not ready: {}", e.into()),
1485 )
1486 })?;
1487 let codec = tonic_prost::ProstCodec::default();
1488 let path = http::uri::PathAndQuery::from_static(
1489 "/danube_admin.TopicAdmin/ListNamespaceTopics",
1490 );
1491 let mut req = request.into_request();
1492 req.extensions_mut()
1493 .insert(
1494 GrpcMethod::new("danube_admin.TopicAdmin", "ListNamespaceTopics"),
1495 );
1496 self.inner.unary(req, path, codec).await
1497 }
1498 pub async fn list_broker_topics(
1499 &mut self,
1500 request: impl tonic::IntoRequest<super::BrokerRequest>,
1501 ) -> std::result::Result<
1502 tonic::Response<super::TopicInfoListResponse>,
1503 tonic::Status,
1504 > {
1505 self.inner
1506 .ready()
1507 .await
1508 .map_err(|e| {
1509 tonic::Status::unknown(
1510 format!("Service was not ready: {}", e.into()),
1511 )
1512 })?;
1513 let codec = tonic_prost::ProstCodec::default();
1514 let path = http::uri::PathAndQuery::from_static(
1515 "/danube_admin.TopicAdmin/ListBrokerTopics",
1516 );
1517 let mut req = request.into_request();
1518 req.extensions_mut()
1519 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "ListBrokerTopics"));
1520 self.inner.unary(req, path, codec).await
1521 }
1522 pub async fn create_topic(
1523 &mut self,
1524 request: impl tonic::IntoRequest<super::NewTopicRequest>,
1525 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
1526 self.inner
1527 .ready()
1528 .await
1529 .map_err(|e| {
1530 tonic::Status::unknown(
1531 format!("Service was not ready: {}", e.into()),
1532 )
1533 })?;
1534 let codec = tonic_prost::ProstCodec::default();
1535 let path = http::uri::PathAndQuery::from_static(
1536 "/danube_admin.TopicAdmin/CreateTopic",
1537 );
1538 let mut req = request.into_request();
1539 req.extensions_mut()
1540 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "CreateTopic"));
1541 self.inner.unary(req, path, codec).await
1542 }
1543 pub async fn create_partitioned_topic(
1544 &mut self,
1545 request: impl tonic::IntoRequest<super::PartitionedTopicRequest>,
1546 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
1547 self.inner
1548 .ready()
1549 .await
1550 .map_err(|e| {
1551 tonic::Status::unknown(
1552 format!("Service was not ready: {}", e.into()),
1553 )
1554 })?;
1555 let codec = tonic_prost::ProstCodec::default();
1556 let path = http::uri::PathAndQuery::from_static(
1557 "/danube_admin.TopicAdmin/CreatePartitionedTopic",
1558 );
1559 let mut req = request.into_request();
1560 req.extensions_mut()
1561 .insert(
1562 GrpcMethod::new("danube_admin.TopicAdmin", "CreatePartitionedTopic"),
1563 );
1564 self.inner.unary(req, path, codec).await
1565 }
1566 pub async fn delete_topic(
1567 &mut self,
1568 request: impl tonic::IntoRequest<super::TopicRequest>,
1569 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
1570 self.inner
1571 .ready()
1572 .await
1573 .map_err(|e| {
1574 tonic::Status::unknown(
1575 format!("Service was not ready: {}", e.into()),
1576 )
1577 })?;
1578 let codec = tonic_prost::ProstCodec::default();
1579 let path = http::uri::PathAndQuery::from_static(
1580 "/danube_admin.TopicAdmin/DeleteTopic",
1581 );
1582 let mut req = request.into_request();
1583 req.extensions_mut()
1584 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "DeleteTopic"));
1585 self.inner.unary(req, path, codec).await
1586 }
1587 pub async fn unload_topic(
1588 &mut self,
1589 request: impl tonic::IntoRequest<super::TopicRequest>,
1590 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status> {
1591 self.inner
1592 .ready()
1593 .await
1594 .map_err(|e| {
1595 tonic::Status::unknown(
1596 format!("Service was not ready: {}", e.into()),
1597 )
1598 })?;
1599 let codec = tonic_prost::ProstCodec::default();
1600 let path = http::uri::PathAndQuery::from_static(
1601 "/danube_admin.TopicAdmin/UnloadTopic",
1602 );
1603 let mut req = request.into_request();
1604 req.extensions_mut()
1605 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "UnloadTopic"));
1606 self.inner.unary(req, path, codec).await
1607 }
1608 pub async fn list_subscriptions(
1609 &mut self,
1610 request: impl tonic::IntoRequest<super::TopicRequest>,
1611 ) -> std::result::Result<
1612 tonic::Response<super::SubscriptionListResponse>,
1613 tonic::Status,
1614 > {
1615 self.inner
1616 .ready()
1617 .await
1618 .map_err(|e| {
1619 tonic::Status::unknown(
1620 format!("Service was not ready: {}", e.into()),
1621 )
1622 })?;
1623 let codec = tonic_prost::ProstCodec::default();
1624 let path = http::uri::PathAndQuery::from_static(
1625 "/danube_admin.TopicAdmin/ListSubscriptions",
1626 );
1627 let mut req = request.into_request();
1628 req.extensions_mut()
1629 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "ListSubscriptions"));
1630 self.inner.unary(req, path, codec).await
1631 }
1632 pub async fn unsubscribe(
1633 &mut self,
1634 request: impl tonic::IntoRequest<super::SubscriptionRequest>,
1635 ) -> std::result::Result<
1636 tonic::Response<super::SubscriptionResponse>,
1637 tonic::Status,
1638 > {
1639 self.inner
1640 .ready()
1641 .await
1642 .map_err(|e| {
1643 tonic::Status::unknown(
1644 format!("Service was not ready: {}", e.into()),
1645 )
1646 })?;
1647 let codec = tonic_prost::ProstCodec::default();
1648 let path = http::uri::PathAndQuery::from_static(
1649 "/danube_admin.TopicAdmin/Unsubscribe",
1650 );
1651 let mut req = request.into_request();
1652 req.extensions_mut()
1653 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "Unsubscribe"));
1654 self.inner.unary(req, path, codec).await
1655 }
1656 pub async fn describe_topic(
1657 &mut self,
1658 request: impl tonic::IntoRequest<super::DescribeTopicRequest>,
1659 ) -> std::result::Result<
1660 tonic::Response<super::DescribeTopicResponse>,
1661 tonic::Status,
1662 > {
1663 self.inner
1664 .ready()
1665 .await
1666 .map_err(|e| {
1667 tonic::Status::unknown(
1668 format!("Service was not ready: {}", e.into()),
1669 )
1670 })?;
1671 let codec = tonic_prost::ProstCodec::default();
1672 let path = http::uri::PathAndQuery::from_static(
1673 "/danube_admin.TopicAdmin/DescribeTopic",
1674 );
1675 let mut req = request.into_request();
1676 req.extensions_mut()
1677 .insert(GrpcMethod::new("danube_admin.TopicAdmin", "DescribeTopic"));
1678 self.inner.unary(req, path, codec).await
1679 }
1680 }
1681}
1682pub mod topic_admin_server {
1684 #![allow(
1685 unused_variables,
1686 dead_code,
1687 missing_docs,
1688 clippy::wildcard_imports,
1689 clippy::let_unit_value,
1690 )]
1691 use tonic::codegen::*;
1692 #[async_trait]
1694 pub trait TopicAdmin: std::marker::Send + std::marker::Sync + 'static {
1695 async fn list_namespace_topics(
1697 &self,
1698 request: tonic::Request<super::NamespaceRequest>,
1699 ) -> std::result::Result<
1700 tonic::Response<super::TopicInfoListResponse>,
1701 tonic::Status,
1702 >;
1703 async fn list_broker_topics(
1704 &self,
1705 request: tonic::Request<super::BrokerRequest>,
1706 ) -> std::result::Result<
1707 tonic::Response<super::TopicInfoListResponse>,
1708 tonic::Status,
1709 >;
1710 async fn create_topic(
1711 &self,
1712 request: tonic::Request<super::NewTopicRequest>,
1713 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
1714 async fn create_partitioned_topic(
1715 &self,
1716 request: tonic::Request<super::PartitionedTopicRequest>,
1717 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
1718 async fn delete_topic(
1719 &self,
1720 request: tonic::Request<super::TopicRequest>,
1721 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
1722 async fn unload_topic(
1723 &self,
1724 request: tonic::Request<super::TopicRequest>,
1725 ) -> std::result::Result<tonic::Response<super::TopicResponse>, tonic::Status>;
1726 async fn list_subscriptions(
1727 &self,
1728 request: tonic::Request<super::TopicRequest>,
1729 ) -> std::result::Result<
1730 tonic::Response<super::SubscriptionListResponse>,
1731 tonic::Status,
1732 >;
1733 async fn unsubscribe(
1734 &self,
1735 request: tonic::Request<super::SubscriptionRequest>,
1736 ) -> std::result::Result<
1737 tonic::Response<super::SubscriptionResponse>,
1738 tonic::Status,
1739 >;
1740 async fn describe_topic(
1741 &self,
1742 request: tonic::Request<super::DescribeTopicRequest>,
1743 ) -> std::result::Result<
1744 tonic::Response<super::DescribeTopicResponse>,
1745 tonic::Status,
1746 >;
1747 }
1748 #[derive(Debug)]
1749 pub struct TopicAdminServer<T> {
1750 inner: Arc<T>,
1751 accept_compression_encodings: EnabledCompressionEncodings,
1752 send_compression_encodings: EnabledCompressionEncodings,
1753 max_decoding_message_size: Option<usize>,
1754 max_encoding_message_size: Option<usize>,
1755 }
1756 impl<T> TopicAdminServer<T> {
1757 pub fn new(inner: T) -> Self {
1758 Self::from_arc(Arc::new(inner))
1759 }
1760 pub fn from_arc(inner: Arc<T>) -> Self {
1761 Self {
1762 inner,
1763 accept_compression_encodings: Default::default(),
1764 send_compression_encodings: Default::default(),
1765 max_decoding_message_size: None,
1766 max_encoding_message_size: None,
1767 }
1768 }
1769 pub fn with_interceptor<F>(
1770 inner: T,
1771 interceptor: F,
1772 ) -> InterceptedService<Self, F>
1773 where
1774 F: tonic::service::Interceptor,
1775 {
1776 InterceptedService::new(Self::new(inner), interceptor)
1777 }
1778 #[must_use]
1780 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1781 self.accept_compression_encodings.enable(encoding);
1782 self
1783 }
1784 #[must_use]
1786 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1787 self.send_compression_encodings.enable(encoding);
1788 self
1789 }
1790 #[must_use]
1794 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1795 self.max_decoding_message_size = Some(limit);
1796 self
1797 }
1798 #[must_use]
1802 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1803 self.max_encoding_message_size = Some(limit);
1804 self
1805 }
1806 }
1807 impl<T, B> tonic::codegen::Service<http::Request<B>> for TopicAdminServer<T>
1808 where
1809 T: TopicAdmin,
1810 B: Body + std::marker::Send + 'static,
1811 B::Error: Into<StdError> + std::marker::Send + 'static,
1812 {
1813 type Response = http::Response<tonic::body::Body>;
1814 type Error = std::convert::Infallible;
1815 type Future = BoxFuture<Self::Response, Self::Error>;
1816 fn poll_ready(
1817 &mut self,
1818 _cx: &mut Context<'_>,
1819 ) -> Poll<std::result::Result<(), Self::Error>> {
1820 Poll::Ready(Ok(()))
1821 }
1822 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1823 match req.uri().path() {
1824 "/danube_admin.TopicAdmin/ListNamespaceTopics" => {
1825 #[allow(non_camel_case_types)]
1826 struct ListNamespaceTopicsSvc<T: TopicAdmin>(pub Arc<T>);
1827 impl<
1828 T: TopicAdmin,
1829 > tonic::server::UnaryService<super::NamespaceRequest>
1830 for ListNamespaceTopicsSvc<T> {
1831 type Response = super::TopicInfoListResponse;
1832 type Future = BoxFuture<
1833 tonic::Response<Self::Response>,
1834 tonic::Status,
1835 >;
1836 fn call(
1837 &mut self,
1838 request: tonic::Request<super::NamespaceRequest>,
1839 ) -> Self::Future {
1840 let inner = Arc::clone(&self.0);
1841 let fut = async move {
1842 <T as TopicAdmin>::list_namespace_topics(&inner, request)
1843 .await
1844 };
1845 Box::pin(fut)
1846 }
1847 }
1848 let accept_compression_encodings = self.accept_compression_encodings;
1849 let send_compression_encodings = self.send_compression_encodings;
1850 let max_decoding_message_size = self.max_decoding_message_size;
1851 let max_encoding_message_size = self.max_encoding_message_size;
1852 let inner = self.inner.clone();
1853 let fut = async move {
1854 let method = ListNamespaceTopicsSvc(inner);
1855 let codec = tonic_prost::ProstCodec::default();
1856 let mut grpc = tonic::server::Grpc::new(codec)
1857 .apply_compression_config(
1858 accept_compression_encodings,
1859 send_compression_encodings,
1860 )
1861 .apply_max_message_size_config(
1862 max_decoding_message_size,
1863 max_encoding_message_size,
1864 );
1865 let res = grpc.unary(method, req).await;
1866 Ok(res)
1867 };
1868 Box::pin(fut)
1869 }
1870 "/danube_admin.TopicAdmin/ListBrokerTopics" => {
1871 #[allow(non_camel_case_types)]
1872 struct ListBrokerTopicsSvc<T: TopicAdmin>(pub Arc<T>);
1873 impl<T: TopicAdmin> tonic::server::UnaryService<super::BrokerRequest>
1874 for ListBrokerTopicsSvc<T> {
1875 type Response = super::TopicInfoListResponse;
1876 type Future = BoxFuture<
1877 tonic::Response<Self::Response>,
1878 tonic::Status,
1879 >;
1880 fn call(
1881 &mut self,
1882 request: tonic::Request<super::BrokerRequest>,
1883 ) -> Self::Future {
1884 let inner = Arc::clone(&self.0);
1885 let fut = async move {
1886 <T as TopicAdmin>::list_broker_topics(&inner, request).await
1887 };
1888 Box::pin(fut)
1889 }
1890 }
1891 let accept_compression_encodings = self.accept_compression_encodings;
1892 let send_compression_encodings = self.send_compression_encodings;
1893 let max_decoding_message_size = self.max_decoding_message_size;
1894 let max_encoding_message_size = self.max_encoding_message_size;
1895 let inner = self.inner.clone();
1896 let fut = async move {
1897 let method = ListBrokerTopicsSvc(inner);
1898 let codec = tonic_prost::ProstCodec::default();
1899 let mut grpc = tonic::server::Grpc::new(codec)
1900 .apply_compression_config(
1901 accept_compression_encodings,
1902 send_compression_encodings,
1903 )
1904 .apply_max_message_size_config(
1905 max_decoding_message_size,
1906 max_encoding_message_size,
1907 );
1908 let res = grpc.unary(method, req).await;
1909 Ok(res)
1910 };
1911 Box::pin(fut)
1912 }
1913 "/danube_admin.TopicAdmin/CreateTopic" => {
1914 #[allow(non_camel_case_types)]
1915 struct CreateTopicSvc<T: TopicAdmin>(pub Arc<T>);
1916 impl<
1917 T: TopicAdmin,
1918 > tonic::server::UnaryService<super::NewTopicRequest>
1919 for CreateTopicSvc<T> {
1920 type Response = super::TopicResponse;
1921 type Future = BoxFuture<
1922 tonic::Response<Self::Response>,
1923 tonic::Status,
1924 >;
1925 fn call(
1926 &mut self,
1927 request: tonic::Request<super::NewTopicRequest>,
1928 ) -> Self::Future {
1929 let inner = Arc::clone(&self.0);
1930 let fut = async move {
1931 <T as TopicAdmin>::create_topic(&inner, request).await
1932 };
1933 Box::pin(fut)
1934 }
1935 }
1936 let accept_compression_encodings = self.accept_compression_encodings;
1937 let send_compression_encodings = self.send_compression_encodings;
1938 let max_decoding_message_size = self.max_decoding_message_size;
1939 let max_encoding_message_size = self.max_encoding_message_size;
1940 let inner = self.inner.clone();
1941 let fut = async move {
1942 let method = CreateTopicSvc(inner);
1943 let codec = tonic_prost::ProstCodec::default();
1944 let mut grpc = tonic::server::Grpc::new(codec)
1945 .apply_compression_config(
1946 accept_compression_encodings,
1947 send_compression_encodings,
1948 )
1949 .apply_max_message_size_config(
1950 max_decoding_message_size,
1951 max_encoding_message_size,
1952 );
1953 let res = grpc.unary(method, req).await;
1954 Ok(res)
1955 };
1956 Box::pin(fut)
1957 }
1958 "/danube_admin.TopicAdmin/CreatePartitionedTopic" => {
1959 #[allow(non_camel_case_types)]
1960 struct CreatePartitionedTopicSvc<T: TopicAdmin>(pub Arc<T>);
1961 impl<
1962 T: TopicAdmin,
1963 > tonic::server::UnaryService<super::PartitionedTopicRequest>
1964 for CreatePartitionedTopicSvc<T> {
1965 type Response = super::TopicResponse;
1966 type Future = BoxFuture<
1967 tonic::Response<Self::Response>,
1968 tonic::Status,
1969 >;
1970 fn call(
1971 &mut self,
1972 request: tonic::Request<super::PartitionedTopicRequest>,
1973 ) -> Self::Future {
1974 let inner = Arc::clone(&self.0);
1975 let fut = async move {
1976 <T as TopicAdmin>::create_partitioned_topic(&inner, request)
1977 .await
1978 };
1979 Box::pin(fut)
1980 }
1981 }
1982 let accept_compression_encodings = self.accept_compression_encodings;
1983 let send_compression_encodings = self.send_compression_encodings;
1984 let max_decoding_message_size = self.max_decoding_message_size;
1985 let max_encoding_message_size = self.max_encoding_message_size;
1986 let inner = self.inner.clone();
1987 let fut = async move {
1988 let method = CreatePartitionedTopicSvc(inner);
1989 let codec = tonic_prost::ProstCodec::default();
1990 let mut grpc = tonic::server::Grpc::new(codec)
1991 .apply_compression_config(
1992 accept_compression_encodings,
1993 send_compression_encodings,
1994 )
1995 .apply_max_message_size_config(
1996 max_decoding_message_size,
1997 max_encoding_message_size,
1998 );
1999 let res = grpc.unary(method, req).await;
2000 Ok(res)
2001 };
2002 Box::pin(fut)
2003 }
2004 "/danube_admin.TopicAdmin/DeleteTopic" => {
2005 #[allow(non_camel_case_types)]
2006 struct DeleteTopicSvc<T: TopicAdmin>(pub Arc<T>);
2007 impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
2008 for DeleteTopicSvc<T> {
2009 type Response = super::TopicResponse;
2010 type Future = BoxFuture<
2011 tonic::Response<Self::Response>,
2012 tonic::Status,
2013 >;
2014 fn call(
2015 &mut self,
2016 request: tonic::Request<super::TopicRequest>,
2017 ) -> Self::Future {
2018 let inner = Arc::clone(&self.0);
2019 let fut = async move {
2020 <T as TopicAdmin>::delete_topic(&inner, request).await
2021 };
2022 Box::pin(fut)
2023 }
2024 }
2025 let accept_compression_encodings = self.accept_compression_encodings;
2026 let send_compression_encodings = self.send_compression_encodings;
2027 let max_decoding_message_size = self.max_decoding_message_size;
2028 let max_encoding_message_size = self.max_encoding_message_size;
2029 let inner = self.inner.clone();
2030 let fut = async move {
2031 let method = DeleteTopicSvc(inner);
2032 let codec = tonic_prost::ProstCodec::default();
2033 let mut grpc = tonic::server::Grpc::new(codec)
2034 .apply_compression_config(
2035 accept_compression_encodings,
2036 send_compression_encodings,
2037 )
2038 .apply_max_message_size_config(
2039 max_decoding_message_size,
2040 max_encoding_message_size,
2041 );
2042 let res = grpc.unary(method, req).await;
2043 Ok(res)
2044 };
2045 Box::pin(fut)
2046 }
2047 "/danube_admin.TopicAdmin/UnloadTopic" => {
2048 #[allow(non_camel_case_types)]
2049 struct UnloadTopicSvc<T: TopicAdmin>(pub Arc<T>);
2050 impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
2051 for UnloadTopicSvc<T> {
2052 type Response = super::TopicResponse;
2053 type Future = BoxFuture<
2054 tonic::Response<Self::Response>,
2055 tonic::Status,
2056 >;
2057 fn call(
2058 &mut self,
2059 request: tonic::Request<super::TopicRequest>,
2060 ) -> Self::Future {
2061 let inner = Arc::clone(&self.0);
2062 let fut = async move {
2063 <T as TopicAdmin>::unload_topic(&inner, request).await
2064 };
2065 Box::pin(fut)
2066 }
2067 }
2068 let accept_compression_encodings = self.accept_compression_encodings;
2069 let send_compression_encodings = self.send_compression_encodings;
2070 let max_decoding_message_size = self.max_decoding_message_size;
2071 let max_encoding_message_size = self.max_encoding_message_size;
2072 let inner = self.inner.clone();
2073 let fut = async move {
2074 let method = UnloadTopicSvc(inner);
2075 let codec = tonic_prost::ProstCodec::default();
2076 let mut grpc = tonic::server::Grpc::new(codec)
2077 .apply_compression_config(
2078 accept_compression_encodings,
2079 send_compression_encodings,
2080 )
2081 .apply_max_message_size_config(
2082 max_decoding_message_size,
2083 max_encoding_message_size,
2084 );
2085 let res = grpc.unary(method, req).await;
2086 Ok(res)
2087 };
2088 Box::pin(fut)
2089 }
2090 "/danube_admin.TopicAdmin/ListSubscriptions" => {
2091 #[allow(non_camel_case_types)]
2092 struct ListSubscriptionsSvc<T: TopicAdmin>(pub Arc<T>);
2093 impl<T: TopicAdmin> tonic::server::UnaryService<super::TopicRequest>
2094 for ListSubscriptionsSvc<T> {
2095 type Response = super::SubscriptionListResponse;
2096 type Future = BoxFuture<
2097 tonic::Response<Self::Response>,
2098 tonic::Status,
2099 >;
2100 fn call(
2101 &mut self,
2102 request: tonic::Request<super::TopicRequest>,
2103 ) -> Self::Future {
2104 let inner = Arc::clone(&self.0);
2105 let fut = async move {
2106 <T as TopicAdmin>::list_subscriptions(&inner, request).await
2107 };
2108 Box::pin(fut)
2109 }
2110 }
2111 let accept_compression_encodings = self.accept_compression_encodings;
2112 let send_compression_encodings = self.send_compression_encodings;
2113 let max_decoding_message_size = self.max_decoding_message_size;
2114 let max_encoding_message_size = self.max_encoding_message_size;
2115 let inner = self.inner.clone();
2116 let fut = async move {
2117 let method = ListSubscriptionsSvc(inner);
2118 let codec = tonic_prost::ProstCodec::default();
2119 let mut grpc = tonic::server::Grpc::new(codec)
2120 .apply_compression_config(
2121 accept_compression_encodings,
2122 send_compression_encodings,
2123 )
2124 .apply_max_message_size_config(
2125 max_decoding_message_size,
2126 max_encoding_message_size,
2127 );
2128 let res = grpc.unary(method, req).await;
2129 Ok(res)
2130 };
2131 Box::pin(fut)
2132 }
2133 "/danube_admin.TopicAdmin/Unsubscribe" => {
2134 #[allow(non_camel_case_types)]
2135 struct UnsubscribeSvc<T: TopicAdmin>(pub Arc<T>);
2136 impl<
2137 T: TopicAdmin,
2138 > tonic::server::UnaryService<super::SubscriptionRequest>
2139 for UnsubscribeSvc<T> {
2140 type Response = super::SubscriptionResponse;
2141 type Future = BoxFuture<
2142 tonic::Response<Self::Response>,
2143 tonic::Status,
2144 >;
2145 fn call(
2146 &mut self,
2147 request: tonic::Request<super::SubscriptionRequest>,
2148 ) -> Self::Future {
2149 let inner = Arc::clone(&self.0);
2150 let fut = async move {
2151 <T as TopicAdmin>::unsubscribe(&inner, request).await
2152 };
2153 Box::pin(fut)
2154 }
2155 }
2156 let accept_compression_encodings = self.accept_compression_encodings;
2157 let send_compression_encodings = self.send_compression_encodings;
2158 let max_decoding_message_size = self.max_decoding_message_size;
2159 let max_encoding_message_size = self.max_encoding_message_size;
2160 let inner = self.inner.clone();
2161 let fut = async move {
2162 let method = UnsubscribeSvc(inner);
2163 let codec = tonic_prost::ProstCodec::default();
2164 let mut grpc = tonic::server::Grpc::new(codec)
2165 .apply_compression_config(
2166 accept_compression_encodings,
2167 send_compression_encodings,
2168 )
2169 .apply_max_message_size_config(
2170 max_decoding_message_size,
2171 max_encoding_message_size,
2172 );
2173 let res = grpc.unary(method, req).await;
2174 Ok(res)
2175 };
2176 Box::pin(fut)
2177 }
2178 "/danube_admin.TopicAdmin/DescribeTopic" => {
2179 #[allow(non_camel_case_types)]
2180 struct DescribeTopicSvc<T: TopicAdmin>(pub Arc<T>);
2181 impl<
2182 T: TopicAdmin,
2183 > tonic::server::UnaryService<super::DescribeTopicRequest>
2184 for DescribeTopicSvc<T> {
2185 type Response = super::DescribeTopicResponse;
2186 type Future = BoxFuture<
2187 tonic::Response<Self::Response>,
2188 tonic::Status,
2189 >;
2190 fn call(
2191 &mut self,
2192 request: tonic::Request<super::DescribeTopicRequest>,
2193 ) -> Self::Future {
2194 let inner = Arc::clone(&self.0);
2195 let fut = async move {
2196 <T as TopicAdmin>::describe_topic(&inner, request).await
2197 };
2198 Box::pin(fut)
2199 }
2200 }
2201 let accept_compression_encodings = self.accept_compression_encodings;
2202 let send_compression_encodings = self.send_compression_encodings;
2203 let max_decoding_message_size = self.max_decoding_message_size;
2204 let max_encoding_message_size = self.max_encoding_message_size;
2205 let inner = self.inner.clone();
2206 let fut = async move {
2207 let method = DescribeTopicSvc(inner);
2208 let codec = tonic_prost::ProstCodec::default();
2209 let mut grpc = tonic::server::Grpc::new(codec)
2210 .apply_compression_config(
2211 accept_compression_encodings,
2212 send_compression_encodings,
2213 )
2214 .apply_max_message_size_config(
2215 max_decoding_message_size,
2216 max_encoding_message_size,
2217 );
2218 let res = grpc.unary(method, req).await;
2219 Ok(res)
2220 };
2221 Box::pin(fut)
2222 }
2223 _ => {
2224 Box::pin(async move {
2225 let mut response = http::Response::new(
2226 tonic::body::Body::default(),
2227 );
2228 let headers = response.headers_mut();
2229 headers
2230 .insert(
2231 tonic::Status::GRPC_STATUS,
2232 (tonic::Code::Unimplemented as i32).into(),
2233 );
2234 headers
2235 .insert(
2236 http::header::CONTENT_TYPE,
2237 tonic::metadata::GRPC_CONTENT_TYPE,
2238 );
2239 Ok(response)
2240 })
2241 }
2242 }
2243 }
2244 }
2245 impl<T> Clone for TopicAdminServer<T> {
2246 fn clone(&self) -> Self {
2247 let inner = self.inner.clone();
2248 Self {
2249 inner,
2250 accept_compression_encodings: self.accept_compression_encodings,
2251 send_compression_encodings: self.send_compression_encodings,
2252 max_decoding_message_size: self.max_decoding_message_size,
2253 max_encoding_message_size: self.max_encoding_message_size,
2254 }
2255 }
2256 }
2257 pub const SERVICE_NAME: &str = "danube_admin.TopicAdmin";
2259 impl<T> tonic::server::NamedService for TopicAdminServer<T> {
2260 const NAME: &'static str = SERVICE_NAME;
2261 }
2262}