slim_controller/api/gen/
controller.proto.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ControlMessage {
4    #[prost(string, tag = "1")]
5    pub message_id: ::prost::alloc::string::String,
6    #[prost(
7        oneof = "control_message::Payload",
8        tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19"
9    )]
10    pub payload: ::core::option::Option<control_message::Payload>,
11}
12/// Nested message and enum types in `ControlMessage`.
13pub mod control_message {
14    #[derive(Clone, PartialEq, ::prost::Oneof)]
15    pub enum Payload {
16        #[prost(message, tag = "2")]
17        ConfigCommand(super::ConfigurationCommand),
18        #[prost(message, tag = "3")]
19        Ack(super::Ack),
20        #[prost(message, tag = "4")]
21        SubscriptionListRequest(super::SubscriptionListRequest),
22        #[prost(message, tag = "5")]
23        SubscriptionListResponse(super::SubscriptionListResponse),
24        #[prost(message, tag = "6")]
25        ConnectionListRequest(super::ConnectionListRequest),
26        #[prost(message, tag = "7")]
27        ConnectionListResponse(super::ConnectionListResponse),
28        #[prost(message, tag = "8")]
29        RegisterNodeRequest(super::RegisterNodeRequest),
30        #[prost(message, tag = "9")]
31        RegisterNodeResponse(super::RegisterNodeResponse),
32        #[prost(message, tag = "10")]
33        DeregisterNodeRequest(super::DeregisterNodeRequest),
34        #[prost(message, tag = "11")]
35        DeregisterNodeResponse(super::DeregisterNodeResponse),
36        #[prost(message, tag = "12")]
37        CreateChannelRequest(super::CreateChannelRequest),
38        #[prost(message, tag = "13")]
39        DeleteChannelRequest(super::DeleteChannelRequest),
40        #[prost(message, tag = "14")]
41        AddParticipantRequest(super::AddParticipantRequest),
42        #[prost(message, tag = "15")]
43        DeleteParticipantRequest(super::DeleteParticipantRequest),
44        #[prost(message, tag = "16")]
45        ListChannelRequest(super::ListChannelsRequest),
46        #[prost(message, tag = "17")]
47        ListChannelResponse(super::ListChannelsResponse),
48        #[prost(message, tag = "18")]
49        ListParticipantsRequest(super::ListParticipantsRequest),
50        #[prost(message, tag = "19")]
51        ListParticipantsResponse(super::ListParticipantsResponse),
52    }
53}
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct Connection {
56    #[prost(string, tag = "1")]
57    pub connection_id: ::prost::alloc::string::String,
58    #[prost(string, tag = "2")]
59    pub config_data: ::prost::alloc::string::String,
60}
61#[derive(Clone, PartialEq, ::prost::Message)]
62pub struct Subscription {
63    #[prost(string, tag = "1")]
64    pub component_0: ::prost::alloc::string::String,
65    #[prost(string, tag = "2")]
66    pub component_1: ::prost::alloc::string::String,
67    #[prost(string, tag = "3")]
68    pub component_2: ::prost::alloc::string::String,
69    #[prost(message, optional, tag = "4")]
70    pub id: ::core::option::Option<u64>,
71    #[prost(string, tag = "5")]
72    pub connection_id: ::prost::alloc::string::String,
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct ConfigurationCommand {
76    #[prost(message, repeated, tag = "1")]
77    pub connections_to_create: ::prost::alloc::vec::Vec<Connection>,
78    #[prost(message, repeated, tag = "2")]
79    pub subscriptions_to_set: ::prost::alloc::vec::Vec<Subscription>,
80    #[prost(message, repeated, tag = "3")]
81    pub subscriptions_to_delete: ::prost::alloc::vec::Vec<Subscription>,
82}
83#[derive(Clone, PartialEq, ::prost::Message)]
84pub struct Ack {
85    #[prost(string, tag = "1")]
86    pub original_message_id: ::prost::alloc::string::String,
87    #[prost(bool, tag = "2")]
88    pub success: bool,
89    #[prost(string, repeated, tag = "3")]
90    pub messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
91}
92#[derive(Clone, Copy, PartialEq, ::prost::Message)]
93pub struct SubscriptionListRequest {}
94#[derive(Clone, PartialEq, ::prost::Message)]
95pub struct SubscriptionListResponse {
96    #[prost(message, repeated, tag = "1")]
97    pub entries: ::prost::alloc::vec::Vec<SubscriptionEntry>,
98}
99#[derive(Clone, PartialEq, ::prost::Message)]
100pub struct SubscriptionEntry {
101    #[prost(string, tag = "1")]
102    pub component_0: ::prost::alloc::string::String,
103    #[prost(string, tag = "2")]
104    pub component_1: ::prost::alloc::string::String,
105    #[prost(string, tag = "3")]
106    pub component_2: ::prost::alloc::string::String,
107    #[prost(message, optional, tag = "4")]
108    pub id: ::core::option::Option<u64>,
109    #[prost(message, repeated, tag = "5")]
110    pub local_connections: ::prost::alloc::vec::Vec<ConnectionEntry>,
111    #[prost(message, repeated, tag = "6")]
112    pub remote_connections: ::prost::alloc::vec::Vec<ConnectionEntry>,
113}
114#[derive(Clone, PartialEq, ::prost::Message)]
115pub struct ConnectionEntry {
116    #[prost(uint64, tag = "1")]
117    pub id: u64,
118    #[prost(enumeration = "ConnectionType", tag = "2")]
119    pub connection_type: i32,
120    #[prost(string, tag = "3")]
121    pub config_data: ::prost::alloc::string::String,
122}
123#[derive(Clone, Copy, PartialEq, ::prost::Message)]
124pub struct ConnectionListRequest {}
125#[derive(Clone, PartialEq, ::prost::Message)]
126pub struct ConnectionListResponse {
127    #[prost(message, repeated, tag = "1")]
128    pub entries: ::prost::alloc::vec::Vec<ConnectionEntry>,
129}
130#[derive(Clone, PartialEq, ::prost::Message)]
131pub struct Node {
132    #[prost(string, tag = "1")]
133    pub id: ::prost::alloc::string::String,
134}
135#[derive(Clone, PartialEq, ::prost::Message)]
136pub struct ConnectionDetails {
137    #[prost(string, tag = "1")]
138    pub endpoint: ::prost::alloc::string::String,
139    #[prost(bool, tag = "2")]
140    pub mtls_required: bool,
141    #[prost(string, optional, tag = "3")]
142    pub local_endpoint: ::core::option::Option<::prost::alloc::string::String>,
143    #[prost(string, optional, tag = "4")]
144    pub external_endpoint: ::core::option::Option<::prost::alloc::string::String>,
145    #[prost(string, optional, tag = "5")]
146    pub group_name: ::core::option::Option<::prost::alloc::string::String>,
147}
148#[derive(Clone, PartialEq, ::prost::Message)]
149pub struct RegisterNodeRequest {
150    #[prost(string, tag = "1")]
151    pub node_id: ::prost::alloc::string::String,
152    #[prost(message, repeated, tag = "2")]
153    pub connection_details: ::prost::alloc::vec::Vec<ConnectionDetails>,
154    #[prost(string, optional, tag = "3")]
155    pub group_name: ::core::option::Option<::prost::alloc::string::String>,
156}
157#[derive(Clone, Copy, PartialEq, ::prost::Message)]
158pub struct RegisterNodeResponse {
159    #[prost(bool, tag = "1")]
160    pub success: bool,
161}
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct DeregisterNodeRequest {
164    #[prost(message, optional, tag = "1")]
165    pub node: ::core::option::Option<Node>,
166}
167#[derive(Clone, Copy, PartialEq, ::prost::Message)]
168pub struct DeregisterNodeResponse {
169    #[prost(bool, tag = "1")]
170    pub success: bool,
171}
172#[derive(Clone, PartialEq, ::prost::Message)]
173pub struct CreateChannelRequest {
174    /// list of moderators for the channel
175    #[prost(string, repeated, tag = "1")]
176    pub moderators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
177    /// The channel name in the form organization/namespace/channel_name
178    #[prost(string, tag = "2")]
179    pub channel_name: ::prost::alloc::string::String,
180}
181#[derive(Clone, PartialEq, ::prost::Message)]
182pub struct DeleteChannelRequest {
183    /// The channel name in the form organization/namespace/channel_name
184    #[prost(string, tag = "1")]
185    pub channel_name: ::prost::alloc::string::String,
186    /// list of moderators for the channel
187    #[prost(string, repeated, tag = "2")]
188    pub moderators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
189}
190#[derive(Clone, PartialEq, ::prost::Message)]
191pub struct AddParticipantRequest {
192    /// The channel name in the form organization/namespace/channel_name
193    #[prost(string, tag = "1")]
194    pub channel_name: ::prost::alloc::string::String,
195    /// Name of the participant
196    #[prost(string, tag = "2")]
197    pub participant_name: ::prost::alloc::string::String,
198    /// list of moderators for the channel
199    #[prost(string, repeated, tag = "3")]
200    pub moderators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
201}
202#[derive(Clone, PartialEq, ::prost::Message)]
203pub struct DeleteParticipantRequest {
204    /// The channel name in the form organization/namespace/channel_name
205    #[prost(string, tag = "1")]
206    pub channel_name: ::prost::alloc::string::String,
207    /// ID of participant
208    #[prost(string, tag = "2")]
209    pub participant_name: ::prost::alloc::string::String,
210    /// list of moderators for the channel
211    #[prost(string, repeated, tag = "3")]
212    pub moderators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
213}
214#[derive(Clone, Copy, PartialEq, ::prost::Message)]
215pub struct ListChannelsRequest {}
216#[derive(Clone, PartialEq, ::prost::Message)]
217pub struct ListChannelsResponse {
218    /// IDs of the channels available in the control plane
219    #[prost(string, repeated, tag = "1")]
220    pub channel_name: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
221}
222#[derive(Clone, PartialEq, ::prost::Message)]
223pub struct ListParticipantsRequest {
224    /// name of the channel
225    #[prost(string, tag = "1")]
226    pub channel_name: ::prost::alloc::string::String,
227}
228#[derive(Clone, PartialEq, ::prost::Message)]
229pub struct ListParticipantsResponse {
230    /// list of participants in the channel
231    #[prost(string, repeated, tag = "1")]
232    pub participant_name: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
233}
234#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
235#[repr(i32)]
236pub enum ConnectionType {
237    Local = 0,
238    Remote = 1,
239}
240impl ConnectionType {
241    /// String value of the enum field names used in the ProtoBuf definition.
242    ///
243    /// The values are not transformed in any way and thus are considered stable
244    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
245    pub fn as_str_name(&self) -> &'static str {
246        match self {
247            Self::Local => "CONNECTION_TYPE_LOCAL",
248            Self::Remote => "CONNECTION_TYPE_REMOTE",
249        }
250    }
251    /// Creates an enum from field names used in the ProtoBuf definition.
252    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
253        match value {
254            "CONNECTION_TYPE_LOCAL" => Some(Self::Local),
255            "CONNECTION_TYPE_REMOTE" => Some(Self::Remote),
256            _ => None,
257        }
258    }
259}
260/// Generated client implementations.
261pub mod controller_service_client {
262    #![allow(
263        unused_variables,
264        dead_code,
265        missing_docs,
266        clippy::wildcard_imports,
267        clippy::let_unit_value,
268    )]
269    use tonic::codegen::*;
270    use tonic::codegen::http::Uri;
271    #[derive(Debug, Clone)]
272    pub struct ControllerServiceClient<T> {
273        inner: tonic::client::Grpc<T>,
274    }
275    impl ControllerServiceClient<tonic::transport::Channel> {
276        /// Attempt to create a new client by connecting to a given endpoint.
277        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
278        where
279            D: TryInto<tonic::transport::Endpoint>,
280            D::Error: Into<StdError>,
281        {
282            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
283            Ok(Self::new(conn))
284        }
285    }
286    impl<T> ControllerServiceClient<T>
287    where
288        T: tonic::client::GrpcService<tonic::body::Body>,
289        T::Error: Into<StdError>,
290        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
291        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
292    {
293        pub fn new(inner: T) -> Self {
294            let inner = tonic::client::Grpc::new(inner);
295            Self { inner }
296        }
297        pub fn with_origin(inner: T, origin: Uri) -> Self {
298            let inner = tonic::client::Grpc::with_origin(inner, origin);
299            Self { inner }
300        }
301        pub fn with_interceptor<F>(
302            inner: T,
303            interceptor: F,
304        ) -> ControllerServiceClient<InterceptedService<T, F>>
305        where
306            F: tonic::service::Interceptor,
307            T::ResponseBody: Default,
308            T: tonic::codegen::Service<
309                http::Request<tonic::body::Body>,
310                Response = http::Response<
311                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
312                >,
313            >,
314            <T as tonic::codegen::Service<
315                http::Request<tonic::body::Body>,
316            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
317        {
318            ControllerServiceClient::new(InterceptedService::new(inner, interceptor))
319        }
320        /// Compress requests with the given encoding.
321        ///
322        /// This requires the server to support it otherwise it might respond with an
323        /// error.
324        #[must_use]
325        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
326            self.inner = self.inner.send_compressed(encoding);
327            self
328        }
329        /// Enable decompressing responses.
330        #[must_use]
331        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
332            self.inner = self.inner.accept_compressed(encoding);
333            self
334        }
335        /// Limits the maximum size of a decoded message.
336        ///
337        /// Default: `4MB`
338        #[must_use]
339        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
340            self.inner = self.inner.max_decoding_message_size(limit);
341            self
342        }
343        /// Limits the maximum size of an encoded message.
344        ///
345        /// Default: `usize::MAX`
346        #[must_use]
347        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
348            self.inner = self.inner.max_encoding_message_size(limit);
349            self
350        }
351        pub async fn open_control_channel(
352            &mut self,
353            request: impl tonic::IntoStreamingRequest<Message = super::ControlMessage>,
354        ) -> std::result::Result<
355            tonic::Response<tonic::codec::Streaming<super::ControlMessage>>,
356            tonic::Status,
357        > {
358            self.inner
359                .ready()
360                .await
361                .map_err(|e| {
362                    tonic::Status::unknown(
363                        format!("Service was not ready: {}", e.into()),
364                    )
365                })?;
366            let codec = tonic::codec::ProstCodec::default();
367            let path = http::uri::PathAndQuery::from_static(
368                "/controller.proto.v1.ControllerService/OpenControlChannel",
369            );
370            let mut req = request.into_streaming_request();
371            req.extensions_mut()
372                .insert(
373                    GrpcMethod::new(
374                        "controller.proto.v1.ControllerService",
375                        "OpenControlChannel",
376                    ),
377                );
378            self.inner.streaming(req, path, codec).await
379        }
380    }
381}
382/// Generated server implementations.
383pub mod controller_service_server {
384    #![allow(
385        unused_variables,
386        dead_code,
387        missing_docs,
388        clippy::wildcard_imports,
389        clippy::let_unit_value,
390    )]
391    use tonic::codegen::*;
392    /// Generated trait containing gRPC methods that should be implemented for use with ControllerServiceServer.
393    #[async_trait]
394    pub trait ControllerService: std::marker::Send + std::marker::Sync + 'static {
395        /// Server streaming response type for the OpenControlChannel method.
396        type OpenControlChannelStream: tonic::codegen::tokio_stream::Stream<
397                Item = std::result::Result<super::ControlMessage, tonic::Status>,
398            >
399            + std::marker::Send
400            + 'static;
401        async fn open_control_channel(
402            &self,
403            request: tonic::Request<tonic::Streaming<super::ControlMessage>>,
404        ) -> std::result::Result<
405            tonic::Response<Self::OpenControlChannelStream>,
406            tonic::Status,
407        >;
408    }
409    #[derive(Debug)]
410    pub struct ControllerServiceServer<T> {
411        inner: Arc<T>,
412        accept_compression_encodings: EnabledCompressionEncodings,
413        send_compression_encodings: EnabledCompressionEncodings,
414        max_decoding_message_size: Option<usize>,
415        max_encoding_message_size: Option<usize>,
416    }
417    impl<T> ControllerServiceServer<T> {
418        pub fn new(inner: T) -> Self {
419            Self::from_arc(Arc::new(inner))
420        }
421        pub fn from_arc(inner: Arc<T>) -> Self {
422            Self {
423                inner,
424                accept_compression_encodings: Default::default(),
425                send_compression_encodings: Default::default(),
426                max_decoding_message_size: None,
427                max_encoding_message_size: None,
428            }
429        }
430        pub fn with_interceptor<F>(
431            inner: T,
432            interceptor: F,
433        ) -> InterceptedService<Self, F>
434        where
435            F: tonic::service::Interceptor,
436        {
437            InterceptedService::new(Self::new(inner), interceptor)
438        }
439        /// Enable decompressing requests with the given encoding.
440        #[must_use]
441        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
442            self.accept_compression_encodings.enable(encoding);
443            self
444        }
445        /// Compress responses with the given encoding, if the client supports it.
446        #[must_use]
447        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
448            self.send_compression_encodings.enable(encoding);
449            self
450        }
451        /// Limits the maximum size of a decoded message.
452        ///
453        /// Default: `4MB`
454        #[must_use]
455        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
456            self.max_decoding_message_size = Some(limit);
457            self
458        }
459        /// Limits the maximum size of an encoded message.
460        ///
461        /// Default: `usize::MAX`
462        #[must_use]
463        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
464            self.max_encoding_message_size = Some(limit);
465            self
466        }
467    }
468    impl<T, B> tonic::codegen::Service<http::Request<B>> for ControllerServiceServer<T>
469    where
470        T: ControllerService,
471        B: Body + std::marker::Send + 'static,
472        B::Error: Into<StdError> + std::marker::Send + 'static,
473    {
474        type Response = http::Response<tonic::body::Body>;
475        type Error = std::convert::Infallible;
476        type Future = BoxFuture<Self::Response, Self::Error>;
477        fn poll_ready(
478            &mut self,
479            _cx: &mut Context<'_>,
480        ) -> Poll<std::result::Result<(), Self::Error>> {
481            Poll::Ready(Ok(()))
482        }
483        fn call(&mut self, req: http::Request<B>) -> Self::Future {
484            match req.uri().path() {
485                "/controller.proto.v1.ControllerService/OpenControlChannel" => {
486                    #[allow(non_camel_case_types)]
487                    struct OpenControlChannelSvc<T: ControllerService>(pub Arc<T>);
488                    impl<
489                        T: ControllerService,
490                    > tonic::server::StreamingService<super::ControlMessage>
491                    for OpenControlChannelSvc<T> {
492                        type Response = super::ControlMessage;
493                        type ResponseStream = T::OpenControlChannelStream;
494                        type Future = BoxFuture<
495                            tonic::Response<Self::ResponseStream>,
496                            tonic::Status,
497                        >;
498                        fn call(
499                            &mut self,
500                            request: tonic::Request<
501                                tonic::Streaming<super::ControlMessage>,
502                            >,
503                        ) -> Self::Future {
504                            let inner = Arc::clone(&self.0);
505                            let fut = async move {
506                                <T as ControllerService>::open_control_channel(
507                                        &inner,
508                                        request,
509                                    )
510                                    .await
511                            };
512                            Box::pin(fut)
513                        }
514                    }
515                    let accept_compression_encodings = self.accept_compression_encodings;
516                    let send_compression_encodings = self.send_compression_encodings;
517                    let max_decoding_message_size = self.max_decoding_message_size;
518                    let max_encoding_message_size = self.max_encoding_message_size;
519                    let inner = self.inner.clone();
520                    let fut = async move {
521                        let method = OpenControlChannelSvc(inner);
522                        let codec = tonic::codec::ProstCodec::default();
523                        let mut grpc = tonic::server::Grpc::new(codec)
524                            .apply_compression_config(
525                                accept_compression_encodings,
526                                send_compression_encodings,
527                            )
528                            .apply_max_message_size_config(
529                                max_decoding_message_size,
530                                max_encoding_message_size,
531                            );
532                        let res = grpc.streaming(method, req).await;
533                        Ok(res)
534                    };
535                    Box::pin(fut)
536                }
537                _ => {
538                    Box::pin(async move {
539                        let mut response = http::Response::new(
540                            tonic::body::Body::default(),
541                        );
542                        let headers = response.headers_mut();
543                        headers
544                            .insert(
545                                tonic::Status::GRPC_STATUS,
546                                (tonic::Code::Unimplemented as i32).into(),
547                            );
548                        headers
549                            .insert(
550                                http::header::CONTENT_TYPE,
551                                tonic::metadata::GRPC_CONTENT_TYPE,
552                            );
553                        Ok(response)
554                    })
555                }
556            }
557        }
558    }
559    impl<T> Clone for ControllerServiceServer<T> {
560        fn clone(&self) -> Self {
561            let inner = self.inner.clone();
562            Self {
563                inner,
564                accept_compression_encodings: self.accept_compression_encodings,
565                send_compression_encodings: self.send_compression_encodings,
566                max_decoding_message_size: self.max_decoding_message_size,
567                max_encoding_message_size: self.max_encoding_message_size,
568            }
569        }
570    }
571    /// Generated gRPC service name
572    pub const SERVICE_NAME: &str = "controller.proto.v1.ControllerService";
573    impl<T> tonic::server::NamedService for ControllerServiceServer<T> {
574        const NAME: &'static str = SERVICE_NAME;
575    }
576}