1#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Subscribe {
4 #[prost(message, optional, tag = "1")]
5 pub header: ::core::option::Option<SlimHeader>,
6 #[prost(string, tag = "2")]
7 pub component_0: ::prost::alloc::string::String,
8 #[prost(string, tag = "3")]
9 pub component_1: ::prost::alloc::string::String,
10 #[prost(string, tag = "4")]
11 pub component_2: ::prost::alloc::string::String,
12}
13#[derive(Clone, Copy, PartialEq, ::prost::Message)]
14pub struct Unsubscribe {
15 #[prost(message, optional, tag = "1")]
16 pub header: ::core::option::Option<SlimHeader>,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct Publish {
20 #[prost(message, optional, tag = "1")]
21 pub header: ::core::option::Option<SlimHeader>,
22 #[prost(message, optional, tag = "2")]
23 pub session: ::core::option::Option<SessionHeader>,
24 #[prost(message, optional, tag = "4")]
25 pub msg: ::core::option::Option<Content>,
26}
27#[derive(Clone, Copy, PartialEq, ::prost::Message)]
32pub struct SlimHeader {
33 #[prost(message, optional, tag = "1")]
34 pub source: ::core::option::Option<Name>,
35 #[prost(message, optional, tag = "2")]
36 pub destination: ::core::option::Option<Name>,
37 #[prost(uint32, tag = "3")]
38 pub fanout: u32,
39 #[prost(uint64, optional, tag = "4")]
40 pub recv_from: ::core::option::Option<u64>,
41 #[prost(uint64, optional, tag = "5")]
42 pub forward_to: ::core::option::Option<u64>,
43 #[prost(uint64, optional, tag = "6")]
44 pub incoming_conn: ::core::option::Option<u64>,
45 #[prost(bool, optional, tag = "7")]
46 pub error: ::core::option::Option<bool>,
47}
48#[derive(Clone, Copy, PartialEq, ::prost::Message)]
49pub struct Name {
50 #[prost(uint64, tag = "1")]
51 pub component_0: u64,
52 #[prost(uint64, tag = "2")]
53 pub component_1: u64,
54 #[prost(uint64, tag = "3")]
55 pub component_2: u64,
56 #[prost(uint64, tag = "4")]
57 pub component_3: u64,
58}
59#[derive(Clone, Copy, PartialEq, ::prost::Message)]
60pub struct SessionHeader {
61 #[prost(enumeration = "SessionType", tag = "1")]
62 pub session_type: i32,
63 #[prost(enumeration = "SessionMessageType", tag = "2")]
64 pub session_message_type: i32,
65 #[prost(uint32, tag = "3")]
66 pub session_id: u32,
67 #[prost(uint32, tag = "4")]
68 pub message_id: u32,
69}
70#[derive(Clone, PartialEq, ::prost::Message)]
71pub struct Content {
72 #[prost(string, tag = "1")]
73 pub content_type: ::prost::alloc::string::String,
74 #[prost(bytes = "vec", tag = "2")]
75 pub blob: ::prost::alloc::vec::Vec<u8>,
76}
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct Message {
79 #[prost(map = "string, string", tag = "4")]
80 pub metadata: ::std::collections::HashMap<
81 ::prost::alloc::string::String,
82 ::prost::alloc::string::String,
83 >,
84 #[prost(oneof = "message::MessageType", tags = "1, 2, 3")]
85 pub message_type: ::core::option::Option<message::MessageType>,
86}
87pub mod message {
89 #[derive(Clone, PartialEq, ::prost::Oneof)]
90 pub enum MessageType {
91 #[prost(message, tag = "1")]
92 Subscribe(super::Subscribe),
93 #[prost(message, tag = "2")]
94 Unsubscribe(super::Unsubscribe),
95 #[prost(message, tag = "3")]
96 Publish(super::Publish),
97 }
98}
99#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
100#[repr(i32)]
101pub enum SessionType {
102 SessionUnknown = 0,
103 SessionFireForget = 1,
104 SessionStreaming = 2,
105 SessionPubSub = 3,
106}
107impl SessionType {
108 pub fn as_str_name(&self) -> &'static str {
113 match self {
114 Self::SessionUnknown => "SESSION_UNKNOWN",
115 Self::SessionFireForget => "SESSION_FIRE_FORGET",
116 Self::SessionStreaming => "SESSION_STREAMING",
117 Self::SessionPubSub => "SESSION_PUB_SUB",
118 }
119 }
120 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
122 match value {
123 "SESSION_UNKNOWN" => Some(Self::SessionUnknown),
124 "SESSION_FIRE_FORGET" => Some(Self::SessionFireForget),
125 "SESSION_STREAMING" => Some(Self::SessionStreaming),
126 "SESSION_PUB_SUB" => Some(Self::SessionPubSub),
127 _ => None,
128 }
129 }
130}
131#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
132#[repr(i32)]
133pub enum SessionMessageType {
134 Unspecified = 0,
135 FnfMsg = 1,
136 FnfReliable = 2,
137 FnfAck = 3,
138 StreamMsg = 4,
139 PubSubMsg = 5,
140 RtxRequest = 6,
141 RtxReply = 7,
142 BeaconStream = 8,
143 BeaconPubSub = 9,
144 ChannelDiscoveryRequest = 10,
145 ChannelDiscoveryReply = 11,
146 ChannelJoinRequest = 12,
147 ChannelJoinReply = 13,
148 ChannelLeaveRequest = 14,
149 ChannelLeaveReply = 15,
150 ChannelMlsCommit = 16,
151 ChannelMlsWelcome = 17,
152 ChannelMlsProposal = 18,
153 ChannelMlsAck = 19,
154}
155impl SessionMessageType {
156 pub fn as_str_name(&self) -> &'static str {
161 match self {
162 Self::Unspecified => "UNSPECIFIED",
163 Self::FnfMsg => "FNF_MSG",
164 Self::FnfReliable => "FNF_RELIABLE",
165 Self::FnfAck => "FNF_ACK",
166 Self::StreamMsg => "STREAM_MSG",
167 Self::PubSubMsg => "PUB_SUB_MSG",
168 Self::RtxRequest => "RTX_REQUEST",
169 Self::RtxReply => "RTX_REPLY",
170 Self::BeaconStream => "BEACON_STREAM",
171 Self::BeaconPubSub => "BEACON_PUB_SUB",
172 Self::ChannelDiscoveryRequest => "CHANNEL_DISCOVERY_REQUEST",
173 Self::ChannelDiscoveryReply => "CHANNEL_DISCOVERY_REPLY",
174 Self::ChannelJoinRequest => "CHANNEL_JOIN_REQUEST",
175 Self::ChannelJoinReply => "CHANNEL_JOIN_REPLY",
176 Self::ChannelLeaveRequest => "CHANNEL_LEAVE_REQUEST",
177 Self::ChannelLeaveReply => "CHANNEL_LEAVE_REPLY",
178 Self::ChannelMlsCommit => "CHANNEL_MLS_COMMIT",
179 Self::ChannelMlsWelcome => "CHANNEL_MLS_WELCOME",
180 Self::ChannelMlsProposal => "CHANNEL_MLS_PROPOSAL",
181 Self::ChannelMlsAck => "CHANNEL_MLS_ACK",
182 }
183 }
184 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
186 match value {
187 "UNSPECIFIED" => Some(Self::Unspecified),
188 "FNF_MSG" => Some(Self::FnfMsg),
189 "FNF_RELIABLE" => Some(Self::FnfReliable),
190 "FNF_ACK" => Some(Self::FnfAck),
191 "STREAM_MSG" => Some(Self::StreamMsg),
192 "PUB_SUB_MSG" => Some(Self::PubSubMsg),
193 "RTX_REQUEST" => Some(Self::RtxRequest),
194 "RTX_REPLY" => Some(Self::RtxReply),
195 "BEACON_STREAM" => Some(Self::BeaconStream),
196 "BEACON_PUB_SUB" => Some(Self::BeaconPubSub),
197 "CHANNEL_DISCOVERY_REQUEST" => Some(Self::ChannelDiscoveryRequest),
198 "CHANNEL_DISCOVERY_REPLY" => Some(Self::ChannelDiscoveryReply),
199 "CHANNEL_JOIN_REQUEST" => Some(Self::ChannelJoinRequest),
200 "CHANNEL_JOIN_REPLY" => Some(Self::ChannelJoinReply),
201 "CHANNEL_LEAVE_REQUEST" => Some(Self::ChannelLeaveRequest),
202 "CHANNEL_LEAVE_REPLY" => Some(Self::ChannelLeaveReply),
203 "CHANNEL_MLS_COMMIT" => Some(Self::ChannelMlsCommit),
204 "CHANNEL_MLS_WELCOME" => Some(Self::ChannelMlsWelcome),
205 "CHANNEL_MLS_PROPOSAL" => Some(Self::ChannelMlsProposal),
206 "CHANNEL_MLS_ACK" => Some(Self::ChannelMlsAck),
207 _ => None,
208 }
209 }
210}
211pub mod pub_sub_service_client {
213 #![allow(
214 unused_variables,
215 dead_code,
216 missing_docs,
217 clippy::wildcard_imports,
218 clippy::let_unit_value,
219 )]
220 use tonic::codegen::*;
221 use tonic::codegen::http::Uri;
222 #[derive(Debug, Clone)]
223 pub struct PubSubServiceClient<T> {
224 inner: tonic::client::Grpc<T>,
225 }
226 impl PubSubServiceClient<tonic::transport::Channel> {
227 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
229 where
230 D: TryInto<tonic::transport::Endpoint>,
231 D::Error: Into<StdError>,
232 {
233 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
234 Ok(Self::new(conn))
235 }
236 }
237 impl<T> PubSubServiceClient<T>
238 where
239 T: tonic::client::GrpcService<tonic::body::Body>,
240 T::Error: Into<StdError>,
241 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
242 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
243 {
244 pub fn new(inner: T) -> Self {
245 let inner = tonic::client::Grpc::new(inner);
246 Self { inner }
247 }
248 pub fn with_origin(inner: T, origin: Uri) -> Self {
249 let inner = tonic::client::Grpc::with_origin(inner, origin);
250 Self { inner }
251 }
252 pub fn with_interceptor<F>(
253 inner: T,
254 interceptor: F,
255 ) -> PubSubServiceClient<InterceptedService<T, F>>
256 where
257 F: tonic::service::Interceptor,
258 T::ResponseBody: Default,
259 T: tonic::codegen::Service<
260 http::Request<tonic::body::Body>,
261 Response = http::Response<
262 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
263 >,
264 >,
265 <T as tonic::codegen::Service<
266 http::Request<tonic::body::Body>,
267 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
268 {
269 PubSubServiceClient::new(InterceptedService::new(inner, interceptor))
270 }
271 #[must_use]
276 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
277 self.inner = self.inner.send_compressed(encoding);
278 self
279 }
280 #[must_use]
282 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
283 self.inner = self.inner.accept_compressed(encoding);
284 self
285 }
286 #[must_use]
290 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
291 self.inner = self.inner.max_decoding_message_size(limit);
292 self
293 }
294 #[must_use]
298 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
299 self.inner = self.inner.max_encoding_message_size(limit);
300 self
301 }
302 pub async fn open_channel(
303 &mut self,
304 request: impl tonic::IntoStreamingRequest<Message = super::Message>,
305 ) -> std::result::Result<
306 tonic::Response<tonic::codec::Streaming<super::Message>>,
307 tonic::Status,
308 > {
309 self.inner
310 .ready()
311 .await
312 .map_err(|e| {
313 tonic::Status::unknown(
314 format!("Service was not ready: {}", e.into()),
315 )
316 })?;
317 let codec = tonic::codec::ProstCodec::default();
318 let path = http::uri::PathAndQuery::from_static(
319 "/pubsub.proto.v1.PubSubService/OpenChannel",
320 );
321 let mut req = request.into_streaming_request();
322 req.extensions_mut()
323 .insert(GrpcMethod::new("pubsub.proto.v1.PubSubService", "OpenChannel"));
324 self.inner.streaming(req, path, codec).await
325 }
326 }
327}
328pub mod pub_sub_service_server {
330 #![allow(
331 unused_variables,
332 dead_code,
333 missing_docs,
334 clippy::wildcard_imports,
335 clippy::let_unit_value,
336 )]
337 use tonic::codegen::*;
338 #[async_trait]
340 pub trait PubSubService: std::marker::Send + std::marker::Sync + 'static {
341 type OpenChannelStream: tonic::codegen::tokio_stream::Stream<
343 Item = std::result::Result<super::Message, tonic::Status>,
344 >
345 + std::marker::Send
346 + 'static;
347 async fn open_channel(
348 &self,
349 request: tonic::Request<tonic::Streaming<super::Message>>,
350 ) -> std::result::Result<
351 tonic::Response<Self::OpenChannelStream>,
352 tonic::Status,
353 >;
354 }
355 #[derive(Debug)]
356 pub struct PubSubServiceServer<T> {
357 inner: Arc<T>,
358 accept_compression_encodings: EnabledCompressionEncodings,
359 send_compression_encodings: EnabledCompressionEncodings,
360 max_decoding_message_size: Option<usize>,
361 max_encoding_message_size: Option<usize>,
362 }
363 impl<T> PubSubServiceServer<T> {
364 pub fn new(inner: T) -> Self {
365 Self::from_arc(Arc::new(inner))
366 }
367 pub fn from_arc(inner: Arc<T>) -> Self {
368 Self {
369 inner,
370 accept_compression_encodings: Default::default(),
371 send_compression_encodings: Default::default(),
372 max_decoding_message_size: None,
373 max_encoding_message_size: None,
374 }
375 }
376 pub fn with_interceptor<F>(
377 inner: T,
378 interceptor: F,
379 ) -> InterceptedService<Self, F>
380 where
381 F: tonic::service::Interceptor,
382 {
383 InterceptedService::new(Self::new(inner), interceptor)
384 }
385 #[must_use]
387 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
388 self.accept_compression_encodings.enable(encoding);
389 self
390 }
391 #[must_use]
393 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
394 self.send_compression_encodings.enable(encoding);
395 self
396 }
397 #[must_use]
401 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
402 self.max_decoding_message_size = Some(limit);
403 self
404 }
405 #[must_use]
409 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
410 self.max_encoding_message_size = Some(limit);
411 self
412 }
413 }
414 impl<T, B> tonic::codegen::Service<http::Request<B>> for PubSubServiceServer<T>
415 where
416 T: PubSubService,
417 B: Body + std::marker::Send + 'static,
418 B::Error: Into<StdError> + std::marker::Send + 'static,
419 {
420 type Response = http::Response<tonic::body::Body>;
421 type Error = std::convert::Infallible;
422 type Future = BoxFuture<Self::Response, Self::Error>;
423 fn poll_ready(
424 &mut self,
425 _cx: &mut Context<'_>,
426 ) -> Poll<std::result::Result<(), Self::Error>> {
427 Poll::Ready(Ok(()))
428 }
429 fn call(&mut self, req: http::Request<B>) -> Self::Future {
430 match req.uri().path() {
431 "/pubsub.proto.v1.PubSubService/OpenChannel" => {
432 #[allow(non_camel_case_types)]
433 struct OpenChannelSvc<T: PubSubService>(pub Arc<T>);
434 impl<
435 T: PubSubService,
436 > tonic::server::StreamingService<super::Message>
437 for OpenChannelSvc<T> {
438 type Response = super::Message;
439 type ResponseStream = T::OpenChannelStream;
440 type Future = BoxFuture<
441 tonic::Response<Self::ResponseStream>,
442 tonic::Status,
443 >;
444 fn call(
445 &mut self,
446 request: tonic::Request<tonic::Streaming<super::Message>>,
447 ) -> Self::Future {
448 let inner = Arc::clone(&self.0);
449 let fut = async move {
450 <T as PubSubService>::open_channel(&inner, request).await
451 };
452 Box::pin(fut)
453 }
454 }
455 let accept_compression_encodings = self.accept_compression_encodings;
456 let send_compression_encodings = self.send_compression_encodings;
457 let max_decoding_message_size = self.max_decoding_message_size;
458 let max_encoding_message_size = self.max_encoding_message_size;
459 let inner = self.inner.clone();
460 let fut = async move {
461 let method = OpenChannelSvc(inner);
462 let codec = tonic::codec::ProstCodec::default();
463 let mut grpc = tonic::server::Grpc::new(codec)
464 .apply_compression_config(
465 accept_compression_encodings,
466 send_compression_encodings,
467 )
468 .apply_max_message_size_config(
469 max_decoding_message_size,
470 max_encoding_message_size,
471 );
472 let res = grpc.streaming(method, req).await;
473 Ok(res)
474 };
475 Box::pin(fut)
476 }
477 _ => {
478 Box::pin(async move {
479 let mut response = http::Response::new(
480 tonic::body::Body::default(),
481 );
482 let headers = response.headers_mut();
483 headers
484 .insert(
485 tonic::Status::GRPC_STATUS,
486 (tonic::Code::Unimplemented as i32).into(),
487 );
488 headers
489 .insert(
490 http::header::CONTENT_TYPE,
491 tonic::metadata::GRPC_CONTENT_TYPE,
492 );
493 Ok(response)
494 })
495 }
496 }
497 }
498 }
499 impl<T> Clone for PubSubServiceServer<T> {
500 fn clone(&self) -> Self {
501 let inner = self.inner.clone();
502 Self {
503 inner,
504 accept_compression_encodings: self.accept_compression_encodings,
505 send_compression_encodings: self.send_compression_encodings,
506 max_decoding_message_size: self.max_decoding_message_size,
507 max_encoding_message_size: self.max_encoding_message_size,
508 }
509 }
510 }
511 pub const SERVICE_NAME: &str = "pubsub.proto.v1.PubSubService";
513 impl<T> tonic::server::NamedService for PubSubServiceServer<T> {
514 const NAME: &'static str = SERVICE_NAME;
515 }
516}