Skip to main content

slim_datapath/api/gen/
dataplane.proto.v1.rs

1// This file is @generated by prost-build.
2/// SLIM messages
3#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct Subscribe {
5    #[prost(message, optional, tag = "1")]
6    pub header: ::core::option::Option<SlimHeader>,
7    /// Globally unique identifier for this subscription.
8    /// Non-zero when the sender wants a SubscriptionAck back.
9    #[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    /// Globally unique identifier for this subscription.
17    /// Non-zero when the sender wants a SubscriptionAck back.
18    #[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}
40/// Nested message and enum types in `Message`.
41pub 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/// Link is a link-local message exchanged only between directly connected SLIM nodes.
57/// It is never routed and never sent over local (application-facing) connections.
58#[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}
63/// Nested message and enum types in `Link`.
64pub 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/// recvFrom = connection from where the sub/unsub is supposed to be received
72/// forwardTo = connection where to forward the message
73/// incomingConn = connection from where the packet was received
74/// error = if true the publication contains an error notification
75#[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/// SLIM message content
133#[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}
138/// Nested message and enum types in `Content`.
139pub 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}
165/// Nested message and enum types in `CommandPayload`.
166pub 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/// Discovery Request
200/// The destination is Optional. If present the message should be forwarded
201/// to the destination in the payload.
202#[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/// Discovery Reply
208#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
209pub struct DiscoveryReplyPayload {}
210/// Join Request
211#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
212pub struct JoinRequestPayload {
213    /// true if mls is enabled
214    #[prost(bool, tag = "1")]
215    pub enable_mls: bool,
216    /// settings for timers for rtx and acks
217    #[prost(message, optional, tag = "2")]
218    pub timer_settings: ::core::option::Option<TimerSettings>,
219    /// name where to send the messages
220    /// it can be a channel or none
221    #[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    /// timeout is intended in ms
227    #[prost(uint32, tag = "1")]
228    pub timeout: u32,
229    #[prost(uint32, tag = "2")]
230    pub max_retries: u32,
231}
232/// Join Reply
233#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
234pub struct JoinReplyPayload {
235    /// to be used only is MLS is enabled
236    #[prost(bytes = "vec", optional, tag = "1")]
237    pub key_package: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
238}
239/// Leave Request
240/// The destination is Optional. If present the message should be forwarded
241/// to the destination in the payload.
242#[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/// Leave Reply
248#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
249pub struct LeaveReplyPayload {}
250/// MLS payload to add to the group
251/// messages when mls is active
252#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
253pub struct MlsPayload {
254    /// the commit id for add/rm participants
255    /// the last commit id sent by the moderator in case of welcome message
256    #[prost(uint32, tag = "1")]
257    pub commit_id: u32,
258    /// commit or welcome mls message
259    #[prost(bytes = "vec", tag = "2")]
260    pub mls_content: ::prost::alloc::vec::Vec<u8>,
261}
262/// Group Add Payload
263/// sent when a new participant is added
264#[derive(Clone, PartialEq, ::prost::Message)]
265pub struct GroupAddPayload {
266    /// new participant to add
267    #[prost(message, optional, tag = "1")]
268    pub new_participant: ::core::option::Option<Name>,
269    /// new list of participants
270    #[prost(message, repeated, tag = "2")]
271    pub participants: ::prost::alloc::vec::Vec<Name>,
272    /// used only when MLS is enabled
273    #[prost(message, optional, tag = "3")]
274    pub mls: ::core::option::Option<MlsPayload>,
275}
276/// Group Remove Payload
277/// sent when a participant is removed
278#[derive(Clone, PartialEq, ::prost::Message)]
279pub struct GroupRemovePayload {
280    /// new participant to add
281    #[prost(message, optional, tag = "1")]
282    pub removed_participant: ::core::option::Option<Name>,
283    /// new list of participants
284    #[prost(message, repeated, tag = "2")]
285    pub participants: ::prost::alloc::vec::Vec<Name>,
286    /// used only when MLS is enabled
287    #[prost(message, optional, tag = "3")]
288    pub mls: ::core::option::Option<MlsPayload>,
289}
290/// Group Welcome
291/// sent on group join
292#[derive(Clone, PartialEq, ::prost::Message)]
293pub struct GroupWelcomePayload {
294    #[prost(message, repeated, tag = "1")]
295    pub participants: ::prost::alloc::vec::Vec<Name>,
296    /// used only when MLS is enabled
297    #[prost(message, optional, tag = "2")]
298    pub mls: ::core::option::Option<MlsPayload>,
299}
300/// Group Close
301/// sent on group close
302#[derive(Clone, PartialEq, ::prost::Message)]
303pub struct GroupClosePayload {
304    #[prost(message, repeated, tag = "1")]
305    pub participants: ::prost::alloc::vec::Vec<Name>,
306}
307/// Group Proposal
308/// sent on mls key rotation
309#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
310pub struct GroupProposalPayload {
311    /// Original name of the endpoint that crated the proposal name
312    /// this may by different from the packet source since it is
313    /// forwarded by the moderator on the channel to all the
314    /// group participants
315    #[prost(message, optional, tag = "1")]
316    pub source: ::core::option::Option<Name>,
317    /// MLS proposal message
318    #[prost(bytes = "vec", tag = "2")]
319    pub mls_proposal: ::prost::alloc::vec::Vec<u8>,
320}
321/// Group Ack
322#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
323pub struct GroupAckPayload {}
324/// Group Nack
325#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
326pub struct GroupNackPayload {}
327/// Ping
328#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
329pub struct PingPayload {}
330/// SubscriptionAck is delivered directly to the requesting connection in response
331/// to a Subscribe or Unsubscribe that carried a non-zero subscription_id field.
332/// It is never routed through the subscription table.
333#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
334pub struct SubscriptionAck {
335    /// Echoes the subscription_id from the originating Subscribe or Unsubscribe request.
336    #[prost(uint64, tag = "1")]
337    pub subscription_id: u64,
338    /// True if the subscription operation succeeded.
339    #[prost(bool, tag = "2")]
340    pub success: bool,
341    /// Non-empty only when success == false.
342    #[prost(string, tag = "3")]
343    pub error: ::prost::alloc::string::String,
344}
345/// Link Negotiation
346/// Sent upon connection establishment to negotiate a common link identifier
347/// and exchange SLIM version information. Not routed; handled locally by
348/// the receiving SLIM instance.
349#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
350pub struct LinkNegotiationPayload {
351    /// Common link identifier agreed upon by both peers.
352    /// The connecting side generates this value; the accepting side echoes it back.
353    #[prost(string, tag = "1")]
354    pub link_id: ::prost::alloc::string::String,
355    /// SLIM version of the sender (semver string, e.g. "0.11.4").
356    #[prost(string, tag = "2")]
357    pub slim_version: ::prost::alloc::string::String,
358    /// True if this message is a reply to a negotiation request.
359    #[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    /// String value of the enum field names used in the ProtoBuf definition.
371    ///
372    /// The values are not transformed in any way and thus are considered stable
373    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
374    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    /// Creates an enum from field names used in the ProtoBuf definition.
382    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    /// String value of the enum field names used in the ProtoBuf definition.
416    ///
417    /// The values are not transformed in any way and thus are considered stable
418    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
419    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    /// Creates an enum from field names used in the ProtoBuf definition.
443    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}
468/// Generated client implementations.
469pub 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        /// Attempt to create a new client by connecting to a given endpoint.
485        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        /// Compress requests with the given encoding.
529        ///
530        /// This requires the server to support it otherwise it might respond with an
531        /// error.
532        #[must_use]
533        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
534            self.inner = self.inner.send_compressed(encoding);
535            self
536        }
537        /// Enable decompressing responses.
538        #[must_use]
539        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
540            self.inner = self.inner.accept_compressed(encoding);
541            self
542        }
543        /// Limits the maximum size of a decoded message.
544        ///
545        /// Default: `4MB`
546        #[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        /// Limits the maximum size of an encoded message.
552        ///
553        /// Default: `usize::MAX`
554        #[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}
587/// Generated server implementations.
588pub 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    /// Generated trait containing gRPC methods that should be implemented for use with DataPlaneServiceServer.
598    #[async_trait]
599    pub trait DataPlaneService: std::marker::Send + std::marker::Sync + 'static {
600        /// Server streaming response type for the OpenChannel method.
601        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        /// Enable decompressing requests with the given encoding.
645        #[must_use]
646        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
647            self.accept_compression_encodings.enable(encoding);
648            self
649        }
650        /// Compress responses with the given encoding, if the client supports it.
651        #[must_use]
652        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
653            self.send_compression_encodings.enable(encoding);
654            self
655        }
656        /// Limits the maximum size of a decoded message.
657        ///
658        /// Default: `4MB`
659        #[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        /// Limits the maximum size of an encoded message.
665        ///
666        /// Default: `usize::MAX`
667        #[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    /// Generated gRPC service name
771    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}