Skip to main content

deq_runtime/proto/
deq.decoder.blackbox_decoder.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct DecoderCapabilities {
4    #[prost(enumeration = "DecoderFeature", repeated, tag = "1")]
5    pub features: ::prost::alloc::vec::Vec<i32>,
6}
7#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8pub struct ResetRequest {
9    /// by default keep all the hypergraphs intact
10    #[prost(bool, tag = "1")]
11    pub reset_hypergraphs: bool,
12    /// other custom things
13    #[prost(string, tag = "200")]
14    pub custom: ::prost::alloc::string::String,
15}
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct DecodingProblem {
18    #[prost(message, optional, tag = "1")]
19    pub hypergraph: ::core::option::Option<DecodingHypergraph>,
20    #[prost(message, optional, tag = "2")]
21    pub syndrome: ::core::option::Option<super::super::util::BitVector>,
22    /// Optional loss-aware extension. Present only when atom losses are observed
23    /// for this shot; absent otherwise.
24    #[prost(message, optional, tag = "3")]
25    pub loss: ::core::option::Option<LossInfo>,
26    /// Optional deterministic seed for decoder randomness. Zero is valid.
27    #[prost(uint64, optional, tag = "4")]
28    pub decoder_seed: ::core::option::Option<u64>,
29}
30#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
31pub struct LoadHypergraphResponse {
32    /// hypergraph id assigned by the decoder service
33    #[prost(uint64, tag = "1")]
34    pub hid: u64,
35}
36#[derive(Clone, PartialEq, ::prost::Message)]
37pub struct LoadedDecodingProblem {
38    #[prost(uint64, tag = "1")]
39    pub hid: u64,
40    #[prost(message, optional, tag = "2")]
41    pub syndrome: ::core::option::Option<super::super::util::BitVector>,
42    /// Optional per-shot prior overrides, applied to this decode only. The loaded
43    /// hypergraph is left unchanged, so a subsequent decode on the same `hid` sees
44    /// the priors it was loaded with.
45    #[prost(message, repeated, tag = "3")]
46    pub reweights: ::prost::alloc::vec::Vec<EdgeReweight>,
47    /// Optional loss-aware extension. Present only when atom losses are observed
48    /// for this shot; absent otherwise.
49    #[prost(message, optional, tag = "4")]
50    pub loss: ::core::option::Option<LossInfo>,
51    /// Optional deterministic seed for decoder randomness. Zero is valid.
52    #[prost(uint64, optional, tag = "5")]
53    pub decoder_seed: ::core::option::Option<u64>,
54}
55/// Replaces the prior of one hyperedge, addressed by its index in the loaded
56/// hypergraph. The probability is *assigned*, not combined: it may raise or lower
57/// the loaded prior. Each edge may appear at most once in a request.
58#[derive(Clone, Copy, PartialEq, ::prost::Message)]
59pub struct EdgeReweight {
60    #[prost(uint64, tag = "1")]
61    pub edge: u64,
62    #[prost(double, tag = "2")]
63    pub probability: f64,
64}
65#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
66pub struct ParityFactor {
67    #[prost(uint64, repeated, tag = "1")]
68    pub subgraph: ::prost::alloc::vec::Vec<u64>,
69}
70#[derive(Clone, PartialEq, ::prost::Message)]
71pub struct DecodingHypergraph {
72    #[prost(uint64, tag = "1")]
73    pub vertex_num: u64,
74    #[prost(message, repeated, tag = "2")]
75    pub hyperedges: ::prost::alloc::vec::Vec<Hyperedge>,
76}
77#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
78pub struct ObservableFlips {
79    /// Unique opaque observable indices; order is not significant.
80    #[prost(uint64, repeated, tag = "1")]
81    pub indices: ::prost::alloc::vec::Vec<u64>,
82}
83#[derive(Clone, PartialEq, ::prost::Message)]
84pub struct Hyperedge {
85    #[prost(uint64, repeated, tag = "1")]
86    pub vertices: ::prost::alloc::vec::Vec<u64>,
87    /// we use probability instead of weight here to make it more intuitive
88    /// and easier to manipulate, e.g., updating the soft information
89    #[prost(double, tag = "2")]
90    pub probability: f64,
91    /// Optional effects on the observable targets chosen by the graph producer,
92    /// including for zero-prior errors. Absent means unknown; a present empty list
93    /// means this error flips no observables. Indices share a namespace across the
94    /// graph. This metadata belongs to the loaded graph's identity.
95    /// Decoders that do not use observable effects may ignore it.
96    #[prost(message, optional, tag = "3")]
97    pub observable_flips: ::core::option::Option<ObservableFlips>,
98}
99/// The observed atom-loss graph for one shot, projected onto the decoding
100/// problem's own indices. Enforcing exclusivity is a decoder policy, expressed
101/// through `LossSite.children`. A reweighting strategy can instead flatten the
102/// sites into ordinary reweighted hyperedges for an unmodified black-box decoder.
103#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct LossInfo {
105    /// One entry per possible loss site. The runtime has already filtered these to
106    /// sites consistent with the observed loss-resolving readouts. Direct herald
107    /// identities remain available so a loss-aware decoder can correlate possible
108    /// sites that are not connected by the child graph.
109    #[prost(message, repeated, tag = "1")]
110    pub sites: ::prost::alloc::vec::Vec<LossSite>,
111}
112#[derive(Clone, PartialEq, ::prost::Message)]
113pub struct LossSite {
114    /// Hyperedge indices (into DecodingHypergraph.hyperedges) for the SOURCE
115    /// generators at the loss location. Along a parent/child chain (one atom) at
116    /// most one site's source is the true start -- the exclusivity because a qubit
117    /// cannot lose twice.
118    #[prost(uint64, repeated, tag = "1")]
119    pub source_edges: ::prost::alloc::vec::Vec<u64>,
120    /// Hyperedge indices for the CONTINUATION generators (the loss propagated
121    /// forward). Not mutually exclusive; they accompany whichever start reaches
122    /// them.
123    #[prost(uint64, repeated, tag = "2")]
124    pub continuation_edges: ::prost::alloc::vec::Vec<u64>,
125    /// Forward parent -> child links (same atom, lost later): indices into
126    /// LossInfo.sites.
127    #[prost(uint64, repeated, tag = "3")]
128    pub children: ::prost::alloc::vec::Vec<u64>,
129    /// Declared LOSS_ERROR probability of the loss starting at this site, or 0 for
130    /// a continuation site fixed by a parent in another gadget.
131    #[prost(double, tag = "4")]
132    pub probability: f64,
133    /// Direct loss-resolving measurements for this site. Indices are window-local:
134    /// equal values identify the same observed herald across all LossInfo.sites.
135    /// Heralds inherited through propagation are found by following children.
136    #[prost(uint64, repeated, tag = "5")]
137    pub heralds: ::prost::alloc::vec::Vec<u64>,
138}
139#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
140#[repr(i32)]
141pub enum DecoderFeature {
142    Unspecified = 0,
143    Reweights = 1,
144    Loss = 2,
145    Seed = 3,
146    /// Requests per-hyperedge observable effects when available.
147    Observables = 4,
148}
149impl DecoderFeature {
150    /// String value of the enum field names used in the ProtoBuf definition.
151    ///
152    /// The values are not transformed in any way and thus are considered stable
153    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
154    pub fn as_str_name(&self) -> &'static str {
155        match self {
156            Self::Unspecified => "DECODER_FEATURE_UNSPECIFIED",
157            Self::Reweights => "DECODER_FEATURE_REWEIGHTS",
158            Self::Loss => "DECODER_FEATURE_LOSS",
159            Self::Seed => "DECODER_FEATURE_SEED",
160            Self::Observables => "DECODER_FEATURE_OBSERVABLES",
161        }
162    }
163    /// Creates an enum from field names used in the ProtoBuf definition.
164    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
165        match value {
166            "DECODER_FEATURE_UNSPECIFIED" => Some(Self::Unspecified),
167            "DECODER_FEATURE_REWEIGHTS" => Some(Self::Reweights),
168            "DECODER_FEATURE_LOSS" => Some(Self::Loss),
169            "DECODER_FEATURE_SEED" => Some(Self::Seed),
170            "DECODER_FEATURE_OBSERVABLES" => Some(Self::Observables),
171            _ => None,
172        }
173    }
174}
175/// Generated client implementations.
176#[cfg(feature = "cli")]
177pub mod black_box_decoder_client {
178    #![allow(
179        unused_variables,
180        dead_code,
181        missing_docs,
182        clippy::wildcard_imports,
183        clippy::let_unit_value,
184    )]
185    use tonic::codegen::*;
186    use tonic::codegen::http::Uri;
187    #[derive(Debug, Clone)]
188    pub struct BlackBoxDecoderClient<T> {
189        inner: tonic::client::Grpc<T>,
190    }
191    impl BlackBoxDecoderClient<tonic::transport::Channel> {
192        /// Attempt to create a new client by connecting to a given endpoint.
193        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
194        where
195            D: TryInto<tonic::transport::Endpoint>,
196            D::Error: Into<StdError>,
197        {
198            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
199            Ok(Self::new(conn))
200        }
201    }
202    impl<T> BlackBoxDecoderClient<T>
203    where
204        T: tonic::client::GrpcService<tonic::body::Body>,
205        T::Error: Into<StdError>,
206        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
207        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
208    {
209        pub fn new(inner: T) -> Self {
210            let inner = tonic::client::Grpc::new(inner);
211            Self { inner }
212        }
213        pub fn with_origin(inner: T, origin: Uri) -> Self {
214            let inner = tonic::client::Grpc::with_origin(inner, origin);
215            Self { inner }
216        }
217        pub fn with_interceptor<F>(
218            inner: T,
219            interceptor: F,
220        ) -> BlackBoxDecoderClient<InterceptedService<T, F>>
221        where
222            F: tonic::service::Interceptor,
223            T::ResponseBody: Default,
224            T: tonic::codegen::Service<
225                http::Request<tonic::body::Body>,
226                Response = http::Response<
227                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
228                >,
229            >,
230            <T as tonic::codegen::Service<
231                http::Request<tonic::body::Body>,
232            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
233        {
234            BlackBoxDecoderClient::new(InterceptedService::new(inner, interceptor))
235        }
236        /// Compress requests with the given encoding.
237        ///
238        /// This requires the server to support it otherwise it might respond with an
239        /// error.
240        #[must_use]
241        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
242            self.inner = self.inner.send_compressed(encoding);
243            self
244        }
245        /// Enable decompressing responses.
246        #[must_use]
247        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
248            self.inner = self.inner.accept_compressed(encoding);
249            self
250        }
251        /// Limits the maximum size of a decoded message.
252        ///
253        /// Default: `4MB`
254        #[must_use]
255        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
256            self.inner = self.inner.max_decoding_message_size(limit);
257            self
258        }
259        /// Limits the maximum size of an encoded message.
260        ///
261        /// Default: `usize::MAX`
262        #[must_use]
263        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
264            self.inner = self.inner.max_encoding_message_size(limit);
265            self
266        }
267        /// Report optional decoder features. Advertising multiple features means
268        /// they may be used together.
269        pub async fn get_capabilities(
270            &mut self,
271            request: impl tonic::IntoRequest<()>,
272        ) -> std::result::Result<
273            tonic::Response<super::DecoderCapabilities>,
274            tonic::Status,
275        > {
276            self.inner
277                .ready()
278                .await
279                .map_err(|e| {
280                    tonic::Status::unknown(
281                        format!("Service was not ready: {}", e.into()),
282                    )
283                })?;
284            let codec = tonic_prost::ProstCodec::default();
285            let path = http::uri::PathAndQuery::from_static(
286                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/GetCapabilities",
287            );
288            let mut req = request.into_request();
289            req.extensions_mut()
290                .insert(
291                    GrpcMethod::new(
292                        "deq.decoder.blackbox_decoder.BlackBoxDecoder",
293                        "GetCapabilities",
294                    ),
295                );
296            self.inner.unary(req, path, codec).await
297        }
298        /// calling this service is in general inefficient because it has to process
299        /// the entire decoding hypergraph during runtime. Consider using preloaded
300        /// decoder instances like the rpc interfaces followed
301        pub async fn decode(
302            &mut self,
303            request: impl tonic::IntoRequest<super::DecodingProblem>,
304        ) -> std::result::Result<tonic::Response<super::ParityFactor>, tonic::Status> {
305            self.inner
306                .ready()
307                .await
308                .map_err(|e| {
309                    tonic::Status::unknown(
310                        format!("Service was not ready: {}", e.into()),
311                    )
312                })?;
313            let codec = tonic_prost::ProstCodec::default();
314            let path = http::uri::PathAndQuery::from_static(
315                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/Decode",
316            );
317            let mut req = request.into_request();
318            req.extensions_mut()
319                .insert(
320                    GrpcMethod::new(
321                        "deq.decoder.blackbox_decoder.BlackBoxDecoder",
322                        "Decode",
323                    ),
324                );
325            self.inner.unary(req, path, codec).await
326        }
327        /// load a decoding hypergraph into the decoder service so that the runtime
328        /// decoding can simply decode using the existing instances
329        pub async fn load_hypergraph(
330            &mut self,
331            request: impl tonic::IntoRequest<super::DecodingHypergraph>,
332        ) -> std::result::Result<
333            tonic::Response<super::LoadHypergraphResponse>,
334            tonic::Status,
335        > {
336            self.inner
337                .ready()
338                .await
339                .map_err(|e| {
340                    tonic::Status::unknown(
341                        format!("Service was not ready: {}", e.into()),
342                    )
343                })?;
344            let codec = tonic_prost::ProstCodec::default();
345            let path = http::uri::PathAndQuery::from_static(
346                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/LoadHypergraph",
347            );
348            let mut req = request.into_request();
349            req.extensions_mut()
350                .insert(
351                    GrpcMethod::new(
352                        "deq.decoder.blackbox_decoder.BlackBoxDecoder",
353                        "LoadHypergraph",
354                    ),
355                );
356            self.inner.unary(req, path, codec).await
357        }
358        /// decode using a preloaded hypergraph instance
359        pub async fn decode_loaded(
360            &mut self,
361            request: impl tonic::IntoRequest<super::LoadedDecodingProblem>,
362        ) -> std::result::Result<tonic::Response<super::ParityFactor>, tonic::Status> {
363            self.inner
364                .ready()
365                .await
366                .map_err(|e| {
367                    tonic::Status::unknown(
368                        format!("Service was not ready: {}", e.into()),
369                    )
370                })?;
371            let codec = tonic_prost::ProstCodec::default();
372            let path = http::uri::PathAndQuery::from_static(
373                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/DecodeLoaded",
374            );
375            let mut req = request.into_request();
376            req.extensions_mut()
377                .insert(
378                    GrpcMethod::new(
379                        "deq.decoder.blackbox_decoder.BlackBoxDecoder",
380                        "DecodeLoaded",
381                    ),
382                );
383            self.inner.unary(req, path, codec).await
384        }
385        /// remove all loaded hypergraph instances
386        pub async fn reset(
387            &mut self,
388            request: impl tonic::IntoRequest<super::ResetRequest>,
389        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
390            self.inner
391                .ready()
392                .await
393                .map_err(|e| {
394                    tonic::Status::unknown(
395                        format!("Service was not ready: {}", e.into()),
396                    )
397                })?;
398            let codec = tonic_prost::ProstCodec::default();
399            let path = http::uri::PathAndQuery::from_static(
400                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/Reset",
401            );
402            let mut req = request.into_request();
403            req.extensions_mut()
404                .insert(
405                    GrpcMethod::new(
406                        "deq.decoder.blackbox_decoder.BlackBoxDecoder",
407                        "Reset",
408                    ),
409                );
410            self.inner.unary(req, path, codec).await
411        }
412    }
413}
414/// Generated server implementations.
415pub mod black_box_decoder_server {
416    #![allow(
417        unused_variables,
418        dead_code,
419        missing_docs,
420        clippy::wildcard_imports,
421        clippy::let_unit_value,
422    )]
423    use tonic::codegen::*;
424    /// Generated trait containing gRPC methods that should be implemented for use with BlackBoxDecoderServer.
425    #[async_trait]
426    pub trait BlackBoxDecoder: std::marker::Send + std::marker::Sync + 'static {
427        /// Report optional decoder features. Advertising multiple features means
428        /// they may be used together.
429        async fn get_capabilities(
430            &self,
431            request: tonic::Request<()>,
432        ) -> std::result::Result<
433            tonic::Response<super::DecoderCapabilities>,
434            tonic::Status,
435        >;
436        /// calling this service is in general inefficient because it has to process
437        /// the entire decoding hypergraph during runtime. Consider using preloaded
438        /// decoder instances like the rpc interfaces followed
439        async fn decode(
440            &self,
441            request: tonic::Request<super::DecodingProblem>,
442        ) -> std::result::Result<tonic::Response<super::ParityFactor>, tonic::Status>;
443        /// load a decoding hypergraph into the decoder service so that the runtime
444        /// decoding can simply decode using the existing instances
445        async fn load_hypergraph(
446            &self,
447            request: tonic::Request<super::DecodingHypergraph>,
448        ) -> std::result::Result<
449            tonic::Response<super::LoadHypergraphResponse>,
450            tonic::Status,
451        >;
452        /// decode using a preloaded hypergraph instance
453        async fn decode_loaded(
454            &self,
455            request: tonic::Request<super::LoadedDecodingProblem>,
456        ) -> std::result::Result<tonic::Response<super::ParityFactor>, tonic::Status>;
457        /// remove all loaded hypergraph instances
458        async fn reset(
459            &self,
460            request: tonic::Request<super::ResetRequest>,
461        ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
462    }
463    #[derive(Debug)]
464    pub struct BlackBoxDecoderServer<T> {
465        inner: Arc<T>,
466        accept_compression_encodings: EnabledCompressionEncodings,
467        send_compression_encodings: EnabledCompressionEncodings,
468        max_decoding_message_size: Option<usize>,
469        max_encoding_message_size: Option<usize>,
470    }
471    impl<T> BlackBoxDecoderServer<T> {
472        pub fn new(inner: T) -> Self {
473            Self::from_arc(Arc::new(inner))
474        }
475        pub fn from_arc(inner: Arc<T>) -> Self {
476            Self {
477                inner,
478                accept_compression_encodings: Default::default(),
479                send_compression_encodings: Default::default(),
480                max_decoding_message_size: None,
481                max_encoding_message_size: None,
482            }
483        }
484        pub fn with_interceptor<F>(
485            inner: T,
486            interceptor: F,
487        ) -> InterceptedService<Self, F>
488        where
489            F: tonic::service::Interceptor,
490        {
491            InterceptedService::new(Self::new(inner), interceptor)
492        }
493        /// Enable decompressing requests with the given encoding.
494        #[must_use]
495        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
496            self.accept_compression_encodings.enable(encoding);
497            self
498        }
499        /// Compress responses with the given encoding, if the client supports it.
500        #[must_use]
501        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
502            self.send_compression_encodings.enable(encoding);
503            self
504        }
505        /// Limits the maximum size of a decoded message.
506        ///
507        /// Default: `4MB`
508        #[must_use]
509        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
510            self.max_decoding_message_size = Some(limit);
511            self
512        }
513        /// Limits the maximum size of an encoded message.
514        ///
515        /// Default: `usize::MAX`
516        #[must_use]
517        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
518            self.max_encoding_message_size = Some(limit);
519            self
520        }
521    }
522    impl<T, B> tonic::codegen::Service<http::Request<B>> for BlackBoxDecoderServer<T>
523    where
524        T: BlackBoxDecoder,
525        B: Body + std::marker::Send + 'static,
526        B::Error: Into<StdError> + std::marker::Send + 'static,
527    {
528        type Response = http::Response<tonic::body::Body>;
529        type Error = std::convert::Infallible;
530        type Future = BoxFuture<Self::Response, Self::Error>;
531        fn poll_ready(
532            &mut self,
533            _cx: &mut Context<'_>,
534        ) -> Poll<std::result::Result<(), Self::Error>> {
535            Poll::Ready(Ok(()))
536        }
537        fn call(&mut self, req: http::Request<B>) -> Self::Future {
538            match req.uri().path() {
539                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/GetCapabilities" => {
540                    #[allow(non_camel_case_types)]
541                    struct GetCapabilitiesSvc<T: BlackBoxDecoder>(pub Arc<T>);
542                    impl<T: BlackBoxDecoder> tonic::server::UnaryService<()>
543                    for GetCapabilitiesSvc<T> {
544                        type Response = super::DecoderCapabilities;
545                        type Future = BoxFuture<
546                            tonic::Response<Self::Response>,
547                            tonic::Status,
548                        >;
549                        fn call(&mut self, request: tonic::Request<()>) -> Self::Future {
550                            let inner = Arc::clone(&self.0);
551                            let fut = async move {
552                                <T as BlackBoxDecoder>::get_capabilities(&inner, request)
553                                    .await
554                            };
555                            Box::pin(fut)
556                        }
557                    }
558                    let accept_compression_encodings = self.accept_compression_encodings;
559                    let send_compression_encodings = self.send_compression_encodings;
560                    let max_decoding_message_size = self.max_decoding_message_size;
561                    let max_encoding_message_size = self.max_encoding_message_size;
562                    let inner = self.inner.clone();
563                    let fut = async move {
564                        let method = GetCapabilitiesSvc(inner);
565                        let codec = tonic_prost::ProstCodec::default();
566                        let mut grpc = tonic::server::Grpc::new(codec)
567                            .apply_compression_config(
568                                accept_compression_encodings,
569                                send_compression_encodings,
570                            )
571                            .apply_max_message_size_config(
572                                max_decoding_message_size,
573                                max_encoding_message_size,
574                            );
575                        let res = grpc.unary(method, req).await;
576                        Ok(res)
577                    };
578                    Box::pin(fut)
579                }
580                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/Decode" => {
581                    #[allow(non_camel_case_types)]
582                    struct DecodeSvc<T: BlackBoxDecoder>(pub Arc<T>);
583                    impl<
584                        T: BlackBoxDecoder,
585                    > tonic::server::UnaryService<super::DecodingProblem>
586                    for DecodeSvc<T> {
587                        type Response = super::ParityFactor;
588                        type Future = BoxFuture<
589                            tonic::Response<Self::Response>,
590                            tonic::Status,
591                        >;
592                        fn call(
593                            &mut self,
594                            request: tonic::Request<super::DecodingProblem>,
595                        ) -> Self::Future {
596                            let inner = Arc::clone(&self.0);
597                            let fut = async move {
598                                <T as BlackBoxDecoder>::decode(&inner, request).await
599                            };
600                            Box::pin(fut)
601                        }
602                    }
603                    let accept_compression_encodings = self.accept_compression_encodings;
604                    let send_compression_encodings = self.send_compression_encodings;
605                    let max_decoding_message_size = self.max_decoding_message_size;
606                    let max_encoding_message_size = self.max_encoding_message_size;
607                    let inner = self.inner.clone();
608                    let fut = async move {
609                        let method = DecodeSvc(inner);
610                        let codec = tonic_prost::ProstCodec::default();
611                        let mut grpc = tonic::server::Grpc::new(codec)
612                            .apply_compression_config(
613                                accept_compression_encodings,
614                                send_compression_encodings,
615                            )
616                            .apply_max_message_size_config(
617                                max_decoding_message_size,
618                                max_encoding_message_size,
619                            );
620                        let res = grpc.unary(method, req).await;
621                        Ok(res)
622                    };
623                    Box::pin(fut)
624                }
625                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/LoadHypergraph" => {
626                    #[allow(non_camel_case_types)]
627                    struct LoadHypergraphSvc<T: BlackBoxDecoder>(pub Arc<T>);
628                    impl<
629                        T: BlackBoxDecoder,
630                    > tonic::server::UnaryService<super::DecodingHypergraph>
631                    for LoadHypergraphSvc<T> {
632                        type Response = super::LoadHypergraphResponse;
633                        type Future = BoxFuture<
634                            tonic::Response<Self::Response>,
635                            tonic::Status,
636                        >;
637                        fn call(
638                            &mut self,
639                            request: tonic::Request<super::DecodingHypergraph>,
640                        ) -> Self::Future {
641                            let inner = Arc::clone(&self.0);
642                            let fut = async move {
643                                <T as BlackBoxDecoder>::load_hypergraph(&inner, request)
644                                    .await
645                            };
646                            Box::pin(fut)
647                        }
648                    }
649                    let accept_compression_encodings = self.accept_compression_encodings;
650                    let send_compression_encodings = self.send_compression_encodings;
651                    let max_decoding_message_size = self.max_decoding_message_size;
652                    let max_encoding_message_size = self.max_encoding_message_size;
653                    let inner = self.inner.clone();
654                    let fut = async move {
655                        let method = LoadHypergraphSvc(inner);
656                        let codec = tonic_prost::ProstCodec::default();
657                        let mut grpc = tonic::server::Grpc::new(codec)
658                            .apply_compression_config(
659                                accept_compression_encodings,
660                                send_compression_encodings,
661                            )
662                            .apply_max_message_size_config(
663                                max_decoding_message_size,
664                                max_encoding_message_size,
665                            );
666                        let res = grpc.unary(method, req).await;
667                        Ok(res)
668                    };
669                    Box::pin(fut)
670                }
671                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/DecodeLoaded" => {
672                    #[allow(non_camel_case_types)]
673                    struct DecodeLoadedSvc<T: BlackBoxDecoder>(pub Arc<T>);
674                    impl<
675                        T: BlackBoxDecoder,
676                    > tonic::server::UnaryService<super::LoadedDecodingProblem>
677                    for DecodeLoadedSvc<T> {
678                        type Response = super::ParityFactor;
679                        type Future = BoxFuture<
680                            tonic::Response<Self::Response>,
681                            tonic::Status,
682                        >;
683                        fn call(
684                            &mut self,
685                            request: tonic::Request<super::LoadedDecodingProblem>,
686                        ) -> Self::Future {
687                            let inner = Arc::clone(&self.0);
688                            let fut = async move {
689                                <T as BlackBoxDecoder>::decode_loaded(&inner, request).await
690                            };
691                            Box::pin(fut)
692                        }
693                    }
694                    let accept_compression_encodings = self.accept_compression_encodings;
695                    let send_compression_encodings = self.send_compression_encodings;
696                    let max_decoding_message_size = self.max_decoding_message_size;
697                    let max_encoding_message_size = self.max_encoding_message_size;
698                    let inner = self.inner.clone();
699                    let fut = async move {
700                        let method = DecodeLoadedSvc(inner);
701                        let codec = tonic_prost::ProstCodec::default();
702                        let mut grpc = tonic::server::Grpc::new(codec)
703                            .apply_compression_config(
704                                accept_compression_encodings,
705                                send_compression_encodings,
706                            )
707                            .apply_max_message_size_config(
708                                max_decoding_message_size,
709                                max_encoding_message_size,
710                            );
711                        let res = grpc.unary(method, req).await;
712                        Ok(res)
713                    };
714                    Box::pin(fut)
715                }
716                "/deq.decoder.blackbox_decoder.BlackBoxDecoder/Reset" => {
717                    #[allow(non_camel_case_types)]
718                    struct ResetSvc<T: BlackBoxDecoder>(pub Arc<T>);
719                    impl<
720                        T: BlackBoxDecoder,
721                    > tonic::server::UnaryService<super::ResetRequest> for ResetSvc<T> {
722                        type Response = ();
723                        type Future = BoxFuture<
724                            tonic::Response<Self::Response>,
725                            tonic::Status,
726                        >;
727                        fn call(
728                            &mut self,
729                            request: tonic::Request<super::ResetRequest>,
730                        ) -> Self::Future {
731                            let inner = Arc::clone(&self.0);
732                            let fut = async move {
733                                <T as BlackBoxDecoder>::reset(&inner, request).await
734                            };
735                            Box::pin(fut)
736                        }
737                    }
738                    let accept_compression_encodings = self.accept_compression_encodings;
739                    let send_compression_encodings = self.send_compression_encodings;
740                    let max_decoding_message_size = self.max_decoding_message_size;
741                    let max_encoding_message_size = self.max_encoding_message_size;
742                    let inner = self.inner.clone();
743                    let fut = async move {
744                        let method = ResetSvc(inner);
745                        let codec = tonic_prost::ProstCodec::default();
746                        let mut grpc = tonic::server::Grpc::new(codec)
747                            .apply_compression_config(
748                                accept_compression_encodings,
749                                send_compression_encodings,
750                            )
751                            .apply_max_message_size_config(
752                                max_decoding_message_size,
753                                max_encoding_message_size,
754                            );
755                        let res = grpc.unary(method, req).await;
756                        Ok(res)
757                    };
758                    Box::pin(fut)
759                }
760                _ => {
761                    Box::pin(async move {
762                        let mut response = http::Response::new(
763                            tonic::body::Body::default(),
764                        );
765                        let headers = response.headers_mut();
766                        headers
767                            .insert(
768                                tonic::Status::GRPC_STATUS,
769                                (tonic::Code::Unimplemented as i32).into(),
770                            );
771                        headers
772                            .insert(
773                                http::header::CONTENT_TYPE,
774                                tonic::metadata::GRPC_CONTENT_TYPE,
775                            );
776                        Ok(response)
777                    })
778                }
779            }
780        }
781    }
782    impl<T> Clone for BlackBoxDecoderServer<T> {
783        fn clone(&self) -> Self {
784            let inner = self.inner.clone();
785            Self {
786                inner,
787                accept_compression_encodings: self.accept_compression_encodings,
788                send_compression_encodings: self.send_compression_encodings,
789                max_decoding_message_size: self.max_decoding_message_size,
790                max_encoding_message_size: self.max_encoding_message_size,
791            }
792        }
793    }
794    /// Generated gRPC service name
795    pub const SERVICE_NAME: &str = "deq.decoder.blackbox_decoder.BlackBoxDecoder";
796    impl<T> tonic::server::NamedService for BlackBoxDecoderServer<T> {
797        const NAME: &'static str = SERVICE_NAME;
798    }
799}