1#[derive(Clone, PartialEq, ::qcs_dependencies_client::prost::Message)]
19#[prost(prost_path = "::qcs_dependencies_client::prost")]
20pub struct TranslationOptions {
21 #[prost(message, optional, tag = "1")]
24 pub q_ctrl: ::core::option::Option<translation_options::QCtrl>,
25 #[prost(message, optional, tag = "2")]
26 pub riverlane: ::core::option::Option<translation_options::Riverlane>,
27 #[prost(oneof = "translation_options::TranslationBackend", tags = "101, 102")]
31 pub translation_backend: ::core::option::Option<
32 translation_options::TranslationBackend,
33 >,
34}
35pub mod translation_options {
37 #[derive(
38 Clone,
39 Copy,
40 PartialEq,
41 Eq,
42 Hash,
43 ::qcs_dependencies_client::prost::Message
44 )]
45 #[prost(prost_path = "::qcs_dependencies_client::prost")]
46 pub struct QCtrl {
47 #[prost(bool, optional, tag = "1")]
58 pub fixed_layout: ::core::option::Option<bool>,
59 }
60 #[derive(Clone, PartialEq, ::qcs_dependencies_client::prost::Message)]
61 #[prost(prost_path = "::qcs_dependencies_client::prost")]
62 pub struct Riverlane {
63 #[prost(map = "string, bytes", tag = "2")]
65 pub qeci_configuration_data: ::std::collections::HashMap<
66 ::qcs_dependencies_client::prost::alloc::string::String,
67 ::qcs_dependencies_client::prost::alloc::vec::Vec<u8>,
68 >,
69 #[prost(uint64, tag = "3")]
72 pub qeci_max_nanoseconds_until_read_available: u64,
73 }
74 #[derive(Clone, Copy, PartialEq, ::qcs_dependencies_client::prost::Oneof)]
78 #[prost(prost_path = "::qcs_dependencies_client::prost")]
79 pub enum TranslationBackend {
80 #[prost(message, tag = "101")]
81 V1(super::BackendV1Options),
82 #[prost(message, tag = "102")]
83 V2(super::BackendV2Options),
84 }
85}
86#[derive(Clone, Copy, PartialEq, Eq, Hash, ::qcs_dependencies_client::prost::Message)]
88#[prost(prost_path = "::qcs_dependencies_client::prost")]
89pub struct BackendV1Options {}
90#[derive(Clone, Copy, PartialEq, ::qcs_dependencies_client::prost::Message)]
92#[prost(prost_path = "::qcs_dependencies_client::prost")]
93pub struct BackendV2Options {
94 #[prost(bool, optional, tag = "1")]
98 pub prepend_default_calibrations: ::core::option::Option<bool>,
99 #[prost(double, optional, tag = "2")]
101 pub passive_reset_delay_seconds: ::core::option::Option<f64>,
102 #[prost(bool, optional, tag = "4")]
104 pub allow_unchecked_pointer_arithmetic: ::core::option::Option<bool>,
105 #[prost(bool, optional, tag = "5")]
107 pub allow_frame_redefinition: ::core::option::Option<bool>,
108 #[prost(bool, optional, tag = "6")]
111 pub store_all_readout_values: ::core::option::Option<bool>,
112}
113#[derive(Clone, PartialEq, ::qcs_dependencies_client::prost::Message)]
114#[prost(prost_path = "::qcs_dependencies_client::prost")]
115pub struct TranslateQuilToEncryptedControllerJobRequest {
116 #[prost(string, tag = "1")]
117 pub quantum_processor_id: ::qcs_dependencies_client::prost::alloc::string::String,
118 #[prost(string, tag = "2")]
119 pub quil_program: ::qcs_dependencies_client::prost::alloc::string::String,
120 #[prost(message, optional, tag = "4")]
122 pub options: ::core::option::Option<TranslationOptions>,
123 #[prost(
124 oneof = "translate_quil_to_encrypted_controller_job_request::NumShots",
125 tags = "3"
126 )]
127 pub num_shots: ::core::option::Option<
128 translate_quil_to_encrypted_controller_job_request::NumShots,
129 >,
130}
131pub mod translate_quil_to_encrypted_controller_job_request {
133 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::qcs_dependencies_client::prost::Oneof)]
134 #[prost(prost_path = "::qcs_dependencies_client::prost")]
135 pub enum NumShots {
136 #[prost(uint32, tag = "3")]
137 NumShotsValue(u32),
138 }
139}
140#[derive(Clone, PartialEq, ::qcs_dependencies_client::prost::Message)]
141#[prost(prost_path = "::qcs_dependencies_client::prost")]
142pub struct TranslateQuilToEncryptedControllerJobResponse {
143 #[prost(message, optional, tag = "1")]
144 pub job: ::core::option::Option<
145 super::super::models::controller::EncryptedControllerJob,
146 >,
147 #[prost(message, optional, tag = "2")]
148 pub metadata: ::core::option::Option<
149 super::super::models::translation::QuilTranslationMetadata,
150 >,
151}
152#[derive(Clone, PartialEq, Eq, Hash, ::qcs_dependencies_client::prost::Message)]
153#[prost(prost_path = "::qcs_dependencies_client::prost")]
154pub struct QuantumProcessorQuilCalibrationProgram {
155 #[prost(string, tag = "1")]
157 pub quil_calibration_program: ::qcs_dependencies_client::prost::alloc::string::String,
158}
159#[derive(Clone, PartialEq, Eq, Hash, ::qcs_dependencies_client::prost::Message)]
160#[prost(prost_path = "::qcs_dependencies_client::prost")]
161pub struct GetQuantumProcessorQuilCalibrationProgramRequest {
162 #[prost(string, tag = "1")]
164 pub quantum_processor_id: ::qcs_dependencies_client::prost::alloc::string::String,
165}
166pub mod translation_client {
168 #![allow(
169 unused_variables,
170 dead_code,
171 missing_docs,
172 clippy::wildcard_imports,
173 clippy::let_unit_value,
174 )]
175 use qcs_dependencies_client::tonic;
176 use qcs_dependencies_client::tonic_prost;
177 use qcs_dependencies_client::tonic::codegen::*;
178 use qcs_dependencies_client::tonic::codegen::http::Uri;
179 #[derive(Debug, Clone)]
180 pub struct TranslationClient<T> {
181 inner: tonic::client::Grpc<T>,
182 }
183 impl TranslationClient<tonic::transport::Channel> {
184 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
186 where
187 D: TryInto<tonic::transport::Endpoint>,
188 D::Error: Into<StdError>,
189 {
190 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
191 Ok(Self::new(conn))
192 }
193 }
194 impl<T> TranslationClient<T>
195 where
196 T: tonic::client::GrpcService<tonic::body::Body>,
197 T::Error: Into<StdError>,
198 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
199 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
200 {
201 pub fn new(inner: T) -> Self {
202 let inner = tonic::client::Grpc::new(inner);
203 Self { inner }
204 }
205 pub fn with_origin(inner: T, origin: Uri) -> Self {
206 let inner = tonic::client::Grpc::with_origin(inner, origin);
207 Self { inner }
208 }
209 pub fn with_interceptor<F>(
210 inner: T,
211 interceptor: F,
212 ) -> TranslationClient<InterceptedService<T, F>>
213 where
214 F: tonic::service::Interceptor,
215 T::ResponseBody: Default,
216 T: tonic::codegen::Service<
217 http::Request<tonic::body::Body>,
218 Response = http::Response<
219 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
220 >,
221 >,
222 <T as tonic::codegen::Service<
223 http::Request<tonic::body::Body>,
224 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
225 {
226 TranslationClient::new(InterceptedService::new(inner, interceptor))
227 }
228 #[must_use]
233 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
234 self.inner = self.inner.send_compressed(encoding);
235 self
236 }
237 #[must_use]
239 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
240 self.inner = self.inner.accept_compressed(encoding);
241 self
242 }
243 #[must_use]
247 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
248 self.inner = self.inner.max_decoding_message_size(limit);
249 self
250 }
251 #[must_use]
255 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
256 self.inner = self.inner.max_encoding_message_size(limit);
257 self
258 }
259 pub async fn translate_quil_to_encrypted_controller_job(
260 &mut self,
261 request: impl tonic::IntoRequest<
262 super::TranslateQuilToEncryptedControllerJobRequest,
263 >,
264 ) -> std::result::Result<
265 tonic::Response<super::TranslateQuilToEncryptedControllerJobResponse>,
266 tonic::Status,
267 > {
268 self.inner
269 .ready()
270 .await
271 .map_err(|e| {
272 tonic::Status::unknown(
273 format!("Service was not ready: {}", e.into()),
274 )
275 })?;
276 let codec = tonic_prost::ProstCodec::default();
277 let path = http::uri::PathAndQuery::from_static(
278 "/services.translation.Translation/TranslateQuilToEncryptedControllerJob",
279 );
280 let mut req = request.into_request();
281 req.extensions_mut()
282 .insert(
283 GrpcMethod::new(
284 "services.translation.Translation",
285 "TranslateQuilToEncryptedControllerJob",
286 ),
287 );
288 self.inner.unary(req, path, codec).await
289 }
290 pub async fn get_quantum_processor_quil_calibration_program(
292 &mut self,
293 request: impl tonic::IntoRequest<
294 super::GetQuantumProcessorQuilCalibrationProgramRequest,
295 >,
296 ) -> std::result::Result<
297 tonic::Response<super::QuantumProcessorQuilCalibrationProgram>,
298 tonic::Status,
299 > {
300 self.inner
301 .ready()
302 .await
303 .map_err(|e| {
304 tonic::Status::unknown(
305 format!("Service was not ready: {}", e.into()),
306 )
307 })?;
308 let codec = tonic_prost::ProstCodec::default();
309 let path = http::uri::PathAndQuery::from_static(
310 "/services.translation.Translation/GetQuantumProcessorQuilCalibrationProgram",
311 );
312 let mut req = request.into_request();
313 req.extensions_mut()
314 .insert(
315 GrpcMethod::new(
316 "services.translation.Translation",
317 "GetQuantumProcessorQuilCalibrationProgram",
318 ),
319 );
320 self.inner.unary(req, path, codec).await
321 }
322 }
323}
324#[cfg(feature = "server")]
326pub mod translation_server {
327 #![allow(
328 unused_variables,
329 dead_code,
330 missing_docs,
331 clippy::wildcard_imports,
332 clippy::let_unit_value,
333 )]
334 use qcs_dependencies_client::tonic;
335 use qcs_dependencies_client::tonic_prost;
336 use qcs_dependencies_client::tonic::codegen::*;
337 #[async_trait]
339 pub trait Translation: std::marker::Send + std::marker::Sync + 'static {
340 async fn translate_quil_to_encrypted_controller_job(
341 &self,
342 request: tonic::Request<super::TranslateQuilToEncryptedControllerJobRequest>,
343 ) -> std::result::Result<
344 tonic::Response<super::TranslateQuilToEncryptedControllerJobResponse>,
345 tonic::Status,
346 >;
347 async fn get_quantum_processor_quil_calibration_program(
349 &self,
350 request: tonic::Request<
351 super::GetQuantumProcessorQuilCalibrationProgramRequest,
352 >,
353 ) -> std::result::Result<
354 tonic::Response<super::QuantumProcessorQuilCalibrationProgram>,
355 tonic::Status,
356 >;
357 }
358 #[derive(Debug)]
359 pub struct TranslationServer<T> {
360 inner: Arc<T>,
361 accept_compression_encodings: EnabledCompressionEncodings,
362 send_compression_encodings: EnabledCompressionEncodings,
363 max_decoding_message_size: Option<usize>,
364 max_encoding_message_size: Option<usize>,
365 }
366 impl<T> TranslationServer<T> {
367 pub fn new(inner: T) -> Self {
368 Self::from_arc(Arc::new(inner))
369 }
370 pub fn from_arc(inner: Arc<T>) -> Self {
371 Self {
372 inner,
373 accept_compression_encodings: Default::default(),
374 send_compression_encodings: Default::default(),
375 max_decoding_message_size: None,
376 max_encoding_message_size: None,
377 }
378 }
379 pub fn with_interceptor<F>(
380 inner: T,
381 interceptor: F,
382 ) -> InterceptedService<Self, F>
383 where
384 F: tonic::service::Interceptor,
385 {
386 InterceptedService::new(Self::new(inner), interceptor)
387 }
388 #[must_use]
390 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
391 self.accept_compression_encodings.enable(encoding);
392 self
393 }
394 #[must_use]
396 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
397 self.send_compression_encodings.enable(encoding);
398 self
399 }
400 #[must_use]
404 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
405 self.max_decoding_message_size = Some(limit);
406 self
407 }
408 #[must_use]
412 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
413 self.max_encoding_message_size = Some(limit);
414 self
415 }
416 }
417 impl<T, B> tonic::codegen::Service<http::Request<B>> for TranslationServer<T>
418 where
419 T: Translation,
420 B: Body + std::marker::Send + 'static,
421 B::Error: Into<StdError> + std::marker::Send + 'static,
422 {
423 type Response = http::Response<tonic::body::Body>;
424 type Error = std::convert::Infallible;
425 type Future = BoxFuture<Self::Response, Self::Error>;
426 fn poll_ready(
427 &mut self,
428 _cx: &mut Context<'_>,
429 ) -> Poll<std::result::Result<(), Self::Error>> {
430 Poll::Ready(Ok(()))
431 }
432 fn call(&mut self, req: http::Request<B>) -> Self::Future {
433 match req.uri().path() {
434 "/services.translation.Translation/TranslateQuilToEncryptedControllerJob" => {
435 #[allow(non_camel_case_types)]
436 struct TranslateQuilToEncryptedControllerJobSvc<T: Translation>(
437 pub Arc<T>,
438 );
439 impl<
440 T: Translation,
441 > tonic::server::UnaryService<
442 super::TranslateQuilToEncryptedControllerJobRequest,
443 > for TranslateQuilToEncryptedControllerJobSvc<T> {
444 type Response = super::TranslateQuilToEncryptedControllerJobResponse;
445 type Future = BoxFuture<
446 tonic::Response<Self::Response>,
447 tonic::Status,
448 >;
449 fn call(
450 &mut self,
451 request: tonic::Request<
452 super::TranslateQuilToEncryptedControllerJobRequest,
453 >,
454 ) -> Self::Future {
455 let inner = Arc::clone(&self.0);
456 let fut = async move {
457 <T as Translation>::translate_quil_to_encrypted_controller_job(
458 &inner,
459 request,
460 )
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 = TranslateQuilToEncryptedControllerJobSvc(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 "/services.translation.Translation/GetQuantumProcessorQuilCalibrationProgram" => {
489 #[allow(non_camel_case_types)]
490 struct GetQuantumProcessorQuilCalibrationProgramSvc<T: Translation>(
491 pub Arc<T>,
492 );
493 impl<
494 T: Translation,
495 > tonic::server::UnaryService<
496 super::GetQuantumProcessorQuilCalibrationProgramRequest,
497 > for GetQuantumProcessorQuilCalibrationProgramSvc<T> {
498 type Response = super::QuantumProcessorQuilCalibrationProgram;
499 type Future = BoxFuture<
500 tonic::Response<Self::Response>,
501 tonic::Status,
502 >;
503 fn call(
504 &mut self,
505 request: tonic::Request<
506 super::GetQuantumProcessorQuilCalibrationProgramRequest,
507 >,
508 ) -> Self::Future {
509 let inner = Arc::clone(&self.0);
510 let fut = async move {
511 <T as Translation>::get_quantum_processor_quil_calibration_program(
512 &inner,
513 request,
514 )
515 .await
516 };
517 Box::pin(fut)
518 }
519 }
520 let accept_compression_encodings = self.accept_compression_encodings;
521 let send_compression_encodings = self.send_compression_encodings;
522 let max_decoding_message_size = self.max_decoding_message_size;
523 let max_encoding_message_size = self.max_encoding_message_size;
524 let inner = self.inner.clone();
525 let fut = async move {
526 let method = GetQuantumProcessorQuilCalibrationProgramSvc(inner);
527 let codec = tonic_prost::ProstCodec::default();
528 let mut grpc = tonic::server::Grpc::new(codec)
529 .apply_compression_config(
530 accept_compression_encodings,
531 send_compression_encodings,
532 )
533 .apply_max_message_size_config(
534 max_decoding_message_size,
535 max_encoding_message_size,
536 );
537 let res = grpc.unary(method, req).await;
538 Ok(res)
539 };
540 Box::pin(fut)
541 }
542 _ => {
543 Box::pin(async move {
544 let mut response = http::Response::new(
545 tonic::body::Body::default(),
546 );
547 let headers = response.headers_mut();
548 headers
549 .insert(
550 tonic::Status::GRPC_STATUS,
551 (tonic::Code::Unimplemented as i32).into(),
552 );
553 headers
554 .insert(
555 http::header::CONTENT_TYPE,
556 tonic::metadata::GRPC_CONTENT_TYPE,
557 );
558 Ok(response)
559 })
560 }
561 }
562 }
563 }
564 impl<T> Clone for TranslationServer<T> {
565 fn clone(&self) -> Self {
566 let inner = self.inner.clone();
567 Self {
568 inner,
569 accept_compression_encodings: self.accept_compression_encodings,
570 send_compression_encodings: self.send_compression_encodings,
571 max_decoding_message_size: self.max_decoding_message_size,
572 max_encoding_message_size: self.max_encoding_message_size,
573 }
574 }
575 }
576 pub const SERVICE_NAME: &str = "services.translation.Translation";
578 impl<T> tonic::server::NamedService for TranslationServer<T> {
579 const NAME: &'static str = SERVICE_NAME;
580 }
581}
582