Fix C++ 23 unique_ptr issue

pull/37096/head
Esun Kim 7 months ago
parent fb37e2a882
commit 20199cad7e
  1. 24
      src/core/load_balancing/health_check_client.cc
  2. 48
      src/core/server/server.cc
  3. 21
      src/core/telemetry/metrics.h

@ -144,18 +144,6 @@ void HealthProducer::HealthChecker::OnConnectivityStateChangeLocked(
}
}
void HealthProducer::HealthChecker::StartHealthStreamLocked() {
if (GRPC_TRACE_FLAG_ENABLED(health_check_client)) {
LOG(INFO) << "HealthProducer " << producer_.get() << " HealthChecker "
<< this << ": creating HealthClient for \""
<< health_check_service_name_ << "\"";
}
stream_client_ = MakeOrphanable<SubchannelStreamClient>(
producer_->connected_subchannel_, producer_->subchannel_->pollset_set(),
std::make_unique<HealthStreamEventHandler>(Ref()),
GRPC_TRACE_FLAG_ENABLED(health_check_client) ? "HealthClient" : nullptr);
}
void HealthProducer::HealthChecker::NotifyWatchersLocked(
grpc_connectivity_state state, absl::Status status) {
if (GRPC_TRACE_FLAG_ENABLED(health_check_client)) {
@ -311,6 +299,18 @@ class HealthProducer::HealthChecker::HealthStreamEventHandler final
RefCountedPtr<HealthChecker> health_checker_;
};
void HealthProducer::HealthChecker::StartHealthStreamLocked() {
if (GRPC_TRACE_FLAG_ENABLED(health_check_client)) {
LOG(INFO) << "HealthProducer " << producer_.get() << " HealthChecker "
<< this << ": creating HealthClient for \""
<< health_check_service_name_ << "\"";
}
stream_client_ = MakeOrphanable<SubchannelStreamClient>(
producer_->connected_subchannel_, producer_->subchannel_->pollset_set(),
std::make_unique<HealthStreamEventHandler>(Ref()),
GRPC_TRACE_FLAG_ENABLED(health_check_client) ? "HealthClient" : nullptr);
}
//
// HealthProducer::ConnectivityWatcher
//

@ -87,30 +87,6 @@
namespace grpc_core {
//
// Server::RegisteredMethod
//
struct Server::RegisteredMethod {
RegisteredMethod(
const char* method_arg, const char* host_arg,
grpc_server_register_method_payload_handling payload_handling_arg,
uint32_t flags_arg)
: method(method_arg == nullptr ? "" : method_arg),
host(host_arg == nullptr ? "" : host_arg),
payload_handling(payload_handling_arg),
flags(flags_arg) {}
~RegisteredMethod() = default;
const std::string method;
const std::string host;
const grpc_server_register_method_payload_handling payload_handling;
const uint32_t flags;
// One request matcher per method.
std::unique_ptr<RequestMatcherInterface> matcher;
};
//
// Server::RequestMatcherInterface
//
@ -202,6 +178,30 @@ class Server::RequestMatcherInterface {
virtual Server* server() const = 0;
};
//
// Server::RegisteredMethod
//
struct Server::RegisteredMethod {
RegisteredMethod(
const char* method_arg, const char* host_arg,
grpc_server_register_method_payload_handling payload_handling_arg,
uint32_t flags_arg)
: method(method_arg == nullptr ? "" : method_arg),
host(host_arg == nullptr ? "" : host_arg),
payload_handling(payload_handling_arg),
flags(flags_arg) {}
~RegisteredMethod() = default;
const std::string method;
const std::string host;
const grpc_server_register_method_payload_handling payload_handling;
const uint32_t flags;
// One request matcher per method.
std::unique_ptr<RequestMatcherInterface> matcher;
};
//
// Server::RequestedCall
//

@ -461,14 +461,7 @@ class GlobalStatsPluginRegistry {
template <typename... Args>
GRPC_MUST_USE_RESULT std::unique_ptr<RegisteredMetricCallback>
RegisterCallback(absl::AnyInvocable<void(CallbackMetricReporter&)> callback,
Duration min_interval, Args... args) {
AssertIsCallbackGaugeHandle(args...);
return std::make_unique<RegisteredMetricCallback>(
*this, std::move(callback),
std::vector<GlobalInstrumentsRegistry::GlobalInstrumentHandle>{
args...},
min_interval);
}
Duration min_interval, Args... args);
// Adds all available client call tracers associated with the stats plugins
// within the group to \a call_context.
@ -557,6 +550,18 @@ class RegisteredMetricCallback {
Duration min_interval_;
};
template <typename... Args>
inline std::unique_ptr<RegisteredMetricCallback>
GlobalStatsPluginRegistry::StatsPluginGroup::RegisterCallback(
absl::AnyInvocable<void(CallbackMetricReporter&)> callback,
Duration min_interval, Args... args) {
AssertIsCallbackGaugeHandle(args...);
return std::make_unique<RegisteredMetricCallback>(
*this, std::move(callback),
std::vector<GlobalInstrumentsRegistry::GlobalInstrumentHandle>{args...},
min_interval);
}
} // namespace grpc_core
#endif // GRPC_SRC_CORE_TELEMETRY_METRICS_H

Loading…
Cancel
Save