1#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct EnvelopesQuery {
6 #[prost(bytes = "vec", repeated, tag = "1")]
8 pub topics: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
9 #[prost(uint32, repeated, tag = "2")]
11 pub originator_node_ids: ::prost::alloc::vec::Vec<u32>,
12 #[prost(message, optional, tag = "3")]
13 pub last_seen: ::core::option::Option<super::envelopes::Cursor>,
14}
15impl ::prost::Name for EnvelopesQuery {
16 const NAME: &'static str = "EnvelopesQuery";
17 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
18 fn full_name() -> ::prost::alloc::string::String {
19 "xmtp.xmtpv4.message_api.EnvelopesQuery".into()
20 }
21 fn type_url() -> ::prost::alloc::string::String {
22 "/xmtp.xmtpv4.message_api.EnvelopesQuery".into()
23 }
24}
25#[derive(Clone, PartialEq, ::prost::Message)]
27pub struct SubscribeEnvelopesRequest {
28 #[prost(message, optional, tag = "1")]
29 pub query: ::core::option::Option<EnvelopesQuery>,
30}
31impl ::prost::Name for SubscribeEnvelopesRequest {
32 const NAME: &'static str = "SubscribeEnvelopesRequest";
33 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
34 fn full_name() -> ::prost::alloc::string::String {
35 "xmtp.xmtpv4.message_api.SubscribeEnvelopesRequest".into()
36 }
37 fn type_url() -> ::prost::alloc::string::String {
38 "/xmtp.xmtpv4.message_api.SubscribeEnvelopesRequest".into()
39 }
40}
41#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct SubscribeEnvelopesResponse {
44 #[prost(message, repeated, tag = "1")]
45 pub envelopes: ::prost::alloc::vec::Vec<super::envelopes::OriginatorEnvelope>,
46}
47impl ::prost::Name for SubscribeEnvelopesResponse {
48 const NAME: &'static str = "SubscribeEnvelopesResponse";
49 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
50 fn full_name() -> ::prost::alloc::string::String {
51 "xmtp.xmtpv4.message_api.SubscribeEnvelopesResponse".into()
52 }
53 fn type_url() -> ::prost::alloc::string::String {
54 "/xmtp.xmtpv4.message_api.SubscribeEnvelopesResponse".into()
55 }
56}
57#[derive(Clone, PartialEq, ::prost::Message)]
59pub struct QueryEnvelopesRequest {
60 #[prost(message, optional, tag = "1")]
61 pub query: ::core::option::Option<EnvelopesQuery>,
62 #[prost(uint32, tag = "2")]
63 pub limit: u32,
64}
65impl ::prost::Name for QueryEnvelopesRequest {
66 const NAME: &'static str = "QueryEnvelopesRequest";
67 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
68 fn full_name() -> ::prost::alloc::string::String {
69 "xmtp.xmtpv4.message_api.QueryEnvelopesRequest".into()
70 }
71 fn type_url() -> ::prost::alloc::string::String {
72 "/xmtp.xmtpv4.message_api.QueryEnvelopesRequest".into()
73 }
74}
75#[derive(Clone, PartialEq, ::prost::Message)]
77pub struct QueryEnvelopesResponse {
78 #[prost(message, repeated, tag = "1")]
79 pub envelopes: ::prost::alloc::vec::Vec<super::envelopes::OriginatorEnvelope>,
80}
81impl ::prost::Name for QueryEnvelopesResponse {
82 const NAME: &'static str = "QueryEnvelopesResponse";
83 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
84 fn full_name() -> ::prost::alloc::string::String {
85 "xmtp.xmtpv4.message_api.QueryEnvelopesResponse".into()
86 }
87 fn type_url() -> ::prost::alloc::string::String {
88 "/xmtp.xmtpv4.message_api.QueryEnvelopesResponse".into()
89 }
90}
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct PublishPayerEnvelopesRequest {
93 #[prost(message, repeated, tag = "1")]
94 pub payer_envelopes: ::prost::alloc::vec::Vec<super::envelopes::PayerEnvelope>,
95}
96impl ::prost::Name for PublishPayerEnvelopesRequest {
97 const NAME: &'static str = "PublishPayerEnvelopesRequest";
98 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
99 fn full_name() -> ::prost::alloc::string::String {
100 "xmtp.xmtpv4.message_api.PublishPayerEnvelopesRequest".into()
101 }
102 fn type_url() -> ::prost::alloc::string::String {
103 "/xmtp.xmtpv4.message_api.PublishPayerEnvelopesRequest".into()
104 }
105}
106#[derive(Clone, PartialEq, ::prost::Message)]
107pub struct PublishPayerEnvelopesResponse {
108 #[prost(message, repeated, tag = "1")]
109 pub originator_envelopes: ::prost::alloc::vec::Vec<
110 super::envelopes::OriginatorEnvelope,
111 >,
112}
113impl ::prost::Name for PublishPayerEnvelopesResponse {
114 const NAME: &'static str = "PublishPayerEnvelopesResponse";
115 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
116 fn full_name() -> ::prost::alloc::string::String {
117 "xmtp.xmtpv4.message_api.PublishPayerEnvelopesResponse".into()
118 }
119 fn type_url() -> ::prost::alloc::string::String {
120 "/xmtp.xmtpv4.message_api.PublishPayerEnvelopesResponse".into()
121 }
122}
123#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct GetInboxIdsRequest {
126 #[prost(message, repeated, tag = "1")]
127 pub requests: ::prost::alloc::vec::Vec<get_inbox_ids_request::Request>,
128}
129pub mod get_inbox_ids_request {
131 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
133 pub struct Request {
134 #[prost(string, tag = "1")]
135 pub identifier: ::prost::alloc::string::String,
136 #[prost(
137 enumeration = "super::super::super::identity::associations::IdentifierKind",
138 tag = "2"
139 )]
140 pub identifier_kind: i32,
141 }
142 impl ::prost::Name for Request {
143 const NAME: &'static str = "Request";
144 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
145 fn full_name() -> ::prost::alloc::string::String {
146 "xmtp.xmtpv4.message_api.GetInboxIdsRequest.Request".into()
147 }
148 fn type_url() -> ::prost::alloc::string::String {
149 "/xmtp.xmtpv4.message_api.GetInboxIdsRequest.Request".into()
150 }
151 }
152}
153impl ::prost::Name for GetInboxIdsRequest {
154 const NAME: &'static str = "GetInboxIdsRequest";
155 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
156 fn full_name() -> ::prost::alloc::string::String {
157 "xmtp.xmtpv4.message_api.GetInboxIdsRequest".into()
158 }
159 fn type_url() -> ::prost::alloc::string::String {
160 "/xmtp.xmtpv4.message_api.GetInboxIdsRequest".into()
161 }
162}
163#[derive(Clone, PartialEq, ::prost::Message)]
165pub struct GetInboxIdsResponse {
166 #[prost(message, repeated, tag = "1")]
167 pub responses: ::prost::alloc::vec::Vec<get_inbox_ids_response::Response>,
168}
169pub mod get_inbox_ids_response {
171 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
173 pub struct Response {
174 #[prost(string, tag = "1")]
175 pub identifier: ::prost::alloc::string::String,
176 #[prost(string, optional, tag = "2")]
177 pub inbox_id: ::core::option::Option<::prost::alloc::string::String>,
178 #[prost(
179 enumeration = "super::super::super::identity::associations::IdentifierKind",
180 tag = "3"
181 )]
182 pub identifier_kind: i32,
183 }
184 impl ::prost::Name for Response {
185 const NAME: &'static str = "Response";
186 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
187 fn full_name() -> ::prost::alloc::string::String {
188 "xmtp.xmtpv4.message_api.GetInboxIdsResponse.Response".into()
189 }
190 fn type_url() -> ::prost::alloc::string::String {
191 "/xmtp.xmtpv4.message_api.GetInboxIdsResponse.Response".into()
192 }
193 }
194}
195impl ::prost::Name for GetInboxIdsResponse {
196 const NAME: &'static str = "GetInboxIdsResponse";
197 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
198 fn full_name() -> ::prost::alloc::string::String {
199 "xmtp.xmtpv4.message_api.GetInboxIdsResponse".into()
200 }
201 fn type_url() -> ::prost::alloc::string::String {
202 "/xmtp.xmtpv4.message_api.GetInboxIdsResponse".into()
203 }
204}
205#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
207pub struct GetNewestEnvelopeRequest {
208 #[prost(bytes = "vec", repeated, tag = "1")]
209 pub topics: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
210}
211impl ::prost::Name for GetNewestEnvelopeRequest {
212 const NAME: &'static str = "GetNewestEnvelopeRequest";
213 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
214 fn full_name() -> ::prost::alloc::string::String {
215 "xmtp.xmtpv4.message_api.GetNewestEnvelopeRequest".into()
216 }
217 fn type_url() -> ::prost::alloc::string::String {
218 "/xmtp.xmtpv4.message_api.GetNewestEnvelopeRequest".into()
219 }
220}
221#[derive(Clone, PartialEq, ::prost::Message)]
223pub struct GetNewestEnvelopeResponse {
224 #[prost(message, repeated, tag = "1")]
226 pub results: ::prost::alloc::vec::Vec<get_newest_envelope_response::Response>,
227}
228pub mod get_newest_envelope_response {
230 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
231 pub struct Response {
232 #[prost(message, optional, tag = "1")]
233 pub originator_envelope: ::core::option::Option<
234 super::super::envelopes::OriginatorEnvelope,
235 >,
236 }
237 impl ::prost::Name for Response {
238 const NAME: &'static str = "Response";
239 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
240 fn full_name() -> ::prost::alloc::string::String {
241 "xmtp.xmtpv4.message_api.GetNewestEnvelopeResponse.Response".into()
242 }
243 fn type_url() -> ::prost::alloc::string::String {
244 "/xmtp.xmtpv4.message_api.GetNewestEnvelopeResponse.Response".into()
245 }
246 }
247}
248impl ::prost::Name for GetNewestEnvelopeResponse {
249 const NAME: &'static str = "GetNewestEnvelopeResponse";
250 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
251 fn full_name() -> ::prost::alloc::string::String {
252 "xmtp.xmtpv4.message_api.GetNewestEnvelopeResponse".into()
253 }
254 fn type_url() -> ::prost::alloc::string::String {
255 "/xmtp.xmtpv4.message_api.GetNewestEnvelopeResponse".into()
256 }
257}
258#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))]
260pub mod replication_api_server {
261 #![allow(
262 unused_variables,
263 dead_code,
264 missing_docs,
265 clippy::wildcard_imports,
266 clippy::let_unit_value,
267 )]
268 use tonic::codegen::*;
269 #[async_trait]
271 pub trait ReplicationApi: std::marker::Send + std::marker::Sync + 'static {
272 type SubscribeEnvelopesStream: tonic::codegen::tokio_stream::Stream<
274 Item = std::result::Result<
275 super::SubscribeEnvelopesResponse,
276 tonic::Status,
277 >,
278 >
279 + std::marker::Send
280 + 'static;
281 async fn subscribe_envelopes(
282 &self,
283 request: tonic::Request<super::SubscribeEnvelopesRequest>,
284 ) -> std::result::Result<
285 tonic::Response<Self::SubscribeEnvelopesStream>,
286 tonic::Status,
287 >;
288 async fn query_envelopes(
289 &self,
290 request: tonic::Request<super::QueryEnvelopesRequest>,
291 ) -> std::result::Result<
292 tonic::Response<super::QueryEnvelopesResponse>,
293 tonic::Status,
294 >;
295 async fn publish_payer_envelopes(
296 &self,
297 request: tonic::Request<super::PublishPayerEnvelopesRequest>,
298 ) -> std::result::Result<
299 tonic::Response<super::PublishPayerEnvelopesResponse>,
300 tonic::Status,
301 >;
302 async fn get_inbox_ids(
303 &self,
304 request: tonic::Request<super::GetInboxIdsRequest>,
305 ) -> std::result::Result<
306 tonic::Response<super::GetInboxIdsResponse>,
307 tonic::Status,
308 >;
309 async fn get_newest_envelope(
311 &self,
312 request: tonic::Request<super::GetNewestEnvelopeRequest>,
313 ) -> std::result::Result<
314 tonic::Response<super::GetNewestEnvelopeResponse>,
315 tonic::Status,
316 >;
317 }
318 #[derive(Debug)]
319 pub struct ReplicationApiServer<T> {
320 inner: Arc<T>,
321 accept_compression_encodings: EnabledCompressionEncodings,
322 send_compression_encodings: EnabledCompressionEncodings,
323 max_decoding_message_size: Option<usize>,
324 max_encoding_message_size: Option<usize>,
325 }
326 impl<T> ReplicationApiServer<T> {
327 pub fn new(inner: T) -> Self {
328 Self::from_arc(Arc::new(inner))
329 }
330 pub fn from_arc(inner: Arc<T>) -> Self {
331 Self {
332 inner,
333 accept_compression_encodings: Default::default(),
334 send_compression_encodings: Default::default(),
335 max_decoding_message_size: None,
336 max_encoding_message_size: None,
337 }
338 }
339 pub fn with_interceptor<F>(
340 inner: T,
341 interceptor: F,
342 ) -> InterceptedService<Self, F>
343 where
344 F: tonic::service::Interceptor,
345 {
346 InterceptedService::new(Self::new(inner), interceptor)
347 }
348 #[must_use]
350 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
351 self.accept_compression_encodings.enable(encoding);
352 self
353 }
354 #[must_use]
356 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
357 self.send_compression_encodings.enable(encoding);
358 self
359 }
360 #[must_use]
364 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
365 self.max_decoding_message_size = Some(limit);
366 self
367 }
368 #[must_use]
372 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
373 self.max_encoding_message_size = Some(limit);
374 self
375 }
376 }
377 impl<T, B> tonic::codegen::Service<http::Request<B>> for ReplicationApiServer<T>
378 where
379 T: ReplicationApi,
380 B: Body + std::marker::Send + 'static,
381 B::Error: Into<StdError> + std::marker::Send + 'static,
382 {
383 type Response = http::Response<tonic::body::Body>;
384 type Error = std::convert::Infallible;
385 type Future = BoxFuture<Self::Response, Self::Error>;
386 fn poll_ready(
387 &mut self,
388 _cx: &mut Context<'_>,
389 ) -> Poll<std::result::Result<(), Self::Error>> {
390 Poll::Ready(Ok(()))
391 }
392 fn call(&mut self, req: http::Request<B>) -> Self::Future {
393 match req.uri().path() {
394 "/xmtp.xmtpv4.message_api.ReplicationApi/SubscribeEnvelopes" => {
395 #[allow(non_camel_case_types)]
396 struct SubscribeEnvelopesSvc<T: ReplicationApi>(pub Arc<T>);
397 impl<
398 T: ReplicationApi,
399 > tonic::server::ServerStreamingService<
400 super::SubscribeEnvelopesRequest,
401 > for SubscribeEnvelopesSvc<T> {
402 type Response = super::SubscribeEnvelopesResponse;
403 type ResponseStream = T::SubscribeEnvelopesStream;
404 type Future = BoxFuture<
405 tonic::Response<Self::ResponseStream>,
406 tonic::Status,
407 >;
408 fn call(
409 &mut self,
410 request: tonic::Request<super::SubscribeEnvelopesRequest>,
411 ) -> Self::Future {
412 let inner = Arc::clone(&self.0);
413 let fut = async move {
414 <T as ReplicationApi>::subscribe_envelopes(&inner, request)
415 .await
416 };
417 Box::pin(fut)
418 }
419 }
420 let accept_compression_encodings = self.accept_compression_encodings;
421 let send_compression_encodings = self.send_compression_encodings;
422 let max_decoding_message_size = self.max_decoding_message_size;
423 let max_encoding_message_size = self.max_encoding_message_size;
424 let inner = self.inner.clone();
425 let fut = async move {
426 let method = SubscribeEnvelopesSvc(inner);
427 let codec = tonic_prost::ProstCodec::default();
428 let mut grpc = tonic::server::Grpc::new(codec)
429 .apply_compression_config(
430 accept_compression_encodings,
431 send_compression_encodings,
432 )
433 .apply_max_message_size_config(
434 max_decoding_message_size,
435 max_encoding_message_size,
436 );
437 let res = grpc.server_streaming(method, req).await;
438 Ok(res)
439 };
440 Box::pin(fut)
441 }
442 "/xmtp.xmtpv4.message_api.ReplicationApi/QueryEnvelopes" => {
443 #[allow(non_camel_case_types)]
444 struct QueryEnvelopesSvc<T: ReplicationApi>(pub Arc<T>);
445 impl<
446 T: ReplicationApi,
447 > tonic::server::UnaryService<super::QueryEnvelopesRequest>
448 for QueryEnvelopesSvc<T> {
449 type Response = super::QueryEnvelopesResponse;
450 type Future = BoxFuture<
451 tonic::Response<Self::Response>,
452 tonic::Status,
453 >;
454 fn call(
455 &mut self,
456 request: tonic::Request<super::QueryEnvelopesRequest>,
457 ) -> Self::Future {
458 let inner = Arc::clone(&self.0);
459 let fut = async move {
460 <T as ReplicationApi>::query_envelopes(&inner, request)
461 .await
462 };
463 Box::pin(fut)
464 }
465 }
466 let accept_compression_encodings = self.accept_compression_encodings;
467 let send_compression_encodings = self.send_compression_encodings;
468 let max_decoding_message_size = self.max_decoding_message_size;
469 let max_encoding_message_size = self.max_encoding_message_size;
470 let inner = self.inner.clone();
471 let fut = async move {
472 let method = QueryEnvelopesSvc(inner);
473 let codec = tonic_prost::ProstCodec::default();
474 let mut grpc = tonic::server::Grpc::new(codec)
475 .apply_compression_config(
476 accept_compression_encodings,
477 send_compression_encodings,
478 )
479 .apply_max_message_size_config(
480 max_decoding_message_size,
481 max_encoding_message_size,
482 );
483 let res = grpc.unary(method, req).await;
484 Ok(res)
485 };
486 Box::pin(fut)
487 }
488 "/xmtp.xmtpv4.message_api.ReplicationApi/PublishPayerEnvelopes" => {
489 #[allow(non_camel_case_types)]
490 struct PublishPayerEnvelopesSvc<T: ReplicationApi>(pub Arc<T>);
491 impl<
492 T: ReplicationApi,
493 > tonic::server::UnaryService<super::PublishPayerEnvelopesRequest>
494 for PublishPayerEnvelopesSvc<T> {
495 type Response = super::PublishPayerEnvelopesResponse;
496 type Future = BoxFuture<
497 tonic::Response<Self::Response>,
498 tonic::Status,
499 >;
500 fn call(
501 &mut self,
502 request: tonic::Request<super::PublishPayerEnvelopesRequest>,
503 ) -> Self::Future {
504 let inner = Arc::clone(&self.0);
505 let fut = async move {
506 <T as ReplicationApi>::publish_payer_envelopes(
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 = PublishPayerEnvelopesSvc(inner);
522 let codec = tonic_prost::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.unary(method, req).await;
533 Ok(res)
534 };
535 Box::pin(fut)
536 }
537 "/xmtp.xmtpv4.message_api.ReplicationApi/GetInboxIds" => {
538 #[allow(non_camel_case_types)]
539 struct GetInboxIdsSvc<T: ReplicationApi>(pub Arc<T>);
540 impl<
541 T: ReplicationApi,
542 > tonic::server::UnaryService<super::GetInboxIdsRequest>
543 for GetInboxIdsSvc<T> {
544 type Response = super::GetInboxIdsResponse;
545 type Future = BoxFuture<
546 tonic::Response<Self::Response>,
547 tonic::Status,
548 >;
549 fn call(
550 &mut self,
551 request: tonic::Request<super::GetInboxIdsRequest>,
552 ) -> Self::Future {
553 let inner = Arc::clone(&self.0);
554 let fut = async move {
555 <T as ReplicationApi>::get_inbox_ids(&inner, request).await
556 };
557 Box::pin(fut)
558 }
559 }
560 let accept_compression_encodings = self.accept_compression_encodings;
561 let send_compression_encodings = self.send_compression_encodings;
562 let max_decoding_message_size = self.max_decoding_message_size;
563 let max_encoding_message_size = self.max_encoding_message_size;
564 let inner = self.inner.clone();
565 let fut = async move {
566 let method = GetInboxIdsSvc(inner);
567 let codec = tonic_prost::ProstCodec::default();
568 let mut grpc = tonic::server::Grpc::new(codec)
569 .apply_compression_config(
570 accept_compression_encodings,
571 send_compression_encodings,
572 )
573 .apply_max_message_size_config(
574 max_decoding_message_size,
575 max_encoding_message_size,
576 );
577 let res = grpc.unary(method, req).await;
578 Ok(res)
579 };
580 Box::pin(fut)
581 }
582 "/xmtp.xmtpv4.message_api.ReplicationApi/GetNewestEnvelope" => {
583 #[allow(non_camel_case_types)]
584 struct GetNewestEnvelopeSvc<T: ReplicationApi>(pub Arc<T>);
585 impl<
586 T: ReplicationApi,
587 > tonic::server::UnaryService<super::GetNewestEnvelopeRequest>
588 for GetNewestEnvelopeSvc<T> {
589 type Response = super::GetNewestEnvelopeResponse;
590 type Future = BoxFuture<
591 tonic::Response<Self::Response>,
592 tonic::Status,
593 >;
594 fn call(
595 &mut self,
596 request: tonic::Request<super::GetNewestEnvelopeRequest>,
597 ) -> Self::Future {
598 let inner = Arc::clone(&self.0);
599 let fut = async move {
600 <T as ReplicationApi>::get_newest_envelope(&inner, request)
601 .await
602 };
603 Box::pin(fut)
604 }
605 }
606 let accept_compression_encodings = self.accept_compression_encodings;
607 let send_compression_encodings = self.send_compression_encodings;
608 let max_decoding_message_size = self.max_decoding_message_size;
609 let max_encoding_message_size = self.max_encoding_message_size;
610 let inner = self.inner.clone();
611 let fut = async move {
612 let method = GetNewestEnvelopeSvc(inner);
613 let codec = tonic_prost::ProstCodec::default();
614 let mut grpc = tonic::server::Grpc::new(codec)
615 .apply_compression_config(
616 accept_compression_encodings,
617 send_compression_encodings,
618 )
619 .apply_max_message_size_config(
620 max_decoding_message_size,
621 max_encoding_message_size,
622 );
623 let res = grpc.unary(method, req).await;
624 Ok(res)
625 };
626 Box::pin(fut)
627 }
628 _ => {
629 Box::pin(async move {
630 let mut response = http::Response::new(
631 tonic::body::Body::default(),
632 );
633 let headers = response.headers_mut();
634 headers
635 .insert(
636 tonic::Status::GRPC_STATUS,
637 (tonic::Code::Unimplemented as i32).into(),
638 );
639 headers
640 .insert(
641 http::header::CONTENT_TYPE,
642 tonic::metadata::GRPC_CONTENT_TYPE,
643 );
644 Ok(response)
645 })
646 }
647 }
648 }
649 }
650 impl<T> Clone for ReplicationApiServer<T> {
651 fn clone(&self) -> Self {
652 let inner = self.inner.clone();
653 Self {
654 inner,
655 accept_compression_encodings: self.accept_compression_encodings,
656 send_compression_encodings: self.send_compression_encodings,
657 max_decoding_message_size: self.max_decoding_message_size,
658 max_encoding_message_size: self.max_encoding_message_size,
659 }
660 }
661 }
662 pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.ReplicationApi";
664 impl<T> tonic::server::NamedService for ReplicationApiServer<T> {
665 const NAME: &'static str = SERVICE_NAME;
666 }
667}
668#[derive(Clone, PartialEq, ::prost::Message)]
669pub struct LivenessFailure {
670 #[prost(uint32, tag = "1")]
671 pub response_time_ns: u32,
672 #[prost(oneof = "liveness_failure::Request", tags = "2, 3, 4")]
673 pub request: ::core::option::Option<liveness_failure::Request>,
674}
675pub mod liveness_failure {
677 #[derive(Clone, PartialEq, ::prost::Oneof)]
678 pub enum Request {
679 #[prost(message, tag = "2")]
680 Subscribe(super::SubscribeEnvelopesRequest),
681 #[prost(message, tag = "3")]
682 Query(super::QueryEnvelopesRequest),
683 #[prost(message, tag = "4")]
684 Publish(super::PublishPayerEnvelopesRequest),
685 }
686}
687impl ::prost::Name for LivenessFailure {
688 const NAME: &'static str = "LivenessFailure";
689 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
690 fn full_name() -> ::prost::alloc::string::String {
691 "xmtp.xmtpv4.message_api.LivenessFailure".into()
692 }
693 fn type_url() -> ::prost::alloc::string::String {
694 "/xmtp.xmtpv4.message_api.LivenessFailure".into()
695 }
696}
697#[derive(Clone, PartialEq, ::prost::Message)]
698pub struct SafetyFailure {
699 #[prost(message, repeated, tag = "1")]
700 pub envelopes: ::prost::alloc::vec::Vec<super::envelopes::OriginatorEnvelope>,
701}
702impl ::prost::Name for SafetyFailure {
703 const NAME: &'static str = "SafetyFailure";
704 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
705 fn full_name() -> ::prost::alloc::string::String {
706 "xmtp.xmtpv4.message_api.SafetyFailure".into()
707 }
708 fn type_url() -> ::prost::alloc::string::String {
709 "/xmtp.xmtpv4.message_api.SafetyFailure".into()
710 }
711}
712#[derive(Clone, PartialEq, ::prost::Message)]
713pub struct UnsignedMisbehaviorReport {
714 #[prost(uint64, tag = "1")]
715 pub reporter_time_ns: u64,
716 #[prost(uint32, tag = "2")]
717 pub misbehaving_node_id: u32,
718 #[prost(enumeration = "Misbehavior", tag = "3")]
719 pub r#type: i32,
720 #[prost(bool, tag = "6")]
722 pub submitted_by_node: bool,
723 #[prost(oneof = "unsigned_misbehavior_report::Failure", tags = "4, 5")]
724 pub failure: ::core::option::Option<unsigned_misbehavior_report::Failure>,
725}
726pub mod unsigned_misbehavior_report {
728 #[derive(Clone, PartialEq, ::prost::Oneof)]
729 pub enum Failure {
730 #[prost(message, tag = "4")]
731 Liveness(super::LivenessFailure),
732 #[prost(message, tag = "5")]
733 Safety(super::SafetyFailure),
734 }
735}
736impl ::prost::Name for UnsignedMisbehaviorReport {
737 const NAME: &'static str = "UnsignedMisbehaviorReport";
738 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
739 fn full_name() -> ::prost::alloc::string::String {
740 "xmtp.xmtpv4.message_api.UnsignedMisbehaviorReport".into()
741 }
742 fn type_url() -> ::prost::alloc::string::String {
743 "/xmtp.xmtpv4.message_api.UnsignedMisbehaviorReport".into()
744 }
745}
746#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
747pub struct MisbehaviorReport {
748 #[prost(uint64, tag = "1")]
751 pub server_time_ns: u64,
752 #[prost(bytes = "vec", tag = "2")]
753 pub unsigned_misbehavior_report: ::prost::alloc::vec::Vec<u8>,
754 #[prost(message, optional, tag = "3")]
756 pub signature: ::core::option::Option<
757 super::super::identity::associations::RecoverableEcdsaSignature,
758 >,
759}
760impl ::prost::Name for MisbehaviorReport {
761 const NAME: &'static str = "MisbehaviorReport";
762 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
763 fn full_name() -> ::prost::alloc::string::String {
764 "xmtp.xmtpv4.message_api.MisbehaviorReport".into()
765 }
766 fn type_url() -> ::prost::alloc::string::String {
767 "/xmtp.xmtpv4.message_api.MisbehaviorReport".into()
768 }
769}
770#[derive(Clone, PartialEq, ::prost::Message)]
771pub struct SubmitMisbehaviorReportRequest {
772 #[prost(message, optional, tag = "1")]
773 pub report: ::core::option::Option<UnsignedMisbehaviorReport>,
774}
775impl ::prost::Name for SubmitMisbehaviorReportRequest {
776 const NAME: &'static str = "SubmitMisbehaviorReportRequest";
777 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
778 fn full_name() -> ::prost::alloc::string::String {
779 "xmtp.xmtpv4.message_api.SubmitMisbehaviorReportRequest".into()
780 }
781 fn type_url() -> ::prost::alloc::string::String {
782 "/xmtp.xmtpv4.message_api.SubmitMisbehaviorReportRequest".into()
783 }
784}
785#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
786pub struct SubmitMisbehaviorReportResponse {}
787impl ::prost::Name for SubmitMisbehaviorReportResponse {
788 const NAME: &'static str = "SubmitMisbehaviorReportResponse";
789 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
790 fn full_name() -> ::prost::alloc::string::String {
791 "xmtp.xmtpv4.message_api.SubmitMisbehaviorReportResponse".into()
792 }
793 fn type_url() -> ::prost::alloc::string::String {
794 "/xmtp.xmtpv4.message_api.SubmitMisbehaviorReportResponse".into()
795 }
796}
797#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
798pub struct QueryMisbehaviorReportsRequest {
799 #[prost(uint64, tag = "1")]
800 pub after_ns: u64,
801}
802impl ::prost::Name for QueryMisbehaviorReportsRequest {
803 const NAME: &'static str = "QueryMisbehaviorReportsRequest";
804 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
805 fn full_name() -> ::prost::alloc::string::String {
806 "xmtp.xmtpv4.message_api.QueryMisbehaviorReportsRequest".into()
807 }
808 fn type_url() -> ::prost::alloc::string::String {
809 "/xmtp.xmtpv4.message_api.QueryMisbehaviorReportsRequest".into()
810 }
811}
812#[derive(Clone, PartialEq, ::prost::Message)]
813pub struct QueryMisbehaviorReportsResponse {
814 #[prost(message, repeated, tag = "1")]
815 pub reports: ::prost::alloc::vec::Vec<MisbehaviorReport>,
816}
817impl ::prost::Name for QueryMisbehaviorReportsResponse {
818 const NAME: &'static str = "QueryMisbehaviorReportsResponse";
819 const PACKAGE: &'static str = "xmtp.xmtpv4.message_api";
820 fn full_name() -> ::prost::alloc::string::String {
821 "xmtp.xmtpv4.message_api.QueryMisbehaviorReportsResponse".into()
822 }
823 fn type_url() -> ::prost::alloc::string::String {
824 "/xmtp.xmtpv4.message_api.QueryMisbehaviorReportsResponse".into()
825 }
826}
827#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
828#[repr(i32)]
829pub enum Misbehavior {
830 Unspecified = 0,
831 UnresponsiveNode = 1,
832 SlowNode = 2,
833 FailedRequest = 3,
834 OutOfOrder = 4,
835 DuplicateSequenceId = 5,
836 CausalOrdering = 6,
837 InvalidPayload = 7,
838 BlockchainInconsistency = 8,
839}
840impl Misbehavior {
841 pub fn as_str_name(&self) -> &'static str {
846 match self {
847 Self::Unspecified => "MISBEHAVIOR_UNSPECIFIED",
848 Self::UnresponsiveNode => "MISBEHAVIOR_UNRESPONSIVE_NODE",
849 Self::SlowNode => "MISBEHAVIOR_SLOW_NODE",
850 Self::FailedRequest => "MISBEHAVIOR_FAILED_REQUEST",
851 Self::OutOfOrder => "MISBEHAVIOR_OUT_OF_ORDER",
852 Self::DuplicateSequenceId => "MISBEHAVIOR_DUPLICATE_SEQUENCE_ID",
853 Self::CausalOrdering => "MISBEHAVIOR_CAUSAL_ORDERING",
854 Self::InvalidPayload => "MISBEHAVIOR_INVALID_PAYLOAD",
855 Self::BlockchainInconsistency => "MISBEHAVIOR_BLOCKCHAIN_INCONSISTENCY",
856 }
857 }
858 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
860 match value {
861 "MISBEHAVIOR_UNSPECIFIED" => Some(Self::Unspecified),
862 "MISBEHAVIOR_UNRESPONSIVE_NODE" => Some(Self::UnresponsiveNode),
863 "MISBEHAVIOR_SLOW_NODE" => Some(Self::SlowNode),
864 "MISBEHAVIOR_FAILED_REQUEST" => Some(Self::FailedRequest),
865 "MISBEHAVIOR_OUT_OF_ORDER" => Some(Self::OutOfOrder),
866 "MISBEHAVIOR_DUPLICATE_SEQUENCE_ID" => Some(Self::DuplicateSequenceId),
867 "MISBEHAVIOR_CAUSAL_ORDERING" => Some(Self::CausalOrdering),
868 "MISBEHAVIOR_INVALID_PAYLOAD" => Some(Self::InvalidPayload),
869 "MISBEHAVIOR_BLOCKCHAIN_INCONSISTENCY" => Some(Self::BlockchainInconsistency),
870 _ => None,
871 }
872 }
873}
874#[cfg(any(not(target_arch = "wasm32"), feature = "grpc_server_impls"))]
876pub mod misbehavior_api_server {
877 #![allow(
878 unused_variables,
879 dead_code,
880 missing_docs,
881 clippy::wildcard_imports,
882 clippy::let_unit_value,
883 )]
884 use tonic::codegen::*;
885 #[async_trait]
887 pub trait MisbehaviorApi: std::marker::Send + std::marker::Sync + 'static {
888 async fn submit_misbehavior_report(
889 &self,
890 request: tonic::Request<super::SubmitMisbehaviorReportRequest>,
891 ) -> std::result::Result<
892 tonic::Response<super::SubmitMisbehaviorReportResponse>,
893 tonic::Status,
894 >;
895 async fn query_misbehavior_reports(
896 &self,
897 request: tonic::Request<super::QueryMisbehaviorReportsRequest>,
898 ) -> std::result::Result<
899 tonic::Response<super::QueryMisbehaviorReportsResponse>,
900 tonic::Status,
901 >;
902 }
903 #[derive(Debug)]
904 pub struct MisbehaviorApiServer<T> {
905 inner: Arc<T>,
906 accept_compression_encodings: EnabledCompressionEncodings,
907 send_compression_encodings: EnabledCompressionEncodings,
908 max_decoding_message_size: Option<usize>,
909 max_encoding_message_size: Option<usize>,
910 }
911 impl<T> MisbehaviorApiServer<T> {
912 pub fn new(inner: T) -> Self {
913 Self::from_arc(Arc::new(inner))
914 }
915 pub fn from_arc(inner: Arc<T>) -> Self {
916 Self {
917 inner,
918 accept_compression_encodings: Default::default(),
919 send_compression_encodings: Default::default(),
920 max_decoding_message_size: None,
921 max_encoding_message_size: None,
922 }
923 }
924 pub fn with_interceptor<F>(
925 inner: T,
926 interceptor: F,
927 ) -> InterceptedService<Self, F>
928 where
929 F: tonic::service::Interceptor,
930 {
931 InterceptedService::new(Self::new(inner), interceptor)
932 }
933 #[must_use]
935 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
936 self.accept_compression_encodings.enable(encoding);
937 self
938 }
939 #[must_use]
941 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
942 self.send_compression_encodings.enable(encoding);
943 self
944 }
945 #[must_use]
949 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
950 self.max_decoding_message_size = Some(limit);
951 self
952 }
953 #[must_use]
957 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
958 self.max_encoding_message_size = Some(limit);
959 self
960 }
961 }
962 impl<T, B> tonic::codegen::Service<http::Request<B>> for MisbehaviorApiServer<T>
963 where
964 T: MisbehaviorApi,
965 B: Body + std::marker::Send + 'static,
966 B::Error: Into<StdError> + std::marker::Send + 'static,
967 {
968 type Response = http::Response<tonic::body::Body>;
969 type Error = std::convert::Infallible;
970 type Future = BoxFuture<Self::Response, Self::Error>;
971 fn poll_ready(
972 &mut self,
973 _cx: &mut Context<'_>,
974 ) -> Poll<std::result::Result<(), Self::Error>> {
975 Poll::Ready(Ok(()))
976 }
977 fn call(&mut self, req: http::Request<B>) -> Self::Future {
978 match req.uri().path() {
979 "/xmtp.xmtpv4.message_api.MisbehaviorApi/SubmitMisbehaviorReport" => {
980 #[allow(non_camel_case_types)]
981 struct SubmitMisbehaviorReportSvc<T: MisbehaviorApi>(pub Arc<T>);
982 impl<
983 T: MisbehaviorApi,
984 > tonic::server::UnaryService<super::SubmitMisbehaviorReportRequest>
985 for SubmitMisbehaviorReportSvc<T> {
986 type Response = super::SubmitMisbehaviorReportResponse;
987 type Future = BoxFuture<
988 tonic::Response<Self::Response>,
989 tonic::Status,
990 >;
991 fn call(
992 &mut self,
993 request: tonic::Request<
994 super::SubmitMisbehaviorReportRequest,
995 >,
996 ) -> Self::Future {
997 let inner = Arc::clone(&self.0);
998 let fut = async move {
999 <T as MisbehaviorApi>::submit_misbehavior_report(
1000 &inner,
1001 request,
1002 )
1003 .await
1004 };
1005 Box::pin(fut)
1006 }
1007 }
1008 let accept_compression_encodings = self.accept_compression_encodings;
1009 let send_compression_encodings = self.send_compression_encodings;
1010 let max_decoding_message_size = self.max_decoding_message_size;
1011 let max_encoding_message_size = self.max_encoding_message_size;
1012 let inner = self.inner.clone();
1013 let fut = async move {
1014 let method = SubmitMisbehaviorReportSvc(inner);
1015 let codec = tonic_prost::ProstCodec::default();
1016 let mut grpc = tonic::server::Grpc::new(codec)
1017 .apply_compression_config(
1018 accept_compression_encodings,
1019 send_compression_encodings,
1020 )
1021 .apply_max_message_size_config(
1022 max_decoding_message_size,
1023 max_encoding_message_size,
1024 );
1025 let res = grpc.unary(method, req).await;
1026 Ok(res)
1027 };
1028 Box::pin(fut)
1029 }
1030 "/xmtp.xmtpv4.message_api.MisbehaviorApi/QueryMisbehaviorReports" => {
1031 #[allow(non_camel_case_types)]
1032 struct QueryMisbehaviorReportsSvc<T: MisbehaviorApi>(pub Arc<T>);
1033 impl<
1034 T: MisbehaviorApi,
1035 > tonic::server::UnaryService<super::QueryMisbehaviorReportsRequest>
1036 for QueryMisbehaviorReportsSvc<T> {
1037 type Response = super::QueryMisbehaviorReportsResponse;
1038 type Future = BoxFuture<
1039 tonic::Response<Self::Response>,
1040 tonic::Status,
1041 >;
1042 fn call(
1043 &mut self,
1044 request: tonic::Request<
1045 super::QueryMisbehaviorReportsRequest,
1046 >,
1047 ) -> Self::Future {
1048 let inner = Arc::clone(&self.0);
1049 let fut = async move {
1050 <T as MisbehaviorApi>::query_misbehavior_reports(
1051 &inner,
1052 request,
1053 )
1054 .await
1055 };
1056 Box::pin(fut)
1057 }
1058 }
1059 let accept_compression_encodings = self.accept_compression_encodings;
1060 let send_compression_encodings = self.send_compression_encodings;
1061 let max_decoding_message_size = self.max_decoding_message_size;
1062 let max_encoding_message_size = self.max_encoding_message_size;
1063 let inner = self.inner.clone();
1064 let fut = async move {
1065 let method = QueryMisbehaviorReportsSvc(inner);
1066 let codec = tonic_prost::ProstCodec::default();
1067 let mut grpc = tonic::server::Grpc::new(codec)
1068 .apply_compression_config(
1069 accept_compression_encodings,
1070 send_compression_encodings,
1071 )
1072 .apply_max_message_size_config(
1073 max_decoding_message_size,
1074 max_encoding_message_size,
1075 );
1076 let res = grpc.unary(method, req).await;
1077 Ok(res)
1078 };
1079 Box::pin(fut)
1080 }
1081 _ => {
1082 Box::pin(async move {
1083 let mut response = http::Response::new(
1084 tonic::body::Body::default(),
1085 );
1086 let headers = response.headers_mut();
1087 headers
1088 .insert(
1089 tonic::Status::GRPC_STATUS,
1090 (tonic::Code::Unimplemented as i32).into(),
1091 );
1092 headers
1093 .insert(
1094 http::header::CONTENT_TYPE,
1095 tonic::metadata::GRPC_CONTENT_TYPE,
1096 );
1097 Ok(response)
1098 })
1099 }
1100 }
1101 }
1102 }
1103 impl<T> Clone for MisbehaviorApiServer<T> {
1104 fn clone(&self) -> Self {
1105 let inner = self.inner.clone();
1106 Self {
1107 inner,
1108 accept_compression_encodings: self.accept_compression_encodings,
1109 send_compression_encodings: self.send_compression_encodings,
1110 max_decoding_message_size: self.max_decoding_message_size,
1111 max_encoding_message_size: self.max_encoding_message_size,
1112 }
1113 }
1114 }
1115 pub const SERVICE_NAME: &str = "xmtp.xmtpv4.message_api.MisbehaviorApi";
1117 impl<T> tonic::server::NamedService for MisbehaviorApiServer<T> {
1118 const NAME: &'static str = SERVICE_NAME;
1119 }
1120}