Go to the documentation of this file.
21 #include "absl/strings/str_cat.h"
22 #include "absl/strings/str_format.h"
23 #include "absl/strings/str_split.h"
24 #include "absl/synchronization/blocking_counter.h"
30 #include "src/proto/grpc/testing/istio_echo.pb.h"
32 using proto::EchoRequest;
33 using proto::EchoResponse;
34 using proto::EchoTestService;
35 using proto::ForwardEchoRequest;
36 using proto::ForwardEchoResponse;
68 EchoTestServiceImpl::EchoTestServiceImpl(
std::string hostname,
81 StringRefToStringView(
context->ExperimentalGetAuthority()),
83 const std::multimap<string_ref, string_ref>
metadata =
87 if (kv.first.ends_with(
"-bin")) {
90 absl::StrAppend(&s, kRequestHeader,
"=", StringRefToStringView(kv.first),
91 ":", StringRefToStringView(kv.second),
"\n");
115 const ForwardEchoRequest*
request,
118 size_t colon = raw_url.find_first_of(
':');
120 if (colon == std::string::npos) {
125 scheme = raw_url.substr(0, colon);
126 std::shared_ptr<Channel>
channel;
127 if (scheme ==
"xds") {
134 }
else if (scheme ==
"grpc") {
146 return forwarding_stub_->ForwardEcho(&forwarding_ctx, *
request,
response);
151 std::chrono::duration<double> duration_per_query =
152 std::chrono::nanoseconds::zero();
158 EchoRequest echo_request;
159 echo_request.set_message(
request->message());
165 if (
header.key() != kHostField) {
171 std::chrono::microseconds(
request->timeout_micros());
172 calls[
i].context.set_deadline(deadline);
178 std::this_thread::sleep_for(duration_per_query);
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, AllowEmpty, absl::string_view > StrSplit(strings_internal::ConvertibleToStringView text, Delimiter d)
std::chrono::duration< std::int_fast64_t > seconds
static fling_call calls[100001]
void StrAppend(std::string *dest, const AlphaNum &a)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
std::chrono::time_point< std::chrono::system_clock, D > time_point
void set_deadline(const T &deadline)
bool SplitHostPort(absl::string_view name, absl::string_view *host, absl::string_view *port)
ABSL_MUST_USE_RESULT absl::string_view StripPrefix(absl::string_view str, absl::string_view prefix)
wrapped_grpc_channel * channel
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
def c_str(s, encoding='ascii')
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
struct absl::base_internal::@2940::AllocList::Header header
proto::EchoResponse response
std::unique_ptr< proto::EchoTestService::Stub > forwarding_stub_
static const Status & OK
An OK pre-defined instance.
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
std::chrono::system_clock::time_point deadline() const
Return the deadline for the client call.
absl::string_view string_view
GRPC_CUSTOM_UTIL_STATUS Status
std::shared_ptr< ChannelCredentials > XdsCredentials(const std::shared_ptr< ChannelCredentials > &fallback_creds)
Builds XDS Credentials.
grpc::ClientContext context
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
std::string forwarding_address_
static bool to_string(zval *from)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:08