// The Execute API used to be unary, and became streaming. The contract of the streaming API is
// that if the client closes the stream after one request, it should continue to function exactly
// like the unary API.
// For maximal compatibility with servers, we fall back to this unary-like behavior, and control
// our own polling rates.
// In the future, we may want to remove this behavior if servers reliably support the full stream
// behavior.
The Execute API used to be unary, and became streaming. The contract of the streaming API is
that if the client closes the stream after one request, it should continue to function exactly
like the unary API.
For maximal compatibility with servers, we fall back to this unary-like behavior, and control
our own polling rates.
In the future, we may want to remove this behavior if servers reliably support the full stream
behavior.
The Execute API used to be unary and became streaming . The contract of the streaming API is that if the client closes the stream after one request it should continue to function exactly like the unary API . For maximal compatibility with servers we fall back to this unary - like behavior and control our own polling rates . In the future we may want to remove this behavior if servers reliably support the full stream behavior .
fn oneshot_execute(
    &self,
    execute_request: &Arc<bazel_protos::remote_execution::ExecuteRequest>,
  ) -> BoxFuture<OperationOrStatus, String> {
    let stream = try_future!(self
      .execution_client
      .execute_opt(&execute_request, self.call_option())
      .map_err(rpcerror_to_string));
    stream
      .take(1)
      .into_future()
      // If there was a response, drop the _stream to disconnect so that the server doesn't keep
      // the connection alive and continue sending on it.
      .map(|(maybe_operation, stream)| {
        drop(stream);
        maybe_operation
      })
      // If there was an error, drop the _stream to disconnect so that the server doesn't keep the
      // connection alive and continue sending on it.
      .map_err(|(error, stream)| {
        drop(stream);
        error
      })
      .then(move |maybe_operation_result| match maybe_operation_result {
        Ok(Some(operation)) => Ok(OperationOrStatus::Operation(operation)),
        Ok(None) => {
          Err("Didn't get proper stream response from server during remote execution".to_owned())
        }
        Err(err) => rpcerror_to_status_or_string(err).map(OperationOrStatus::Status),
      })
      .to_boxed()
  }
fn oneshot_execute ( & self , execute_request : & Arc < bazel_protos :: remote_execution :: ExecuteRequest > , ) -> BoxFuture < OperationOrStatus , String > { let stream = try_future ! ( self execution_client execute_opt ( execute_request self call_option ( ) ) map_err ( rpcerror_to_string ) ) ; stream . take ( 1 ) . into_future ( ) // If there was a response, drop the _stream to disconnect so that the server doesn't keep // the connection alive and continue sending on it. . map ( | ( maybe_operation , stream ) | { drop ( stream ) ; maybe_operation } ) // If there was an error, drop the _stream to disconnect so that the server doesn't keep the // connection alive and continue sending on it. . map_err ( | ( error , stream ) | { drop ( stream ) ; error } ) . then ( move | maybe_operation_result | match maybe_operation_result { Ok ( Some ( operation ) ) => Ok ( OperationOrStatus :: Operation ( operation ) ) , Ok ( None ) => { Err ( " " . to_owned ( ) ) } Err ( err ) => rpcerror_to_status_or_string ( err ) . map ( OperationOrStatus :: Status ) , } ) . to_boxed ( ) }
The Execute API used to be unary, and became streaming.
The Execute API used to be unary and became streaming .
&self
execute_request
&Arc<bazel_protos::remote_execution::ExecuteRequest>