1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct Subscribe {
5 #[prost(message, optional, tag = "1")]
6 pub header: ::core::option::Option<SlimHeader>,
7 #[prost(uint64, tag = "2")]
10 pub subscription_id: u64,
11}
12#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
13pub struct Unsubscribe {
14 #[prost(message, optional, tag = "1")]
15 pub header: ::core::option::Option<SlimHeader>,
16 #[prost(uint64, tag = "2")]
19 pub subscription_id: u64,
20}
21#[derive(Clone, PartialEq, ::prost::Message)]
22pub struct Publish {
23 #[prost(message, optional, tag = "1")]
24 pub header: ::core::option::Option<SlimHeader>,
25 #[prost(message, optional, tag = "2")]
26 pub session: ::core::option::Option<SessionHeader>,
27 #[prost(message, optional, tag = "3")]
28 pub msg: ::core::option::Option<Content>,
29}
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct Message {
32 #[prost(map = "string, string", tag = "4")]
33 pub metadata: ::std::collections::HashMap<
34 ::prost::alloc::string::String,
35 ::prost::alloc::string::String,
36 >,
37 #[prost(oneof = "message::MessageType", tags = "1, 2, 3, 5, 6")]
38 pub message_type: ::core::option::Option<message::MessageType>,
39}
40pub mod message {
42 #[derive(Clone, PartialEq, ::prost::Oneof)]
43 pub enum MessageType {
44 #[prost(message, tag = "1")]
45 Subscribe(super::Subscribe),
46 #[prost(message, tag = "2")]
47 Unsubscribe(super::Unsubscribe),
48 #[prost(message, tag = "3")]
49 Publish(super::Publish),
50 #[prost(message, tag = "5")]
51 Link(super::Link),
52 #[prost(message, tag = "6")]
53 SubscriptionAck(super::SubscriptionAck),
54 }
55}
56#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
59pub struct Link {
60 #[prost(oneof = "link::LinkType", tags = "1")]
61 pub link_type: ::core::option::Option<link::LinkType>,
62}
63pub mod link {
65 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
66 pub enum LinkType {
67 #[prost(message, tag = "1")]
68 LinkNegotiation(super::LinkNegotiationPayload),
69 }
70}
71#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
76pub struct SlimHeader {
77 #[prost(message, optional, tag = "1")]
78 pub source: ::core::option::Option<Name>,
79 #[prost(message, optional, tag = "2")]
80 pub destination: ::core::option::Option<Name>,
81 #[prost(string, tag = "4")]
82 pub identity: ::prost::alloc::string::String,
83 #[prost(uint32, tag = "3")]
84 pub fanout: u32,
85 #[prost(uint64, optional, tag = "5")]
86 pub recv_from: ::core::option::Option<u64>,
87 #[prost(uint64, optional, tag = "6")]
88 pub forward_to: ::core::option::Option<u64>,
89 #[prost(uint64, optional, tag = "7")]
90 pub incoming_conn: ::core::option::Option<u64>,
91 #[prost(bool, optional, tag = "8")]
92 pub error: ::core::option::Option<bool>,
93}
94#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
95pub struct SessionHeader {
96 #[prost(enumeration = "SessionType", tag = "1")]
97 pub session_type: i32,
98 #[prost(enumeration = "SessionMessageType", tag = "2")]
99 pub session_message_type: i32,
100 #[prost(uint32, tag = "3")]
101 pub session_id: u32,
102 #[prost(uint32, tag = "4")]
103 pub message_id: u32,
104}
105#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
106pub struct Name {
107 #[prost(message, optional, tag = "1")]
108 pub name: ::core::option::Option<EncodedName>,
109 #[prost(message, optional, tag = "2")]
110 pub str_name: ::core::option::Option<StringName>,
111}
112#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
113pub struct EncodedName {
114 #[prost(uint64, tag = "1")]
115 pub component_0: u64,
116 #[prost(uint64, tag = "2")]
117 pub component_1: u64,
118 #[prost(uint64, tag = "3")]
119 pub component_2: u64,
120 #[prost(uint64, tag = "4")]
121 pub component_3: u64,
122}
123#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
124pub struct StringName {
125 #[prost(string, tag = "1")]
126 pub str_component_0: ::prost::alloc::string::String,
127 #[prost(string, tag = "2")]
128 pub str_component_1: ::prost::alloc::string::String,
129 #[prost(string, tag = "3")]
130 pub str_component_2: ::prost::alloc::string::String,
131}
132#[derive(Clone, PartialEq, ::prost::Message)]
134pub struct Content {
135 #[prost(oneof = "content::ContentType", tags = "1, 2")]
136 pub content_type: ::core::option::Option<content::ContentType>,
137}
138pub mod content {
140 #[derive(Clone, PartialEq, ::prost::Oneof)]
141 pub enum ContentType {
142 #[prost(message, tag = "1")]
143 AppPayload(super::ApplicationPayload),
144 #[prost(message, tag = "2")]
145 CommandPayload(super::CommandPayload),
146 }
147}
148#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
149pub struct ApplicationPayload {
150 #[prost(string, tag = "1")]
151 pub payload_type: ::prost::alloc::string::String,
152 #[prost(bytes = "vec", tag = "2")]
153 pub blob: ::prost::alloc::vec::Vec<u8>,
154}
155#[derive(Clone, PartialEq, ::prost::Message)]
156pub struct CommandPayload {
157 #[prost(
158 oneof = "command_payload::CommandPayloadType",
159 tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14"
160 )]
161 pub command_payload_type: ::core::option::Option<
162 command_payload::CommandPayloadType,
163 >,
164}
165pub mod command_payload {
167 #[derive(Clone, PartialEq, ::prost::Oneof)]
168 pub enum CommandPayloadType {
169 #[prost(message, tag = "1")]
170 DiscoveryRequest(super::DiscoveryRequestPayload),
171 #[prost(message, tag = "2")]
172 DiscoveryReply(super::DiscoveryReplyPayload),
173 #[prost(message, tag = "3")]
174 JoinRequest(super::JoinRequestPayload),
175 #[prost(message, tag = "4")]
176 JoinReply(super::JoinReplyPayload),
177 #[prost(message, tag = "5")]
178 LeaveRequest(super::LeaveRequestPayload),
179 #[prost(message, tag = "6")]
180 LeaveReply(super::LeaveReplyPayload),
181 #[prost(message, tag = "7")]
182 GroupAdd(super::GroupAddPayload),
183 #[prost(message, tag = "8")]
184 GroupRemove(super::GroupRemovePayload),
185 #[prost(message, tag = "9")]
186 GroupWelcome(super::GroupWelcomePayload),
187 #[prost(message, tag = "10")]
188 GroupClose(super::GroupClosePayload),
189 #[prost(message, tag = "11")]
190 GroupProposal(super::GroupProposalPayload),
191 #[prost(message, tag = "12")]
192 GroupAck(super::GroupAckPayload),
193 #[prost(message, tag = "13")]
194 GroupNack(super::GroupNackPayload),
195 #[prost(message, tag = "14")]
196 Ping(super::PingPayload),
197 }
198}
199#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
203pub struct DiscoveryRequestPayload {
204 #[prost(message, optional, tag = "1")]
205 pub destination: ::core::option::Option<Name>,
206}
207#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
209pub struct DiscoveryReplyPayload {}
210#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
212pub struct JoinRequestPayload {
213 #[prost(bool, tag = "1")]
215 pub enable_mls: bool,
216 #[prost(message, optional, tag = "2")]
218 pub timer_settings: ::core::option::Option<TimerSettings>,
219 #[prost(message, optional, tag = "3")]
222 pub channel: ::core::option::Option<Name>,
223}
224#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
225pub struct TimerSettings {
226 #[prost(uint32, tag = "1")]
228 pub timeout: u32,
229 #[prost(uint32, tag = "2")]
230 pub max_retries: u32,
231}
232#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
234pub struct JoinReplyPayload {
235 #[prost(bytes = "vec", optional, tag = "1")]
237 pub key_package: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
238}
239#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
243pub struct LeaveRequestPayload {
244 #[prost(message, optional, tag = "1")]
245 pub destination: ::core::option::Option<Name>,
246}
247#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
249pub struct LeaveReplyPayload {}
250#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
253pub struct MlsPayload {
254 #[prost(uint32, tag = "1")]
257 pub commit_id: u32,
258 #[prost(bytes = "vec", tag = "2")]
260 pub mls_content: ::prost::alloc::vec::Vec<u8>,
261}
262#[derive(Clone, PartialEq, ::prost::Message)]
265pub struct GroupAddPayload {
266 #[prost(message, optional, tag = "1")]
268 pub new_participant: ::core::option::Option<Name>,
269 #[prost(message, repeated, tag = "2")]
271 pub participants: ::prost::alloc::vec::Vec<Name>,
272 #[prost(message, optional, tag = "3")]
274 pub mls: ::core::option::Option<MlsPayload>,
275}
276#[derive(Clone, PartialEq, ::prost::Message)]
279pub struct GroupRemovePayload {
280 #[prost(message, optional, tag = "1")]
282 pub removed_participant: ::core::option::Option<Name>,
283 #[prost(message, repeated, tag = "2")]
285 pub participants: ::prost::alloc::vec::Vec<Name>,
286 #[prost(message, optional, tag = "3")]
288 pub mls: ::core::option::Option<MlsPayload>,
289}
290#[derive(Clone, PartialEq, ::prost::Message)]
293pub struct GroupWelcomePayload {
294 #[prost(message, repeated, tag = "1")]
295 pub participants: ::prost::alloc::vec::Vec<Name>,
296 #[prost(message, optional, tag = "2")]
298 pub mls: ::core::option::Option<MlsPayload>,
299}
300#[derive(Clone, PartialEq, ::prost::Message)]
303pub struct GroupClosePayload {
304 #[prost(message, repeated, tag = "1")]
305 pub participants: ::prost::alloc::vec::Vec<Name>,
306}
307#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
310pub struct GroupProposalPayload {
311 #[prost(message, optional, tag = "1")]
316 pub source: ::core::option::Option<Name>,
317 #[prost(bytes = "vec", tag = "2")]
319 pub mls_proposal: ::prost::alloc::vec::Vec<u8>,
320}
321#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
323pub struct GroupAckPayload {}
324#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
326pub struct GroupNackPayload {}
327#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
329pub struct PingPayload {}
330#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
334pub struct SubscriptionAck {
335 #[prost(uint64, tag = "1")]
337 pub subscription_id: u64,
338 #[prost(bool, tag = "2")]
340 pub success: bool,
341 #[prost(string, tag = "3")]
343 pub error: ::prost::alloc::string::String,
344}
345#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
350pub struct LinkNegotiationPayload {
351 #[prost(string, tag = "1")]
354 pub link_id: ::prost::alloc::string::String,
355 #[prost(string, tag = "2")]
357 pub slim_version: ::prost::alloc::string::String,
358 #[prost(bool, tag = "3")]
360 pub is_reply: bool,
361}
362#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
363#[repr(i32)]
364pub enum SessionType {
365 Unspecified = 0,
366 PointToPoint = 1,
367 Multicast = 2,
368}
369impl SessionType {
370 pub fn as_str_name(&self) -> &'static str {
375 match self {
376 Self::Unspecified => "SESSION_TYPE_UNSPECIFIED",
377 Self::PointToPoint => "SESSION_TYPE_POINT_TO_POINT",
378 Self::Multicast => "SESSION_TYPE_MULTICAST",
379 }
380 }
381 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
383 match value {
384 "SESSION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
385 "SESSION_TYPE_POINT_TO_POINT" => Some(Self::PointToPoint),
386 "SESSION_TYPE_MULTICAST" => Some(Self::Multicast),
387 _ => None,
388 }
389 }
390}
391#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
392#[repr(i32)]
393pub enum SessionMessageType {
394 Unspecified = 0,
395 Msg = 1,
396 MsgAck = 2,
397 RtxRequest = 3,
398 RtxReply = 4,
399 DiscoveryRequest = 5,
400 DiscoveryReply = 6,
401 JoinRequest = 7,
402 JoinReply = 8,
403 LeaveRequest = 9,
404 LeaveReply = 10,
405 GroupAdd = 11,
406 GroupRemove = 12,
407 GroupWelcome = 13,
408 GroupClose = 14,
409 GroupProposal = 15,
410 GroupAck = 16,
411 GroupNack = 17,
412 Ping = 18,
413}
414impl SessionMessageType {
415 pub fn as_str_name(&self) -> &'static str {
420 match self {
421 Self::Unspecified => "SESSION_MESSAGE_TYPE_UNSPECIFIED",
422 Self::Msg => "SESSION_MESSAGE_TYPE_MSG",
423 Self::MsgAck => "SESSION_MESSAGE_TYPE_MSG_ACK",
424 Self::RtxRequest => "SESSION_MESSAGE_TYPE_RTX_REQUEST",
425 Self::RtxReply => "SESSION_MESSAGE_TYPE_RTX_REPLY",
426 Self::DiscoveryRequest => "SESSION_MESSAGE_TYPE_DISCOVERY_REQUEST",
427 Self::DiscoveryReply => "SESSION_MESSAGE_TYPE_DISCOVERY_REPLY",
428 Self::JoinRequest => "SESSION_MESSAGE_TYPE_JOIN_REQUEST",
429 Self::JoinReply => "SESSION_MESSAGE_TYPE_JOIN_REPLY",
430 Self::LeaveRequest => "SESSION_MESSAGE_TYPE_LEAVE_REQUEST",
431 Self::LeaveReply => "SESSION_MESSAGE_TYPE_LEAVE_REPLY",
432 Self::GroupAdd => "SESSION_MESSAGE_TYPE_GROUP_ADD",
433 Self::GroupRemove => "SESSION_MESSAGE_TYPE_GROUP_REMOVE",
434 Self::GroupWelcome => "SESSION_MESSAGE_TYPE_GROUP_WELCOME",
435 Self::GroupClose => "SESSION_MESSAGE_TYPE_GROUP_CLOSE",
436 Self::GroupProposal => "SESSION_MESSAGE_TYPE_GROUP_PROPOSAL",
437 Self::GroupAck => "SESSION_MESSAGE_TYPE_GROUP_ACK",
438 Self::GroupNack => "SESSION_MESSAGE_TYPE_GROUP_NACK",
439 Self::Ping => "SESSION_MESSAGE_TYPE_PING",
440 }
441 }
442 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
444 match value {
445 "SESSION_MESSAGE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
446 "SESSION_MESSAGE_TYPE_MSG" => Some(Self::Msg),
447 "SESSION_MESSAGE_TYPE_MSG_ACK" => Some(Self::MsgAck),
448 "SESSION_MESSAGE_TYPE_RTX_REQUEST" => Some(Self::RtxRequest),
449 "SESSION_MESSAGE_TYPE_RTX_REPLY" => Some(Self::RtxReply),
450 "SESSION_MESSAGE_TYPE_DISCOVERY_REQUEST" => Some(Self::DiscoveryRequest),
451 "SESSION_MESSAGE_TYPE_DISCOVERY_REPLY" => Some(Self::DiscoveryReply),
452 "SESSION_MESSAGE_TYPE_JOIN_REQUEST" => Some(Self::JoinRequest),
453 "SESSION_MESSAGE_TYPE_JOIN_REPLY" => Some(Self::JoinReply),
454 "SESSION_MESSAGE_TYPE_LEAVE_REQUEST" => Some(Self::LeaveRequest),
455 "SESSION_MESSAGE_TYPE_LEAVE_REPLY" => Some(Self::LeaveReply),
456 "SESSION_MESSAGE_TYPE_GROUP_ADD" => Some(Self::GroupAdd),
457 "SESSION_MESSAGE_TYPE_GROUP_REMOVE" => Some(Self::GroupRemove),
458 "SESSION_MESSAGE_TYPE_GROUP_WELCOME" => Some(Self::GroupWelcome),
459 "SESSION_MESSAGE_TYPE_GROUP_CLOSE" => Some(Self::GroupClose),
460 "SESSION_MESSAGE_TYPE_GROUP_PROPOSAL" => Some(Self::GroupProposal),
461 "SESSION_MESSAGE_TYPE_GROUP_ACK" => Some(Self::GroupAck),
462 "SESSION_MESSAGE_TYPE_GROUP_NACK" => Some(Self::GroupNack),
463 "SESSION_MESSAGE_TYPE_PING" => Some(Self::Ping),
464 _ => None,
465 }
466 }
467}
468pub mod data_plane_service_client {
470 #![allow(
471 unused_variables,
472 dead_code,
473 missing_docs,
474 clippy::wildcard_imports,
475 clippy::let_unit_value,
476 )]
477 use tonic::codegen::*;
478 use tonic::codegen::http::Uri;
479 #[derive(Debug, Clone)]
480 pub struct DataPlaneServiceClient<T> {
481 inner: tonic::client::Grpc<T>,
482 }
483 impl DataPlaneServiceClient<tonic::transport::Channel> {
484 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
486 where
487 D: TryInto<tonic::transport::Endpoint>,
488 D::Error: Into<StdError>,
489 {
490 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
491 Ok(Self::new(conn))
492 }
493 }
494 impl<T> DataPlaneServiceClient<T>
495 where
496 T: tonic::client::GrpcService<tonic::body::Body>,
497 T::Error: Into<StdError>,
498 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
499 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
500 {
501 pub fn new(inner: T) -> Self {
502 let inner = tonic::client::Grpc::new(inner);
503 Self { inner }
504 }
505 pub fn with_origin(inner: T, origin: Uri) -> Self {
506 let inner = tonic::client::Grpc::with_origin(inner, origin);
507 Self { inner }
508 }
509 pub fn with_interceptor<F>(
510 inner: T,
511 interceptor: F,
512 ) -> DataPlaneServiceClient<InterceptedService<T, F>>
513 where
514 F: tonic::service::Interceptor,
515 T::ResponseBody: Default,
516 T: tonic::codegen::Service<
517 http::Request<tonic::body::Body>,
518 Response = http::Response<
519 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
520 >,
521 >,
522 <T as tonic::codegen::Service<
523 http::Request<tonic::body::Body>,
524 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
525 {
526 DataPlaneServiceClient::new(InterceptedService::new(inner, interceptor))
527 }
528 #[must_use]
533 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
534 self.inner = self.inner.send_compressed(encoding);
535 self
536 }
537 #[must_use]
539 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
540 self.inner = self.inner.accept_compressed(encoding);
541 self
542 }
543 #[must_use]
547 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
548 self.inner = self.inner.max_decoding_message_size(limit);
549 self
550 }
551 #[must_use]
555 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
556 self.inner = self.inner.max_encoding_message_size(limit);
557 self
558 }
559 pub async fn open_channel(
560 &mut self,
561 request: impl tonic::IntoStreamingRequest<Message = super::Message>,
562 ) -> std::result::Result<
563 tonic::Response<tonic::codec::Streaming<super::Message>>,
564 tonic::Status,
565 > {
566 self.inner
567 .ready()
568 .await
569 .map_err(|e| {
570 tonic::Status::unknown(
571 format!("Service was not ready: {}", e.into()),
572 )
573 })?;
574 let codec = tonic_prost::ProstCodec::default();
575 let path = http::uri::PathAndQuery::from_static(
576 "/dataplane.proto.v1.DataPlaneService/OpenChannel",
577 );
578 let mut req = request.into_streaming_request();
579 req.extensions_mut()
580 .insert(
581 GrpcMethod::new("dataplane.proto.v1.DataPlaneService", "OpenChannel"),
582 );
583 self.inner.streaming(req, path, codec).await
584 }
585 }
586}
587pub mod data_plane_service_server {
589 #![allow(
590 unused_variables,
591 dead_code,
592 missing_docs,
593 clippy::wildcard_imports,
594 clippy::let_unit_value,
595 )]
596 use tonic::codegen::*;
597 #[async_trait]
599 pub trait DataPlaneService: std::marker::Send + std::marker::Sync + 'static {
600 type OpenChannelStream: tonic::codegen::tokio_stream::Stream<
602 Item = std::result::Result<super::Message, tonic::Status>,
603 >
604 + std::marker::Send
605 + 'static;
606 async fn open_channel(
607 &self,
608 request: tonic::Request<tonic::Streaming<super::Message>>,
609 ) -> std::result::Result<
610 tonic::Response<Self::OpenChannelStream>,
611 tonic::Status,
612 >;
613 }
614 #[derive(Debug)]
615 pub struct DataPlaneServiceServer<T> {
616 inner: Arc<T>,
617 accept_compression_encodings: EnabledCompressionEncodings,
618 send_compression_encodings: EnabledCompressionEncodings,
619 max_decoding_message_size: Option<usize>,
620 max_encoding_message_size: Option<usize>,
621 }
622 impl<T> DataPlaneServiceServer<T> {
623 pub fn new(inner: T) -> Self {
624 Self::from_arc(Arc::new(inner))
625 }
626 pub fn from_arc(inner: Arc<T>) -> Self {
627 Self {
628 inner,
629 accept_compression_encodings: Default::default(),
630 send_compression_encodings: Default::default(),
631 max_decoding_message_size: None,
632 max_encoding_message_size: None,
633 }
634 }
635 pub fn with_interceptor<F>(
636 inner: T,
637 interceptor: F,
638 ) -> InterceptedService<Self, F>
639 where
640 F: tonic::service::Interceptor,
641 {
642 InterceptedService::new(Self::new(inner), interceptor)
643 }
644 #[must_use]
646 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
647 self.accept_compression_encodings.enable(encoding);
648 self
649 }
650 #[must_use]
652 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
653 self.send_compression_encodings.enable(encoding);
654 self
655 }
656 #[must_use]
660 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
661 self.max_decoding_message_size = Some(limit);
662 self
663 }
664 #[must_use]
668 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
669 self.max_encoding_message_size = Some(limit);
670 self
671 }
672 }
673 impl<T, B> tonic::codegen::Service<http::Request<B>> for DataPlaneServiceServer<T>
674 where
675 T: DataPlaneService,
676 B: Body + std::marker::Send + 'static,
677 B::Error: Into<StdError> + std::marker::Send + 'static,
678 {
679 type Response = http::Response<tonic::body::Body>;
680 type Error = std::convert::Infallible;
681 type Future = BoxFuture<Self::Response, Self::Error>;
682 fn poll_ready(
683 &mut self,
684 _cx: &mut Context<'_>,
685 ) -> Poll<std::result::Result<(), Self::Error>> {
686 Poll::Ready(Ok(()))
687 }
688 fn call(&mut self, req: http::Request<B>) -> Self::Future {
689 match req.uri().path() {
690 "/dataplane.proto.v1.DataPlaneService/OpenChannel" => {
691 #[allow(non_camel_case_types)]
692 struct OpenChannelSvc<T: DataPlaneService>(pub Arc<T>);
693 impl<
694 T: DataPlaneService,
695 > tonic::server::StreamingService<super::Message>
696 for OpenChannelSvc<T> {
697 type Response = super::Message;
698 type ResponseStream = T::OpenChannelStream;
699 type Future = BoxFuture<
700 tonic::Response<Self::ResponseStream>,
701 tonic::Status,
702 >;
703 fn call(
704 &mut self,
705 request: tonic::Request<tonic::Streaming<super::Message>>,
706 ) -> Self::Future {
707 let inner = Arc::clone(&self.0);
708 let fut = async move {
709 <T as DataPlaneService>::open_channel(&inner, request).await
710 };
711 Box::pin(fut)
712 }
713 }
714 let accept_compression_encodings = self.accept_compression_encodings;
715 let send_compression_encodings = self.send_compression_encodings;
716 let max_decoding_message_size = self.max_decoding_message_size;
717 let max_encoding_message_size = self.max_encoding_message_size;
718 let inner = self.inner.clone();
719 let fut = async move {
720 let method = OpenChannelSvc(inner);
721 let codec = tonic_prost::ProstCodec::default();
722 let mut grpc = tonic::server::Grpc::new(codec)
723 .apply_compression_config(
724 accept_compression_encodings,
725 send_compression_encodings,
726 )
727 .apply_max_message_size_config(
728 max_decoding_message_size,
729 max_encoding_message_size,
730 );
731 let res = grpc.streaming(method, req).await;
732 Ok(res)
733 };
734 Box::pin(fut)
735 }
736 _ => {
737 Box::pin(async move {
738 let mut response = http::Response::new(
739 tonic::body::Body::default(),
740 );
741 let headers = response.headers_mut();
742 headers
743 .insert(
744 tonic::Status::GRPC_STATUS,
745 (tonic::Code::Unimplemented as i32).into(),
746 );
747 headers
748 .insert(
749 http::header::CONTENT_TYPE,
750 tonic::metadata::GRPC_CONTENT_TYPE,
751 );
752 Ok(response)
753 })
754 }
755 }
756 }
757 }
758 impl<T> Clone for DataPlaneServiceServer<T> {
759 fn clone(&self) -> Self {
760 let inner = self.inner.clone();
761 Self {
762 inner,
763 accept_compression_encodings: self.accept_compression_encodings,
764 send_compression_encodings: self.send_compression_encodings,
765 max_decoding_message_size: self.max_decoding_message_size,
766 max_encoding_message_size: self.max_encoding_message_size,
767 }
768 }
769 }
770 pub const SERVICE_NAME: &str = "dataplane.proto.v1.DataPlaneService";
772 impl<T> tonic::server::NamedService for DataPlaneServiceServer<T> {
773 const NAME: &'static str = SERVICE_NAME;
774 }
775}