[context] Remove `grpc_call_context_element` (#36793)
Closes #36793
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36793 from ctiller:nukage 5bf4c34c12
PiperOrigin-RevId: 639806446
This commit is contained in:
parent
3eb1b1cf69
commit
b2e14059a6
22
BUILD
22
BUILD
|
|
@ -1757,7 +1757,6 @@ grpc_cc_library(
|
|||
visibility = ["@grpc:alt_grpc_base_legacy"],
|
||||
deps = [
|
||||
"gpr",
|
||||
"legacy_context",
|
||||
"tcp_tracer",
|
||||
"//src/core:arena",
|
||||
"//src/core:call_final_info",
|
||||
|
|
@ -2070,7 +2069,6 @@ grpc_cc_library(
|
|||
"grpc_trace",
|
||||
"iomgr",
|
||||
"iomgr_timer",
|
||||
"legacy_context",
|
||||
"orphanable",
|
||||
"promise",
|
||||
"ref_counted_ptr",
|
||||
|
|
@ -2141,19 +2139,6 @@ grpc_cc_library(
|
|||
],
|
||||
)
|
||||
|
||||
grpc_cc_library(
|
||||
name = "legacy_context",
|
||||
hdrs = [
|
||||
"//src/core:lib/channel/context.h",
|
||||
],
|
||||
language = "c++",
|
||||
visibility = ["@grpc:alt_grpc_base_legacy"],
|
||||
deps = [
|
||||
"gpr_platform",
|
||||
"//src/core:context",
|
||||
],
|
||||
)
|
||||
|
||||
grpc_cc_library(
|
||||
name = "lb_load_data_store",
|
||||
srcs = [
|
||||
|
|
@ -2343,7 +2328,6 @@ grpc_cc_library(
|
|||
"grpc_trace",
|
||||
"handshaker",
|
||||
"iomgr",
|
||||
"legacy_context",
|
||||
"promise",
|
||||
"ref_counted_ptr",
|
||||
"resource_quota_api",
|
||||
|
|
@ -2524,7 +2508,6 @@ grpc_cc_library(
|
|||
"grpcpp_status",
|
||||
"iomgr",
|
||||
"iomgr_timer",
|
||||
"legacy_context",
|
||||
"ref_counted_ptr",
|
||||
"resource_quota_api",
|
||||
"server",
|
||||
|
|
@ -2610,7 +2593,6 @@ grpc_cc_library(
|
|||
"grpcpp_status",
|
||||
"iomgr",
|
||||
"iomgr_timer",
|
||||
"legacy_context",
|
||||
"ref_counted_ptr",
|
||||
"resource_quota_api",
|
||||
"server",
|
||||
|
|
@ -2936,7 +2918,6 @@ grpc_cc_library(
|
|||
"grpc++_base",
|
||||
"grpc_base",
|
||||
"grpc_public_hdrs",
|
||||
"legacy_context",
|
||||
"tcp_tracer",
|
||||
"//src/core:arena",
|
||||
"//src/core:arena_promise",
|
||||
|
|
@ -3763,7 +3744,6 @@ grpc_cc_library(
|
|||
"grpc_trace",
|
||||
"iomgr",
|
||||
"lb_child_policy_handler",
|
||||
"legacy_context",
|
||||
"orphanable",
|
||||
"promise",
|
||||
"ref_counted_ptr",
|
||||
|
|
@ -4343,7 +4323,6 @@ grpc_cc_library(
|
|||
"grpc_base",
|
||||
"grpc_public_hdrs",
|
||||
"grpc_trace",
|
||||
"legacy_context",
|
||||
"promise",
|
||||
"//src/core:activity",
|
||||
"//src/core:arena",
|
||||
|
|
@ -4826,7 +4805,6 @@ grpc_cc_library(
|
|||
"httpcli",
|
||||
"iomgr",
|
||||
"iomgr_buffer_list",
|
||||
"legacy_context",
|
||||
"ref_counted_ptr",
|
||||
"stats",
|
||||
"tcp_tracer",
|
||||
|
|
|
|||
|
|
@ -1093,7 +1093,6 @@ if(gRPC_BUILD_TESTS)
|
|||
endif()
|
||||
add_dependencies(buildtests_cxx file_watcher_certificate_provider_factory_test)
|
||||
add_dependencies(buildtests_cxx filter_causes_close_test)
|
||||
add_dependencies(buildtests_cxx filter_context_test)
|
||||
add_dependencies(buildtests_cxx filter_init_fails_test)
|
||||
add_dependencies(buildtests_cxx filter_test_test)
|
||||
add_dependencies(buildtests_cxx filtered_metadata_test)
|
||||
|
|
@ -14034,69 +14033,6 @@ target_link_libraries(filter_causes_close_test
|
|||
)
|
||||
|
||||
|
||||
endif()
|
||||
if(gRPC_BUILD_TESTS)
|
||||
|
||||
add_executable(filter_context_test
|
||||
src/core/ext/transport/chaotic_good/chaotic_good_transport.cc
|
||||
src/core/ext/transport/chaotic_good/client/chaotic_good_connector.cc
|
||||
src/core/ext/transport/chaotic_good/client_transport.cc
|
||||
src/core/ext/transport/chaotic_good/frame.cc
|
||||
src/core/ext/transport/chaotic_good/frame_header.cc
|
||||
src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc
|
||||
src/core/ext/transport/chaotic_good/server_transport.cc
|
||||
src/core/ext/transport/chaotic_good/settings_metadata.cc
|
||||
src/core/lib/transport/promise_endpoint.cc
|
||||
test/core/end2end/cq_verifier.cc
|
||||
test/core/end2end/end2end_test_main.cc
|
||||
test/core/end2end/end2end_test_suites.cc
|
||||
test/core/end2end/end2end_tests.cc
|
||||
test/core/end2end/fixtures/http_proxy_fixture.cc
|
||||
test/core/end2end/fixtures/local_util.cc
|
||||
test/core/end2end/fixtures/proxy.cc
|
||||
test/core/end2end/tests/filter_context.cc
|
||||
test/core/event_engine/event_engine_test_utils.cc
|
||||
test/core/test_util/fake_stats_plugin.cc
|
||||
test/core/test_util/test_lb_policies.cc
|
||||
)
|
||||
if(WIN32 AND MSVC)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(filter_context_test
|
||||
PRIVATE
|
||||
"GPR_DLL_IMPORTS"
|
||||
"GRPC_DLL_IMPORTS"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
target_compile_features(filter_context_test PUBLIC cxx_std_14)
|
||||
target_include_directories(filter_context_test
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
|
||||
${_gRPC_RE2_INCLUDE_DIR}
|
||||
${_gRPC_SSL_INCLUDE_DIR}
|
||||
${_gRPC_UPB_GENERATED_DIR}
|
||||
${_gRPC_UPB_GRPC_GENERATED_DIR}
|
||||
${_gRPC_UPB_INCLUDE_DIR}
|
||||
${_gRPC_XXHASH_INCLUDE_DIR}
|
||||
${_gRPC_ZLIB_INCLUDE_DIR}
|
||||
third_party/googletest/googletest/include
|
||||
third_party/googletest/googletest
|
||||
third_party/googletest/googlemock/include
|
||||
third_party/googletest/googlemock
|
||||
${_gRPC_PROTO_GENS_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(filter_context_test
|
||||
${_gRPC_ALLTARGETS_LIBRARIES}
|
||||
gtest
|
||||
grpc_authorization_provider
|
||||
grpc_unsecure
|
||||
grpc_test_util
|
||||
)
|
||||
|
||||
|
||||
endif()
|
||||
if(gRPC_BUILD_TESTS)
|
||||
|
||||
|
|
|
|||
|
|
@ -1107,7 +1107,6 @@ let package = Package(
|
|||
"src/core/lib/channel/channel_stack_trace.h",
|
||||
"src/core/lib/channel/connected_channel.cc",
|
||||
"src/core/lib/channel/connected_channel.h",
|
||||
"src/core/lib/channel/context.h",
|
||||
"src/core/lib/channel/promise_based_filter.cc",
|
||||
"src/core/lib/channel/promise_based_filter.h",
|
||||
"src/core/lib/channel/status_util.cc",
|
||||
|
|
|
|||
|
|
@ -803,7 +803,6 @@ libs:
|
|||
- src/core/lib/channel/channel_stack_builder_impl.h
|
||||
- src/core/lib/channel/channel_stack_trace.h
|
||||
- src/core/lib/channel/connected_channel.h
|
||||
- src/core/lib/channel/context.h
|
||||
- src/core/lib/channel/promise_based_filter.h
|
||||
- src/core/lib/channel/status_util.h
|
||||
- src/core/lib/compression/compression_internal.h
|
||||
|
|
@ -2347,7 +2346,6 @@ libs:
|
|||
- src/core/lib/channel/channel_stack_builder_impl.h
|
||||
- src/core/lib/channel/channel_stack_trace.h
|
||||
- src/core/lib/channel/connected_channel.h
|
||||
- src/core/lib/channel/context.h
|
||||
- src/core/lib/channel/promise_based_filter.h
|
||||
- src/core/lib/channel/status_util.h
|
||||
- src/core/lib/compression/compression_internal.h
|
||||
|
|
@ -4440,7 +4438,6 @@ libs:
|
|||
- src/core/lib/channel/channel_stack_builder_impl.h
|
||||
- src/core/lib/channel/channel_stack_trace.h
|
||||
- src/core/lib/channel/connected_channel.h
|
||||
- src/core/lib/channel/context.h
|
||||
- src/core/lib/channel/promise_based_filter.h
|
||||
- src/core/lib/channel/status_util.h
|
||||
- src/core/lib/compression/compression_internal.h
|
||||
|
|
@ -9706,69 +9703,6 @@ targets:
|
|||
- grpc_authorization_provider
|
||||
- grpc_unsecure
|
||||
- grpc_test_util
|
||||
- name: filter_context_test
|
||||
gtest: true
|
||||
build: test
|
||||
language: c++
|
||||
headers:
|
||||
- src/core/ext/transport/chaotic_good/chaotic_good_transport.h
|
||||
- src/core/ext/transport/chaotic_good/client/chaotic_good_connector.h
|
||||
- src/core/ext/transport/chaotic_good/client_transport.h
|
||||
- src/core/ext/transport/chaotic_good/frame.h
|
||||
- src/core/ext/transport/chaotic_good/frame_header.h
|
||||
- src/core/ext/transport/chaotic_good/server/chaotic_good_server.h
|
||||
- src/core/ext/transport/chaotic_good/server_transport.h
|
||||
- src/core/ext/transport/chaotic_good/settings_metadata.h
|
||||
- src/core/lib/promise/event_engine_wakeup_scheduler.h
|
||||
- src/core/lib/promise/inter_activity_latch.h
|
||||
- src/core/lib/promise/inter_activity_pipe.h
|
||||
- src/core/lib/promise/mpsc.h
|
||||
- src/core/lib/promise/switch.h
|
||||
- src/core/lib/promise/wait_for_callback.h
|
||||
- src/core/lib/promise/wait_set.h
|
||||
- src/core/lib/transport/promise_endpoint.h
|
||||
- test/core/end2end/cq_verifier.h
|
||||
- test/core/end2end/end2end_tests.h
|
||||
- test/core/end2end/fixtures/h2_oauth2_common.h
|
||||
- test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h
|
||||
- test/core/end2end/fixtures/h2_ssl_tls_common.h
|
||||
- test/core/end2end/fixtures/h2_tls_common.h
|
||||
- test/core/end2end/fixtures/http_proxy_fixture.h
|
||||
- test/core/end2end/fixtures/inproc_fixture.h
|
||||
- test/core/end2end/fixtures/local_util.h
|
||||
- test/core/end2end/fixtures/proxy.h
|
||||
- test/core/end2end/fixtures/secure_fixture.h
|
||||
- test/core/end2end/fixtures/sockpair_fixture.h
|
||||
- test/core/end2end/tests/cancel_test_helpers.h
|
||||
- test/core/event_engine/event_engine_test_utils.h
|
||||
- test/core/test_util/fake_stats_plugin.h
|
||||
- test/core/test_util/test_lb_policies.h
|
||||
src:
|
||||
- src/core/ext/transport/chaotic_good/chaotic_good_transport.cc
|
||||
- src/core/ext/transport/chaotic_good/client/chaotic_good_connector.cc
|
||||
- src/core/ext/transport/chaotic_good/client_transport.cc
|
||||
- src/core/ext/transport/chaotic_good/frame.cc
|
||||
- src/core/ext/transport/chaotic_good/frame_header.cc
|
||||
- src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc
|
||||
- src/core/ext/transport/chaotic_good/server_transport.cc
|
||||
- src/core/ext/transport/chaotic_good/settings_metadata.cc
|
||||
- src/core/lib/transport/promise_endpoint.cc
|
||||
- test/core/end2end/cq_verifier.cc
|
||||
- test/core/end2end/end2end_test_main.cc
|
||||
- test/core/end2end/end2end_test_suites.cc
|
||||
- test/core/end2end/end2end_tests.cc
|
||||
- test/core/end2end/fixtures/http_proxy_fixture.cc
|
||||
- test/core/end2end/fixtures/local_util.cc
|
||||
- test/core/end2end/fixtures/proxy.cc
|
||||
- test/core/end2end/tests/filter_context.cc
|
||||
- test/core/event_engine/event_engine_test_utils.cc
|
||||
- test/core/test_util/fake_stats_plugin.cc
|
||||
- test/core/test_util/test_lb_policies.cc
|
||||
deps:
|
||||
- gtest
|
||||
- grpc_authorization_provider
|
||||
- grpc_unsecure
|
||||
- grpc_test_util
|
||||
- name: filter_init_fails_test
|
||||
gtest: true
|
||||
build: test
|
||||
|
|
@ -11751,7 +11685,6 @@ targets:
|
|||
- src/core/lib/channel/channel_stack_builder_impl.h
|
||||
- src/core/lib/channel/channel_stack_trace.h
|
||||
- src/core/lib/channel/connected_channel.h
|
||||
- src/core/lib/channel/context.h
|
||||
- src/core/lib/channel/promise_based_filter.h
|
||||
- src/core/lib/channel/status_util.h
|
||||
- src/core/lib/compression/compression_internal.h
|
||||
|
|
|
|||
|
|
@ -882,7 +882,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/channel/channel_stack_builder_impl.h',
|
||||
'src/core/lib/channel/channel_stack_trace.h',
|
||||
'src/core/lib/channel/connected_channel.h',
|
||||
'src/core/lib/channel/context.h',
|
||||
'src/core/lib/channel/promise_based_filter.h',
|
||||
'src/core/lib/channel/status_util.h',
|
||||
'src/core/lib/compression/compression_internal.h',
|
||||
|
|
@ -2156,7 +2155,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/channel/channel_stack_builder_impl.h',
|
||||
'src/core/lib/channel/channel_stack_trace.h',
|
||||
'src/core/lib/channel/connected_channel.h',
|
||||
'src/core/lib/channel/context.h',
|
||||
'src/core/lib/channel/promise_based_filter.h',
|
||||
'src/core/lib/channel/status_util.h',
|
||||
'src/core/lib/compression/compression_internal.h',
|
||||
|
|
|
|||
|
|
@ -1226,7 +1226,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/channel/channel_stack_trace.h',
|
||||
'src/core/lib/channel/connected_channel.cc',
|
||||
'src/core/lib/channel/connected_channel.h',
|
||||
'src/core/lib/channel/context.h',
|
||||
'src/core/lib/channel/promise_based_filter.cc',
|
||||
'src/core/lib/channel/promise_based_filter.h',
|
||||
'src/core/lib/channel/status_util.cc',
|
||||
|
|
@ -2938,7 +2937,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/channel/channel_stack_builder_impl.h',
|
||||
'src/core/lib/channel/channel_stack_trace.h',
|
||||
'src/core/lib/channel/connected_channel.h',
|
||||
'src/core/lib/channel/context.h',
|
||||
'src/core/lib/channel/promise_based_filter.h',
|
||||
'src/core/lib/channel/status_util.h',
|
||||
'src/core/lib/compression/compression_internal.h',
|
||||
|
|
|
|||
|
|
@ -1113,7 +1113,6 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/lib/channel/channel_stack_trace.h )
|
||||
s.files += %w( src/core/lib/channel/connected_channel.cc )
|
||||
s.files += %w( src/core/lib/channel/connected_channel.h )
|
||||
s.files += %w( src/core/lib/channel/context.h )
|
||||
s.files += %w( src/core/lib/channel/promise_based_filter.cc )
|
||||
s.files += %w( src/core/lib/channel/promise_based_filter.h )
|
||||
s.files += %w( src/core/lib/channel/status_util.cc )
|
||||
|
|
|
|||
|
|
@ -1095,7 +1095,6 @@
|
|||
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_trace.h" role="src" />
|
||||
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.cc" role="src" />
|
||||
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.h" role="src" />
|
||||
<file baseinstalldir="/" name="src/core/lib/channel/context.h" role="src" />
|
||||
<file baseinstalldir="/" name="src/core/lib/channel/promise_based_filter.cc" role="src" />
|
||||
<file baseinstalldir="/" name="src/core/lib/channel/promise_based_filter.h" role="src" />
|
||||
<file baseinstalldir="/" name="src/core/lib/channel/status_util.cc" role="src" />
|
||||
|
|
|
|||
|
|
@ -163,7 +163,6 @@ grpc_cc_library(
|
|||
"//:config",
|
||||
"//:gpr_platform",
|
||||
"//:grpc_base",
|
||||
"//:legacy_context",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -3196,7 +3195,6 @@ grpc_cc_library(
|
|||
"unique_type_name",
|
||||
"useful",
|
||||
"//:gpr_platform",
|
||||
"//:legacy_context",
|
||||
"//:ref_counted_ptr",
|
||||
],
|
||||
)
|
||||
|
|
@ -3295,7 +3293,6 @@ grpc_cc_library(
|
|||
"unique_type_name",
|
||||
"//:call_tracer",
|
||||
"//:gpr",
|
||||
"//:legacy_context",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -3515,7 +3512,6 @@ grpc_cc_library(
|
|||
"//:gpr_public_hdrs",
|
||||
"//:grpc_base",
|
||||
"//:grpc_service_config_impl",
|
||||
"//:legacy_context",
|
||||
"//:ref_counted_ptr",
|
||||
],
|
||||
)
|
||||
|
|
@ -3767,7 +3763,6 @@ grpc_cc_library(
|
|||
"status_helper",
|
||||
"//:gpr",
|
||||
"//:grpc_base",
|
||||
"//:legacy_context",
|
||||
"//:promise",
|
||||
"//:ref_counted_ptr",
|
||||
],
|
||||
|
|
@ -4775,7 +4770,6 @@ grpc_cc_library(
|
|||
"//:grpc_base",
|
||||
"//:grpc_public_hdrs",
|
||||
"//:grpc_trace",
|
||||
"//:legacy_context",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -4820,7 +4814,6 @@ grpc_cc_library(
|
|||
"//:grpc_base",
|
||||
"//:grpc_public_hdrs",
|
||||
"//:grpc_trace",
|
||||
"//:legacy_context",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -4862,7 +4855,6 @@ grpc_cc_library(
|
|||
"//:gpr",
|
||||
"//:grpc_base",
|
||||
"//:grpc_security_base",
|
||||
"//:legacy_context",
|
||||
"//:promise",
|
||||
],
|
||||
)
|
||||
|
|
@ -4908,7 +4900,6 @@ grpc_cc_library(
|
|||
"//:gpr",
|
||||
"//:grpc_base",
|
||||
"//:grpc_trace",
|
||||
"//:legacy_context",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -6344,7 +6335,6 @@ grpc_cc_library(
|
|||
"//:gpr_platform",
|
||||
"//:grpc_base",
|
||||
"//:grpc_trace",
|
||||
"//:legacy_context",
|
||||
"//:xds_orca_upb",
|
||||
],
|
||||
)
|
||||
|
|
@ -6684,7 +6674,6 @@ grpc_cc_library(
|
|||
"//:grpc_resolver",
|
||||
"//:grpc_service_config_impl",
|
||||
"//:grpc_trace",
|
||||
"//:legacy_context",
|
||||
"//:orphanable",
|
||||
"//:ref_counted_ptr",
|
||||
"//:uri_parser",
|
||||
|
|
@ -7297,7 +7286,6 @@ grpc_cc_library(
|
|||
"//:grpc_client_channel",
|
||||
"//:grpc_public_hdrs",
|
||||
"//:grpc_resolver",
|
||||
"//:legacy_context",
|
||||
"//:uri_parser",
|
||||
],
|
||||
)
|
||||
|
|
@ -7644,7 +7632,6 @@ grpc_cc_library(
|
|||
"status_flag",
|
||||
"try_seq",
|
||||
"//:gpr",
|
||||
"//:legacy_context",
|
||||
"//:promise",
|
||||
],
|
||||
)
|
||||
|
|
@ -7915,7 +7902,6 @@ grpc_cc_library(
|
|||
"time",
|
||||
"//:call_tracer",
|
||||
"//:gpr",
|
||||
"//:legacy_context",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -822,7 +822,7 @@ CallInitiator ClientChannel::CreateCall(
|
|||
// Create an initiator/unstarted-handler pair.
|
||||
auto call =
|
||||
MakeCallPair(std::move(client_initial_metadata), event_engine_.get(),
|
||||
call_arena_allocator()->MakeArena(), nullptr);
|
||||
call_arena_allocator()->MakeArena());
|
||||
// Spawn a promise to wait for the resolver result.
|
||||
// This will eventually start the call.
|
||||
call.initiator.SpawnGuardedUntilCallCompletes(
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ class ClientChannelFilter::CallData {
|
|||
virtual Arena* arena() const = 0;
|
||||
virtual grpc_polling_entity* pollent() = 0;
|
||||
virtual grpc_metadata_batch* send_initial_metadata() = 0;
|
||||
virtual grpc_call_context_element* call_context() const = 0;
|
||||
|
||||
// Helper function for CheckResolution(). Returns true if the call
|
||||
// can continue (i.e., there is a valid resolution result, or there is
|
||||
|
|
@ -222,9 +221,6 @@ class ClientChannelFilter::FilterBasedCallData final
|
|||
return pending_batches_[0]
|
||||
->payload->send_initial_metadata.send_initial_metadata;
|
||||
}
|
||||
grpc_call_context_element* call_context() const override {
|
||||
return call_context_;
|
||||
}
|
||||
|
||||
// Returns the index into pending_batches_ to be used for batch.
|
||||
static size_t GetBatchIndex(grpc_transport_stream_op_batch* batch);
|
||||
|
|
@ -278,7 +274,6 @@ class ClientChannelFilter::FilterBasedCallData final
|
|||
void* arg, grpc_error_handle error);
|
||||
|
||||
grpc_slice path_; // Request path.
|
||||
grpc_call_context_element* call_context_;
|
||||
gpr_cycle_counter call_start_time_;
|
||||
Timestamp deadline_;
|
||||
|
||||
|
|
@ -365,9 +360,6 @@ class ClientChannelFilter::PromiseBasedCallData final
|
|||
grpc_metadata_batch* send_initial_metadata() override {
|
||||
return client_initial_metadata_.get();
|
||||
}
|
||||
grpc_call_context_element* call_context() const override {
|
||||
return GetContext<grpc_call_context_element>();
|
||||
}
|
||||
|
||||
void OnAddToQueueLocked() override
|
||||
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&ClientChannelFilter::resolution_mu_) {
|
||||
|
|
@ -530,10 +522,10 @@ class DynamicTerminationFilter::CallData final {
|
|||
auto* calld = static_cast<CallData*>(elem->call_data);
|
||||
auto* chand = static_cast<DynamicTerminationFilter*>(elem->channel_data);
|
||||
ClientChannelFilter* client_channel = chand->chand_;
|
||||
grpc_call_element_args args = {calld->owning_call_, nullptr,
|
||||
calld->call_context_, calld->path_,
|
||||
/*start_time=*/0, calld->deadline_,
|
||||
calld->arena_, calld->call_combiner_};
|
||||
grpc_call_element_args args = {calld->owning_call_, nullptr,
|
||||
calld->path_,
|
||||
/*start_time=*/0, calld->deadline_,
|
||||
calld->arena_, calld->call_combiner_};
|
||||
auto* service_config_call_data = GetServiceConfigCallData(calld->arena_);
|
||||
calld->lb_call_ = client_channel->CreateLoadBalancedCall(
|
||||
args, pollent, nullptr,
|
||||
|
|
@ -552,8 +544,7 @@ class DynamicTerminationFilter::CallData final {
|
|||
deadline_(args.deadline),
|
||||
arena_(args.arena),
|
||||
owning_call_(args.call_stack),
|
||||
call_combiner_(args.call_combiner),
|
||||
call_context_(args.context) {}
|
||||
call_combiner_(args.call_combiner) {}
|
||||
|
||||
~CallData() { CSliceUnref(path_); }
|
||||
|
||||
|
|
@ -562,7 +553,6 @@ class DynamicTerminationFilter::CallData final {
|
|||
Arena* arena_;
|
||||
grpc_call_stack* owning_call_;
|
||||
CallCombiner* call_combiner_;
|
||||
grpc_call_context_element* call_context_;
|
||||
|
||||
OrphanablePtr<ClientChannelFilter::FilterBasedLoadBalancedCall> lb_call_;
|
||||
};
|
||||
|
|
@ -2177,7 +2167,6 @@ bool ClientChannelFilter::CallData::CheckResolutionLocked(
|
|||
ClientChannelFilter::FilterBasedCallData::FilterBasedCallData(
|
||||
grpc_call_element* elem, const grpc_call_element_args& args)
|
||||
: path_(CSliceRef(args.path)),
|
||||
call_context_(args.context),
|
||||
call_start_time_(args.start_time),
|
||||
deadline_(args.deadline),
|
||||
arena_(args.arena),
|
||||
|
|
@ -2515,9 +2504,9 @@ void ClientChannelFilter::FilterBasedCallData::RetryCheckResolutionLocked() {
|
|||
}
|
||||
|
||||
void ClientChannelFilter::FilterBasedCallData::CreateDynamicCall() {
|
||||
DynamicFilters::Call::Args args = {dynamic_filters(), pollent_, path_,
|
||||
call_start_time_, deadline_, arena(),
|
||||
call_context_, call_combiner()};
|
||||
DynamicFilters::Call::Args args = {dynamic_filters(), pollent_, path_,
|
||||
call_start_time_, deadline_, arena(),
|
||||
call_combiner()};
|
||||
grpc_error_handle error;
|
||||
DynamicFilters* channel_stack = args.channel_stack.get();
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_call_trace)) {
|
||||
|
|
@ -2736,16 +2725,14 @@ void CreateCallAttemptTracer(Arena* arena, bool is_transparent_retry) {
|
|||
} // namespace
|
||||
|
||||
ClientChannelFilter::LoadBalancedCall::LoadBalancedCall(
|
||||
ClientChannelFilter* chand, grpc_call_context_element* call_context,
|
||||
Arena* arena, absl::AnyInvocable<void()> on_commit,
|
||||
bool is_transparent_retry)
|
||||
ClientChannelFilter* chand, Arena* arena,
|
||||
absl::AnyInvocable<void()> on_commit, bool is_transparent_retry)
|
||||
: InternallyRefCounted(
|
||||
GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)
|
||||
? "LoadBalancedCall"
|
||||
: nullptr),
|
||||
chand_(chand),
|
||||
on_commit_(std::move(on_commit)),
|
||||
call_context_(call_context),
|
||||
arena_(arena) {
|
||||
CreateCallAttemptTracer(arena, is_transparent_retry);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
||||
|
|
@ -3014,7 +3001,7 @@ ClientChannelFilter::FilterBasedLoadBalancedCall::FilterBasedLoadBalancedCall(
|
|||
ClientChannelFilter* chand, const grpc_call_element_args& args,
|
||||
grpc_polling_entity* pollent, grpc_closure* on_call_destruction_complete,
|
||||
absl::AnyInvocable<void()> on_commit, bool is_transparent_retry)
|
||||
: LoadBalancedCall(chand, args.context, args.arena, std::move(on_commit),
|
||||
: LoadBalancedCall(chand, args.arena, std::move(on_commit),
|
||||
is_transparent_retry),
|
||||
owning_call_(args.call_stack),
|
||||
call_combiner_(args.call_combiner),
|
||||
|
|
@ -3454,10 +3441,10 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::CreateSubchannelCall() {
|
|||
CHECK_NE(path, nullptr);
|
||||
SubchannelCall::Args call_args = {
|
||||
connected_subchannel()->Ref(), pollent_, path->Ref(), /*start_time=*/0,
|
||||
arena()->GetContext<Call>()->deadline(), arena(),
|
||||
arena()->GetContext<Call>()->deadline(),
|
||||
// TODO(roth): When we implement hedging support, we will probably
|
||||
// need to use a separate call context for each subchannel call.
|
||||
call_context(), call_combiner_};
|
||||
// need to use a separate arena for each subchannel call.
|
||||
arena(), call_combiner_};
|
||||
grpc_error_handle error;
|
||||
subchannel_call_ = SubchannelCall::Create(std::move(call_args), &error);
|
||||
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_lb_call_trace)) {
|
||||
|
|
@ -3483,8 +3470,7 @@ void ClientChannelFilter::FilterBasedLoadBalancedCall::CreateSubchannelCall() {
|
|||
ClientChannelFilter::PromiseBasedLoadBalancedCall::PromiseBasedLoadBalancedCall(
|
||||
ClientChannelFilter* chand, absl::AnyInvocable<void()> on_commit,
|
||||
bool is_transparent_retry)
|
||||
: LoadBalancedCall(chand, GetContext<grpc_call_context_element>(),
|
||||
GetContext<Arena>(), std::move(on_commit),
|
||||
: LoadBalancedCall(chand, GetContext<Arena>(), std::move(on_commit),
|
||||
is_transparent_retry) {}
|
||||
|
||||
ArenaPromise<ServerMetadataHandle>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/orphanable.h"
|
||||
#include "src/core/lib/gprpp/ref_counted.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
|
|
@ -371,8 +370,7 @@ class ClientChannelFilter final {
|
|||
class ClientChannelFilter::LoadBalancedCall
|
||||
: public InternallyRefCounted<LoadBalancedCall, UnrefCallDtor> {
|
||||
public:
|
||||
LoadBalancedCall(ClientChannelFilter* chand,
|
||||
grpc_call_context_element* call_context, Arena* arena,
|
||||
LoadBalancedCall(ClientChannelFilter* chand, Arena* arena,
|
||||
absl::AnyInvocable<void()> on_commit,
|
||||
bool is_transparent_retry);
|
||||
~LoadBalancedCall() override;
|
||||
|
|
@ -427,8 +425,6 @@ class ClientChannelFilter::LoadBalancedCall
|
|||
|
||||
void RecordLatency();
|
||||
|
||||
grpc_call_context_element* call_context() const { return call_context_; }
|
||||
|
||||
private:
|
||||
class LbCallState;
|
||||
class Metadata;
|
||||
|
|
@ -459,7 +455,6 @@ class ClientChannelFilter::LoadBalancedCall
|
|||
const BackendMetricData* backend_metric_data_ = nullptr;
|
||||
std::unique_ptr<LoadBalancingPolicy::SubchannelCallTrackerInterface>
|
||||
lb_subchannel_call_tracker_;
|
||||
grpc_call_context_element* const call_context_;
|
||||
Arena* const arena_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/unique_type_name.h"
|
||||
#include "src/core/lib/resource_quota/arena.h"
|
||||
#include "src/core/lib/transport/call_destination.h"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ DynamicFilters::Call::Call(Args args, grpc_error_handle* error)
|
|||
const grpc_call_element_args call_args = {
|
||||
call_stack, // call_stack
|
||||
nullptr, // server_transport_data
|
||||
args.context, // context
|
||||
args.path, // path
|
||||
args.start_time, // start_time
|
||||
args.deadline, // deadline
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/debug_location.h"
|
||||
#include "src/core/lib/gprpp/ref_counted.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
|
|
@ -54,7 +53,6 @@ class DynamicFilters final : public RefCounted<DynamicFilters> {
|
|||
gpr_cycle_counter start_time;
|
||||
Timestamp deadline;
|
||||
Arena* arena;
|
||||
grpc_call_context_element* context;
|
||||
CallCombiner* call_combiner;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
#include "src/core/lib/iomgr/error.h"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#include "src/core/client_channel/retry_throttle.h"
|
||||
#include "src/core/lib/backoff/backoff.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/status_util.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/construct_destruct.h"
|
||||
|
|
@ -120,7 +119,6 @@ RetryFilter::LegacyCallData::CallAttempt::CallAttempt(
|
|||
: RefCounted(GRPC_TRACE_FLAG_ENABLED(grpc_retry_trace) ? "CallAttempt"
|
||||
: nullptr),
|
||||
calld_(calld),
|
||||
batch_payload_(calld->call_context_),
|
||||
started_send_initial_metadata_(false),
|
||||
completed_send_initial_metadata_(false),
|
||||
started_send_trailing_metadata_(false),
|
||||
|
|
@ -1562,7 +1560,6 @@ RetryFilter::LegacyCallData::LegacyCallData(RetryFilter* chand,
|
|||
arena_(args.arena),
|
||||
owning_call_(args.call_stack),
|
||||
call_combiner_(args.call_combiner),
|
||||
call_context_(args.context),
|
||||
call_stack_destruction_barrier_(
|
||||
arena_->New<CallStackDestructionBarrier>()),
|
||||
pending_send_initial_metadata_(false),
|
||||
|
|
@ -1714,9 +1711,9 @@ void RetryFilter::LegacyCallData::StartTransportStreamOpBatch(
|
|||
OrphanablePtr<ClientChannelFilter::FilterBasedLoadBalancedCall>
|
||||
RetryFilter::LegacyCallData::CreateLoadBalancedCall(
|
||||
absl::AnyInvocable<void()> on_commit, bool is_transparent_retry) {
|
||||
grpc_call_element_args args = {owning_call_, nullptr, call_context_,
|
||||
path_, /*start_time=*/0, deadline_,
|
||||
arena_, call_combiner_};
|
||||
grpc_call_element_args args = {owning_call_, nullptr, path_,
|
||||
/*start_time=*/0, deadline_, arena_,
|
||||
call_combiner_};
|
||||
return chand_->client_channel()->CreateLoadBalancedCall(
|
||||
args, pollent_,
|
||||
// This callback holds a ref to the CallStackDestructionBarrier
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "src/core/lib/backoff/backoff.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/debug_location.h"
|
||||
#include "src/core/lib/gprpp/orphanable.h"
|
||||
#include "src/core/lib/gprpp/ref_counted.h"
|
||||
|
|
@ -380,7 +379,6 @@ class RetryFilter::LegacyCallData final {
|
|||
Arena* arena_;
|
||||
grpc_call_stack* owning_call_;
|
||||
CallCombiner* call_combiner_;
|
||||
grpc_call_context_element* call_context_;
|
||||
|
||||
grpc_error_handle cancelled_from_surface_;
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,6 @@ SubchannelCall::SubchannelCall(Args args, grpc_error_handle* error)
|
|||
const grpc_call_element_args call_args = {
|
||||
callstk, // call_stack
|
||||
nullptr, // server_transport_data
|
||||
args.context, // context
|
||||
args.path.c_slice(), // path
|
||||
args.start_time, // start_time
|
||||
args.deadline, // deadline
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "src/core/lib/backoff/backoff.h"
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/debug_location.h"
|
||||
#include "src/core/lib/gprpp/dual_ref_counted.h"
|
||||
#include "src/core/lib/gprpp/orphanable.h"
|
||||
|
|
@ -109,7 +108,6 @@ class SubchannelCall final {
|
|||
gpr_cycle_counter start_time;
|
||||
Timestamp deadline;
|
||||
Arena* arena;
|
||||
grpc_call_context_element* context;
|
||||
CallCombiner* call_combiner;
|
||||
};
|
||||
static RefCountedPtr<SubchannelCall> Create(Args args,
|
||||
|
|
|
|||
|
|
@ -172,8 +172,7 @@ SubchannelStreamClient::CallState::CallState(
|
|||
grpc_pollset_set* interested_parties)
|
||||
: subchannel_stream_client_(std::move(health_check_client)),
|
||||
pollent_(grpc_polling_entity_create_from_pollset_set(interested_parties)),
|
||||
arena_(subchannel_stream_client_->call_allocator_->MakeArena()),
|
||||
payload_(context_) {}
|
||||
arena_(subchannel_stream_client_->call_allocator_->MakeArena()) {}
|
||||
|
||||
SubchannelStreamClient::CallState::~CallState() {
|
||||
if (GPR_UNLIKELY(subchannel_stream_client_->tracer_ != nullptr)) {
|
||||
|
|
@ -181,11 +180,6 @@ SubchannelStreamClient::CallState::~CallState() {
|
|||
<< subchannel_stream_client_.get()
|
||||
<< ": SubchannelStreamClient destroying CallState " << this;
|
||||
}
|
||||
for (size_t i = 0; i < GRPC_CONTEXT_COUNT; ++i) {
|
||||
if (context_[i].destroy != nullptr) {
|
||||
context_[i].destroy(context_[i].value);
|
||||
}
|
||||
}
|
||||
// Unset the call combiner cancellation closure. This has the
|
||||
// effect of scheduling the previously set cancellation closure, if
|
||||
// any, so that it can release any internal references it may be
|
||||
|
|
@ -206,7 +200,6 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
|
|||
gpr_get_cycle_counter(), // start_time
|
||||
Timestamp::InfFuture(), // deadline
|
||||
arena_.get(),
|
||||
context_,
|
||||
&call_combiner_,
|
||||
};
|
||||
grpc_error_handle error;
|
||||
|
|
@ -225,7 +218,6 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
|
|||
return;
|
||||
}
|
||||
// Initialize payload and batch.
|
||||
payload_.context = context_;
|
||||
batch_.payload = &payload_;
|
||||
// on_complete callback takes ref, handled manually.
|
||||
call_->Ref(DEBUG_LOCATION, "on_complete").release();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "src/core/client_channel/subchannel.h"
|
||||
#include "src/core/lib/backoff/backoff.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/orphanable.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
#include "src/core/lib/gprpp/sync.h"
|
||||
|
|
@ -148,7 +147,6 @@ class SubchannelStreamClient final
|
|||
|
||||
RefCountedPtr<Arena> arena_;
|
||||
CallCombiner call_combiner_;
|
||||
grpc_call_context_element context_[GRPC_CONTEXT_COUNT] = {};
|
||||
|
||||
// The streaming call to the backend. Always non-null.
|
||||
// Refs are tracked manually; when the last ref is released, the
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <grpc/support/log.h>
|
||||
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/status_util.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "src/core/ext/filters/message_size/message_size_filter.h"
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/compression/compression_internal.h"
|
||||
#include "src/core/lib/compression/message_compress.h"
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/gprpp/host_port.h"
|
||||
#include "src/core/lib/gprpp/time.h"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/gprpp/validation_errors.h"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "src/core/ext/filters/rbac/rbac_service_config_parser.h"
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/iomgr/error.h"
|
||||
#include "src/core/lib/promise/context.h"
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include "src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/crash.h"
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ auto ChaoticGoodServerTransport::DeserializeAndPushFragmentToNewCall(
|
|||
absl::optional<CallInitiator> call_initiator;
|
||||
if (status.ok()) {
|
||||
auto call = MakeCallPair(std::move(fragment_frame.headers),
|
||||
event_engine_.get(), std::move(arena), nullptr);
|
||||
event_engine_.get(), std::move(arena));
|
||||
call_initiator.emplace(std::move(call.initiator));
|
||||
auto add_result = NewStream(frame_header.stream_id, *call_initiator);
|
||||
if (add_result.ok()) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@
|
|||
#include "src/core/ext/transport/chttp2/transport/varint.h"
|
||||
#include "src/core/ext/transport/chttp2/transport/write_size_policy.h"
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/experiments/experiments.h"
|
||||
#include "src/core/lib/gprpp/bitset.h"
|
||||
#include "src/core/lib/gprpp/crash.h"
|
||||
|
|
@ -1336,7 +1335,6 @@ static void perform_stream_op_locked(void* stream_op,
|
|||
grpc_transport_stream_op_batch_payload* op_payload = op->payload;
|
||||
grpc_chttp2_transport* t = s->t.get();
|
||||
|
||||
s->context = op->payload->context;
|
||||
s->traced = op->is_traced;
|
||||
s->call_tracer = CallTracerIfSampled(s);
|
||||
s->tcp_tracer = TcpTracerIfSampled(s);
|
||||
|
|
|
|||
|
|
@ -548,7 +548,6 @@ struct grpc_chttp2_stream {
|
|||
const void* server_data, grpc_core::Arena* arena);
|
||||
~grpc_chttp2_stream();
|
||||
|
||||
void* context = nullptr;
|
||||
const grpc_core::RefCountedPtr<grpc_chttp2_transport> t;
|
||||
grpc_stream_refcount* refcount;
|
||||
grpc_core::Arena* const arena;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@
|
|||
#include "src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h"
|
||||
#include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h"
|
||||
#include "src/core/lib/backoff/random_early_detection.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/experiments/experiments.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
|
|
|
|||
|
|
@ -105,9 +105,8 @@ class InprocServerTransport final : public ServerTransport {
|
|||
case ConnectionState::kReady:
|
||||
break;
|
||||
}
|
||||
auto server_call =
|
||||
MakeCallPair(std::move(md), event_engine_.get(),
|
||||
call_arena_allocator_->MakeArena(), nullptr);
|
||||
auto server_call = MakeCallPair(std::move(md), event_engine_.get(),
|
||||
call_arena_allocator_->MakeArena());
|
||||
unstarted_call_handler_->StartCall(std::move(server_call.handler));
|
||||
return std::move(server_call.initiator);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/manual_constructor.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
|
|
@ -84,7 +83,6 @@ struct grpc_channel_element_args {
|
|||
struct grpc_call_element_args {
|
||||
grpc_call_stack* call_stack;
|
||||
const void* server_transport_data;
|
||||
grpc_call_context_element* context;
|
||||
const grpc_slice& path;
|
||||
gpr_cycle_counter start_time; // Note: not populated in subchannel stack.
|
||||
grpc_core::Timestamp deadline;
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
//
|
||||
//
|
||||
// Copyright 2015 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.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef GRPC_SRC_CORE_LIB_CHANNEL_CONTEXT_H
|
||||
#define GRPC_SRC_CORE_LIB_CHANNEL_CONTEXT_H
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include "src/core/lib/promise/context.h"
|
||||
|
||||
/// Call object context pointers.
|
||||
|
||||
/// Call context is represented as an array of \a grpc_call_context_elements.
|
||||
/// This enum represents the indexes into the array, where each index
|
||||
/// contains a different type of value.
|
||||
typedef enum { GRPC_CONTEXT_COUNT } grpc_context_index;
|
||||
|
||||
struct grpc_call_context_element {
|
||||
void* value = nullptr;
|
||||
void (*destroy)(void*) = nullptr;
|
||||
};
|
||||
|
||||
namespace grpc_core {
|
||||
class ServiceConfigCallData;
|
||||
|
||||
// Bind the legacy context array into the new style structure
|
||||
// TODO(ctiller): remove as we migrate these contexts to the new system.
|
||||
template <>
|
||||
struct ContextType<grpc_call_context_element> {};
|
||||
|
||||
// Also as a transition step allow exposing a GetContext<T> that can peek into
|
||||
// the legacy context array.
|
||||
namespace promise_detail {
|
||||
template <typename T>
|
||||
struct OldStyleContext;
|
||||
|
||||
template <typename T>
|
||||
class Context<T, absl::void_t<decltype(OldStyleContext<T>::kIndex)>> {
|
||||
public:
|
||||
static T* get() {
|
||||
return static_cast<T*>(
|
||||
GetContext<grpc_call_context_element>()[OldStyleContext<T>::kIndex]
|
||||
.value);
|
||||
}
|
||||
static void set(T* value) {
|
||||
auto& elem =
|
||||
GetContext<grpc_call_context_element>()[OldStyleContext<T>::kIndex];
|
||||
if (elem.destroy != nullptr) {
|
||||
elem.destroy(elem.value);
|
||||
elem.destroy = nullptr;
|
||||
}
|
||||
elem.value = value;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace promise_detail
|
||||
} // namespace grpc_core
|
||||
|
||||
#endif // GRPC_SRC_CORE_LIB_CHANNEL_CONTEXT_H
|
||||
|
|
@ -93,7 +93,6 @@ BaseCallData::BaseCallData(
|
|||
call_context_(flags & kFilterExaminesCallContext
|
||||
? arena_->New<CallContext>(nullptr)
|
||||
: nullptr),
|
||||
context_(args->context),
|
||||
server_initial_metadata_pipe_(
|
||||
flags & kFilterExaminesServerInitialMetadata
|
||||
? arena_->New<Pipe<ServerMetadataHandle>>(arena_)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/event_engine/default_event_engine.h"
|
||||
#include "src/core/lib/event_engine/event_engine_context.h" // IWYU pragma: keep
|
||||
#include "src/core/lib/gprpp/debug_location.h"
|
||||
|
|
@ -355,49 +354,38 @@ template <typename Promise, typename Derived>
|
|||
auto MapResult(absl::Status (Derived::Call::*fn)(ServerMetadata&), Promise x,
|
||||
FilterCallData<Derived>* call_data) {
|
||||
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata);
|
||||
return OnCancel(
|
||||
Map(std::move(x),
|
||||
[call_data](ServerMetadataHandle md) {
|
||||
auto status = call_data->call.OnServerTrailingMetadata(*md);
|
||||
if (!status.ok()) {
|
||||
return ServerMetadataFromStatus(status);
|
||||
}
|
||||
return md;
|
||||
}),
|
||||
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
|
||||
// valid for the cancellation function requiring us to capture it here.
|
||||
// This ought to be easy to fix once client side promises are completely
|
||||
// rolled out.
|
||||
[call_data, ctx = GetContext<grpc_call_context_element>()]() {
|
||||
grpc_metadata_batch b;
|
||||
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
|
||||
b.Set(GrpcCallWasCancelled(), true);
|
||||
promise_detail::Context<grpc_call_context_element> context(ctx);
|
||||
call_data->call.OnServerTrailingMetadata(b).IgnoreError();
|
||||
});
|
||||
return OnCancel(Map(std::move(x),
|
||||
[call_data](ServerMetadataHandle md) {
|
||||
auto status =
|
||||
call_data->call.OnServerTrailingMetadata(*md);
|
||||
if (!status.ok()) {
|
||||
return ServerMetadataFromStatus(status);
|
||||
}
|
||||
return md;
|
||||
}),
|
||||
[call_data]() {
|
||||
grpc_metadata_batch b;
|
||||
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
|
||||
b.Set(GrpcCallWasCancelled(), true);
|
||||
call_data->call.OnServerTrailingMetadata(b).IgnoreError();
|
||||
});
|
||||
}
|
||||
|
||||
template <typename Promise, typename Derived>
|
||||
auto MapResult(void (Derived::Call::*fn)(ServerMetadata&), Promise x,
|
||||
FilterCallData<Derived>* call_data) {
|
||||
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata);
|
||||
return OnCancel(
|
||||
Map(std::move(x),
|
||||
[call_data](ServerMetadataHandle md) {
|
||||
call_data->call.OnServerTrailingMetadata(*md);
|
||||
return md;
|
||||
}),
|
||||
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
|
||||
// valid for the cancellation function requiring us to capture it here.
|
||||
// This ought to be easy to fix once client side promises are completely
|
||||
// rolled out.
|
||||
[call_data, ctx = GetContext<grpc_call_context_element>()]() {
|
||||
grpc_metadata_batch b;
|
||||
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
|
||||
b.Set(GrpcCallWasCancelled(), true);
|
||||
promise_detail::Context<grpc_call_context_element> context(ctx);
|
||||
call_data->call.OnServerTrailingMetadata(b);
|
||||
});
|
||||
return OnCancel(Map(std::move(x),
|
||||
[call_data](ServerMetadataHandle md) {
|
||||
call_data->call.OnServerTrailingMetadata(*md);
|
||||
return md;
|
||||
}),
|
||||
[call_data]() {
|
||||
grpc_metadata_batch b;
|
||||
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
|
||||
b.Set(GrpcCallWasCancelled(), true);
|
||||
call_data->call.OnServerTrailingMetadata(b);
|
||||
});
|
||||
}
|
||||
|
||||
template <typename Promise, typename Derived>
|
||||
|
|
@ -410,15 +398,10 @@ auto MapResult(void (Derived::Call::*fn)(ServerMetadata&, Derived*), Promise x,
|
|||
call_data->call.OnServerTrailingMetadata(*md, call_data->channel);
|
||||
return md;
|
||||
}),
|
||||
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
|
||||
// valid for the cancellation function requiring us to capture it here.
|
||||
// This ought to be easy to fix once client side promises are completely
|
||||
// rolled out.
|
||||
[call_data, ctx = GetContext<grpc_call_context_element>()]() {
|
||||
[call_data]() {
|
||||
grpc_metadata_batch b;
|
||||
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
|
||||
b.Set(GrpcCallWasCancelled(), true);
|
||||
promise_detail::Context<grpc_call_context_element> context(ctx);
|
||||
call_data->call.OnServerTrailingMetadata(b, call_data->channel);
|
||||
});
|
||||
}
|
||||
|
|
@ -1362,19 +1345,15 @@ class BaseCallData : public Activity, private Wakeable {
|
|||
virtual void StartBatch(grpc_transport_stream_op_batch* batch) = 0;
|
||||
|
||||
protected:
|
||||
class ScopedContext
|
||||
: public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<grpc_call_context_element>,
|
||||
public promise_detail::Context<grpc_polling_entity>,
|
||||
public promise_detail::Context<CallFinalization>,
|
||||
public promise_detail::Context<
|
||||
grpc_event_engine::experimental::EventEngine>,
|
||||
public promise_detail::Context<CallContext> {
|
||||
class ScopedContext : public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<grpc_polling_entity>,
|
||||
public promise_detail::Context<CallFinalization>,
|
||||
public promise_detail::Context<
|
||||
grpc_event_engine::experimental::EventEngine>,
|
||||
public promise_detail::Context<CallContext> {
|
||||
public:
|
||||
explicit ScopedContext(BaseCallData* call_data)
|
||||
: promise_detail::Context<Arena>(call_data->arena_),
|
||||
promise_detail::Context<grpc_call_context_element>(
|
||||
call_data->context_),
|
||||
promise_detail::Context<grpc_polling_entity>(
|
||||
call_data->pollent_.load(std::memory_order_acquire)),
|
||||
promise_detail::Context<CallFinalization>(&call_data->finalization_),
|
||||
|
|
@ -1727,7 +1706,6 @@ class BaseCallData : public Activity, private Wakeable {
|
|||
const Timestamp deadline_;
|
||||
CallFinalization finalization_;
|
||||
CallContext* call_context_ = nullptr;
|
||||
grpc_call_context_element* const context_;
|
||||
std::atomic<grpc_polling_entity*> pollent_{nullptr};
|
||||
Pipe<ServerMetadataHandle>* const server_initial_metadata_pipe_;
|
||||
SendMessage* const send_message_;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <grpc/support/string_util.h>
|
||||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
#include "src/core/lib/iomgr/exec_ctx.h"
|
||||
#include "src/core/lib/resource_quota/arena.h"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/channel/status_util.h"
|
||||
#include "src/core/lib/gprpp/debug_location.h"
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/debug_location.h"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@
|
|||
#include "src/core/channelz/channelz.h"
|
||||
#include "src/core/lib/channel/call_finalization.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/status_util.h"
|
||||
#include "src/core/lib/compression/compression_internal.h"
|
||||
#include "src/core/lib/experiments/experiments.h"
|
||||
|
|
@ -436,11 +435,6 @@ class ChannelBasedCall : public Call {
|
|||
class FilterStackCall final : public ChannelBasedCall {
|
||||
public:
|
||||
~FilterStackCall() override {
|
||||
for (int i = 0; i < GRPC_CONTEXT_COUNT; ++i) {
|
||||
if (context_[i].destroy) {
|
||||
context_[i].destroy(context_[i].value);
|
||||
}
|
||||
}
|
||||
gpr_free(static_cast<void*>(const_cast<char*>(final_info_.error_string)));
|
||||
}
|
||||
|
||||
|
|
@ -481,12 +475,6 @@ class FilterStackCall final : public ChannelBasedCall {
|
|||
GRPC_CALL_STACK_UNREF(call_stack(), reason);
|
||||
}
|
||||
|
||||
void ContextSet(grpc_context_index elem, void* value,
|
||||
void (*destroy)(void* value)) override;
|
||||
void* ContextGet(grpc_context_index elem) const override {
|
||||
return context_[elem].value;
|
||||
}
|
||||
|
||||
bool is_trailers_only() const override {
|
||||
bool result = is_trailers_only_;
|
||||
DCHECK(!result || recv_initial_metadata_.TransportSize() == 0);
|
||||
|
|
@ -600,8 +588,7 @@ class FilterStackCall final : public ChannelBasedCall {
|
|||
: ChannelBasedCall(std::move(arena),
|
||||
args.server_transport_data == nullptr,
|
||||
args.send_deadline, args.channel->Ref()),
|
||||
cq_(args.cq),
|
||||
stream_op_payload_(context_) {
|
||||
cq_(args.cq) {
|
||||
GetArena()->SetContext<Call>(this);
|
||||
}
|
||||
|
||||
|
|
@ -660,9 +647,6 @@ class FilterStackCall final : public ChannelBasedCall {
|
|||
// completed
|
||||
grpc_call_final_info final_info_;
|
||||
|
||||
// Contexts for various subsystems (security, tracing, ...).
|
||||
grpc_call_context_element context_[GRPC_CONTEXT_COUNT] = {};
|
||||
|
||||
SliceBuffer send_slice_buffer_;
|
||||
absl::optional<SliceBuffer> receiving_slice_buffer_;
|
||||
uint32_t receiving_stream_flags_;
|
||||
|
|
@ -792,10 +776,9 @@ grpc_error_handle FilterStackCall::Create(grpc_call_create_args* args,
|
|||
}
|
||||
// initial refcount dropped by grpc_call_unref
|
||||
grpc_call_element_args call_args = {
|
||||
call->call_stack(), args->server_transport_data,
|
||||
call->context_, path,
|
||||
call->start_time(), call->send_deadline(),
|
||||
call->arena(), &call->call_combiner_};
|
||||
call->call_stack(), args->server_transport_data, path,
|
||||
call->start_time(), call->send_deadline(), call->arena(),
|
||||
&call->call_combiner_};
|
||||
add_init_error(&error, grpc_call_stack_init(channel_stack, 1, DestroyCall,
|
||||
call, &call_args));
|
||||
// Publish this call to parent only after the call stack has been initialized.
|
||||
|
|
@ -1860,15 +1843,6 @@ done_with_error:
|
|||
goto done;
|
||||
}
|
||||
|
||||
void FilterStackCall::ContextSet(grpc_context_index elem, void* value,
|
||||
void (*destroy)(void*)) {
|
||||
if (context_[elem].destroy) {
|
||||
context_[elem].destroy(context_[elem].value);
|
||||
}
|
||||
context_[elem].value = value;
|
||||
context_[elem].destroy = destroy;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Metadata validation helpers
|
||||
|
||||
|
|
@ -1922,11 +1896,6 @@ class BasicPromiseBasedCall : public ChannelBasedCall, public Party {
|
|||
|
||||
~BasicPromiseBasedCall() override {
|
||||
if (cq_) GRPC_CQ_INTERNAL_UNREF(cq_, "bind");
|
||||
for (int i = 0; i < GRPC_CONTEXT_COUNT; i++) {
|
||||
if (context_[i].destroy) {
|
||||
context_[i].destroy(context_[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OrphanCall() = 0;
|
||||
|
|
@ -1972,19 +1941,6 @@ class BasicPromiseBasedCall : public ChannelBasedCall, public Party {
|
|||
[](Empty) {});
|
||||
}
|
||||
|
||||
void ContextSet(grpc_context_index elem, void* value,
|
||||
void (*destroy)(void*)) final {
|
||||
if (context_[elem].destroy != nullptr) {
|
||||
context_[elem].destroy(context_[elem].value);
|
||||
}
|
||||
context_[elem].value = value;
|
||||
context_[elem].destroy = destroy;
|
||||
}
|
||||
|
||||
void* ContextGet(grpc_context_index elem) const final {
|
||||
return context_[elem].value;
|
||||
}
|
||||
|
||||
// Accept the stats from the context (call once we have proof the transport is
|
||||
// done with them).
|
||||
void AcceptTransportStatsFromContext() {
|
||||
|
|
@ -2000,23 +1956,18 @@ class BasicPromiseBasedCall : public ChannelBasedCall, public Party {
|
|||
}
|
||||
|
||||
protected:
|
||||
class ScopedContext
|
||||
: public ScopedActivity,
|
||||
public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<grpc_call_context_element>,
|
||||
public promise_detail::Context<CallContext>,
|
||||
public promise_detail::Context<CallFinalization> {
|
||||
class ScopedContext : public ScopedActivity,
|
||||
public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<CallContext>,
|
||||
public promise_detail::Context<CallFinalization> {
|
||||
public:
|
||||
explicit ScopedContext(BasicPromiseBasedCall* call)
|
||||
: ScopedActivity(call),
|
||||
promise_detail::Context<Arena>(call->arena()),
|
||||
promise_detail::Context<grpc_call_context_element>(call->context_),
|
||||
promise_detail::Context<CallContext>(&call->call_context_),
|
||||
promise_detail::Context<CallFinalization>(&call->finalization_) {}
|
||||
};
|
||||
|
||||
grpc_call_context_element* context() { return context_; }
|
||||
|
||||
grpc_completion_queue* cq() { return cq_; }
|
||||
|
||||
// At the end of the call run any finalization actions.
|
||||
|
|
@ -2057,8 +2008,6 @@ class BasicPromiseBasedCall : public ChannelBasedCall, public Party {
|
|||
std::atomic<size_t> external_refs_;
|
||||
CallFinalization finalization_;
|
||||
CallContext call_context_{this};
|
||||
// Contexts for various subsystems (security, tracing, ...).
|
||||
grpc_call_context_element context_[GRPC_CONTEXT_COUNT] = {};
|
||||
grpc_call_stats final_stats_{};
|
||||
Slice final_message_;
|
||||
grpc_status_code final_status_ = GRPC_STATUS_UNKNOWN;
|
||||
|
|
@ -2341,7 +2290,7 @@ class PromiseBasedCall : public BasicPromiseBasedCall {
|
|||
// Waiter for when sends_queued_ becomes 0.
|
||||
IntraActivityWaiter waiting_for_queued_sends_;
|
||||
grpc_byte_buffer** recv_message_ = nullptr;
|
||||
grpc_transport_stream_op_batch_payload batch_payload_{context()};
|
||||
grpc_transport_stream_op_batch_payload batch_payload_{};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -3212,16 +3161,6 @@ class ServerCall final : public Call, public DualRefCounted<ServerCall> {
|
|||
CancelWithError(absl::CancelledError());
|
||||
}
|
||||
|
||||
void ContextSet(grpc_context_index elem, void* value,
|
||||
void (*destroy)(void*)) override {
|
||||
call_handler_.legacy_context()[elem] =
|
||||
grpc_call_context_element{value, destroy};
|
||||
}
|
||||
|
||||
void* ContextGet(grpc_context_index elem) const override {
|
||||
return call_handler_.legacy_context()[elem].value;
|
||||
}
|
||||
|
||||
void SetCompletionQueue(grpc_completion_queue*) override {
|
||||
Crash("unimplemented");
|
||||
}
|
||||
|
|
@ -3750,15 +3689,6 @@ grpc_call_error grpc_call_start_batch_and_execute(grpc_call* call,
|
|||
return grpc_core::Call::FromC(call)->StartBatch(ops, nops, closure, true);
|
||||
}
|
||||
|
||||
void grpc_call_context_set(grpc_call* call, grpc_context_index elem,
|
||||
void* value, void (*destroy)(void* value)) {
|
||||
return grpc_core::Call::FromC(call)->ContextSet(elem, value, destroy);
|
||||
}
|
||||
|
||||
void* grpc_call_context_get(grpc_call* call, grpc_context_index elem) {
|
||||
return grpc_core::Call::FromC(call)->ContextGet(elem);
|
||||
}
|
||||
|
||||
void grpc_call_tracer_set(grpc_call* call,
|
||||
grpc_core::ClientCallTracer* tracer) {
|
||||
grpc_core::Arena* arena = grpc_call_get_arena(call);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
#include "src/core/lib/gprpp/time.h"
|
||||
|
|
@ -90,9 +89,6 @@ class Call : public CppImplOf<Call, grpc_call>,
|
|||
virtual Arena* arena() = 0;
|
||||
bool is_client() const { return is_client_; }
|
||||
|
||||
virtual void ContextSet(grpc_context_index elem, void* value,
|
||||
void (*destroy)(void* value)) = 0;
|
||||
virtual void* ContextGet(grpc_context_index elem) const = 0;
|
||||
virtual bool Completed() = 0;
|
||||
void CancelWithStatus(grpc_status_code status, const char* description);
|
||||
virtual void CancelWithError(grpc_error_handle error) = 0;
|
||||
|
|
@ -340,14 +336,6 @@ grpc_call* grpc_call_from_top_element(grpc_call_element* surface_element);
|
|||
void grpc_call_log_batch(const char* file, int line, gpr_log_severity severity,
|
||||
const grpc_op* ops, size_t nops);
|
||||
|
||||
// Set a context pointer.
|
||||
// No thread safety guarantees are made wrt this value.
|
||||
// TODO(#9731): add exec_ctx to destroy
|
||||
void grpc_call_context_set(grpc_call* call, grpc_context_index elem,
|
||||
void* value, void (*destroy)(void* value));
|
||||
// Get a context pointer.
|
||||
void* grpc_call_context_get(grpc_call* call, grpc_context_index elem);
|
||||
|
||||
void grpc_call_tracer_set(grpc_call* call, grpc_core::ClientCallTracer* tracer);
|
||||
|
||||
void* grpc_call_tracer_get(grpc_call* call);
|
||||
|
|
|
|||
|
|
@ -154,8 +154,7 @@ ServerMetadataHandle BatchBuilder::CompleteSendServerTrailingMetadata(
|
|||
BatchBuilder::Batch* BatchBuilder::MakeCancel(
|
||||
grpc_stream_refcount* stream_refcount, absl::Status status) {
|
||||
auto* arena = GetContext<Arena>();
|
||||
auto* payload =
|
||||
arena->NewPooled<grpc_transport_stream_op_batch_payload>(nullptr);
|
||||
auto* payload = arena->NewPooled<grpc_transport_stream_op_batch_payload>();
|
||||
auto* batch = arena->NewPooled<Batch>(payload, stream_refcount);
|
||||
batch->batch.cancel_stream = true;
|
||||
payload->cancel_stream.cancel_error = std::move(status);
|
||||
|
|
|
|||
|
|
@ -95,11 +95,10 @@ void ForwardCall(CallHandler call_handler, CallInitiator call_initiator) {
|
|||
CallInitiatorAndHandler MakeCallPair(
|
||||
ClientMetadataHandle client_initial_metadata,
|
||||
grpc_event_engine::experimental::EventEngine* event_engine,
|
||||
RefCountedPtr<Arena> arena, grpc_call_context_element* legacy_context) {
|
||||
RefCountedPtr<Arena> arena) {
|
||||
CHECK_NE(arena.get(), nullptr);
|
||||
auto spine =
|
||||
CallSpine::Create(std::move(client_initial_metadata), event_engine,
|
||||
std::move(arena), legacy_context);
|
||||
auto spine = CallSpine::Create(std::move(client_initial_metadata),
|
||||
event_engine, std::move(arena));
|
||||
return {CallInitiator(spine), UnstartedCallHandler(spine)};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#include <grpc/support/log.h>
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/dual_ref_counted.h"
|
||||
#include "src/core/lib/promise/detail/status.h"
|
||||
#include "src/core/lib/promise/if.h"
|
||||
|
|
@ -281,21 +280,13 @@ class CallSpine final : public CallSpineInterface, public Party {
|
|||
static RefCountedPtr<CallSpine> Create(
|
||||
ClientMetadataHandle client_initial_metadata,
|
||||
grpc_event_engine::experimental::EventEngine* event_engine,
|
||||
RefCountedPtr<Arena> arena, grpc_call_context_element* legacy_context) {
|
||||
RefCountedPtr<Arena> arena) {
|
||||
auto* arena_ptr = arena.get();
|
||||
return RefCountedPtr<CallSpine>(arena_ptr->New<CallSpine>(
|
||||
std::move(client_initial_metadata), event_engine, std::move(arena),
|
||||
legacy_context));
|
||||
std::move(client_initial_metadata), event_engine, std::move(arena)));
|
||||
}
|
||||
|
||||
~CallSpine() override {
|
||||
if (legacy_context_is_owned_) {
|
||||
for (size_t i = 0; i < GRPC_CONTEXT_COUNT; i++) {
|
||||
grpc_call_context_element& elem = legacy_context_[i];
|
||||
if (elem.destroy != nullptr) elem.destroy(elem.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
~CallSpine() override {}
|
||||
|
||||
CallFilters& call_filters() { return call_filters_; }
|
||||
|
||||
|
|
@ -365,13 +356,6 @@ class CallSpine final : public CallSpineInterface, public Party {
|
|||
return *call_filters().unprocessed_client_initial_metadata();
|
||||
}
|
||||
|
||||
// TODO(ctiller): re-evaluate legacy context apis
|
||||
grpc_call_context_element& legacy_context(grpc_context_index index) const {
|
||||
return legacy_context_[index];
|
||||
}
|
||||
|
||||
grpc_call_context_element* legacy_context() { return legacy_context_; }
|
||||
|
||||
grpc_event_engine::experimental::EventEngine* event_engine() const override {
|
||||
return event_engine_;
|
||||
}
|
||||
|
|
@ -385,37 +369,22 @@ class CallSpine final : public CallSpineInterface, public Party {
|
|||
friend class Arena;
|
||||
CallSpine(ClientMetadataHandle client_initial_metadata,
|
||||
grpc_event_engine::experimental::EventEngine* event_engine,
|
||||
RefCountedPtr<Arena> arena,
|
||||
grpc_call_context_element* legacy_context)
|
||||
RefCountedPtr<Arena> arena)
|
||||
: Party(1),
|
||||
arena_(std::move(arena)),
|
||||
call_filters_(std::move(client_initial_metadata)),
|
||||
event_engine_(event_engine) {
|
||||
if (legacy_context == nullptr) {
|
||||
legacy_context_ = static_cast<grpc_call_context_element*>(arena_->Alloc(
|
||||
sizeof(grpc_call_context_element) * GRPC_CONTEXT_COUNT));
|
||||
memset(legacy_context_, 0,
|
||||
sizeof(grpc_call_context_element) * GRPC_CONTEXT_COUNT);
|
||||
legacy_context_is_owned_ = true;
|
||||
} else {
|
||||
legacy_context_ = legacy_context;
|
||||
legacy_context_is_owned_ = false;
|
||||
}
|
||||
}
|
||||
event_engine_(event_engine) {}
|
||||
|
||||
class ScopedContext
|
||||
: public ScopedActivity,
|
||||
public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<
|
||||
grpc_event_engine::experimental::EventEngine>,
|
||||
public promise_detail::Context<grpc_call_context_element> {
|
||||
class ScopedContext : public ScopedActivity,
|
||||
public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<
|
||||
grpc_event_engine::experimental::EventEngine> {
|
||||
public:
|
||||
explicit ScopedContext(CallSpine* spine)
|
||||
: ScopedActivity(spine),
|
||||
Context<Arena>(spine->arena_.get()),
|
||||
Context<grpc_event_engine::experimental::EventEngine>(
|
||||
spine->event_engine()),
|
||||
Context<grpc_call_context_element>(spine->legacy_context_) {}
|
||||
spine->event_engine()) {}
|
||||
};
|
||||
|
||||
bool RunParty() override {
|
||||
|
|
@ -438,10 +407,6 @@ class CallSpine final : public CallSpineInterface, public Party {
|
|||
CallFilters call_filters_;
|
||||
// Event engine associated with this call
|
||||
grpc_event_engine::experimental::EventEngine* const event_engine_;
|
||||
// Legacy context
|
||||
// TODO(ctiller): remove
|
||||
grpc_call_context_element* legacy_context_;
|
||||
bool legacy_context_is_owned_;
|
||||
};
|
||||
|
||||
class CallInitiator {
|
||||
|
|
@ -565,15 +530,6 @@ class CallHandler {
|
|||
return DownCast<CallSpine*>(spine_.get())->event_engine();
|
||||
}
|
||||
|
||||
// TODO(ctiller): re-evaluate this API
|
||||
const grpc_call_context_element* legacy_context() const {
|
||||
return DownCast<CallSpine*>(spine_.get())->legacy_context();
|
||||
}
|
||||
|
||||
grpc_call_context_element* legacy_context() {
|
||||
return DownCast<CallSpine*>(spine_.get())->legacy_context();
|
||||
}
|
||||
|
||||
private:
|
||||
RefCountedPtr<CallSpineInterface> spine_;
|
||||
};
|
||||
|
|
@ -646,7 +602,7 @@ struct CallInitiatorAndHandler {
|
|||
CallInitiatorAndHandler MakeCallPair(
|
||||
ClientMetadataHandle client_initial_metadata,
|
||||
grpc_event_engine::experimental::EventEngine* event_engine,
|
||||
RefCountedPtr<Arena> arena, grpc_call_context_element* legacy_context);
|
||||
RefCountedPtr<Arena> arena);
|
||||
|
||||
template <typename CallHalf>
|
||||
auto OutgoingMessages(CallHalf h) {
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ CallInitiator HijackedCall::MakeCall() {
|
|||
CallInitiator HijackedCall::MakeCallWithMetadata(
|
||||
ClientMetadataHandle metadata) {
|
||||
auto call = MakeCallPair(std::move(metadata), call_handler_.event_engine(),
|
||||
call_handler_.arena()->Ref(),
|
||||
call_handler_.legacy_context());
|
||||
call_handler_.arena()->Ref());
|
||||
destination_->StartCall(std::move(call.handler));
|
||||
return std::move(call.initiator);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ struct made_transport_stream_op {
|
|||
grpc_closure outer_on_complete;
|
||||
grpc_closure* inner_on_complete = nullptr;
|
||||
grpc_transport_stream_op_batch op;
|
||||
grpc_transport_stream_op_batch_payload payload{nullptr};
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
};
|
||||
static void destroy_made_transport_stream_op(void* arg,
|
||||
grpc_error_handle error) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
#include <grpc/support/port_platform.h>
|
||||
#include <grpc/support/time.h>
|
||||
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/debug/trace.h"
|
||||
#include "src/core/lib/gprpp/orphanable.h"
|
||||
#include "src/core/lib/gprpp/ref_counted.h"
|
||||
|
|
@ -319,9 +318,6 @@ struct grpc_transport_stream_op_batch {
|
|||
};
|
||||
|
||||
struct grpc_transport_stream_op_batch_payload {
|
||||
explicit grpc_transport_stream_op_batch_payload(
|
||||
grpc_call_context_element* context)
|
||||
: context(context) {}
|
||||
struct {
|
||||
grpc_metadata_batch* send_initial_metadata = nullptr;
|
||||
} send_initial_metadata;
|
||||
|
|
@ -411,9 +407,6 @@ struct grpc_transport_stream_op_batch_payload {
|
|||
// initial metadata.
|
||||
bool tarpit = false;
|
||||
} cancel_stream;
|
||||
|
||||
// Indexes correspond to grpc_context_index enum values
|
||||
grpc_call_context_element* context;
|
||||
};
|
||||
|
||||
/// Transport op: a set of operations to perform on a transport as a whole
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/channel/status_util.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/promise/arena_promise.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/event_engine/event_engine_context.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/chunked_vector.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
#include "src/core/lib/gprpp/unique_type_name.h"
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <grpc/support/time.h>
|
||||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/ref_counted_string.h"
|
||||
#include "src/core/lib/iomgr/error.h"
|
||||
#include "src/core/lib/promise/context.h"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
#include <grpc/support/port_platform.h>
|
||||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/no_destruct.h"
|
||||
#include "src/core/lib/gprpp/sync.h"
|
||||
#include "src/core/lib/gprpp/time.h"
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@
|
|||
|
||||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/sync.h"
|
||||
#include "src/core/lib/promise/context.h"
|
||||
#include "src/core/lib/resource_quota/arena.h"
|
||||
|
|
@ -102,7 +101,6 @@ OpenCensusClientFilter::MakeCallPromise(
|
|||
grpc_core::HttpPathMetadata());
|
||||
auto* arena = grpc_core::GetContext<grpc_core::Arena>();
|
||||
auto* tracer = arena->ManagedNew<OpenCensusCallTracer>(
|
||||
grpc_core::GetContext<grpc_call_context_element>(),
|
||||
path != nullptr ? path->Ref() : grpc_core::Slice(),
|
||||
grpc_core::GetContext<grpc_core::Arena>(),
|
||||
OpenCensusTracingEnabled() && tracing_enabled_);
|
||||
|
|
@ -304,11 +302,10 @@ OpenCensusCallTracer::OpenCensusCallAttemptTracer::StartNewTcpTrace() {
|
|||
// OpenCensusCallTracer
|
||||
//
|
||||
|
||||
OpenCensusCallTracer::OpenCensusCallTracer(
|
||||
grpc_call_context_element* call_context, grpc_core::Slice path,
|
||||
grpc_core::Arena* arena, bool tracing_enabled)
|
||||
: call_context_(call_context),
|
||||
path_(std::move(path)),
|
||||
OpenCensusCallTracer::OpenCensusCallTracer(grpc_core::Slice path,
|
||||
grpc_core::Arena* arena,
|
||||
bool tracing_enabled)
|
||||
: path_(std::move(path)),
|
||||
method_(GetMethod(path_)),
|
||||
arena_(arena),
|
||||
tracing_enabled_(tracing_enabled) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include <grpc/support/time.h>
|
||||
#include <grpcpp/opencensus.h>
|
||||
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/sync.h"
|
||||
#include "src/core/lib/iomgr/error.h"
|
||||
#include "src/core/lib/resource_quota/arena.h"
|
||||
|
|
@ -124,8 +123,7 @@ class OpenCensusCallTracer : public grpc_core::ClientCallTracer {
|
|||
absl::StatusCode status_code_;
|
||||
};
|
||||
|
||||
explicit OpenCensusCallTracer(grpc_call_context_element* call_context,
|
||||
grpc_core::Slice path, grpc_core::Arena* arena,
|
||||
explicit OpenCensusCallTracer(grpc_core::Slice path, grpc_core::Arena* arena,
|
||||
bool tracing_enabled);
|
||||
~OpenCensusCallTracer() override;
|
||||
|
||||
|
|
@ -150,7 +148,6 @@ class OpenCensusCallTracer : public grpc_core::ClientCallTracer {
|
|||
private:
|
||||
experimental::CensusContext CreateCensusContextForCallAttempt();
|
||||
|
||||
const grpc_call_context_element* call_context_;
|
||||
// Client method.
|
||||
grpc_core::Slice path_;
|
||||
absl::string_view method_;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ grpc_cc_library(
|
|||
"//:grpc_base",
|
||||
"//:grpc_client_channel",
|
||||
"//:grpc_public_hdrs",
|
||||
"//:legacy_context",
|
||||
"//:tcp_tracer",
|
||||
"//src/core:arena",
|
||||
"//src/core:arena_promise",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
#include "src/core/client_channel/client_channel_filter.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/status_util.h"
|
||||
#include "src/core/lib/gprpp/sync.h"
|
||||
#include "src/core/lib/promise/context.h"
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@
|
|||
#include <grpcpp/support/server_interceptor.h>
|
||||
#include <grpcpp/support/string_ref.h>
|
||||
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/gprpp/crash.h"
|
||||
#include "src/core/lib/gprpp/ref_counted.h"
|
||||
#include "src/core/lib/gprpp/sync.h"
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ class YodelTest : public ::testing::Test {
|
|||
auto MakeCall(ClientMetadataHandle client_initial_metadata) {
|
||||
return MakeCallPair(std::move(client_initial_metadata),
|
||||
state_->event_engine.get(),
|
||||
state_->call_arena_allocator->MakeArena(), nullptr);
|
||||
state_->call_arena_allocator->MakeArena());
|
||||
}
|
||||
|
||||
void WaitForAllPendingWork();
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ TEST(ChannelStackTest, CreateChannelStack) {
|
|||
const grpc_call_element_args args = {
|
||||
call_stack, // call_stack
|
||||
nullptr, // server_transport_data
|
||||
nullptr, // context
|
||||
path, // path
|
||||
gpr_get_cycle_counter(), // start_time
|
||||
grpc_core::Timestamp::InfFuture(), // deadline
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class ConnectedSubchannelTest : public YodelTest {
|
|||
ClientMetadataHandle client_initial_metadata) {
|
||||
return MakeCallPair(std::move(client_initial_metadata),
|
||||
event_engine().get(),
|
||||
SimpleArenaAllocator()->MakeArena(), nullptr);
|
||||
SimpleArenaAllocator()->MakeArena());
|
||||
}
|
||||
|
||||
CallHandler TickUntilCallStarted() {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class LoadBalancedCallDestinationTest : public YodelTest {
|
|||
ClientMetadataHandle client_initial_metadata) {
|
||||
return MakeCallPair(std::move(client_initial_metadata),
|
||||
event_engine().get(),
|
||||
call_arena_allocator_->MakeArena(), nullptr);
|
||||
call_arena_allocator_->MakeArena());
|
||||
}
|
||||
|
||||
CallHandler TickUntilCallStarted() {
|
||||
|
|
|
|||
|
|
@ -344,8 +344,6 @@ grpc_core_end2end_test(name = "empty_batch")
|
|||
|
||||
grpc_core_end2end_test(name = "filter_causes_close")
|
||||
|
||||
grpc_core_end2end_test(name = "filter_context")
|
||||
|
||||
grpc_core_end2end_test(name = "filter_init_fails")
|
||||
|
||||
grpc_core_end2end_test(name = "filtered_metadata")
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ def grpc_core_end2end_test(name, shard_count = 10, tags = []):
|
|||
"//:grpc_security_base",
|
||||
"//:grpc_trace",
|
||||
"//:grpc_unsecure",
|
||||
"//:legacy_context",
|
||||
"//:orphanable",
|
||||
"//:promise",
|
||||
"//:ref_counted_ptr",
|
||||
|
|
|
|||
|
|
@ -1,134 +0,0 @@
|
|||
//
|
||||
//
|
||||
// Copyright 2018 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 <initializer_list>
|
||||
#include <memory>
|
||||
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/log/log.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <grpc/status.h>
|
||||
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/experiments/experiments.h"
|
||||
#include "src/core/lib/gprpp/time.h"
|
||||
#include "src/core/lib/iomgr/closure.h"
|
||||
#include "src/core/lib/iomgr/error.h"
|
||||
#include "src/core/lib/surface/channel_stack_type.h"
|
||||
#include "src/core/lib/transport/transport.h"
|
||||
#include "test/core/end2end/end2end_tests.h"
|
||||
|
||||
namespace grpc_core {
|
||||
namespace {
|
||||
|
||||
//******************************************************************************
|
||||
// Test context filter
|
||||
//
|
||||
|
||||
struct call_data {
|
||||
grpc_call_context_element* context;
|
||||
};
|
||||
|
||||
grpc_error_handle init_call_elem(grpc_call_element* elem,
|
||||
const grpc_call_element_args* args) {
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
calld->context = args->context;
|
||||
LOG(INFO) << "init_call_elem(): context=" << args->context;
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void start_transport_stream_op_batch(grpc_call_element* elem,
|
||||
grpc_transport_stream_op_batch* batch) {
|
||||
call_data* calld = static_cast<call_data*>(elem->call_data);
|
||||
// If batch payload context is not null (which will happen in some
|
||||
// cancellation cases), make sure we get the same context here that we
|
||||
// saw in init_call_elem().
|
||||
LOG(INFO) << "start_transport_stream_op_batch(): context="
|
||||
<< batch->payload->context;
|
||||
if (batch->payload->context != nullptr) {
|
||||
CHECK(calld->context == batch->payload->context);
|
||||
}
|
||||
grpc_call_next_op(elem, batch);
|
||||
}
|
||||
|
||||
void destroy_call_elem(grpc_call_element* /*elem*/,
|
||||
const grpc_call_final_info* /*final_info*/,
|
||||
grpc_closure* /*ignored*/) {}
|
||||
|
||||
grpc_error_handle init_channel_elem(grpc_channel_element* /*elem*/,
|
||||
grpc_channel_element_args* /*args*/) {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void destroy_channel_elem(grpc_channel_element* /*elem*/) {}
|
||||
|
||||
const grpc_channel_filter test_filter = {
|
||||
start_transport_stream_op_batch, nullptr, nullptr, grpc_channel_next_op,
|
||||
sizeof(call_data), init_call_elem,
|
||||
grpc_call_stack_ignore_set_pollset_or_pollset_set, destroy_call_elem, 0,
|
||||
init_channel_elem, grpc_channel_stack_no_post_init, destroy_channel_elem,
|
||||
grpc_channel_next_get_info,
|
||||
// Want to add the filter as close to the end as possible, to
|
||||
// make sure that all of the filters work well together.
|
||||
// However, we can't add it at the very end, because the
|
||||
// connected channel filter must be the last one.
|
||||
// Channel init code falls back to lexical ordering of filters if there are
|
||||
// otherwise no dependencies, so we leverage that.
|
||||
"zzzzzzz_filter_context"};
|
||||
|
||||
// Simple request to test that filters see a consistent view of the
|
||||
// call context.
|
||||
CORE_END2END_TEST(CoreEnd2endTest, FilterContext) {
|
||||
SKIP_IF_CHAOTIC_GOOD();
|
||||
CoreConfiguration::RegisterBuilder([](CoreConfiguration::Builder* builder) {
|
||||
for (auto type : {GRPC_CLIENT_CHANNEL, GRPC_CLIENT_SUBCHANNEL,
|
||||
GRPC_CLIENT_DIRECT_CHANNEL, GRPC_SERVER_CHANNEL}) {
|
||||
builder->channel_init()->RegisterFilter(type, &test_filter);
|
||||
}
|
||||
});
|
||||
auto c = NewClientCall("/foo").Timeout(Duration::Seconds(5)).Create();
|
||||
CoreEnd2endTest::IncomingStatusOnClient server_status;
|
||||
CoreEnd2endTest::IncomingMetadata server_initial_metadata;
|
||||
c.NewBatch(1)
|
||||
.SendInitialMetadata({})
|
||||
.SendMessage("hello world")
|
||||
.SendCloseFromClient()
|
||||
.RecvInitialMetadata(server_initial_metadata)
|
||||
.RecvStatusOnClient(server_status);
|
||||
auto s = RequestCall(101);
|
||||
Expect(101, true);
|
||||
Step();
|
||||
CoreEnd2endTest::IncomingCloseOnServer client_close;
|
||||
s.NewBatch(102)
|
||||
.SendInitialMetadata({})
|
||||
.SendStatusFromServer(GRPC_STATUS_UNIMPLEMENTED, "xyz", {})
|
||||
.RecvCloseOnServer(client_close);
|
||||
Expect(102, true);
|
||||
Expect(1, true);
|
||||
Step();
|
||||
EXPECT_EQ(server_status.status(), GRPC_STATUS_UNIMPLEMENTED);
|
||||
EXPECT_EQ(server_status.message(), "xyz");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace grpc_core
|
||||
|
|
@ -31,7 +31,6 @@
|
|||
#include "src/core/lib/channel/channel_args.h"
|
||||
#include "src/core/lib/channel/channel_fwd.h"
|
||||
#include "src/core/lib/channel/channel_stack.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/channel/promise_based_filter.h"
|
||||
#include "src/core/lib/config/core_configuration.h"
|
||||
#include "src/core/lib/experiments/experiments.h"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <grpc/grpc.h>
|
||||
|
||||
#include "src/core/lib/channel/call_finalization.h"
|
||||
#include "src/core/lib/channel/context.h"
|
||||
#include "src/core/lib/event_engine/default_event_engine.h"
|
||||
#include "src/core/lib/gprpp/crash.h"
|
||||
#include "src/core/lib/iomgr/timer_manager.h"
|
||||
|
|
@ -58,7 +57,6 @@ class FilterTestBase::Call::Impl
|
|||
~Impl();
|
||||
|
||||
Arena* arena() { return arena_.get(); }
|
||||
grpc_call_context_element* legacy_context() { return legacy_context_; }
|
||||
const std::shared_ptr<Channel::Impl>& channel() const { return channel_; }
|
||||
CallFinalization* call_finalization() { return &call_finalization_; }
|
||||
|
||||
|
|
@ -109,19 +107,12 @@ class FilterTestBase::Call::Impl
|
|||
absl::optional<ServerMetadataHandle> forward_server_initial_metadata_;
|
||||
std::queue<MessageHandle> forward_client_to_server_messages_;
|
||||
std::queue<MessageHandle> forward_server_to_client_messages_;
|
||||
// Contexts for various subsystems (security, tracing, ...).
|
||||
grpc_call_context_element legacy_context_[GRPC_CONTEXT_COUNT] = {};
|
||||
};
|
||||
|
||||
FilterTestBase::Call::Impl::~Impl() {
|
||||
if (!run_call_finalization_) {
|
||||
call_finalization_.Run(nullptr);
|
||||
}
|
||||
for (size_t i = 0; i < GRPC_CONTEXT_COUNT; ++i) {
|
||||
if (legacy_context_[i].destroy != nullptr) {
|
||||
legacy_context_[i].destroy(legacy_context_[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FilterTestBase::Call::Impl::Start(ClientMetadataHandle md) {
|
||||
|
|
@ -277,7 +268,6 @@ bool FilterTestBase::Call::Impl::StepOnce() {
|
|||
class FilterTestBase::Call::ScopedContext final
|
||||
: public Activity,
|
||||
public promise_detail::Context<Arena>,
|
||||
public promise_detail::Context<grpc_call_context_element>,
|
||||
public promise_detail::Context<CallFinalization> {
|
||||
private:
|
||||
class TestWakeable final : public Wakeable {
|
||||
|
|
@ -305,8 +295,6 @@ class FilterTestBase::Call::ScopedContext final
|
|||
public:
|
||||
explicit ScopedContext(std::shared_ptr<Impl> impl)
|
||||
: promise_detail::Context<Arena>(impl->arena()),
|
||||
promise_detail::Context<grpc_call_context_element>(
|
||||
impl->legacy_context()),
|
||||
promise_detail::Context<CallFinalization>(impl->call_finalization()),
|
||||
impl_(std::move(impl)) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ TEST(ChannelInitTest, CanCreateFilterWithCall) {
|
|||
"test"),
|
||||
1024);
|
||||
auto call = MakeCallPair(Arena::MakePooled<ClientMetadata>(), nullptr,
|
||||
allocator->MakeArena(), nullptr);
|
||||
allocator->MakeArena());
|
||||
(*stack)->StartCall(std::move(call.handler));
|
||||
EXPECT_EQ(p, 1);
|
||||
EXPECT_EQ(handled, 1);
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ TEST_F(BinderTransportTest, PerformSendInitialMetadata) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
const Metadata kInitialMetadata = kDefaultMetadata;
|
||||
MakeSendInitialMetadata send_initial_metadata(kInitialMetadata, "", &op);
|
||||
|
|
@ -399,7 +399,7 @@ TEST_F(BinderTransportTest, PerformSendInitialMetadataMethodRef) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
const Metadata kInitialMetadata = kDefaultMetadata;
|
||||
const std::string kMethodRef = kDefaultMethodRef;
|
||||
|
|
@ -422,7 +422,7 @@ TEST_F(BinderTransportTest, PerformSendMessage) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
const std::string kMessage = kDefaultMessage;
|
||||
|
|
@ -444,7 +444,7 @@ TEST_F(BinderTransportTest, PerformSendTrailingMetadata) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
// The wireformat guarantees that suffix metadata will always be empty.
|
||||
// TODO(waynetu): Check whether gRPC can internally add extra trailing
|
||||
|
|
@ -467,7 +467,7 @@ TEST_F(BinderTransportTest, PerformSendAll) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
const Metadata kInitialMetadata = kDefaultMetadata;
|
||||
|
|
@ -502,7 +502,7 @@ TEST_F(BinderTransportTest, PerformRecvInitialMetadata) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
MakeRecvInitialMetadata recv_initial_metadata(&op);
|
||||
|
|
@ -523,7 +523,7 @@ TEST_F(BinderTransportTest, PerformRecvInitialMetadataWithMethodRef) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
MakeRecvInitialMetadata recv_initial_metadata(&op);
|
||||
|
|
@ -545,7 +545,7 @@ TEST_F(BinderTransportTest, PerformRecvMessage) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
MakeRecvMessage recv_message(&op);
|
||||
|
|
@ -565,7 +565,7 @@ TEST_F(BinderTransportTest, PerformRecvTrailingMetadata) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
MakeRecvTrailingMetadata recv_trailing_metadata(&op);
|
||||
|
|
@ -587,7 +587,7 @@ TEST_F(BinderTransportTest, PerformRecvAll) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
MakeRecvInitialMetadata recv_initial_metadata(&op);
|
||||
|
|
@ -623,7 +623,7 @@ TEST_F(BinderTransportTest, PerformAllOps) {
|
|||
grpc_core::ExecCtx exec_ctx;
|
||||
grpc_binder_stream* gbs = InitNewBinderStream();
|
||||
grpc_transport_stream_op_batch op{};
|
||||
grpc_transport_stream_op_batch_payload payload(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload;
|
||||
op.payload = &payload;
|
||||
|
||||
const Metadata kSendInitialMetadata = kDefaultMetadata;
|
||||
|
|
@ -706,13 +706,13 @@ TEST_F(BinderTransportTest, WireWriterRpcCallErrorPropagates) {
|
|||
|
||||
const Metadata kInitialMetadata = {};
|
||||
grpc_transport_stream_op_batch op1{};
|
||||
grpc_transport_stream_op_batch_payload payload1(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload1;
|
||||
op1.payload = &payload1;
|
||||
MakeSendInitialMetadata send_initial_metadata1(kInitialMetadata, "", &op1);
|
||||
op1.on_complete = mock_on_complete1.GetGrpcClosure();
|
||||
|
||||
grpc_transport_stream_op_batch op2{};
|
||||
grpc_transport_stream_op_batch_payload payload2(nullptr);
|
||||
grpc_transport_stream_op_batch_payload payload2;
|
||||
op2.payload = &payload2;
|
||||
MakeSendInitialMetadata send_initial_metadata2(kInitialMetadata, "", &op2);
|
||||
op2.on_complete = mock_on_complete2.GetGrpcClosure();
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class ClientTransportTest : public ::testing::Test {
|
|||
|
||||
auto MakeCall(ClientMetadataHandle client_initial_metadata) {
|
||||
return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(),
|
||||
call_arena_allocator_->MakeArena(), nullptr);
|
||||
call_arena_allocator_->MakeArena());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class TransportTest : public ::testing::Test {
|
|||
|
||||
auto MakeCall(ClientMetadataHandle client_initial_metadata) {
|
||||
return MakeCallPair(std::move(client_initial_metadata), event_engine_.get(),
|
||||
MakeArena(), nullptr);
|
||||
MakeArena());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ class InterceptionChainTest : public ::testing::Test {
|
|||
// Run a call through a UnstartedCallDestination until it's complete.
|
||||
FinishedCall RunCall(UnstartedCallDestination* destination) {
|
||||
auto call = MakeCallPair(Arena::MakePooled<ClientMetadata>(), nullptr,
|
||||
call_arena_allocator_->MakeArena(), nullptr);
|
||||
call_arena_allocator_->MakeArena());
|
||||
Poll<ServerMetadataHandle> trailing_md;
|
||||
call.initiator.SpawnInfallible(
|
||||
"run_call", [destination, &call, &trailing_md]() mutable {
|
||||
|
|
|
|||
|
|
@ -2112,7 +2112,6 @@ src/core/lib/channel/channel_stack_trace.cc \
|
|||
src/core/lib/channel/channel_stack_trace.h \
|
||||
src/core/lib/channel/connected_channel.cc \
|
||||
src/core/lib/channel/connected_channel.h \
|
||||
src/core/lib/channel/context.h \
|
||||
src/core/lib/channel/promise_based_filter.cc \
|
||||
src/core/lib/channel/promise_based_filter.h \
|
||||
src/core/lib/channel/status_util.cc \
|
||||
|
|
|
|||
|
|
@ -1884,7 +1884,6 @@ src/core/lib/channel/channel_stack_trace.cc \
|
|||
src/core/lib/channel/channel_stack_trace.h \
|
||||
src/core/lib/channel/connected_channel.cc \
|
||||
src/core/lib/channel/connected_channel.h \
|
||||
src/core/lib/channel/context.h \
|
||||
src/core/lib/channel/promise_based_filter.cc \
|
||||
src/core/lib/channel/promise_based_filter.h \
|
||||
src/core/lib/channel/status_util.cc \
|
||||
|
|
|
|||
|
|
@ -3603,30 +3603,6 @@
|
|||
],
|
||||
"uses_polling": true
|
||||
},
|
||||
{
|
||||
"args": [],
|
||||
"benchmark": false,
|
||||
"ci_platforms": [
|
||||
"linux",
|
||||
"mac",
|
||||
"posix",
|
||||
"windows"
|
||||
],
|
||||
"cpu_cost": 1.0,
|
||||
"exclude_configs": [],
|
||||
"exclude_iomgrs": [],
|
||||
"flaky": false,
|
||||
"gtest": true,
|
||||
"language": "c++",
|
||||
"name": "filter_context_test",
|
||||
"platforms": [
|
||||
"linux",
|
||||
"mac",
|
||||
"posix",
|
||||
"windows"
|
||||
],
|
||||
"uses_polling": true
|
||||
},
|
||||
{
|
||||
"args": [],
|
||||
"benchmark": false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue