1#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct MessageOptions {
5 #[prost(string, tag = "1")]
6 pub client_id: ::prost::alloc::string::String,
7 #[prost(string, tag = "2")]
9 pub r#type: ::prost::alloc::string::String,
10 #[prost(string, tag = "3")]
12 pub state: ::prost::alloc::string::String,
13 #[prost(string, tag = "4")]
15 pub tag: ::prost::alloc::string::String,
16 #[prost(string, tag = "5")]
18 pub key: ::prost::alloc::string::String,
19 #[prost(string, tag = "6")]
21 pub uses: ::prost::alloc::string::String,
22}
23#[allow(clippy::derive_partial_eq_without_eq)]
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct Message {
27 #[prost(string, tag = "1")]
28 pub name: ::prost::alloc::string::String,
29 #[prost(string, tag = "2")]
30 pub seq: ::prost::alloc::string::String,
31 #[prost(string, optional, tag = "3")]
32 pub ack: ::core::option::Option<::prost::alloc::string::String>,
33 #[prost(bytes = "vec", optional, tag = "4")]
34 pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
35}
36pub mod acts_service_client {
38 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
39 use tonic::codegen::*;
40 use tonic::codegen::http::Uri;
41 #[derive(Debug, Clone)]
43 pub struct ActsServiceClient<T> {
44 inner: tonic::client::Grpc<T>,
45 }
46 impl ActsServiceClient<tonic::transport::Channel> {
47 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
49 where
50 D: std::convert::TryInto<tonic::transport::Endpoint>,
51 D::Error: Into<StdError>,
52 {
53 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
54 Ok(Self::new(conn))
55 }
56 }
57 impl<T> ActsServiceClient<T>
58 where
59 T: tonic::client::GrpcService<tonic::body::BoxBody>,
60 T::Error: Into<StdError>,
61 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
62 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
63 {
64 pub fn new(inner: T) -> Self {
65 let inner = tonic::client::Grpc::new(inner);
66 Self { inner }
67 }
68 pub fn with_origin(inner: T, origin: Uri) -> Self {
69 let inner = tonic::client::Grpc::with_origin(inner, origin);
70 Self { inner }
71 }
72 pub fn with_interceptor<F>(
73 inner: T,
74 interceptor: F,
75 ) -> ActsServiceClient<InterceptedService<T, F>>
76 where
77 F: tonic::service::Interceptor,
78 T::ResponseBody: Default,
79 T: tonic::codegen::Service<
80 http::Request<tonic::body::BoxBody>,
81 Response = http::Response<
82 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
83 >,
84 >,
85 <T as tonic::codegen::Service<
86 http::Request<tonic::body::BoxBody>,
87 >>::Error: Into<StdError> + Send + Sync,
88 {
89 ActsServiceClient::new(InterceptedService::new(inner, interceptor))
90 }
91 #[must_use]
96 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
97 self.inner = self.inner.send_compressed(encoding);
98 self
99 }
100 #[must_use]
102 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
103 self.inner = self.inner.accept_compressed(encoding);
104 self
105 }
106 pub async fn send(
107 &mut self,
108 request: impl tonic::IntoRequest<super::Message>,
109 ) -> Result<tonic::Response<super::Message>, tonic::Status> {
110 self.inner
111 .ready()
112 .await
113 .map_err(|e| {
114 tonic::Status::new(
115 tonic::Code::Unknown,
116 format!("Service was not ready: {}", e.into()),
117 )
118 })?;
119 let codec = tonic::codec::ProstCodec::default();
120 let path = http::uri::PathAndQuery::from_static(
121 "/acts.grpc.ActsService/Send",
122 );
123 self.inner.unary(request.into_request(), path, codec).await
124 }
125 pub async fn on_message(
129 &mut self,
130 request: impl tonic::IntoRequest<super::MessageOptions>,
131 ) -> Result<
132 tonic::Response<tonic::codec::Streaming<super::Message>>,
133 tonic::Status,
134 > {
135 self.inner
136 .ready()
137 .await
138 .map_err(|e| {
139 tonic::Status::new(
140 tonic::Code::Unknown,
141 format!("Service was not ready: {}", e.into()),
142 )
143 })?;
144 let codec = tonic::codec::ProstCodec::default();
145 let path = http::uri::PathAndQuery::from_static(
146 "/acts.grpc.ActsService/OnMessage",
147 );
148 self.inner.server_streaming(request.into_request(), path, codec).await
149 }
150 }
151}
152pub mod acts_service_server {
154 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
155 use tonic::codegen::*;
156 #[async_trait]
158 pub trait ActsService: Send + Sync + 'static {
159 async fn send(
160 &self,
161 request: tonic::Request<super::Message>,
162 ) -> Result<tonic::Response<super::Message>, tonic::Status>;
163 type OnMessageStream: futures_core::Stream<
165 Item = Result<super::Message, tonic::Status>,
166 >
167 + Send
168 + 'static;
169 async fn on_message(
173 &self,
174 request: tonic::Request<super::MessageOptions>,
175 ) -> Result<tonic::Response<Self::OnMessageStream>, tonic::Status>;
176 }
177 #[derive(Debug)]
179 pub struct ActsServiceServer<T: ActsService> {
180 inner: _Inner<T>,
181 accept_compression_encodings: EnabledCompressionEncodings,
182 send_compression_encodings: EnabledCompressionEncodings,
183 }
184 struct _Inner<T>(Arc<T>);
185 impl<T: ActsService> ActsServiceServer<T> {
186 pub fn new(inner: T) -> Self {
187 Self::from_arc(Arc::new(inner))
188 }
189 pub fn from_arc(inner: Arc<T>) -> Self {
190 let inner = _Inner(inner);
191 Self {
192 inner,
193 accept_compression_encodings: Default::default(),
194 send_compression_encodings: Default::default(),
195 }
196 }
197 pub fn with_interceptor<F>(
198 inner: T,
199 interceptor: F,
200 ) -> InterceptedService<Self, F>
201 where
202 F: tonic::service::Interceptor,
203 {
204 InterceptedService::new(Self::new(inner), interceptor)
205 }
206 #[must_use]
208 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
209 self.accept_compression_encodings.enable(encoding);
210 self
211 }
212 #[must_use]
214 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
215 self.send_compression_encodings.enable(encoding);
216 self
217 }
218 }
219 impl<T, B> tonic::codegen::Service<http::Request<B>> for ActsServiceServer<T>
220 where
221 T: ActsService,
222 B: Body + Send + 'static,
223 B::Error: Into<StdError> + Send + 'static,
224 {
225 type Response = http::Response<tonic::body::BoxBody>;
226 type Error = std::convert::Infallible;
227 type Future = BoxFuture<Self::Response, Self::Error>;
228 fn poll_ready(
229 &mut self,
230 _cx: &mut Context<'_>,
231 ) -> Poll<Result<(), Self::Error>> {
232 Poll::Ready(Ok(()))
233 }
234 fn call(&mut self, req: http::Request<B>) -> Self::Future {
235 let inner = self.inner.clone();
236 match req.uri().path() {
237 "/acts.grpc.ActsService/Send" => {
238 #[allow(non_camel_case_types)]
239 struct SendSvc<T: ActsService>(pub Arc<T>);
240 impl<T: ActsService> tonic::server::UnaryService<super::Message>
241 for SendSvc<T> {
242 type Response = super::Message;
243 type Future = BoxFuture<
244 tonic::Response<Self::Response>,
245 tonic::Status,
246 >;
247 fn call(
248 &mut self,
249 request: tonic::Request<super::Message>,
250 ) -> Self::Future {
251 let inner = self.0.clone();
252 let fut = async move { (*inner).send(request).await };
253 Box::pin(fut)
254 }
255 }
256 let accept_compression_encodings = self.accept_compression_encodings;
257 let send_compression_encodings = self.send_compression_encodings;
258 let inner = self.inner.clone();
259 let fut = async move {
260 let inner = inner.0;
261 let method = SendSvc(inner);
262 let codec = tonic::codec::ProstCodec::default();
263 let mut grpc = tonic::server::Grpc::new(codec)
264 .apply_compression_config(
265 accept_compression_encodings,
266 send_compression_encodings,
267 );
268 let res = grpc.unary(method, req).await;
269 Ok(res)
270 };
271 Box::pin(fut)
272 }
273 "/acts.grpc.ActsService/OnMessage" => {
274 #[allow(non_camel_case_types)]
275 struct OnMessageSvc<T: ActsService>(pub Arc<T>);
276 impl<
277 T: ActsService,
278 > tonic::server::ServerStreamingService<super::MessageOptions>
279 for OnMessageSvc<T> {
280 type Response = super::Message;
281 type ResponseStream = T::OnMessageStream;
282 type Future = BoxFuture<
283 tonic::Response<Self::ResponseStream>,
284 tonic::Status,
285 >;
286 fn call(
287 &mut self,
288 request: tonic::Request<super::MessageOptions>,
289 ) -> Self::Future {
290 let inner = self.0.clone();
291 let fut = async move { (*inner).on_message(request).await };
292 Box::pin(fut)
293 }
294 }
295 let accept_compression_encodings = self.accept_compression_encodings;
296 let send_compression_encodings = self.send_compression_encodings;
297 let inner = self.inner.clone();
298 let fut = async move {
299 let inner = inner.0;
300 let method = OnMessageSvc(inner);
301 let codec = tonic::codec::ProstCodec::default();
302 let mut grpc = tonic::server::Grpc::new(codec)
303 .apply_compression_config(
304 accept_compression_encodings,
305 send_compression_encodings,
306 );
307 let res = grpc.server_streaming(method, req).await;
308 Ok(res)
309 };
310 Box::pin(fut)
311 }
312 _ => {
313 Box::pin(async move {
314 Ok(
315 http::Response::builder()
316 .status(200)
317 .header("grpc-status", "12")
318 .header("content-type", "application/grpc")
319 .body(empty_body())
320 .unwrap(),
321 )
322 })
323 }
324 }
325 }
326 }
327 impl<T: ActsService> Clone for ActsServiceServer<T> {
328 fn clone(&self) -> Self {
329 let inner = self.inner.clone();
330 Self {
331 inner,
332 accept_compression_encodings: self.accept_compression_encodings,
333 send_compression_encodings: self.send_compression_encodings,
334 }
335 }
336 }
337 impl<T: ActsService> Clone for _Inner<T> {
338 fn clone(&self) -> Self {
339 Self(self.0.clone())
340 }
341 }
342 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
343 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
344 write!(f, "{:?}", self.0)
345 }
346 }
347 impl<T: ActsService> tonic::server::NamedService for ActsServiceServer<T> {
348 const NAME: &'static str = "acts.grpc.ActsService";
349 }
350}