Merge branch 'interception-chain' of github.com:ctiller/grpc into interception-chain

pull/36414/head
Craig Tiller 7 months ago
commit 90c8e96973
  1. 16
      src/core/lib/channel/promise_based_filter.h
  2. 6
      src/core/lib/transport/call_arena_allocator.h
  3. 9
      src/core/lib/transport/interception_chain.cc
  4. 4
      test/core/promise/BUILD
  5. 6
      test/core/promise/poll_matcher.h
  6. 2
      test/core/transport/BUILD
  7. 5
      test/core/transport/chaotic_good/client_transport_error_test.cc
  8. 5
      test/core/transport/chaotic_good/transport_test.h
  9. 5
      test/core/transport/test_suite/test.h

@ -539,8 +539,7 @@ inline void InterceptClientToServerMessage(
template <typename Derived> template <typename Derived>
inline void InterceptClientToServerMessage( inline void InterceptClientToServerMessage(
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*),
Derived*),
FilterCallData<Derived>* call_data, const CallArgs& call_args) { FilterCallData<Derived>* call_data, const CallArgs& call_args) {
GPR_DEBUG_ASSERT(fn == &Derived::Call::OnClientToServerMessage); GPR_DEBUG_ASSERT(fn == &Derived::Call::OnClientToServerMessage);
call_args.client_to_server_messages->InterceptAndMap( call_args.client_to_server_messages->InterceptAndMap(
@ -601,8 +600,7 @@ inline void InterceptClientToServerMessage(
template <typename Derived> template <typename Derived>
inline void InterceptClientToServerMessage( inline void InterceptClientToServerMessage(
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*),
Derived*),
typename Derived::Call* call, Derived* channel, typename Derived::Call* call, Derived* channel,
PipeBasedCallSpine* call_spine) { PipeBasedCallSpine* call_spine) {
GPR_DEBUG_ASSERT(fn == &Derived::Call::OnClientToServerMessage); GPR_DEBUG_ASSERT(fn == &Derived::Call::OnClientToServerMessage);
@ -622,8 +620,8 @@ inline void InterceptClientInitialMetadata(const NoInterceptor*, void*, void*,
template <typename Derived> template <typename Derived>
inline void InterceptClientInitialMetadata( inline void InterceptClientInitialMetadata(
void (Derived::Call::* fn)(ClientMetadata& md), void (Derived::Call::*fn)(ClientMetadata& md), typename Derived::Call* call,
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { Derived*, PipeBasedCallSpine* call_spine) {
GPR_DEBUG_ASSERT(fn == &Derived::Call::OnClientInitialMetadata); GPR_DEBUG_ASSERT(fn == &Derived::Call::OnClientInitialMetadata);
call_spine->client_initial_metadata().receiver.InterceptAndMap( call_spine->client_initial_metadata().receiver.InterceptAndMap(
[call](ClientMetadataHandle md) { [call](ClientMetadataHandle md) {
@ -907,8 +905,7 @@ inline void InterceptServerToClientMessage(
template <typename Derived> template <typename Derived>
inline void InterceptServerToClientMessage( inline void InterceptServerToClientMessage(
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*),
Derived*),
FilterCallData<Derived>* call_data, const CallArgs& call_args) { FilterCallData<Derived>* call_data, const CallArgs& call_args) {
GPR_DEBUG_ASSERT(fn == &Derived::Call::OnServerToClientMessage); GPR_DEBUG_ASSERT(fn == &Derived::Call::OnServerToClientMessage);
call_args.server_to_client_messages->InterceptAndMap( call_args.server_to_client_messages->InterceptAndMap(
@ -969,8 +966,7 @@ inline void InterceptServerToClientMessage(
template <typename Derived> template <typename Derived>
inline void InterceptServerToClientMessage( inline void InterceptServerToClientMessage(
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*),
Derived*),
typename Derived::Call* call, Derived* channel, typename Derived::Call* call, Derived* channel,
PipeBasedCallSpine* call_spine) { PipeBasedCallSpine* call_spine) {
GPR_DEBUG_ASSERT(fn == &Derived::Call::OnServerToClientMessage); GPR_DEBUG_ASSERT(fn == &Derived::Call::OnServerToClientMessage);

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_SIZE_ESTIMATOR_H #ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_ARENA_ALLOCATOR_H
#define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_SIZE_ESTIMATOR_H #define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_ARENA_ALLOCATOR_H
#include <stddef.h> #include <stddef.h>
@ -70,4 +70,4 @@ class CallArenaAllocator : public RefCounted<CallArenaAllocator> {
} // namespace grpc_core } // namespace grpc_core
#endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_SIZE_ESTIMATOR_H #endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_ARENA_ALLOCATOR_H

@ -16,11 +16,10 @@
#include <cstddef> #include <cstddef>
#include "call_destination.h"
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/match.h" #include "src/core/lib/gprpp/match.h"
#include "src/core/lib/transport/call_destination.h"
#include "src/core/lib/transport/call_filters.h" #include "src/core/lib/transport/call_filters.h"
#include "src/core/lib/transport/call_spine.h" #include "src/core/lib/transport/call_spine.h"
#include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/metadata.h"
@ -40,9 +39,9 @@ CallInitiator HijackedCall::MakeCall() {
CallInitiator HijackedCall::MakeCallWithMetadata( CallInitiator HijackedCall::MakeCallWithMetadata(
ClientMetadataHandle metadata) { ClientMetadataHandle metadata) {
auto call = grpc_core::MakeCallPair( auto call = MakeCallPair(std::move(metadata), call_handler_.event_engine(),
std::move(metadata), call_handler_.event_engine(), call_handler_.arena(), call_handler_.arena(), nullptr,
nullptr, call_handler_.legacy_context()); call_handler_.legacy_context());
destination_->StartCall(std::move(call.handler)); destination_->StartCall(std::move(call.handler));
return std::move(call.initiator); return std::move(call.initiator);
} }

@ -23,9 +23,9 @@ grpc_cc_library(
name = "poll_matcher", name = "poll_matcher",
testonly = True, testonly = True,
hdrs = ["poll_matcher.h"], hdrs = ["poll_matcher.h"],
external_deps = ["gtest"],
visibility = ["//test/core:__subpackages__"], visibility = ["//test/core:__subpackages__"],
deps = ["//src/core:poll"], deps = ["//src/core:poll"],
external_deps = ["gtest"],
) )
grpc_cc_library( grpc_cc_library(
@ -505,11 +505,11 @@ grpc_cc_test(
uses_event_engine = False, uses_event_engine = False,
uses_polling = False, uses_polling = False,
deps = [ deps = [
"poll_matcher",
"//src/core:loop", "//src/core:loop",
"//src/core:map", "//src/core:map",
"//src/core:notification", "//src/core:notification",
"//src/core:observable", "//src/core:observable",
"poll_matcher"
], ],
) )

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifndef POLL_MATCHER_H #ifndef GRPC_TEST_CORE_PROMISE_POLL_MATCHER_H
#define POLL_MATCHER_H #define GRPC_TEST_CORE_PROMISE_POLL_MATCHER_H
#include "gmock/gmock.h" #include "gmock/gmock.h"
@ -57,4 +57,4 @@ MATCHER_P(IsReady, value, "") {
} // namespace grpc_core } // namespace grpc_core
#endif #endif // GRPC_TEST_CORE_PROMISE_POLL_MATCHER_H

@ -45,10 +45,10 @@ grpc_cc_test(
uses_event_engine = False, uses_event_engine = False,
uses_polling = False, uses_polling = False,
deps = [ deps = [
"//:grpc_base",
"//src/core:interception_chain", "//src/core:interception_chain",
"//src/core:resource_quota", "//src/core:resource_quota",
"//test/core/promise:poll_matcher", "//test/core/promise:poll_matcher",
"//:grpc_base",
], ],
) )

@ -142,9 +142,8 @@ class ClientTransportTest : public ::testing::Test {
auto MakeCall(ClientMetadataHandle client_initial_metadata) { auto MakeCall(ClientMetadataHandle client_initial_metadata) {
auto* arena = call_arena_allocator_->MakeArena(); auto* arena = call_arena_allocator_->MakeArena();
return grpc_core::MakeCallPair(std::move(client_initial_metadata), return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(),
event_engine_.get(), arena, arena, call_arena_allocator_, nullptr);
call_arena_allocator_, nullptr);
} }
private: private:

@ -44,9 +44,8 @@ class TransportTest : public ::testing::Test {
auto MakeCall(ClientMetadataHandle client_initial_metadata) { auto MakeCall(ClientMetadataHandle client_initial_metadata) {
auto* arena = call_arena_allocator_->MakeArena(); auto* arena = call_arena_allocator_->MakeArena();
return grpc_core::MakeCallPair(std::move(client_initial_metadata), return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(),
event_engine_.get(), arena, arena, call_arena_allocator_, nullptr);
call_arena_allocator_, nullptr);
} }
private: private:

@ -240,9 +240,8 @@ class TransportTest : public ::testing::Test {
auto MakeCall(ClientMetadataHandle client_initial_metadata) { auto MakeCall(ClientMetadataHandle client_initial_metadata) {
auto* arena = call_arena_allocator_->MakeArena(); auto* arena = call_arena_allocator_->MakeArena();
return grpc_core::MakeCallPair(std::move(client_initial_metadata), return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(),
event_engine_.get(), arena, arena, call_arena_allocator_, nullptr);
call_arena_allocator_, nullptr);
} }
// Alternative for Seq for test driver code. // Alternative for Seq for test driver code.

Loading…
Cancel
Save