miden_node_proto/generated/
block_producer.rs1pub mod api_client {
4 #![allow(
5 unused_variables,
6 dead_code,
7 missing_docs,
8 clippy::wildcard_imports,
9 clippy::let_unit_value,
10 )]
11 use tonic::codegen::*;
12 use tonic::codegen::http::Uri;
13 #[derive(Debug, Clone)]
14 pub struct ApiClient<T> {
15 inner: tonic::client::Grpc<T>,
16 }
17 impl ApiClient<tonic::transport::Channel> {
18 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
20 where
21 D: TryInto<tonic::transport::Endpoint>,
22 D::Error: Into<StdError>,
23 {
24 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
25 Ok(Self::new(conn))
26 }
27 }
28 impl<T> ApiClient<T>
29 where
30 T: tonic::client::GrpcService<tonic::body::BoxBody>,
31 T::Error: Into<StdError>,
32 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
33 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
34 {
35 pub fn new(inner: T) -> Self {
36 let inner = tonic::client::Grpc::new(inner);
37 Self { inner }
38 }
39 pub fn with_origin(inner: T, origin: Uri) -> Self {
40 let inner = tonic::client::Grpc::with_origin(inner, origin);
41 Self { inner }
42 }
43 pub fn with_interceptor<F>(
44 inner: T,
45 interceptor: F,
46 ) -> ApiClient<InterceptedService<T, F>>
47 where
48 F: tonic::service::Interceptor,
49 T::ResponseBody: Default,
50 T: tonic::codegen::Service<
51 http::Request<tonic::body::BoxBody>,
52 Response = http::Response<
53 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
54 >,
55 >,
56 <T as tonic::codegen::Service<
57 http::Request<tonic::body::BoxBody>,
58 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
59 {
60 ApiClient::new(InterceptedService::new(inner, interceptor))
61 }
62 #[must_use]
67 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
68 self.inner = self.inner.send_compressed(encoding);
69 self
70 }
71 #[must_use]
73 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
74 self.inner = self.inner.accept_compressed(encoding);
75 self
76 }
77 #[must_use]
81 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
82 self.inner = self.inner.max_decoding_message_size(limit);
83 self
84 }
85 #[must_use]
89 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
90 self.inner = self.inner.max_encoding_message_size(limit);
91 self
92 }
93 pub async fn submit_proven_transaction(
95 &mut self,
96 request: impl tonic::IntoRequest<
97 super::super::requests::SubmitProvenTransactionRequest,
98 >,
99 ) -> std::result::Result<
100 tonic::Response<super::super::responses::SubmitProvenTransactionResponse>,
101 tonic::Status,
102 > {
103 self.inner
104 .ready()
105 .await
106 .map_err(|e| {
107 tonic::Status::unknown(
108 format!("Service was not ready: {}", e.into()),
109 )
110 })?;
111 let codec = tonic::codec::ProstCodec::default();
112 let path = http::uri::PathAndQuery::from_static(
113 "/block_producer.Api/SubmitProvenTransaction",
114 );
115 let mut req = request.into_request();
116 req.extensions_mut()
117 .insert(
118 GrpcMethod::new("block_producer.Api", "SubmitProvenTransaction"),
119 );
120 self.inner.unary(req, path, codec).await
121 }
122 }
123}
124pub mod api_server {
126 #![allow(
127 unused_variables,
128 dead_code,
129 missing_docs,
130 clippy::wildcard_imports,
131 clippy::let_unit_value,
132 )]
133 use tonic::codegen::*;
134 #[async_trait]
136 pub trait Api: std::marker::Send + std::marker::Sync + 'static {
137 async fn submit_proven_transaction(
139 &self,
140 request: tonic::Request<
141 super::super::requests::SubmitProvenTransactionRequest,
142 >,
143 ) -> std::result::Result<
144 tonic::Response<super::super::responses::SubmitProvenTransactionResponse>,
145 tonic::Status,
146 >;
147 }
148 #[derive(Debug)]
149 pub struct ApiServer<T> {
150 inner: Arc<T>,
151 accept_compression_encodings: EnabledCompressionEncodings,
152 send_compression_encodings: EnabledCompressionEncodings,
153 max_decoding_message_size: Option<usize>,
154 max_encoding_message_size: Option<usize>,
155 }
156 impl<T> ApiServer<T> {
157 pub fn new(inner: T) -> Self {
158 Self::from_arc(Arc::new(inner))
159 }
160 pub fn from_arc(inner: Arc<T>) -> Self {
161 Self {
162 inner,
163 accept_compression_encodings: Default::default(),
164 send_compression_encodings: Default::default(),
165 max_decoding_message_size: None,
166 max_encoding_message_size: None,
167 }
168 }
169 pub fn with_interceptor<F>(
170 inner: T,
171 interceptor: F,
172 ) -> InterceptedService<Self, F>
173 where
174 F: tonic::service::Interceptor,
175 {
176 InterceptedService::new(Self::new(inner), interceptor)
177 }
178 #[must_use]
180 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
181 self.accept_compression_encodings.enable(encoding);
182 self
183 }
184 #[must_use]
186 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
187 self.send_compression_encodings.enable(encoding);
188 self
189 }
190 #[must_use]
194 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
195 self.max_decoding_message_size = Some(limit);
196 self
197 }
198 #[must_use]
202 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
203 self.max_encoding_message_size = Some(limit);
204 self
205 }
206 }
207 impl<T, B> tonic::codegen::Service<http::Request<B>> for ApiServer<T>
208 where
209 T: Api,
210 B: Body + std::marker::Send + 'static,
211 B::Error: Into<StdError> + std::marker::Send + 'static,
212 {
213 type Response = http::Response<tonic::body::BoxBody>;
214 type Error = std::convert::Infallible;
215 type Future = BoxFuture<Self::Response, Self::Error>;
216 fn poll_ready(
217 &mut self,
218 _cx: &mut Context<'_>,
219 ) -> Poll<std::result::Result<(), Self::Error>> {
220 Poll::Ready(Ok(()))
221 }
222 fn call(&mut self, req: http::Request<B>) -> Self::Future {
223 match req.uri().path() {
224 "/block_producer.Api/SubmitProvenTransaction" => {
225 #[allow(non_camel_case_types)]
226 struct SubmitProvenTransactionSvc<T: Api>(pub Arc<T>);
227 impl<
228 T: Api,
229 > tonic::server::UnaryService<
230 super::super::requests::SubmitProvenTransactionRequest,
231 > for SubmitProvenTransactionSvc<T> {
232 type Response = super::super::responses::SubmitProvenTransactionResponse;
233 type Future = BoxFuture<
234 tonic::Response<Self::Response>,
235 tonic::Status,
236 >;
237 fn call(
238 &mut self,
239 request: tonic::Request<
240 super::super::requests::SubmitProvenTransactionRequest,
241 >,
242 ) -> Self::Future {
243 let inner = Arc::clone(&self.0);
244 let fut = async move {
245 <T as Api>::submit_proven_transaction(&inner, request).await
246 };
247 Box::pin(fut)
248 }
249 }
250 let accept_compression_encodings = self.accept_compression_encodings;
251 let send_compression_encodings = self.send_compression_encodings;
252 let max_decoding_message_size = self.max_decoding_message_size;
253 let max_encoding_message_size = self.max_encoding_message_size;
254 let inner = self.inner.clone();
255 let fut = async move {
256 let method = SubmitProvenTransactionSvc(inner);
257 let codec = tonic::codec::ProstCodec::default();
258 let mut grpc = tonic::server::Grpc::new(codec)
259 .apply_compression_config(
260 accept_compression_encodings,
261 send_compression_encodings,
262 )
263 .apply_max_message_size_config(
264 max_decoding_message_size,
265 max_encoding_message_size,
266 );
267 let res = grpc.unary(method, req).await;
268 Ok(res)
269 };
270 Box::pin(fut)
271 }
272 _ => {
273 Box::pin(async move {
274 let mut response = http::Response::new(empty_body());
275 let headers = response.headers_mut();
276 headers
277 .insert(
278 tonic::Status::GRPC_STATUS,
279 (tonic::Code::Unimplemented as i32).into(),
280 );
281 headers
282 .insert(
283 http::header::CONTENT_TYPE,
284 tonic::metadata::GRPC_CONTENT_TYPE,
285 );
286 Ok(response)
287 })
288 }
289 }
290 }
291 }
292 impl<T> Clone for ApiServer<T> {
293 fn clone(&self) -> Self {
294 let inner = self.inner.clone();
295 Self {
296 inner,
297 accept_compression_encodings: self.accept_compression_encodings,
298 send_compression_encodings: self.send_compression_encodings,
299 max_decoding_message_size: self.max_decoding_message_size,
300 max_encoding_message_size: self.max_encoding_message_size,
301 }
302 }
303 }
304 pub const SERVICE_NAME: &str = "block_producer.Api";
306 impl<T> tonic::server::NamedService for ApiServer<T> {
307 const NAME: &'static str = SERVICE_NAME;
308 }
309}