1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct ProofRequest {
5 #[prost(enumeration = "ProofType", tag = "1")]
7 pub proof_type: i32,
8 #[prost(bytes = "vec", tag = "2")]
15 pub payload: ::prost::alloc::vec::Vec<u8>,
16}
17#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
19pub struct Proof {
20 #[prost(bytes = "vec", tag = "1")]
26 pub payload: ::prost::alloc::vec::Vec<u8>,
27}
28#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
30pub struct ProxyWorkerStatus {
31 #[prost(string, tag = "1")]
33 pub address: ::prost::alloc::string::String,
34 #[prost(string, tag = "2")]
36 pub version: ::prost::alloc::string::String,
37 #[prost(enumeration = "WorkerHealthStatus", tag = "3")]
39 pub status: i32,
40}
41#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct ProxyStatus {
44 #[prost(string, tag = "1")]
46 pub version: ::prost::alloc::string::String,
47 #[prost(enumeration = "ProofType", tag = "2")]
49 pub supported_proof_type: i32,
50 #[prost(message, repeated, tag = "3")]
52 pub workers: ::prost::alloc::vec::Vec<ProxyWorkerStatus>,
53}
54#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
56pub struct WorkerStatus {
57 #[prost(string, tag = "1")]
59 pub version: ::prost::alloc::string::String,
60 #[prost(enumeration = "ProofType", tag = "2")]
62 pub supported_proof_type: i32,
63}
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
66#[repr(i32)]
67pub enum ProofType {
68 Transaction = 0,
70 Batch = 1,
72 Block = 2,
74}
75impl ProofType {
76 pub fn as_str_name(&self) -> &'static str {
81 match self {
82 Self::Transaction => "TRANSACTION",
83 Self::Batch => "BATCH",
84 Self::Block => "BLOCK",
85 }
86 }
87 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
89 match value {
90 "TRANSACTION" => Some(Self::Transaction),
91 "BATCH" => Some(Self::Batch),
92 "BLOCK" => Some(Self::Block),
93 _ => None,
94 }
95 }
96}
97#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
99#[repr(i32)]
100pub enum WorkerHealthStatus {
101 Unknown = 0,
105 Healthy = 1,
108 Unhealthy = 2,
111}
112impl WorkerHealthStatus {
113 pub fn as_str_name(&self) -> &'static str {
118 match self {
119 Self::Unknown => "UNKNOWN",
120 Self::Healthy => "HEALTHY",
121 Self::Unhealthy => "UNHEALTHY",
122 }
123 }
124 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
126 match value {
127 "UNKNOWN" => Some(Self::Unknown),
128 "HEALTHY" => Some(Self::Healthy),
129 "UNHEALTHY" => Some(Self::Unhealthy),
130 _ => None,
131 }
132 }
133}
134pub mod api_client {
136 #![allow(
137 unused_variables,
138 dead_code,
139 missing_docs,
140 clippy::wildcard_imports,
141 clippy::let_unit_value,
142 )]
143 use tonic::codegen::*;
144 use tonic::codegen::http::Uri;
145 #[derive(Debug, Clone)]
146 pub struct ApiClient<T> {
147 inner: tonic::client::Grpc<T>,
148 }
149 impl ApiClient<tonic::transport::Channel> {
150 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
152 where
153 D: TryInto<tonic::transport::Endpoint>,
154 D::Error: Into<StdError>,
155 {
156 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
157 Ok(Self::new(conn))
158 }
159 }
160 impl<T> ApiClient<T>
161 where
162 T: tonic::client::GrpcService<tonic::body::Body>,
163 T::Error: Into<StdError>,
164 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
165 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
166 {
167 pub fn new(inner: T) -> Self {
168 let inner = tonic::client::Grpc::new(inner);
169 Self { inner }
170 }
171 pub fn with_origin(inner: T, origin: Uri) -> Self {
172 let inner = tonic::client::Grpc::with_origin(inner, origin);
173 Self { inner }
174 }
175 pub fn with_interceptor<F>(
176 inner: T,
177 interceptor: F,
178 ) -> ApiClient<InterceptedService<T, F>>
179 where
180 F: tonic::service::Interceptor,
181 T::ResponseBody: Default,
182 T: tonic::codegen::Service<
183 http::Request<tonic::body::Body>,
184 Response = http::Response<
185 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
186 >,
187 >,
188 <T as tonic::codegen::Service<
189 http::Request<tonic::body::Body>,
190 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
191 {
192 ApiClient::new(InterceptedService::new(inner, interceptor))
193 }
194 #[must_use]
199 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
200 self.inner = self.inner.send_compressed(encoding);
201 self
202 }
203 #[must_use]
205 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
206 self.inner = self.inner.accept_compressed(encoding);
207 self
208 }
209 #[must_use]
213 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
214 self.inner = self.inner.max_decoding_message_size(limit);
215 self
216 }
217 #[must_use]
221 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
222 self.inner = self.inner.max_encoding_message_size(limit);
223 self
224 }
225 pub async fn prove(
227 &mut self,
228 request: impl tonic::IntoRequest<super::ProofRequest>,
229 ) -> std::result::Result<tonic::Response<super::Proof>, tonic::Status> {
230 self.inner
231 .ready()
232 .await
233 .map_err(|e| {
234 tonic::Status::unknown(
235 format!("Service was not ready: {}", e.into()),
236 )
237 })?;
238 let codec = tonic_prost::ProstCodec::default();
239 let path = http::uri::PathAndQuery::from_static("/remote_prover.Api/Prove");
240 let mut req = request.into_request();
241 req.extensions_mut().insert(GrpcMethod::new("remote_prover.Api", "Prove"));
242 self.inner.unary(req, path, codec).await
243 }
244 }
245}
246pub mod api_server {
248 #![allow(
249 unused_variables,
250 dead_code,
251 missing_docs,
252 clippy::wildcard_imports,
253 clippy::let_unit_value,
254 )]
255 use tonic::codegen::*;
256 #[async_trait]
258 pub trait Api: std::marker::Send + std::marker::Sync + 'static {
259 async fn prove(
261 &self,
262 request: tonic::Request<super::ProofRequest>,
263 ) -> std::result::Result<tonic::Response<super::Proof>, tonic::Status>;
264 }
265 #[derive(Debug)]
266 pub struct ApiServer<T> {
267 inner: Arc<T>,
268 accept_compression_encodings: EnabledCompressionEncodings,
269 send_compression_encodings: EnabledCompressionEncodings,
270 max_decoding_message_size: Option<usize>,
271 max_encoding_message_size: Option<usize>,
272 }
273 impl<T> ApiServer<T> {
274 pub fn new(inner: T) -> Self {
275 Self::from_arc(Arc::new(inner))
276 }
277 pub fn from_arc(inner: Arc<T>) -> Self {
278 Self {
279 inner,
280 accept_compression_encodings: Default::default(),
281 send_compression_encodings: Default::default(),
282 max_decoding_message_size: None,
283 max_encoding_message_size: None,
284 }
285 }
286 pub fn with_interceptor<F>(
287 inner: T,
288 interceptor: F,
289 ) -> InterceptedService<Self, F>
290 where
291 F: tonic::service::Interceptor,
292 {
293 InterceptedService::new(Self::new(inner), interceptor)
294 }
295 #[must_use]
297 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
298 self.accept_compression_encodings.enable(encoding);
299 self
300 }
301 #[must_use]
303 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
304 self.send_compression_encodings.enable(encoding);
305 self
306 }
307 #[must_use]
311 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
312 self.max_decoding_message_size = Some(limit);
313 self
314 }
315 #[must_use]
319 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
320 self.max_encoding_message_size = Some(limit);
321 self
322 }
323 }
324 impl<T, B> tonic::codegen::Service<http::Request<B>> for ApiServer<T>
325 where
326 T: Api,
327 B: Body + std::marker::Send + 'static,
328 B::Error: Into<StdError> + std::marker::Send + 'static,
329 {
330 type Response = http::Response<tonic::body::Body>;
331 type Error = std::convert::Infallible;
332 type Future = BoxFuture<Self::Response, Self::Error>;
333 fn poll_ready(
334 &mut self,
335 _cx: &mut Context<'_>,
336 ) -> Poll<std::result::Result<(), Self::Error>> {
337 Poll::Ready(Ok(()))
338 }
339 fn call(&mut self, req: http::Request<B>) -> Self::Future {
340 match req.uri().path() {
341 "/remote_prover.Api/Prove" => {
342 #[allow(non_camel_case_types)]
343 struct ProveSvc<T: Api>(pub Arc<T>);
344 impl<T: Api> tonic::server::UnaryService<super::ProofRequest>
345 for ProveSvc<T> {
346 type Response = super::Proof;
347 type Future = BoxFuture<
348 tonic::Response<Self::Response>,
349 tonic::Status,
350 >;
351 fn call(
352 &mut self,
353 request: tonic::Request<super::ProofRequest>,
354 ) -> Self::Future {
355 let inner = Arc::clone(&self.0);
356 let fut = async move {
357 <T as Api>::prove(&inner, request).await
358 };
359 Box::pin(fut)
360 }
361 }
362 let accept_compression_encodings = self.accept_compression_encodings;
363 let send_compression_encodings = self.send_compression_encodings;
364 let max_decoding_message_size = self.max_decoding_message_size;
365 let max_encoding_message_size = self.max_encoding_message_size;
366 let inner = self.inner.clone();
367 let fut = async move {
368 let method = ProveSvc(inner);
369 let codec = tonic_prost::ProstCodec::default();
370 let mut grpc = tonic::server::Grpc::new(codec)
371 .apply_compression_config(
372 accept_compression_encodings,
373 send_compression_encodings,
374 )
375 .apply_max_message_size_config(
376 max_decoding_message_size,
377 max_encoding_message_size,
378 );
379 let res = grpc.unary(method, req).await;
380 Ok(res)
381 };
382 Box::pin(fut)
383 }
384 _ => {
385 Box::pin(async move {
386 let mut response = http::Response::new(
387 tonic::body::Body::default(),
388 );
389 let headers = response.headers_mut();
390 headers
391 .insert(
392 tonic::Status::GRPC_STATUS,
393 (tonic::Code::Unimplemented as i32).into(),
394 );
395 headers
396 .insert(
397 http::header::CONTENT_TYPE,
398 tonic::metadata::GRPC_CONTENT_TYPE,
399 );
400 Ok(response)
401 })
402 }
403 }
404 }
405 }
406 impl<T> Clone for ApiServer<T> {
407 fn clone(&self) -> Self {
408 let inner = self.inner.clone();
409 Self {
410 inner,
411 accept_compression_encodings: self.accept_compression_encodings,
412 send_compression_encodings: self.send_compression_encodings,
413 max_decoding_message_size: self.max_decoding_message_size,
414 max_encoding_message_size: self.max_encoding_message_size,
415 }
416 }
417 }
418 pub const SERVICE_NAME: &str = "remote_prover.Api";
420 impl<T> tonic::server::NamedService for ApiServer<T> {
421 const NAME: &'static str = SERVICE_NAME;
422 }
423}
424pub mod proxy_status_api_client {
426 #![allow(
427 unused_variables,
428 dead_code,
429 missing_docs,
430 clippy::wildcard_imports,
431 clippy::let_unit_value,
432 )]
433 use tonic::codegen::*;
434 use tonic::codegen::http::Uri;
435 #[derive(Debug, Clone)]
436 pub struct ProxyStatusApiClient<T> {
437 inner: tonic::client::Grpc<T>,
438 }
439 impl ProxyStatusApiClient<tonic::transport::Channel> {
440 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
442 where
443 D: TryInto<tonic::transport::Endpoint>,
444 D::Error: Into<StdError>,
445 {
446 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
447 Ok(Self::new(conn))
448 }
449 }
450 impl<T> ProxyStatusApiClient<T>
451 where
452 T: tonic::client::GrpcService<tonic::body::Body>,
453 T::Error: Into<StdError>,
454 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
455 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
456 {
457 pub fn new(inner: T) -> Self {
458 let inner = tonic::client::Grpc::new(inner);
459 Self { inner }
460 }
461 pub fn with_origin(inner: T, origin: Uri) -> Self {
462 let inner = tonic::client::Grpc::with_origin(inner, origin);
463 Self { inner }
464 }
465 pub fn with_interceptor<F>(
466 inner: T,
467 interceptor: F,
468 ) -> ProxyStatusApiClient<InterceptedService<T, F>>
469 where
470 F: tonic::service::Interceptor,
471 T::ResponseBody: Default,
472 T: tonic::codegen::Service<
473 http::Request<tonic::body::Body>,
474 Response = http::Response<
475 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
476 >,
477 >,
478 <T as tonic::codegen::Service<
479 http::Request<tonic::body::Body>,
480 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
481 {
482 ProxyStatusApiClient::new(InterceptedService::new(inner, interceptor))
483 }
484 #[must_use]
489 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
490 self.inner = self.inner.send_compressed(encoding);
491 self
492 }
493 #[must_use]
495 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
496 self.inner = self.inner.accept_compressed(encoding);
497 self
498 }
499 #[must_use]
503 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
504 self.inner = self.inner.max_decoding_message_size(limit);
505 self
506 }
507 #[must_use]
511 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
512 self.inner = self.inner.max_encoding_message_size(limit);
513 self
514 }
515 pub async fn status(
517 &mut self,
518 request: impl tonic::IntoRequest<()>,
519 ) -> std::result::Result<tonic::Response<super::ProxyStatus>, tonic::Status> {
520 self.inner
521 .ready()
522 .await
523 .map_err(|e| {
524 tonic::Status::unknown(
525 format!("Service was not ready: {}", e.into()),
526 )
527 })?;
528 let codec = tonic_prost::ProstCodec::default();
529 let path = http::uri::PathAndQuery::from_static(
530 "/remote_prover.ProxyStatusApi/Status",
531 );
532 let mut req = request.into_request();
533 req.extensions_mut()
534 .insert(GrpcMethod::new("remote_prover.ProxyStatusApi", "Status"));
535 self.inner.unary(req, path, codec).await
536 }
537 }
538}
539pub mod proxy_status_api_server {
541 #![allow(
542 unused_variables,
543 dead_code,
544 missing_docs,
545 clippy::wildcard_imports,
546 clippy::let_unit_value,
547 )]
548 use tonic::codegen::*;
549 #[async_trait]
551 pub trait ProxyStatusApi: std::marker::Send + std::marker::Sync + 'static {
552 async fn status(
554 &self,
555 request: tonic::Request<()>,
556 ) -> std::result::Result<tonic::Response<super::ProxyStatus>, tonic::Status>;
557 }
558 #[derive(Debug)]
559 pub struct ProxyStatusApiServer<T> {
560 inner: Arc<T>,
561 accept_compression_encodings: EnabledCompressionEncodings,
562 send_compression_encodings: EnabledCompressionEncodings,
563 max_decoding_message_size: Option<usize>,
564 max_encoding_message_size: Option<usize>,
565 }
566 impl<T> ProxyStatusApiServer<T> {
567 pub fn new(inner: T) -> Self {
568 Self::from_arc(Arc::new(inner))
569 }
570 pub fn from_arc(inner: Arc<T>) -> Self {
571 Self {
572 inner,
573 accept_compression_encodings: Default::default(),
574 send_compression_encodings: Default::default(),
575 max_decoding_message_size: None,
576 max_encoding_message_size: None,
577 }
578 }
579 pub fn with_interceptor<F>(
580 inner: T,
581 interceptor: F,
582 ) -> InterceptedService<Self, F>
583 where
584 F: tonic::service::Interceptor,
585 {
586 InterceptedService::new(Self::new(inner), interceptor)
587 }
588 #[must_use]
590 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
591 self.accept_compression_encodings.enable(encoding);
592 self
593 }
594 #[must_use]
596 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
597 self.send_compression_encodings.enable(encoding);
598 self
599 }
600 #[must_use]
604 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
605 self.max_decoding_message_size = Some(limit);
606 self
607 }
608 #[must_use]
612 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
613 self.max_encoding_message_size = Some(limit);
614 self
615 }
616 }
617 impl<T, B> tonic::codegen::Service<http::Request<B>> for ProxyStatusApiServer<T>
618 where
619 T: ProxyStatusApi,
620 B: Body + std::marker::Send + 'static,
621 B::Error: Into<StdError> + std::marker::Send + 'static,
622 {
623 type Response = http::Response<tonic::body::Body>;
624 type Error = std::convert::Infallible;
625 type Future = BoxFuture<Self::Response, Self::Error>;
626 fn poll_ready(
627 &mut self,
628 _cx: &mut Context<'_>,
629 ) -> Poll<std::result::Result<(), Self::Error>> {
630 Poll::Ready(Ok(()))
631 }
632 fn call(&mut self, req: http::Request<B>) -> Self::Future {
633 match req.uri().path() {
634 "/remote_prover.ProxyStatusApi/Status" => {
635 #[allow(non_camel_case_types)]
636 struct StatusSvc<T: ProxyStatusApi>(pub Arc<T>);
637 impl<T: ProxyStatusApi> tonic::server::UnaryService<()>
638 for StatusSvc<T> {
639 type Response = super::ProxyStatus;
640 type Future = BoxFuture<
641 tonic::Response<Self::Response>,
642 tonic::Status,
643 >;
644 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
645 let inner = Arc::clone(&self.0);
646 let fut = async move {
647 <T as ProxyStatusApi>::status(&inner, request).await
648 };
649 Box::pin(fut)
650 }
651 }
652 let accept_compression_encodings = self.accept_compression_encodings;
653 let send_compression_encodings = self.send_compression_encodings;
654 let max_decoding_message_size = self.max_decoding_message_size;
655 let max_encoding_message_size = self.max_encoding_message_size;
656 let inner = self.inner.clone();
657 let fut = async move {
658 let method = StatusSvc(inner);
659 let codec = tonic_prost::ProstCodec::default();
660 let mut grpc = tonic::server::Grpc::new(codec)
661 .apply_compression_config(
662 accept_compression_encodings,
663 send_compression_encodings,
664 )
665 .apply_max_message_size_config(
666 max_decoding_message_size,
667 max_encoding_message_size,
668 );
669 let res = grpc.unary(method, req).await;
670 Ok(res)
671 };
672 Box::pin(fut)
673 }
674 _ => {
675 Box::pin(async move {
676 let mut response = http::Response::new(
677 tonic::body::Body::default(),
678 );
679 let headers = response.headers_mut();
680 headers
681 .insert(
682 tonic::Status::GRPC_STATUS,
683 (tonic::Code::Unimplemented as i32).into(),
684 );
685 headers
686 .insert(
687 http::header::CONTENT_TYPE,
688 tonic::metadata::GRPC_CONTENT_TYPE,
689 );
690 Ok(response)
691 })
692 }
693 }
694 }
695 }
696 impl<T> Clone for ProxyStatusApiServer<T> {
697 fn clone(&self) -> Self {
698 let inner = self.inner.clone();
699 Self {
700 inner,
701 accept_compression_encodings: self.accept_compression_encodings,
702 send_compression_encodings: self.send_compression_encodings,
703 max_decoding_message_size: self.max_decoding_message_size,
704 max_encoding_message_size: self.max_encoding_message_size,
705 }
706 }
707 }
708 pub const SERVICE_NAME: &str = "remote_prover.ProxyStatusApi";
710 impl<T> tonic::server::NamedService for ProxyStatusApiServer<T> {
711 const NAME: &'static str = SERVICE_NAME;
712 }
713}
714pub mod worker_status_api_client {
716 #![allow(
717 unused_variables,
718 dead_code,
719 missing_docs,
720 clippy::wildcard_imports,
721 clippy::let_unit_value,
722 )]
723 use tonic::codegen::*;
724 use tonic::codegen::http::Uri;
725 #[derive(Debug, Clone)]
726 pub struct WorkerStatusApiClient<T> {
727 inner: tonic::client::Grpc<T>,
728 }
729 impl WorkerStatusApiClient<tonic::transport::Channel> {
730 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
732 where
733 D: TryInto<tonic::transport::Endpoint>,
734 D::Error: Into<StdError>,
735 {
736 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
737 Ok(Self::new(conn))
738 }
739 }
740 impl<T> WorkerStatusApiClient<T>
741 where
742 T: tonic::client::GrpcService<tonic::body::Body>,
743 T::Error: Into<StdError>,
744 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
745 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
746 {
747 pub fn new(inner: T) -> Self {
748 let inner = tonic::client::Grpc::new(inner);
749 Self { inner }
750 }
751 pub fn with_origin(inner: T, origin: Uri) -> Self {
752 let inner = tonic::client::Grpc::with_origin(inner, origin);
753 Self { inner }
754 }
755 pub fn with_interceptor<F>(
756 inner: T,
757 interceptor: F,
758 ) -> WorkerStatusApiClient<InterceptedService<T, F>>
759 where
760 F: tonic::service::Interceptor,
761 T::ResponseBody: Default,
762 T: tonic::codegen::Service<
763 http::Request<tonic::body::Body>,
764 Response = http::Response<
765 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
766 >,
767 >,
768 <T as tonic::codegen::Service<
769 http::Request<tonic::body::Body>,
770 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
771 {
772 WorkerStatusApiClient::new(InterceptedService::new(inner, interceptor))
773 }
774 #[must_use]
779 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
780 self.inner = self.inner.send_compressed(encoding);
781 self
782 }
783 #[must_use]
785 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
786 self.inner = self.inner.accept_compressed(encoding);
787 self
788 }
789 #[must_use]
793 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
794 self.inner = self.inner.max_decoding_message_size(limit);
795 self
796 }
797 #[must_use]
801 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
802 self.inner = self.inner.max_encoding_message_size(limit);
803 self
804 }
805 pub async fn status(
807 &mut self,
808 request: impl tonic::IntoRequest<()>,
809 ) -> std::result::Result<tonic::Response<super::WorkerStatus>, tonic::Status> {
810 self.inner
811 .ready()
812 .await
813 .map_err(|e| {
814 tonic::Status::unknown(
815 format!("Service was not ready: {}", e.into()),
816 )
817 })?;
818 let codec = tonic_prost::ProstCodec::default();
819 let path = http::uri::PathAndQuery::from_static(
820 "/remote_prover.WorkerStatusApi/Status",
821 );
822 let mut req = request.into_request();
823 req.extensions_mut()
824 .insert(GrpcMethod::new("remote_prover.WorkerStatusApi", "Status"));
825 self.inner.unary(req, path, codec).await
826 }
827 }
828}
829pub mod worker_status_api_server {
831 #![allow(
832 unused_variables,
833 dead_code,
834 missing_docs,
835 clippy::wildcard_imports,
836 clippy::let_unit_value,
837 )]
838 use tonic::codegen::*;
839 #[async_trait]
841 pub trait WorkerStatusApi: std::marker::Send + std::marker::Sync + 'static {
842 async fn status(
844 &self,
845 request: tonic::Request<()>,
846 ) -> std::result::Result<tonic::Response<super::WorkerStatus>, tonic::Status>;
847 }
848 #[derive(Debug)]
849 pub struct WorkerStatusApiServer<T> {
850 inner: Arc<T>,
851 accept_compression_encodings: EnabledCompressionEncodings,
852 send_compression_encodings: EnabledCompressionEncodings,
853 max_decoding_message_size: Option<usize>,
854 max_encoding_message_size: Option<usize>,
855 }
856 impl<T> WorkerStatusApiServer<T> {
857 pub fn new(inner: T) -> Self {
858 Self::from_arc(Arc::new(inner))
859 }
860 pub fn from_arc(inner: Arc<T>) -> Self {
861 Self {
862 inner,
863 accept_compression_encodings: Default::default(),
864 send_compression_encodings: Default::default(),
865 max_decoding_message_size: None,
866 max_encoding_message_size: None,
867 }
868 }
869 pub fn with_interceptor<F>(
870 inner: T,
871 interceptor: F,
872 ) -> InterceptedService<Self, F>
873 where
874 F: tonic::service::Interceptor,
875 {
876 InterceptedService::new(Self::new(inner), interceptor)
877 }
878 #[must_use]
880 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
881 self.accept_compression_encodings.enable(encoding);
882 self
883 }
884 #[must_use]
886 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
887 self.send_compression_encodings.enable(encoding);
888 self
889 }
890 #[must_use]
894 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
895 self.max_decoding_message_size = Some(limit);
896 self
897 }
898 #[must_use]
902 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
903 self.max_encoding_message_size = Some(limit);
904 self
905 }
906 }
907 impl<T, B> tonic::codegen::Service<http::Request<B>> for WorkerStatusApiServer<T>
908 where
909 T: WorkerStatusApi,
910 B: Body + std::marker::Send + 'static,
911 B::Error: Into<StdError> + std::marker::Send + 'static,
912 {
913 type Response = http::Response<tonic::body::Body>;
914 type Error = std::convert::Infallible;
915 type Future = BoxFuture<Self::Response, Self::Error>;
916 fn poll_ready(
917 &mut self,
918 _cx: &mut Context<'_>,
919 ) -> Poll<std::result::Result<(), Self::Error>> {
920 Poll::Ready(Ok(()))
921 }
922 fn call(&mut self, req: http::Request<B>) -> Self::Future {
923 match req.uri().path() {
924 "/remote_prover.WorkerStatusApi/Status" => {
925 #[allow(non_camel_case_types)]
926 struct StatusSvc<T: WorkerStatusApi>(pub Arc<T>);
927 impl<T: WorkerStatusApi> tonic::server::UnaryService<()>
928 for StatusSvc<T> {
929 type Response = super::WorkerStatus;
930 type Future = BoxFuture<
931 tonic::Response<Self::Response>,
932 tonic::Status,
933 >;
934 fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
935 let inner = Arc::clone(&self.0);
936 let fut = async move {
937 <T as WorkerStatusApi>::status(&inner, request).await
938 };
939 Box::pin(fut)
940 }
941 }
942 let accept_compression_encodings = self.accept_compression_encodings;
943 let send_compression_encodings = self.send_compression_encodings;
944 let max_decoding_message_size = self.max_decoding_message_size;
945 let max_encoding_message_size = self.max_encoding_message_size;
946 let inner = self.inner.clone();
947 let fut = async move {
948 let method = StatusSvc(inner);
949 let codec = tonic_prost::ProstCodec::default();
950 let mut grpc = tonic::server::Grpc::new(codec)
951 .apply_compression_config(
952 accept_compression_encodings,
953 send_compression_encodings,
954 )
955 .apply_max_message_size_config(
956 max_decoding_message_size,
957 max_encoding_message_size,
958 );
959 let res = grpc.unary(method, req).await;
960 Ok(res)
961 };
962 Box::pin(fut)
963 }
964 _ => {
965 Box::pin(async move {
966 let mut response = http::Response::new(
967 tonic::body::Body::default(),
968 );
969 let headers = response.headers_mut();
970 headers
971 .insert(
972 tonic::Status::GRPC_STATUS,
973 (tonic::Code::Unimplemented as i32).into(),
974 );
975 headers
976 .insert(
977 http::header::CONTENT_TYPE,
978 tonic::metadata::GRPC_CONTENT_TYPE,
979 );
980 Ok(response)
981 })
982 }
983 }
984 }
985 }
986 impl<T> Clone for WorkerStatusApiServer<T> {
987 fn clone(&self) -> Self {
988 let inner = self.inner.clone();
989 Self {
990 inner,
991 accept_compression_encodings: self.accept_compression_encodings,
992 send_compression_encodings: self.send_compression_encodings,
993 max_decoding_message_size: self.max_decoding_message_size,
994 max_encoding_message_size: self.max_encoding_message_size,
995 }
996 }
997 }
998 pub const SERVICE_NAME: &str = "remote_prover.WorkerStatusApi";
1000 impl<T> tonic::server::NamedService for WorkerStatusApiServer<T> {
1001 const NAME: &'static str = SERVICE_NAME;
1002 }
1003}