Update xds client interface to take an externally supplied event engine (#31773)

* Update xds client interface to take an externally supplied ev ent engine

* update per review comments

* fix sanity
pull/31779/head
Vignesh Babu 2 years ago committed by GitHub
parent f5d21653fc
commit dcad15d43b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/core/ext/xds/xds_client.cc
  2. 8
      src/core/ext/xds/xds_client.h
  3. 2
      src/core/ext/xds/xds_client_grpc.cc
  4. 6
      test/core/xds/xds_client_fuzzer.cc
  5. 2
      test/core/xds/xds_client_test.cc
  6. 3
      test/core/xds/xds_cluster_resource_type_test.cc
  7. 3
      test/core/xds/xds_common_types_test.cc
  8. 3
      test/core/xds/xds_endpoint_resource_type_test.cc
  9. 3
      test/core/xds/xds_listener_resource_type_test.cc
  10. 3
      test/core/xds/xds_route_config_resource_type_test.cc

@ -39,7 +39,6 @@
#include "src/core/ext/xds/xds_bootstrap.h"
#include "src/core/ext/xds/xds_client_stats.h"
#include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -1460,9 +1459,11 @@ bool XdsClient::ChannelState::LrsCallState::IsCurrentCallOnChannel() const {
// XdsClient
//
XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
OrphanablePtr<XdsTransportFactory> transport_factory,
Duration resource_request_timeout)
XdsClient::XdsClient(
std::unique_ptr<XdsBootstrap> bootstrap,
OrphanablePtr<XdsTransportFactory> transport_factory,
std::shared_ptr<grpc_event_engine::experimental::EventEngine> engine,
Duration resource_request_timeout)
: DualRefCounted<XdsClient>(
GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace) ? "XdsClient"
: nullptr),
@ -1471,7 +1472,7 @@ XdsClient::XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
request_timeout_(resource_request_timeout),
xds_federation_enabled_(XdsFederationEnabled()),
api_(this, &grpc_xds_client_trace, bootstrap_->node(), &symtab_),
engine_(grpc_event_engine::experimental::GetDefaultEventEngine()) {
engine_(std::move(engine)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this);
}

@ -71,9 +71,11 @@ class XdsClient : public DualRefCounted<XdsClient> {
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&work_serializer_) = 0;
};
XdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
OrphanablePtr<XdsTransportFactory> transport_factory,
Duration resource_request_timeout = Duration::Seconds(15));
XdsClient(
std::unique_ptr<XdsBootstrap> bootstrap,
OrphanablePtr<XdsTransportFactory> transport_factory,
std::shared_ptr<grpc_event_engine::experimental::EventEngine> engine,
Duration resource_request_timeout = Duration::Seconds(15));
~XdsClient() override;
const XdsBootstrap& bootstrap() const {

@ -41,6 +41,7 @@
#include "src/core/ext/xds/xds_transport_grpc.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/orphanable.h"
@ -155,6 +156,7 @@ GrpcXdsClient::GrpcXdsClient(std::unique_ptr<GrpcXdsBootstrap> bootstrap,
const ChannelArgs& args)
: XdsClient(
std::move(bootstrap), MakeOrphanable<GrpcXdsTransportFactory>(args),
grpc_event_engine::experimental::GetDefaultEventEngine(),
std::max(Duration::Zero(),
args.GetDurationFromIntMillis(
GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS)

@ -22,6 +22,7 @@
#include "src/core/ext/xds/xds_endpoint.h"
#include "src/core/ext/xds/xds_listener.h"
#include "src/core/ext/xds/xds_route_config.h"
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/libfuzzer/libfuzzer_macro.h"
#include "test/core/xds/xds_client_fuzzer.pb.h"
@ -42,8 +43,9 @@ class Fuzzer {
auto transport_factory = MakeOrphanable<FakeXdsTransportFactory>();
transport_factory->SetAutoCompleteMessagesFromClient(false);
transport_factory_ = transport_factory.get();
xds_client_ = MakeRefCounted<XdsClient>(std::move(*bootstrap),
std::move(transport_factory));
xds_client_ = MakeRefCounted<XdsClient>(
std::move(*bootstrap), std::move(transport_factory),
grpc_event_engine::experimental::GetDefaultEventEngine());
}
void Act(const xds_client_fuzzer::Action& action) {

@ -45,6 +45,7 @@
#include "src/core/ext/xds/xds_bootstrap.h"
#include "src/core/ext/xds/xds_resource_type_impl.h"
#include "src/core/lib/event_engine/default_event_engine.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/sync.h"
@ -568,6 +569,7 @@ class XdsClientTest : public ::testing::Test {
transport_factory_ = transport_factory->Ref();
xds_client_ = MakeRefCounted<XdsClient>(
bootstrap_builder.Build(), std::move(transport_factory),
grpc_event_engine::experimental::GetDefaultEventEngine(),
resource_request_timeout * grpc_test_slowdown_factor());
}

@ -110,7 +110,8 @@ class XdsClusterTest : public ::testing::Test {
GPR_ASSERT(false);
}
return MakeRefCounted<XdsClient>(std::move(*bootstrap),
/*transport_factory=*/nullptr);
/*transport_factory=*/nullptr,
/*event_engine=*/nullptr);
}
RefCountedPtr<XdsClient> xds_client_;

@ -102,7 +102,8 @@ class XdsCommonTypesTest : public ::testing::Test {
GPR_ASSERT(false);
}
return MakeRefCounted<XdsClient>(std::move(*bootstrap),
/*transport_factory=*/nullptr);
/*transport_factory=*/nullptr,
/*event_engine=*/nullptr);
}
RefCountedPtr<XdsClient> xds_client_;

@ -88,7 +88,8 @@ class XdsEndpointTest : public ::testing::Test {
GPR_ASSERT(false);
}
return MakeRefCounted<XdsClient>(std::move(*bootstrap),
/*transport_factory=*/nullptr);
/*transport_factory=*/nullptr,
/*event_engine=*/nullptr);
}
RefCountedPtr<XdsClient> xds_client_;

@ -115,7 +115,8 @@ class XdsListenerTest : public ::testing::Test {
GPR_ASSERT(false);
}
return MakeRefCounted<XdsClient>(std::move(*bootstrap),
/*transport_factory=*/nullptr);
/*transport_factory=*/nullptr,
/*event_engine=*/nullptr);
}
RefCountedPtr<XdsClient> xds_client_;

@ -103,7 +103,8 @@ class XdsRouteConfigTest : public ::testing::Test {
GPR_ASSERT(false);
}
return MakeRefCounted<XdsClient>(std::move(*bootstrap),
/*transport_factory=*/nullptr);
/*transport_factory=*/nullptr,
/*event_engine=*/nullptr);
}
RefCountedPtr<XdsClient> xds_client_;

Loading…
Cancel
Save