Creating an event_engine_common library that contains code which all event engine implementations can depend on (#28765)

* creating an event_engine_common library that contains code which all event engine implementations can depend on

* adding event_engine_common dependency

* regenerate projects

* Automated change: Fix sanity tests

* renaming file

* regenerate projects

Co-authored-by: Vignesh2208 <Vignesh2208@users.noreply.github.com>
pull/28776/head
Vignesh Babu 3 years ago committed by GitHub
parent 2057bfd182
commit eb8af70ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      BUILD
  2. 2
      CMakeLists.txt
  3. 2
      Makefile
  4. 2
      build_autogenerated.yaml
  5. 1
      config.m4
  6. 1
      config.w32
  7. 1
      gRPC-Core.podspec
  8. 1
      grpc.gemspec
  9. 2
      grpc.gyp
  10. 1
      package.xml
  11. 13
      src/core/lib/event_engine/event_engine.cc
  12. 39
      src/core/lib/event_engine/resolved_address.cc
  13. 1
      src/python/grpcio/grpc_core_dependencies.py
  14. 1
      tools/doxygen/Doxyfile.c++.internal
  15. 1
      tools/doxygen/Doxyfile.core.internal

12
BUILD

@ -1746,6 +1746,17 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "event_engine_common",
srcs = [
"src/core/lib/event_engine/resolved_address.cc",
],
deps = [
"event_engine_base_hdrs",
"gpr_base",
],
)
grpc_cc_library(
name = "event_engine_base",
srcs = [
@ -2108,6 +2119,7 @@ grpc_cc_library(
"dual_ref_counted",
"error",
"event_engine_base",
"event_engine_common",
"exec_ctx",
"gpr_base",
"gpr_codegen",

2
CMakeLists.txt generated

@ -1974,6 +1974,7 @@ add_library(grpc
src/core/lib/event_engine/default_event_engine_factory.cc
src/core/lib/event_engine/event_engine.cc
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/event_engine/resolved_address.cc
src/core/lib/event_engine/sockaddr.cc
src/core/lib/http/format_request.cc
src/core/lib/http/httpcli.cc
@ -2625,6 +2626,7 @@ add_library(grpc_unsecure
src/core/lib/event_engine/default_event_engine_factory.cc
src/core/lib/event_engine/event_engine.cc
src/core/lib/event_engine/memory_allocator.cc
src/core/lib/event_engine/resolved_address.cc
src/core/lib/event_engine/sockaddr.cc
src/core/lib/http/format_request.cc
src/core/lib/http/httpcli.cc

2
Makefile generated

@ -1450,6 +1450,7 @@ LIBGRPC_SRC = \
src/core/lib/event_engine/default_event_engine_factory.cc \
src/core/lib/event_engine/event_engine.cc \
src/core/lib/event_engine/memory_allocator.cc \
src/core/lib/event_engine/resolved_address.cc \
src/core/lib/event_engine/sockaddr.cc \
src/core/lib/http/format_request.cc \
src/core/lib/http/httpcli.cc \
@ -1948,6 +1949,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/event_engine/default_event_engine_factory.cc \
src/core/lib/event_engine/event_engine.cc \
src/core/lib/event_engine/memory_allocator.cc \
src/core/lib/event_engine/resolved_address.cc \
src/core/lib/event_engine/sockaddr.cc \
src/core/lib/http/format_request.cc \
src/core/lib/http/httpcli.cc \

@ -1485,6 +1485,7 @@ libs:
- src/core/lib/event_engine/default_event_engine_factory.cc
- src/core/lib/event_engine/event_engine.cc
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/event_engine/resolved_address.cc
- src/core/lib/event_engine/sockaddr.cc
- src/core/lib/http/format_request.cc
- src/core/lib/http/httpcli.cc
@ -2306,6 +2307,7 @@ libs:
- src/core/lib/event_engine/default_event_engine_factory.cc
- src/core/lib/event_engine/event_engine.cc
- src/core/lib/event_engine/memory_allocator.cc
- src/core/lib/event_engine/resolved_address.cc
- src/core/lib/event_engine/sockaddr.cc
- src/core/lib/http/format_request.cc
- src/core/lib/http/httpcli.cc

1
config.m4 generated

@ -468,6 +468,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/event_engine/default_event_engine_factory.cc \
src/core/lib/event_engine/event_engine.cc \
src/core/lib/event_engine/memory_allocator.cc \
src/core/lib/event_engine/resolved_address.cc \
src/core/lib/event_engine/sockaddr.cc \
src/core/lib/gpr/alloc.cc \
src/core/lib/gpr/atm.cc \

1
config.w32 generated

@ -434,6 +434,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\event_engine\\default_event_engine_factory.cc " +
"src\\core\\lib\\event_engine\\event_engine.cc " +
"src\\core\\lib\\event_engine\\memory_allocator.cc " +
"src\\core\\lib\\event_engine\\resolved_address.cc " +
"src\\core\\lib\\event_engine\\sockaddr.cc " +
"src\\core\\lib\\gpr\\alloc.cc " +
"src\\core\\lib\\gpr\\atm.cc " +

1
gRPC-Core.podspec generated

@ -1026,6 +1026,7 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/event_engine.cc',
'src/core/lib/event_engine/event_engine_factory.h',
'src/core/lib/event_engine/memory_allocator.cc',
'src/core/lib/event_engine/resolved_address.cc',
'src/core/lib/event_engine/sockaddr.cc',
'src/core/lib/event_engine/sockaddr.h',
'src/core/lib/gpr/alloc.cc',

1
grpc.gemspec generated

@ -945,6 +945,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/event_engine/event_engine.cc )
s.files += %w( src/core/lib/event_engine/event_engine_factory.h )
s.files += %w( src/core/lib/event_engine/memory_allocator.cc )
s.files += %w( src/core/lib/event_engine/resolved_address.cc )
s.files += %w( src/core/lib/event_engine/sockaddr.cc )
s.files += %w( src/core/lib/event_engine/sockaddr.h )
s.files += %w( src/core/lib/gpr/alloc.cc )

2
grpc.gyp generated

@ -900,6 +900,7 @@
'src/core/lib/event_engine/default_event_engine_factory.cc',
'src/core/lib/event_engine/event_engine.cc',
'src/core/lib/event_engine/memory_allocator.cc',
'src/core/lib/event_engine/resolved_address.cc',
'src/core/lib/event_engine/sockaddr.cc',
'src/core/lib/http/format_request.cc',
'src/core/lib/http/httpcli.cc',
@ -1370,6 +1371,7 @@
'src/core/lib/event_engine/default_event_engine_factory.cc',
'src/core/lib/event_engine/event_engine.cc',
'src/core/lib/event_engine/memory_allocator.cc',
'src/core/lib/event_engine/resolved_address.cc',
'src/core/lib/event_engine/sockaddr.cc',
'src/core/lib/http/format_request.cc',
'src/core/lib/http/httpcli.cc',

1
package.xml generated

@ -925,6 +925,7 @@
<file baseinstalldir="/" name="src/core/lib/event_engine/event_engine.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/event_engine_factory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/memory_allocator.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/resolved_address.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/sockaddr.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/event_engine/sockaddr.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/alloc.cc" role="src" />

@ -23,19 +23,6 @@
namespace grpc_event_engine {
namespace experimental {
EventEngine::ResolvedAddress::ResolvedAddress(const sockaddr* address,
socklen_t size)
: size_(size) {
GPR_ASSERT(size <= sizeof(address_));
memcpy(&address_, address, size);
}
const struct sockaddr* EventEngine::ResolvedAddress::address() const {
return reinterpret_cast<const struct sockaddr*>(address_);
}
socklen_t EventEngine::ResolvedAddress::size() const { return size_; }
namespace {
const std::function<std::unique_ptr<EventEngine>()>* g_event_engine_factory =
nullptr;

@ -0,0 +1,39 @@
// Copyright 2021 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <grpc/support/port_platform.h>
#include <grpc/event_engine/event_engine.h>
#include <grpc/event_engine/port.h>
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/sync.h"
namespace grpc_event_engine {
namespace experimental {
EventEngine::ResolvedAddress::ResolvedAddress(const sockaddr* address,
socklen_t size)
: size_(size) {
GPR_ASSERT(size <= sizeof(address_));
memcpy(&address_, address, size);
}
const struct sockaddr* EventEngine::ResolvedAddress::address() const {
return reinterpret_cast<const struct sockaddr*>(address_);
}
socklen_t EventEngine::ResolvedAddress::size() const { return size_; }
} // namespace experimental
} // namespace grpc_event_engine

@ -443,6 +443,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/event_engine/default_event_engine_factory.cc',
'src/core/lib/event_engine/event_engine.cc',
'src/core/lib/event_engine/memory_allocator.cc',
'src/core/lib/event_engine/resolved_address.cc',
'src/core/lib/event_engine/sockaddr.cc',
'src/core/lib/gpr/alloc.cc',
'src/core/lib/gpr/atm.cc',

@ -1924,6 +1924,7 @@ src/core/lib/event_engine/default_event_engine_factory.cc \
src/core/lib/event_engine/event_engine.cc \
src/core/lib/event_engine/event_engine_factory.h \
src/core/lib/event_engine/memory_allocator.cc \
src/core/lib/event_engine/resolved_address.cc \
src/core/lib/event_engine/sockaddr.cc \
src/core/lib/event_engine/sockaddr.h \
src/core/lib/gpr/alloc.cc \

@ -1720,6 +1720,7 @@ src/core/lib/event_engine/default_event_engine_factory.cc \
src/core/lib/event_engine/event_engine.cc \
src/core/lib/event_engine/event_engine_factory.h \
src/core/lib/event_engine/memory_allocator.cc \
src/core/lib/event_engine/resolved_address.cc \
src/core/lib/event_engine/sockaddr.cc \
src/core/lib/event_engine/sockaddr.h \
src/core/lib/gpr/README.md \

Loading…
Cancel
Save