#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Testing {
#[prost(string, tag = "1")]
pub suite: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub testcases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, optional, tag = "3")]
pub variant: ::core::option::Option<::prost::alloc::string::String>,
#[prost(uint64, optional, tag = "4")]
pub repeat_count: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TestStage {
#[prost(oneof = "test_stage::Item", tags = "1, 2")]
pub item: ::core::option::Option<test_stage::Item>,
}
pub mod test_stage {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Listing {
#[prost(string, tag = "1")]
pub suite: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub cacheable: bool,
}
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Item {
#[prost(message, tag = "1")]
Listing(Listing),
#[prost(message, tag = "2")]
Testing(super::Testing),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutionStream {
#[prost(oneof = "execution_stream::Item", tags = "1")]
pub item: ::core::option::Option<execution_stream::Item>,
}
pub mod execution_stream {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Item {
#[prost(bytes, tag = "1")]
Inline(::prost::alloc::vec::Vec<u8>),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ExecutionStatus {
#[prost(oneof = "execution_status::Status", tags = "1, 2")]
pub status: ::core::option::Option<execution_status::Status>,
}
pub mod execution_status {
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Status {
#[prost(int32, tag = "1")]
Finished(i32),
#[prost(message, tag = "2")]
TimedOut(::prost_types::Duration),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ConfiguredTargetHandle {
#[prost(int64, tag = "1")]
pub id: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfiguredTarget {
#[prost(message, optional, tag = "1")]
pub handle: ::core::option::Option<ConfiguredTargetHandle>,
#[prost(string, tag = "3")]
pub cell: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub package: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub target: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub configuration: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub package_project_relative_path: ::prost::alloc::string::String,
#[prost(bool, tag = "8")]
pub test_config_unification_rollout: bool,
#[prost(string, optional, tag = "9")]
pub package_oncall: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TestResult {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration = "TestStatus", tag = "2")]
pub status: i32,
#[prost(message, optional, tag = "5")]
pub msg: ::core::option::Option<test_result::OptionalMsg>,
#[prost(message, optional, tag = "6")]
pub target: ::core::option::Option<ConfiguredTargetHandle>,
#[prost(message, optional, tag = "7")]
pub duration: ::core::option::Option<::prost_types::Duration>,
#[prost(string, tag = "8")]
pub details: ::prost::alloc::string::String,
#[prost(uint64, optional, tag = "9")]
pub max_memory_used_bytes: ::core::option::Option<u64>,
}
pub mod test_result {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OptionalMsg {
#[prost(string, tag = "1")]
pub msg: ::prost::alloc::string::String,
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReportTestResultRequest {
#[prost(message, optional, tag = "1")]
pub result: ::core::option::Option<TestResult>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReportTestsDiscoveredRequest {
#[prost(message, optional, tag = "1")]
pub target: ::core::option::Option<ConfiguredTargetHandle>,
#[prost(message, optional, tag = "3")]
pub testing: ::core::option::Option<Testing>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReportTestSessionRequest {
#[prost(string, tag = "3")]
pub session_info: ::prost::alloc::string::String,
#[prost(string, optional, tag = "4")]
pub test_session_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EndOfTestResultsRequest {
#[prost(int32, tag = "1")]
pub exit_code: i32,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Empty {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExternalRunnerSpecRequest {
#[prost(message, optional, tag = "1")]
pub test_spec: ::core::option::Option<ExternalRunnerSpec>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExternalRunnerSpec {
#[prost(message, optional, tag = "1")]
pub target: ::core::option::Option<ConfiguredTarget>,
#[prost(string, tag = "2")]
pub test_type: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub command: ::prost::alloc::vec::Vec<ExternalRunnerSpecValue>,
#[prost(map = "string, message", tag = "4")]
pub env: ::std::collections::HashMap<
::prost::alloc::string::String,
ExternalRunnerSpecValue,
>,
#[prost(string, repeated, tag = "5")]
pub labels: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "6")]
pub contacts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, optional, tag = "7")]
pub oncall: ::core::option::Option<::prost::alloc::string::String>,
#[prost(string, tag = "8")]
pub working_dir_cell: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExternalRunnerSpecValue {
#[prost(oneof = "external_runner_spec_value::Value", tags = "1, 2, 3")]
pub value: ::core::option::Option<external_runner_spec_value::Value>,
}
pub mod external_runner_spec_value {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(string, tag = "1")]
Verbatim(::prost::alloc::string::String),
#[prost(int64, tag = "2")]
ArgHandle(i64),
#[prost(string, tag = "3")]
EnvHandle(::prost::alloc::string::String),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TestExecutable {
#[prost(message, optional, tag = "1")]
pub stage: ::core::option::Option<TestStage>,
#[prost(message, optional, tag = "2")]
pub target: ::core::option::Option<ConfiguredTargetHandle>,
#[prost(message, repeated, tag = "3")]
pub cmd: ::prost::alloc::vec::Vec<ArgValue>,
#[prost(message, repeated, tag = "5")]
pub pre_create_dirs: ::prost::alloc::vec::Vec<DeclaredOutput>,
#[prost(message, repeated, tag = "6")]
pub env: ::prost::alloc::vec::Vec<EnvironmentVariable>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutorConfigOverride {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocalResourceType {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecuteRequest2 {
#[prost(message, optional, tag = "5")]
pub timeout: ::core::option::Option<::prost_types::Duration>,
#[prost(message, optional, tag = "6")]
pub host_sharing_requirements: ::core::option::Option<
super::host_sharing::HostSharingRequirements,
>,
#[prost(message, optional, tag = "8")]
pub test_executable: ::core::option::Option<TestExecutable>,
#[prost(message, optional, tag = "9")]
pub executor_override: ::core::option::Option<ExecutorConfigOverride>,
#[prost(message, repeated, tag = "10")]
pub required_local_resources: ::prost::alloc::vec::Vec<LocalResourceType>,
#[prost(bool, tag = "11")]
pub disable_test_execution_caching: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrepareForLocalExecutionRequest {
#[prost(message, optional, tag = "1")]
pub test_executable: ::core::option::Option<TestExecutable>,
#[prost(message, repeated, tag = "2")]
pub required_local_resources: ::prost::alloc::vec::Vec<LocalResourceType>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArgValue {
#[prost(message, optional, tag = "1")]
pub content: ::core::option::Option<ArgValueContent>,
#[prost(message, optional, tag = "2")]
pub format: ::core::option::Option<ArgFormat>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnvironmentVariable {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub value: ::core::option::Option<ArgValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArgFormat {
#[prost(string, tag = "1")]
pub format: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArgValueContent {
#[prost(oneof = "arg_value_content::Value", tags = "1, 2")]
pub value: ::core::option::Option<arg_value_content::Value>,
}
pub mod arg_value_content {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(message, tag = "1")]
SpecValue(super::ExternalRunnerSpecValue),
#[prost(message, tag = "2")]
DeclaredOutput(super::OutputName),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OutputName {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TtlConfig {
#[prost(int64, tag = "1")]
pub ttl_seconds: i64,
#[prost(string, tag = "2")]
pub use_case: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeclaredOutput {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub supports_remote: bool,
#[prost(message, optional, tag = "3")]
pub ttl_config: ::core::option::Option<TtlConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CasDigest {
#[prost(string, tag = "1")]
pub hash: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub size_bytes: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoteFileNode {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoteDirNode {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub children: ::prost::alloc::vec::Vec<RemoteObject>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoteObject {
#[prost(message, optional, tag = "1")]
pub digest: ::core::option::Option<CasDigest>,
#[prost(oneof = "remote_object::Node", tags = "2, 3")]
pub node: ::core::option::Option<remote_object::Node>,
}
pub mod remote_object {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Node {
#[prost(message, tag = "2")]
File(super::RemoteFileNode),
#[prost(message, tag = "3")]
Dir(super::RemoteDirNode),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Output {
#[prost(oneof = "output::Value", tags = "1, 2")]
pub value: ::core::option::Option<output::Value>,
}
pub mod output {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(string, tag = "1")]
LocalPath(::prost::alloc::string::String),
#[prost(message, tag = "2")]
RemoteObject(super::RemoteObject),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OutputEntry {
#[prost(message, optional, tag = "1")]
pub declared_output: ::core::option::Option<OutputName>,
#[prost(message, optional, tag = "2")]
pub output: ::core::option::Option<Output>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutionResult2 {
#[prost(message, optional, tag = "1")]
pub status: ::core::option::Option<ExecutionStatus>,
#[prost(message, optional, tag = "2")]
pub stdout: ::core::option::Option<ExecutionStream>,
#[prost(message, optional, tag = "3")]
pub stderr: ::core::option::Option<ExecutionStream>,
#[prost(message, repeated, tag = "4")]
pub outputs: ::prost::alloc::vec::Vec<OutputEntry>,
#[prost(message, optional, tag = "5")]
pub start_time: ::core::option::Option<::prost_types::Duration>,
#[prost(message, optional, tag = "6")]
pub execution_time: ::core::option::Option<::prost_types::Duration>,
#[prost(message, optional, tag = "7")]
pub execution_details: ::core::option::Option<ExecutionDetails>,
#[prost(uint64, optional, tag = "8")]
pub max_memory_used_bytes: ::core::option::Option<u64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutionDetails {
#[prost(message, optional, tag = "1")]
pub execution_kind: ::core::option::Option<super::data::CommandExecutionKind>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Cancelled {
#[prost(enumeration = "CancellationReason", optional, tag = "1")]
pub reason: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecuteResponse2 {
#[prost(oneof = "execute_response2::Response", tags = "1, 2")]
pub response: ::core::option::Option<execute_response2::Response>,
}
pub mod execute_response2 {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
Result(super::ExecutionResult2),
#[prost(message, tag = "2")]
Cancelled(super::Cancelled),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrepareForLocalExecutionResult {
#[prost(string, repeated, tag = "1")]
pub cmd: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "3")]
pub cwd: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub env: ::prost::alloc::vec::Vec<VerbatimEnvironmentVariable>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetupLocalResourceLocalExecutionCommand {
#[prost(string, repeated, tag = "1")]
pub cmd: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "2")]
pub cwd: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub env: ::prost::alloc::vec::Vec<VerbatimEnvironmentVariable>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VerbatimEnvironmentVariable {
#[prost(string, tag = "1")]
pub key: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub value: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrepareForLocalExecutionResponse {
#[prost(message, optional, tag = "1")]
pub result: ::core::option::Option<PrepareForLocalExecutionResult>,
#[prost(message, repeated, tag = "2")]
pub setup_local_resource_commands: ::prost::alloc::vec::Vec<
SetupLocalResourceLocalExecutionCommand,
>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttachInfoMessageRequest {
#[prost(string, tag = "1")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadFileToCasRequest {
#[prost(string, tag = "1")]
pub local_path: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub ttl_config: ::core::option::Option<TtlConfig>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UploadFileToCasResponse {
#[prost(message, optional, tag = "1")]
pub digest: ::core::option::Option<CasDigest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnstableHeapDumpRequest {
#[prost(string, tag = "1")]
pub destination_path: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UnstableHeapDumpResponse {}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TestStatus {
NotSet = 0,
Pass = 1,
Fail = 2,
Skip = 3,
Omitted = 4,
Fatal = 5,
Timeout = 6,
Unknown = 7,
Rerun = 8,
ListingSuccess = 9,
ListingFailed = 10,
InfraFailure = 11,
}
impl TestStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NotSet => "NOT_SET",
Self::Pass => "PASS",
Self::Fail => "FAIL",
Self::Skip => "SKIP",
Self::Omitted => "OMITTED",
Self::Fatal => "FATAL",
Self::Timeout => "TIMEOUT",
Self::Unknown => "UNKNOWN",
Self::Rerun => "RERUN",
Self::ListingSuccess => "LISTING_SUCCESS",
Self::ListingFailed => "LISTING_FAILED",
Self::InfraFailure => "INFRA_FAILURE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NOT_SET" => Some(Self::NotSet),
"PASS" => Some(Self::Pass),
"FAIL" => Some(Self::Fail),
"SKIP" => Some(Self::Skip),
"OMITTED" => Some(Self::Omitted),
"FATAL" => Some(Self::Fatal),
"TIMEOUT" => Some(Self::Timeout),
"UNKNOWN" => Some(Self::Unknown),
"RERUN" => Some(Self::Rerun),
"LISTING_SUCCESS" => Some(Self::ListingSuccess),
"LISTING_FAILED" => Some(Self::ListingFailed),
"INFRA_FAILURE" => Some(Self::InfraFailure),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CancellationReason {
NotSpecified = 0,
ReQueueTimeout = 1,
}
impl CancellationReason {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NotSpecified => "NOT_SPECIFIED",
Self::ReQueueTimeout => "RE_QUEUE_TIMEOUT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NOT_SPECIFIED" => Some(Self::NotSpecified),
"RE_QUEUE_TIMEOUT" => Some(Self::ReQueueTimeout),
_ => None,
}
}
}
pub mod test_orchestrator_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TestOrchestratorClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TestOrchestratorClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TestOrchestratorClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TestOrchestratorClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TestOrchestratorClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn end_of_test_results(
&mut self,
request: impl tonic::IntoRequest<super::EndOfTestResultsRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/EndOfTestResults",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("buck.test.TestOrchestrator", "EndOfTestResults"),
);
self.inner.unary(req, path, codec).await
}
pub async fn report_test_result(
&mut self,
request: impl tonic::IntoRequest<super::ReportTestResultRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/ReportTestResult",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("buck.test.TestOrchestrator", "ReportTestResult"),
);
self.inner.unary(req, path, codec).await
}
pub async fn report_tests_discovered(
&mut self,
request: impl tonic::IntoRequest<super::ReportTestsDiscoveredRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/ReportTestsDiscovered",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"buck.test.TestOrchestrator",
"ReportTestsDiscovered",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn report_test_session(
&mut self,
request: impl tonic::IntoRequest<super::ReportTestSessionRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/ReportTestSession",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("buck.test.TestOrchestrator", "ReportTestSession"),
);
self.inner.unary(req, path, codec).await
}
pub async fn execute2(
&mut self,
request: impl tonic::IntoRequest<super::ExecuteRequest2>,
) -> std::result::Result<
tonic::Response<super::ExecuteResponse2>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/Execute2",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("buck.test.TestOrchestrator", "Execute2"));
self.inner.unary(req, path, codec).await
}
pub async fn prepare_for_local_execution(
&mut self,
request: impl tonic::IntoRequest<super::PrepareForLocalExecutionRequest>,
) -> std::result::Result<
tonic::Response<super::PrepareForLocalExecutionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/PrepareForLocalExecution",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"buck.test.TestOrchestrator",
"PrepareForLocalExecution",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn attach_info_message(
&mut self,
request: impl tonic::IntoRequest<super::AttachInfoMessageRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/AttachInfoMessage",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("buck.test.TestOrchestrator", "AttachInfoMessage"),
);
self.inner.unary(req, path, codec).await
}
pub async fn upload_file_to_cas(
&mut self,
request: impl tonic::IntoRequest<super::UploadFileToCasRequest>,
) -> std::result::Result<
tonic::Response<super::UploadFileToCasResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestOrchestrator/UploadFileToCas",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("buck.test.TestOrchestrator", "UploadFileToCas"),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod test_executor_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TestExecutorClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TestExecutorClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TestExecutorClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TestExecutorClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
TestExecutorClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn external_runner_spec(
&mut self,
request: impl tonic::IntoRequest<super::ExternalRunnerSpecRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestExecutor/ExternalRunnerSpec",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("buck.test.TestExecutor", "ExternalRunnerSpec"));
self.inner.unary(req, path, codec).await
}
pub async fn end_of_test_requests(
&mut self,
request: impl tonic::IntoRequest<super::Empty>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestExecutor/EndOfTestRequests",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("buck.test.TestExecutor", "EndOfTestRequests"));
self.inner.unary(req, path, codec).await
}
pub async fn unstable_heap_dump(
&mut self,
request: impl tonic::IntoRequest<super::UnstableHeapDumpRequest>,
) -> std::result::Result<
tonic::Response<super::UnstableHeapDumpResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/buck.test.TestExecutor/Unstable_HeapDump",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("buck.test.TestExecutor", "Unstable_HeapDump"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod test_orchestrator_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait TestOrchestrator: std::marker::Send + std::marker::Sync + 'static {
async fn end_of_test_results(
&self,
request: tonic::Request<super::EndOfTestResultsRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn report_test_result(
&self,
request: tonic::Request<super::ReportTestResultRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn report_tests_discovered(
&self,
request: tonic::Request<super::ReportTestsDiscoveredRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn report_test_session(
&self,
request: tonic::Request<super::ReportTestSessionRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn execute2(
&self,
request: tonic::Request<super::ExecuteRequest2>,
) -> std::result::Result<
tonic::Response<super::ExecuteResponse2>,
tonic::Status,
>;
async fn prepare_for_local_execution(
&self,
request: tonic::Request<super::PrepareForLocalExecutionRequest>,
) -> std::result::Result<
tonic::Response<super::PrepareForLocalExecutionResponse>,
tonic::Status,
>;
async fn attach_info_message(
&self,
request: tonic::Request<super::AttachInfoMessageRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn upload_file_to_cas(
&self,
request: tonic::Request<super::UploadFileToCasRequest>,
) -> std::result::Result<
tonic::Response<super::UploadFileToCasResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct TestOrchestratorServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> TestOrchestratorServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TestOrchestratorServer<T>
where
T: TestOrchestrator,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/buck.test.TestOrchestrator/EndOfTestResults" => {
#[allow(non_camel_case_types)]
struct EndOfTestResultsSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::EndOfTestResultsRequest>
for EndOfTestResultsSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::EndOfTestResultsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::end_of_test_results(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EndOfTestResultsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/ReportTestResult" => {
#[allow(non_camel_case_types)]
struct ReportTestResultSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::ReportTestResultRequest>
for ReportTestResultSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReportTestResultRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::report_test_result(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReportTestResultSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/ReportTestsDiscovered" => {
#[allow(non_camel_case_types)]
struct ReportTestsDiscoveredSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::ReportTestsDiscoveredRequest>
for ReportTestsDiscoveredSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReportTestsDiscoveredRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::report_tests_discovered(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReportTestsDiscoveredSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/ReportTestSession" => {
#[allow(non_camel_case_types)]
struct ReportTestSessionSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::ReportTestSessionRequest>
for ReportTestSessionSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ReportTestSessionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::report_test_session(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ReportTestSessionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/Execute2" => {
#[allow(non_camel_case_types)]
struct Execute2Svc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::ExecuteRequest2>
for Execute2Svc<T> {
type Response = super::ExecuteResponse2;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ExecuteRequest2>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::execute2(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = Execute2Svc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/PrepareForLocalExecution" => {
#[allow(non_camel_case_types)]
struct PrepareForLocalExecutionSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::PrepareForLocalExecutionRequest>
for PrepareForLocalExecutionSvc<T> {
type Response = super::PrepareForLocalExecutionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::PrepareForLocalExecutionRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::prepare_for_local_execution(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PrepareForLocalExecutionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/AttachInfoMessage" => {
#[allow(non_camel_case_types)]
struct AttachInfoMessageSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::AttachInfoMessageRequest>
for AttachInfoMessageSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AttachInfoMessageRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::attach_info_message(
&inner,
request,
)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AttachInfoMessageSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestOrchestrator/UploadFileToCas" => {
#[allow(non_camel_case_types)]
struct UploadFileToCasSvc<T: TestOrchestrator>(pub Arc<T>);
impl<
T: TestOrchestrator,
> tonic::server::UnaryService<super::UploadFileToCasRequest>
for UploadFileToCasSvc<T> {
type Response = super::UploadFileToCasResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UploadFileToCasRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestOrchestrator>::upload_file_to_cas(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = UploadFileToCasSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for TestOrchestratorServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "buck.test.TestOrchestrator";
impl<T> tonic::server::NamedService for TestOrchestratorServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod test_executor_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait TestExecutor: std::marker::Send + std::marker::Sync + 'static {
async fn external_runner_spec(
&self,
request: tonic::Request<super::ExternalRunnerSpecRequest>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn end_of_test_requests(
&self,
request: tonic::Request<super::Empty>,
) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
async fn unstable_heap_dump(
&self,
request: tonic::Request<super::UnstableHeapDumpRequest>,
) -> std::result::Result<
tonic::Response<super::UnstableHeapDumpResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct TestExecutorServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> TestExecutorServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for TestExecutorServer<T>
where
T: TestExecutor,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/buck.test.TestExecutor/ExternalRunnerSpec" => {
#[allow(non_camel_case_types)]
struct ExternalRunnerSpecSvc<T: TestExecutor>(pub Arc<T>);
impl<
T: TestExecutor,
> tonic::server::UnaryService<super::ExternalRunnerSpecRequest>
for ExternalRunnerSpecSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ExternalRunnerSpecRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestExecutor>::external_runner_spec(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ExternalRunnerSpecSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestExecutor/EndOfTestRequests" => {
#[allow(non_camel_case_types)]
struct EndOfTestRequestsSvc<T: TestExecutor>(pub Arc<T>);
impl<T: TestExecutor> tonic::server::UnaryService<super::Empty>
for EndOfTestRequestsSvc<T> {
type Response = super::Empty;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::Empty>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestExecutor>::end_of_test_requests(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = EndOfTestRequestsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/buck.test.TestExecutor/Unstable_HeapDump" => {
#[allow(non_camel_case_types)]
struct Unstable_HeapDumpSvc<T: TestExecutor>(pub Arc<T>);
impl<
T: TestExecutor,
> tonic::server::UnaryService<super::UnstableHeapDumpRequest>
for Unstable_HeapDumpSvc<T> {
type Response = super::UnstableHeapDumpResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::UnstableHeapDumpRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TestExecutor>::unstable_heap_dump(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = Unstable_HeapDumpSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(empty_body());
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for TestExecutorServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "buck.test.TestExecutor";
impl<T> tonic::server::NamedService for TestExecutorServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}