[fixup] EventEngine Nomenclature (#32195)

pull/32206/head
AJ Heller 2 years ago committed by GitHub
parent fa5a6c42a6
commit 6a92df7237
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      BUILD
  2. 2
      include/grpc/event_engine/slice_buffer.h
  3. 2
      src/core/ext/filters/client_channel/channel_connectivity.cc
  4. 2
      src/core/lib/channel/promise_based_filter.h
  5. 8
      src/core/lib/event_engine/posix.h
  6. 2
      src/core/lib/event_engine/posix_engine/ev_poll_posix.cc
  7. 2
      src/core/lib/event_engine/posix_engine/posix_endpoint.h
  8. 2
      src/core/lib/event_engine/posix_engine/posix_engine.cc
  9. 10
      src/core/lib/event_engine/posix_engine/posix_engine.h
  10. 6
      src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h
  11. 2
      src/core/lib/event_engine/windows/windows_engine.h
  12. 4
      src/core/lib/slice/slice.h
  13. 2
      src/core/lib/slice/slice_buffer.h
  14. 2
      src/core/lib/transport/handshaker.h
  15. 6
      test/core/event_engine/event_engine_test_utils.h
  16. 2
      test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc
  17. 2
      test/core/event_engine/test_suite/posix/BUILD
  18. 2
      test/core/event_engine/test_suite/posix/oracle_event_engine_posix.h
  19. 2
      test/core/promise/sleep_test.cc
  20. 6
      test/cpp/microbenchmarks/bm_event_engine_run.cc
  21. 2
      tools/distrib/fix_build_deps.py

@ -1273,7 +1273,7 @@ grpc_cc_library(
] + ] +
# TODO(vigneshbabu): remove these # TODO(vigneshbabu): remove these
# These headers used to be vended by this target, but they have to be # These headers used to be vended by this target, but they have to be
# removed after landing event engine. # removed after landing EventEngine.
[ [
"//src/core:lib/iomgr/event_engine_shims/closure.cc", "//src/core:lib/iomgr/event_engine_shims/closure.cc",
"//src/core:lib/iomgr/event_engine_shims/endpoint.cc", "//src/core:lib/iomgr/event_engine_shims/endpoint.cc",
@ -1364,7 +1364,7 @@ grpc_cc_library(
] + ] +
# TODO(vigneshbabu): remove these # TODO(vigneshbabu): remove these
# These headers used to be vended by this target, but they have to be # These headers used to be vended by this target, but they have to be
# removed after landing event engine. # removed after landing EventEngine.
[ [
"//src/core:lib/iomgr/event_engine_shims/closure.h", "//src/core:lib/iomgr/event_engine_shims/closure.h",
"//src/core:lib/iomgr/event_engine_shims/endpoint.h", "//src/core:lib/iomgr/event_engine_shims/endpoint.h",

@ -48,7 +48,7 @@ namespace experimental {
/// ///
/// The SliceBuffer API is basically a replica of the grpc_slice_buffer's, /// The SliceBuffer API is basically a replica of the grpc_slice_buffer's,
/// and its documentation will move here once we remove the C structure, /// and its documentation will move here once we remove the C structure,
/// which should happen before the Event Engine's API is no longer /// which should happen before the EventEngine's API is no longer
/// an experimental API. /// an experimental API.
class SliceBuffer { class SliceBuffer {
public: public:

@ -236,7 +236,7 @@ class StateWatcher : public DualRefCounted<StateWatcher> {
grpc_closure on_complete_; grpc_closure on_complete_;
// timer_handle_ might be accessed in parallel from multiple threads, e.g. // timer_handle_ might be accessed in parallel from multiple threads, e.g.
// timer callback fired immediately on an event engine thread before // timer callback fired immediately on an EventEngine thread before
// RunAfter() returns. // RunAfter() returns.
absl::Mutex mu_; absl::Mutex mu_;
absl::optional<grpc_event_engine::experimental::EventEngine::TaskHandle> absl::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>

@ -119,7 +119,7 @@ class ChannelFilter {
} }
private: private:
// TODO(ctiller): remove once per-channel-stack event engines land // TODO(ctiller): remove once per-channel-stack EventEngines land
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_ = std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_ =
grpc_event_engine::experimental::GetDefaultEventEngine(); grpc_event_engine::experimental::GetDefaultEventEngine();
}; };

@ -30,7 +30,7 @@
namespace grpc_event_engine { namespace grpc_event_engine {
namespace experimental { namespace experimental {
/// This defines an interface that posix specific event engines endpoints /// This defines an interface that posix specific EventEngines endpoints
/// may implement to support additional file descriptor related functionality. /// may implement to support additional file descriptor related functionality.
class PosixEndpointWithFdSupport : public EventEngine::Endpoint { class PosixEndpointWithFdSupport : public EventEngine::Endpoint {
public: public:
@ -52,7 +52,7 @@ class PosixEndpointWithFdSupport : public EventEngine::Endpoint {
on_release_fd) = 0; on_release_fd) = 0;
}; };
/// Defines an interface that posix event engine listeners may implement to /// Defines an interface that posix EventEngine listeners may implement to
/// support additional file descriptor related functionality. /// support additional file descriptor related functionality.
class PosixListenerWithFdSupport : public EventEngine::Listener { class PosixListenerWithFdSupport : public EventEngine::Listener {
public: public:
@ -98,7 +98,7 @@ class PosixListenerWithFdSupport : public EventEngine::Listener {
virtual void ShutdownListeningFds() = 0; virtual void ShutdownListeningFds() = 0;
}; };
/// Defines an interface that posix event engines may implement to /// Defines an interface that posix EventEngines may implement to
/// support additional file descriptor related functionality. /// support additional file descriptor related functionality.
class PosixEventEngineWithFdSupport : public EventEngine { class PosixEventEngineWithFdSupport : public EventEngine {
public: public:
@ -118,7 +118,7 @@ class PosixEventEngineWithFdSupport : public EventEngine {
/// new client connection. /// new client connection.
/// \a is_external - A boolean indicating whether the new client connection /// \a is_external - A boolean indicating whether the new client connection
/// is accepted by an external listener_fd or by a listener_fd that is /// is accepted by an external listener_fd or by a listener_fd that is
/// managed by the event engine listener. /// managed by the EventEngine listener.
/// \a memory_allocator - The callback may use the provided memory /// \a memory_allocator - The callback may use the provided memory
/// allocator to handle memory allocation operations. /// allocator to handle memory allocation operations.
/// \a pending_data - If specified, it holds any pending data that may have /// \a pending_data - If specified, it holds any pending data that may have

@ -713,7 +713,7 @@ Poller::WorkResult PollPoller::Work(
// well instead of crashing. This is because the poller::Work is called // well instead of crashing. This is because the poller::Work is called
// right after an event enging is constructed. Even if phony poll is // right after an event enging is constructed. Even if phony poll is
// expected to be used, we dont want to check for it until some actual // expected to be used, we dont want to check for it until some actual
// event handles are registered. Otherwise the event engine construction // event handles are registered. Otherwise the EventEngine construction
// may crash. // may crash.
r = poll(pfds, pfd_count, timeout_ms); r = poll(pfds, pfd_count, timeout_ms);
} else { } else {

@ -703,7 +703,7 @@ class PosixEndpoint : public PosixEndpointWithFdSupport {
// Create a PosixEndpoint. // Create a PosixEndpoint.
// A shared_ptr of the EventEngine is passed to the endpoint to ensure that // A shared_ptr of the EventEngine is passed to the endpoint to ensure that
// the event engine is alive for the lifetime of the endpoint. The ownership // the EventEngine is alive for the lifetime of the endpoint. The ownership
// of the EventHandle is transferred to the endpoint. // of the EventHandle is transferred to the endpoint.
std::unique_ptr<PosixEndpoint> CreatePosixEndpoint( std::unique_ptr<PosixEndpoint> CreatePosixEndpoint(
EventHandle* handle, PosixEngineClosure* on_shutdown, EventHandle* handle, PosixEngineClosure* on_shutdown,

@ -367,7 +367,7 @@ void PosixEventEngine::PollerWorkInternal(
}); });
}); });
if (result == Poller::WorkResult::kDeadlineExceeded) { if (result == Poller::WorkResult::kDeadlineExceeded) {
// The event engine is not shutting down but the next asynchronous // The EventEngine is not shutting down but the next asynchronous
// PollerWorkInternal did not get scheduled. Schedule it now. // PollerWorkInternal did not get scheduled. Schedule it now.
executor->Run([poller_manager = std::move(poller_manager)]() { executor->Run([poller_manager = std::move(poller_manager)]() {
PollerWorkInternal(poller_manager); PollerWorkInternal(poller_manager);

@ -96,7 +96,7 @@ class AsyncConnect {
}; };
// A helper class to manager lifetime of the poller associated with the // A helper class to manager lifetime of the poller associated with the
// posix event engine. // posix EventEngine.
class PosixEnginePollerManager class PosixEnginePollerManager
: public grpc_event_engine::experimental::Scheduler { : public grpc_event_engine::experimental::Scheduler {
public: public:
@ -131,7 +131,7 @@ class PosixEnginePollerManager
// An iomgr-based Posix EventEngine implementation. // An iomgr-based Posix EventEngine implementation.
// All methods require an ExecCtx to already exist on the thread's stack. // All methods require an ExecCtx to already exist on the thread's stack.
// TODO(ctiller): KeepsGrpcInitialized is an interim measure to ensure that // TODO(ctiller): KeepsGrpcInitialized is an interim measure to ensure that
// event engine is shut down before we shut down iomgr. // EventEngine is shut down before we shut down iomgr.
class PosixEventEngine final : public PosixEventEngineWithFdSupport, class PosixEventEngine final : public PosixEventEngineWithFdSupport,
public grpc_core::KeepsGrpcInitialized { public grpc_core::KeepsGrpcInitialized {
public: public:
@ -152,7 +152,7 @@ class PosixEventEngine final : public PosixEventEngineWithFdSupport,
}; };
#ifdef GRPC_POSIX_SOCKET_TCP #ifdef GRPC_POSIX_SOCKET_TCP
// Constructs an event engine which does not own the poller. Do not call this // Constructs an EventEngine which does not own the poller. Do not call this
// constructor directly. Instead use the MakeTestOnlyPosixEventEngine static // constructor directly. Instead use the MakeTestOnlyPosixEventEngine static
// method. Its expected to be used only in tests. // method. Its expected to be used only in tests.
explicit PosixEventEngine( explicit PosixEventEngine(
@ -201,10 +201,10 @@ class PosixEventEngine final : public PosixEventEngineWithFdSupport,
bool Cancel(TaskHandle handle) override; bool Cancel(TaskHandle handle) override;
#ifdef GRPC_POSIX_SOCKET_TCP #ifdef GRPC_POSIX_SOCKET_TCP
// The posix event engine returned by this method would not own the poller // The posix EventEngine returned by this method would not own the poller
// and would not be in-charge of driving the poller by calling its Work(..) // and would not be in-charge of driving the poller by calling its Work(..)
// method. Instead its upto the test to drive the poller. The returned posix // method. Instead its upto the test to drive the poller. The returned posix
// event engine will also not attempt to shutdown the poller since it does not // EventEngine will also not attempt to shutdown the poller since it does not
// own it. // own it.
static std::shared_ptr<PosixEventEngine> MakeTestOnlyPosixEventEngine( static std::shared_ptr<PosixEventEngine> MakeTestOnlyPosixEventEngine(
grpc_event_engine::experimental::PosixEventPoller* test_only_poller) { grpc_event_engine::experimental::PosixEventPoller* test_only_poller) {

@ -25,10 +25,10 @@
namespace grpc_event_engine { namespace grpc_event_engine {
namespace experimental { namespace experimental {
// This interface exists to allow different Event Engines to implement different // This interface exists to allow different EventEngines to implement different
// custom interception operations while a socket is Appended. The // custom interception operations while a socket is Appended. The
// listener util functions are defined over this interface and thus can be // listener util functions are defined over this interface and thus can be
// shared across multiple event engines. // shared across multiple EventEngines.
class ListenerSocketsContainer { class ListenerSocketsContainer {
public: public:
struct ListenerSocket { struct ListenerSocket {
@ -55,7 +55,7 @@ class ListenerSocketsContainer {
virtual ~ListenerSocketsContainer() = default; virtual ~ListenerSocketsContainer() = default;
}; };
// Creates and configures a socket to be used by the Event Engine Listener. The // Creates and configures a socket to be used by the EventEngine Listener. The
// type of the socket to create is determined by the by the passed address. The // type of the socket to create is determined by the by the passed address. The
// socket configuration is specified by passed tcp options. If successful, it // socket configuration is specified by passed tcp options. If successful, it
// returns a ListenerSocketsContainer::ListenerSocket type which holds the // returns a ListenerSocketsContainer::ListenerSocket type which holds the

@ -41,7 +41,7 @@ namespace grpc_event_engine {
namespace experimental { namespace experimental {
// TODO(ctiller): KeepsGrpcInitialized is an interim measure to ensure that // TODO(ctiller): KeepsGrpcInitialized is an interim measure to ensure that
// event engine is shut down before we shut down iomgr. // EventEngine is shut down before we shut down iomgr.
class WindowsEventEngine : public EventEngine, class WindowsEventEngine : public EventEngine,
public grpc_core::KeepsGrpcInitialized { public grpc_core::KeepsGrpcInitialized {
public: public:

@ -47,9 +47,9 @@
// MutableSlice - provides a guarantee of unique ownership, meaning the // MutableSlice - provides a guarantee of unique ownership, meaning the
// underlying data can be mutated safely. // underlying data can be mutated safely.
// This slice implementation is an extension of the event engine Slice // This slice implementation is an extension of the EventEngine Slice
// implementation defined in <grpc/event_engine/slice.h>. Changes to this // implementation defined in <grpc/event_engine/slice.h>. Changes to this
// implementation might warrant changes to the public event engine Slice // implementation might warrant changes to the public EventEngine Slice
// type as well. // type as well.
namespace grpc_core { namespace grpc_core {

@ -40,7 +40,7 @@ namespace grpc_core {
/// ///
/// The SliceBuffer API is basically a replica of the grpc_slice_buffer's, /// The SliceBuffer API is basically a replica of the grpc_slice_buffer's,
/// and its documentation will move here once we remove the C structure, /// and its documentation will move here once we remove the C structure,
/// which should happen before the Event Engine's API is no longer /// which should happen before the EventEngine's API is no longer
/// an experimental API. /// an experimental API.
class SliceBuffer { class SliceBuffer {
public: public:

@ -75,7 +75,7 @@ struct HandshakerArgs {
// individual handshakers. // individual handshakers.
void* user_data = nullptr; void* user_data = nullptr;
// Deadline associated with the handshake. // Deadline associated with the handshake.
// TODO(anramach): Move this out of handshake args after event engine // TODO(anramach): Move this out of handshake args after EventEngine
// is the default. // is the default.
Timestamp deadline; Timestamp deadline;
}; };

@ -45,7 +45,7 @@ std::string ExtractSliceBufferIntoString(SliceBuffer* buf);
// Returns a random message with bounded length. // Returns a random message with bounded length.
std::string GetNextSendMessage(); std::string GetNextSendMessage();
// Waits until the use_count of the event engine shared_ptr has reached 1 // Waits until the use_count of the EventEngine shared_ptr has reached 1
// and returns. // and returns.
void WaitForSingleOwner(std::shared_ptr<EventEngine>&& engine); void WaitForSingleOwner(std::shared_ptr<EventEngine>&& engine);
@ -59,8 +59,8 @@ absl::Status SendValidatePayload(absl::string_view data,
EventEngine::Endpoint* receive_endpoint); EventEngine::Endpoint* receive_endpoint);
// A helper class to create clients/listeners and connections between them. // A helper class to create clients/listeners and connections between them.
// The clients and listeners can be created by the oracle event engine // The clients and listeners can be created by the oracle EventEngine
// or the event engine under test. The class provides handles into the // or the EventEngine under test. The class provides handles into the
// connections that are created. Inidividual tests can test expected behavior by // connections that are created. Inidividual tests can test expected behavior by
// exchanging arbitrary data over these connections. // exchanging arbitrary data over these connections.
class ConnectionManager { class ConnectionManager {

@ -53,7 +53,7 @@ FuzzingEventEngine::FuzzingEventEngine(
// epoch to allow for some fancy atomic stuff. // epoch to allow for some fancy atomic stuff.
now_ = Time() + std::chrono::seconds(5); now_ = Time() + std::chrono::seconds(5);
// Whilst a fuzzing event engine is active we override grpc's now function. // Whilst a fuzzing EventEngine is active we override grpc's now function.
grpc_core::TestOnlySetProcessEpoch(NowAsTimespec(GPR_CLOCK_MONOTONIC)); grpc_core::TestOnlySetProcessEpoch(NowAsTimespec(GPR_CLOCK_MONOTONIC));
auto update_delay = [](std::map<intptr_t, Duration>* map, auto update_delay = [](std::map<intptr_t, Duration>* map,

@ -45,7 +45,7 @@ grpc_cc_test(
"no_test_ios", "no_test_ios",
"no_windows", "no_windows",
], ],
# TODO(vignesbabu): This is required because the oracle event engine uses # TODO(vignesbabu): This is required because the oracle EventEngine uses
# poll syscall. If uses_polling is set to False, there will be an attempt # poll syscall. If uses_polling is set to False, there will be an attempt
# to run this test with GRPC_POLL_STRATEGY=none which will hijack the poll # to run this test with GRPC_POLL_STRATEGY=none which will hijack the poll
# c-wrapper causing the test to fail. A more generic posix oracle event # c-wrapper causing the test to fail. A more generic posix oracle event

@ -144,7 +144,7 @@ class PosixOracleListener : public EventEngine::Listener {
std::vector<int> listener_fds_; std::vector<int> listener_fds_;
}; };
// A posix based oracle event engine. // A posix based oracle EventEngine.
class PosixOracleEventEngine final : public EventEngine { class PosixOracleEventEngine final : public EventEngine {
public: public:
PosixOracleEventEngine() = default; PosixOracleEventEngine() = default;

@ -87,7 +87,7 @@ TEST(Sleep, OverlyEagerEventEngine) {
EXPECT_NE(wakeup, nullptr); EXPECT_NE(wakeup, nullptr);
EXPECT_FALSE(done); EXPECT_FALSE(done);
// Schedule the wakeup instantaneously - It won't have passed the scheduled // Schedule the wakeup instantaneously - It won't have passed the scheduled
// time yet, but sleep should believe the event engine. // time yet, but sleep should believe the EventEngine.
wakeup->Run(); wakeup->Run();
EXPECT_TRUE(done); EXPECT_TRUE(done);
} }

@ -101,9 +101,9 @@ void BM_EventEngine_RunClosure(benchmark::State& state) {
grpc_core::Notification* signal = new grpc_core::Notification(); grpc_core::Notification* signal = new grpc_core::Notification();
std::atomic_int count{0}; std::atomic_int count{0};
// Ignore leaks from this closure. For simplicty, this closure is not deleted // Ignore leaks from this closure. For simplicty, this closure is not deleted
// because the closure may still be executing after the event engine is // because the closure may still be executing after the EventEngine is
// destroyed. This is because the default posix event engine's thread pool may // destroyed. This is because the default posix EventEngine's thread pool may
// get destroyed separately from the event engine. // get destroyed separately from the EventEngine.
AnyInvocableClosure* closure = absl::IgnoreLeak( AnyInvocableClosure* closure = absl::IgnoreLeak(
new AnyInvocableClosure([signal_holder = &signal, cb_count, &count]() { new AnyInvocableClosure([signal_holder = &signal, cb_count, &count]() {
if (++count == cb_count) { if (++count == cb_count) {

@ -541,7 +541,7 @@ def make_library(library):
hdrs = sorted(consumes[library]) hdrs = sorted(consumes[library])
# we need a little trickery here since grpc_base has channel.cc, which calls grpc_init # we need a little trickery here since grpc_base has channel.cc, which calls grpc_init
# which is in grpc, which is illegal but hard to change # which is in grpc, which is illegal but hard to change
# once event engine lands we can clean this up # once EventEngine lands we can clean this up
deps = Choices(library, {'//:grpc_base': ['//:grpc', '//:grpc_unsecure']} deps = Choices(library, {'//:grpc_base': ['//:grpc', '//:grpc_unsecure']}
if library.startswith('//test/') else {}) if library.startswith('//test/') else {})
external_deps = Choices(None, {}) external_deps = Choices(None, {})

Loading…
Cancel
Save