Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions crates/lib/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub use qcs_api_client_common::configuration::LoadError;
pub use qcs_api_client_grpc::tonic::Error as GrpcError;
pub use qcs_api_client_openapi::apis::Error as OpenApiError;

const DEFAULT_MAX_MESSAGE_ENCODING_SIZE: usize = 50 * 1024 * 1024;
const DEFAULT_MAX_MESSAGE_DECODING_SIZE: usize = 50 * 1024 * 1024;
/// The maximum size of a gRPC request to the translation service, in bytes.
const MAX_TRANSLATION_OUTBOUND_REQUEST_SIZE: usize = 50 * 1024 * 1024;

/// A type alias for the underlying gRPC connection used by all gRPC clients within this library.
/// It is public so that users can create gRPC clients with different APIs using a "raw" connection
Expand Down Expand Up @@ -137,8 +137,10 @@ impl Qcs {
#[cfg(feature = "grpc-web")]
let channel = wrap_channel_with_grpc_web(service);
Ok(TranslationClient::new(channel)
.max_encoding_message_size(DEFAULT_MAX_MESSAGE_ENCODING_SIZE)
.max_decoding_message_size(DEFAULT_MAX_MESSAGE_DECODING_SIZE))
.max_encoding_message_size(MAX_TRANSLATION_OUTBOUND_REQUEST_SIZE)
// do not limit the received response size, although practically the limit is 4Gb due
// to the frame_length of the message being a u32.
.max_decoding_message_size(u32::MAX as usize))
}
}

Expand Down
9 changes: 6 additions & 3 deletions crates/lib/src/qpu/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@

use crate::client::{GrpcClientError, GrpcConnection, Qcs};

/// The maximum size of a gRPC response, in bytes.
const MAX_DECODING_MESSAGE_SIZE_BYTES: usize = 250 * 1024 * 1024;
/// The maximum size of a gRPC request to the controller service, in bytes.
const MAX_CONTROLLER_OUTBOUND_REQUEST_SIZE: usize = 250 * 1024 * 1024;

pub(crate) fn params_into_job_execution_configuration(
params: &Parameters,
Expand Down Expand Up @@ -367,7 +367,7 @@
/// to build a custom set of options.
#[derive(Builder, Clone, Debug, Default, PartialEq)]
#[allow(clippy::module_name_repetitions)]
pub struct ApiExecutionOptions {

Check warning on line 370 in crates/lib/src/qpu/api.rs

View workflow job for this annotation

GitHub Actions / publish-docs

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 370 in crates/lib/src/qpu/api.rs

View workflow job for this annotation

GitHub Actions / Run Checks

type could implement `Copy`; consider adding `impl Copy`

Check warning on line 370 in crates/lib/src/qpu/api.rs

View workflow job for this annotation

GitHub Actions / publish-docs

type could implement `Copy`; consider adding `impl Copy`
/// the inner proto representation
inner: InnerApiExecutionOptions,
}
Expand Down Expand Up @@ -539,7 +539,10 @@
.get_qpu_grpc_connection(client, quantum_processor_id)
.await?;
Ok(ControllerClient::new(service)
.max_decoding_message_size(MAX_DECODING_MESSAGE_SIZE_BYTES))
.max_encoding_message_size(MAX_CONTROLLER_OUTBOUND_REQUEST_SIZE)
// do not limit the received response size, although practically the limit is 4Gb due
// to the frame_length of the message being a u32.
.max_decoding_message_size(u32::MAX as usize))
}

/// Get a GRPC connection to a QPU, without specifying the API to use.
Expand Down
4 changes: 2 additions & 2 deletions crates/lib/tests/mocked_qpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ mod mock_qcs {
warp::reply::json(&rsp)
});

let quantum_processors = warp::path("quantumProcessors")
.and(isa.or(default_endpoint).or(accessors));
let quantum_processors =
warp::path("quantumProcessors").and(isa.or(default_endpoint).or(accessors));

warp::serve(warp::path("v1").and(quantum_processors))
.run(([127, 0, 0, 1], 8000))
Expand Down
Loading