|
|
|
@ -351,7 +351,7 @@ auto MapResult(const NoInterceptor*, Promise x, void*) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Promise, typename Derived> |
|
|
|
|
auto MapResult(absl::Status (Derived::Call::*fn)(ServerMetadata&), Promise x, |
|
|
|
|
auto MapResult(absl::Status (Derived::Call::* fn)(ServerMetadata&), Promise x, |
|
|
|
|
FilterCallData<Derived>* call_data) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata); |
|
|
|
|
return Map(std::move(x), [call_data](ServerMetadataHandle md) { |
|
|
|
@ -362,7 +362,7 @@ auto MapResult(absl::Status (Derived::Call::*fn)(ServerMetadata&), Promise x, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Promise, typename Derived> |
|
|
|
|
auto MapResult(void (Derived::Call::*fn)(ServerMetadata&), Promise x, |
|
|
|
|
auto MapResult(void (Derived::Call::* fn)(ServerMetadata&), Promise x, |
|
|
|
|
FilterCallData<Derived>* call_data) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata); |
|
|
|
|
return Map(std::move(x), [call_data](ServerMetadataHandle md) { |
|
|
|
@ -372,7 +372,7 @@ auto MapResult(void (Derived::Call::*fn)(ServerMetadata&), Promise x, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Promise, typename Derived> |
|
|
|
|
auto MapResult(void (Derived::Call::*fn)(ServerMetadata&, Derived*), Promise x, |
|
|
|
|
auto MapResult(void (Derived::Call::* fn)(ServerMetadata&, Derived*), Promise x, |
|
|
|
|
FilterCallData<Derived>* call_data) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata); |
|
|
|
|
return Map(std::move(x), [call_data](ServerMetadataHandle md) { |
|
|
|
@ -492,137 +492,203 @@ auto RunCall(Interceptor interceptor, CallArgs call_args, |
|
|
|
|
std::move(call_args), std::move(next_promise_factory), call_data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline void InterceptClientToServerMessage(const NoInterceptor*, void*, |
|
|
|
|
const CallArgs&) {} |
|
|
|
|
template <typename Derived> |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
void (Derived::Call::* fn)(const Message&), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
call_data->call.OnClientToServerMessage(*msg); |
|
|
|
|
return std::move(msg); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_args.client_to_server_messages->InterceptAndMap( |
|
|
|
|
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = call_data->call.OnClientToServerMessage(*msg); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
if (call_data->error_latch.is_set()) return absl::nullopt; |
|
|
|
|
call_data->error_latch.Set(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}); |
|
|
|
|
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = call_data->call.OnClientToServerMessage(*msg); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
if (call_data->error_latch.is_set()) return absl::nullopt; |
|
|
|
|
call_data->error_latch.Set(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&, Derived*), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&, Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_args.client_to_server_messages->InterceptAndMap( |
|
|
|
|
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = |
|
|
|
|
call_data->call.OnClientToServerMessage(*msg, call_data->channel); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
if (call_data->error_latch.is_set()) return absl::nullopt; |
|
|
|
|
call_data->error_latch.Set(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}); |
|
|
|
|
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = |
|
|
|
|
call_data->call.OnClientToServerMessage(*msg, call_data->channel); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
if (call_data->error_latch.is_set()) return absl::nullopt; |
|
|
|
|
call_data->error_latch.Set(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
MessageHandle (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
MessageHandle (Derived::Call::* fn)(MessageHandle, Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_args.client_to_server_messages->InterceptAndMap( |
|
|
|
|
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
return call_data->call.OnClientToServerMessage(std::move(msg), |
|
|
|
|
call_data->channel); |
|
|
|
|
}); |
|
|
|
|
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
return call_data->call.OnClientToServerMessage(std::move(msg), |
|
|
|
|
call_data->channel); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, |
|
|
|
|
Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto r = call_data->call.OnClientToServerMessage(std::move(msg), |
|
|
|
|
call_data->channel); |
|
|
|
|
if (r.ok()) return std::move(*r); |
|
|
|
|
if (call_data->error_latch.is_set()) return absl::nullopt; |
|
|
|
|
call_data->error_latch.Set(ServerMetadataFromStatus(r.status())); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived, typename HookFunction> |
|
|
|
|
inline void InterceptClientToServerMessage(HookFunction hook, |
|
|
|
|
const NoInterceptor*, |
|
|
|
|
FilterCallData<Derived>* call_data, |
|
|
|
|
const CallArgs& call_args) { |
|
|
|
|
call_args.client_to_server_messages->InterceptAndMap( |
|
|
|
|
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto r = call_data->call.OnClientToServerMessage(std::move(msg), |
|
|
|
|
call_data->channel); |
|
|
|
|
if (r.ok()) return std::move(*r); |
|
|
|
|
if (call_data->error_latch.is_set()) return absl::nullopt; |
|
|
|
|
call_data->error_latch.Set(ServerMetadataFromStatus(r.status())); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}); |
|
|
|
|
InterceptClientToServerMessageHandler(hook, call_data, call_args)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline void InterceptClientToServerMessage(const NoInterceptor*, void*, void*, |
|
|
|
|
CallSpineInterface*) {} |
|
|
|
|
template <typename Derived, typename HookFunction> |
|
|
|
|
inline void InterceptClientToServerMessage(HookFunction hook, |
|
|
|
|
void (Derived::Call::* half_close)(), |
|
|
|
|
FilterCallData<Derived>* call_data, |
|
|
|
|
const CallArgs& call_args) { |
|
|
|
|
call_args.client_to_server_messages->InterceptAndMapWithHalfClose( |
|
|
|
|
InterceptClientToServerMessageHandler(hook, call_data, call_args), |
|
|
|
|
[call_data]() { call_data->call.OnClientToServerHalfClose(); }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage(const NoInterceptor*, |
|
|
|
|
const NoInterceptor*, |
|
|
|
|
FilterCallData<Derived>*, |
|
|
|
|
const CallArgs&) {} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&), |
|
|
|
|
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_spine->client_to_server_messages().receiver.InterceptAndMap( |
|
|
|
|
return |
|
|
|
|
[call, call_spine](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = call->OnClientToServerMessage(*msg); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
call_spine->PushServerTrailingMetadata(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&, Derived*), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
void (Derived::Call::* fn)(const Message&), typename Derived::Call* call, |
|
|
|
|
Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
return [call](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
call->OnClientToServerMessage(*msg); |
|
|
|
|
return std::move(msg); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&, Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_spine->client_to_server_messages().receiver.InterceptAndMap( |
|
|
|
|
[call, call_spine, |
|
|
|
|
channel](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = call->OnClientToServerMessage(*msg, channel); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
call_spine->PushServerTrailingMetadata(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}); |
|
|
|
|
return [call, call_spine, |
|
|
|
|
channel](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto return_md = call->OnClientToServerMessage(*msg, channel); |
|
|
|
|
if (return_md == nullptr) return std::move(msg); |
|
|
|
|
call_spine->PushServerTrailingMetadata(std::move(return_md)); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
MessageHandle (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
MessageHandle (Derived::Call::* fn)(MessageHandle, Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_spine->client_to_server_messages().receiver.InterceptAndMap( |
|
|
|
|
[call, channel](MessageHandle msg) { |
|
|
|
|
return call->OnClientToServerMessage(std::move(msg), channel); |
|
|
|
|
}); |
|
|
|
|
return [call, channel](MessageHandle msg) { |
|
|
|
|
return call->OnClientToServerMessage(std::move(msg), channel); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage( |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
inline auto InterceptClientToServerMessageHandler( |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, |
|
|
|
|
Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
return [call, call_spine, |
|
|
|
|
channel](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto r = call->OnClientToServerMessage(std::move(msg), channel); |
|
|
|
|
if (r.ok()) return std::move(*r); |
|
|
|
|
call_spine->PushServerTrailingMetadata( |
|
|
|
|
ServerMetadataFromStatus(r.status())); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived, typename HookFunction> |
|
|
|
|
inline void InterceptClientToServerMessage(HookFunction fn, |
|
|
|
|
const NoInterceptor*, |
|
|
|
|
typename Derived::Call* call, |
|
|
|
|
Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
call_spine->client_to_server_messages().receiver.InterceptAndMap( |
|
|
|
|
[call, call_spine, |
|
|
|
|
channel](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
auto r = call->OnClientToServerMessage(std::move(msg), channel); |
|
|
|
|
if (r.ok()) return std::move(*r); |
|
|
|
|
call_spine->PushServerTrailingMetadata( |
|
|
|
|
ServerMetadataFromStatus(r.status())); |
|
|
|
|
return absl::nullopt; |
|
|
|
|
}); |
|
|
|
|
InterceptClientToServerMessageHandler(fn, call, channel, call_spine)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived, typename HookFunction> |
|
|
|
|
inline void InterceptClientToServerMessage(HookFunction fn, |
|
|
|
|
void (Derived::Call::* half_close)(), |
|
|
|
|
typename Derived::Call* call, |
|
|
|
|
Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientToServerMessage); |
|
|
|
|
DCHECK(half_close == &Derived::Call::OnClientToServerHalfClose); |
|
|
|
|
call_spine->client_to_server_messages().receiver.InterceptAndMapWithHalfClose( |
|
|
|
|
InterceptClientToServerMessageHandler(fn, call, channel, call_spine), |
|
|
|
|
[call]() { call->OnClientToServerHalfClose(); }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientToServerMessage(const NoInterceptor*, |
|
|
|
|
const NoInterceptor*, |
|
|
|
|
typename Derived::Call*, Derived*, |
|
|
|
|
PipeBasedCallSpine*) {} |
|
|
|
|
|
|
|
|
|
inline void InterceptClientInitialMetadata(const NoInterceptor*, void*, void*, |
|
|
|
|
PipeBasedCallSpine*) {} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientInitialMetadata( |
|
|
|
|
void (Derived::Call::*fn)(ClientMetadata& md), typename Derived::Call* call, |
|
|
|
|
Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
void (Derived::Call::* fn)(ClientMetadata& md), |
|
|
|
|
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientInitialMetadata); |
|
|
|
|
call_spine->client_initial_metadata().receiver.InterceptAndMap( |
|
|
|
|
[call](ClientMetadataHandle md) { |
|
|
|
@ -633,7 +699,7 @@ inline void InterceptClientInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientInitialMetadata( |
|
|
|
|
void (Derived::Call::*fn)(ClientMetadata& md, Derived* channel), |
|
|
|
|
void (Derived::Call::* fn)(ClientMetadata& md, Derived* channel), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientInitialMetadata); |
|
|
|
@ -646,7 +712,7 @@ inline void InterceptClientInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientInitialMetadata( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(ClientMetadata& md), |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(ClientMetadata& md), |
|
|
|
|
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientInitialMetadata); |
|
|
|
|
call_spine->client_initial_metadata().receiver.InterceptAndMap( |
|
|
|
@ -661,8 +727,8 @@ inline void InterceptClientInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientInitialMetadata( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(ClientMetadata& md, |
|
|
|
|
Derived* channel), |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(ClientMetadata& md, |
|
|
|
|
Derived* channel), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientInitialMetadata); |
|
|
|
@ -678,7 +744,7 @@ inline void InterceptClientInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientInitialMetadata( |
|
|
|
|
absl::Status (Derived::Call::*fn)(ClientMetadata& md), |
|
|
|
|
absl::Status (Derived::Call::* fn)(ClientMetadata& md), |
|
|
|
|
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientInitialMetadata); |
|
|
|
|
call_spine->client_initial_metadata().receiver.InterceptAndMap( |
|
|
|
@ -694,7 +760,7 @@ inline void InterceptClientInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptClientInitialMetadata( |
|
|
|
|
absl::Status (Derived::Call::*fn)(ClientMetadata& md, Derived* channel), |
|
|
|
|
absl::Status (Derived::Call::* fn)(ClientMetadata& md, Derived* channel), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnClientInitialMetadata); |
|
|
|
@ -714,7 +780,7 @@ inline void InterceptClientInitialMetadata( |
|
|
|
|
template <typename Promise, typename Derived> |
|
|
|
|
absl::void_t<decltype(StatusCast<ServerMetadataHandle>( |
|
|
|
|
std::declval<PromiseResult<Promise>>))> |
|
|
|
|
InterceptClientInitialMetadata(Promise (Derived::Call::*promise_factory)( |
|
|
|
|
InterceptClientInitialMetadata(Promise (Derived::Call::* promise_factory)( |
|
|
|
|
ClientMetadata& md, Derived* channel), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
@ -740,7 +806,7 @@ inline void InterceptServerInitialMetadata(const NoInterceptor*, void*, |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
void (Derived::Call::*fn)(ServerMetadata&), |
|
|
|
|
void (Derived::Call::* fn)(ServerMetadata&), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
|
call_args.server_initial_metadata->InterceptAndMap( |
|
|
|
@ -752,7 +818,7 @@ inline void InterceptServerInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
absl::Status (Derived::Call::*fn)(ServerMetadata&), |
|
|
|
|
absl::Status (Derived::Call::* fn)(ServerMetadata&), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
|
call_args.server_initial_metadata->InterceptAndMap( |
|
|
|
@ -769,7 +835,7 @@ inline void InterceptServerInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
void (Derived::Call::*fn)(ServerMetadata&, Derived*), |
|
|
|
|
void (Derived::Call::* fn)(ServerMetadata&, Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
|
call_args.server_initial_metadata->InterceptAndMap( |
|
|
|
@ -781,7 +847,7 @@ inline void InterceptServerInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
absl::Status (Derived::Call::*fn)(ServerMetadata&, Derived*), |
|
|
|
|
absl::Status (Derived::Call::* fn)(ServerMetadata&, Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
|
call_args.server_initial_metadata->InterceptAndMap( |
|
|
|
@ -802,7 +868,7 @@ inline void InterceptServerInitialMetadata(const NoInterceptor*, void*, void*, |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
void (Derived::Call::*fn)(ServerMetadata&), typename Derived::Call* call, |
|
|
|
|
void (Derived::Call::* fn)(ServerMetadata&), typename Derived::Call* call, |
|
|
|
|
Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
|
call_spine->server_initial_metadata().sender.InterceptAndMap( |
|
|
|
@ -814,7 +880,7 @@ inline void InterceptServerInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
absl::Status (Derived::Call::*fn)(ServerMetadata&), |
|
|
|
|
absl::Status (Derived::Call::* fn)(ServerMetadata&), |
|
|
|
|
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
|
call_spine->server_initial_metadata().sender.InterceptAndMap( |
|
|
|
@ -830,7 +896,7 @@ inline void InterceptServerInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
void (Derived::Call::*fn)(ServerMetadata&, Derived*), |
|
|
|
|
void (Derived::Call::* fn)(ServerMetadata&, Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
@ -843,7 +909,7 @@ inline void InterceptServerInitialMetadata( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerInitialMetadata( |
|
|
|
|
absl::Status (Derived::Call::*fn)(ServerMetadata&, Derived*), |
|
|
|
|
absl::Status (Derived::Call::* fn)(ServerMetadata&, Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerInitialMetadata); |
|
|
|
@ -863,7 +929,19 @@ inline void InterceptServerToClientMessage(const NoInterceptor*, void*, |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&), |
|
|
|
|
void (Derived::Call::* fn)(const Message&), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_args.server_to_client_messages->InterceptAndMap( |
|
|
|
|
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
call_data->call.OnServerToClientMessage(*msg); |
|
|
|
|
return std::move(msg); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_args.server_to_client_messages->InterceptAndMap( |
|
|
|
@ -878,7 +956,7 @@ inline void InterceptServerToClientMessage( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&, Derived*), |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&, Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_args.server_to_client_messages->InterceptAndMap( |
|
|
|
@ -894,7 +972,7 @@ inline void InterceptServerToClientMessage( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
MessageHandle (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
MessageHandle (Derived::Call::* fn)(MessageHandle, Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_args.server_to_client_messages->InterceptAndMap( |
|
|
|
@ -906,7 +984,8 @@ inline void InterceptServerToClientMessage( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, |
|
|
|
|
Derived*), |
|
|
|
|
FilterCallData<Derived>* call_data, const CallArgs& call_args) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_args.server_to_client_messages->InterceptAndMap( |
|
|
|
@ -925,7 +1004,19 @@ inline void InterceptServerToClientMessage(const NoInterceptor*, void*, void*, |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&), |
|
|
|
|
void (Derived::Call::* fn)(const Message&), typename Derived::Call* call, |
|
|
|
|
Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_spine->server_to_client_messages().sender.InterceptAndMap( |
|
|
|
|
[call](MessageHandle msg) -> absl::optional<MessageHandle> { |
|
|
|
|
call->OnServerToClientMessage(*msg); |
|
|
|
|
return std::move(msg); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&), |
|
|
|
|
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
|
call_spine->server_to_client_messages().sender.InterceptAndMap( |
|
|
|
@ -939,7 +1030,7 @@ inline void InterceptServerToClientMessage( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
ServerMetadataHandle (Derived::Call::*fn)(const Message&, Derived*), |
|
|
|
|
ServerMetadataHandle (Derived::Call::* fn)(const Message&, Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
@ -955,7 +1046,7 @@ inline void InterceptServerToClientMessage( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
MessageHandle (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
MessageHandle (Derived::Call::* fn)(MessageHandle, Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
@ -967,7 +1058,8 @@ inline void InterceptServerToClientMessage( |
|
|
|
|
|
|
|
|
|
template <typename Derived> |
|
|
|
|
inline void InterceptServerToClientMessage( |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*), |
|
|
|
|
absl::StatusOr<MessageHandle> (Derived::Call::* fn)(MessageHandle, |
|
|
|
|
Derived*), |
|
|
|
|
typename Derived::Call* call, Derived* channel, |
|
|
|
|
PipeBasedCallSpine* call_spine) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnServerToClientMessage); |
|
|
|
@ -1011,7 +1103,7 @@ inline void InterceptServerTrailingMetadata( |
|
|
|
|
inline void InterceptFinalize(const NoInterceptor*, void*, void*) {} |
|
|
|
|
|
|
|
|
|
template <class Call> |
|
|
|
|
inline void InterceptFinalize(void (Call::*fn)(const grpc_call_final_info*), |
|
|
|
|
inline void InterceptFinalize(void (Call::* fn)(const grpc_call_final_info*), |
|
|
|
|
void*, Call* call) { |
|
|
|
|
DCHECK(fn == &Call::OnFinalize); |
|
|
|
|
GetContext<CallFinalization>()->Add( |
|
|
|
@ -1022,7 +1114,7 @@ inline void InterceptFinalize(void (Call::*fn)(const grpc_call_final_info*), |
|
|
|
|
|
|
|
|
|
template <class Derived> |
|
|
|
|
inline void InterceptFinalize( |
|
|
|
|
void (Derived::Call::*fn)(const grpc_call_final_info*, Derived*), |
|
|
|
|
void (Derived::Call::* fn)(const grpc_call_final_info*, Derived*), |
|
|
|
|
Derived* channel, typename Derived::Call* call) { |
|
|
|
|
DCHECK(fn == &Derived::Call::OnFinalize); |
|
|
|
|
GetContext<CallFinalization>()->Add( |
|
|
|
@ -1120,7 +1212,8 @@ class ImplementChannelFilter : public ChannelFilter, |
|
|
|
|
promise_filter_detail::InterceptClientInitialMetadata( |
|
|
|
|
&Derived::Call::OnClientInitialMetadata, call, d, c); |
|
|
|
|
promise_filter_detail::InterceptClientToServerMessage( |
|
|
|
|
&Derived::Call::OnClientToServerMessage, call, d, c); |
|
|
|
|
&Derived::Call::OnClientToServerMessage, |
|
|
|
|
&Derived::Call::OnClientToServerHalfClose, call, d, c); |
|
|
|
|
promise_filter_detail::InterceptServerInitialMetadata( |
|
|
|
|
&Derived::Call::OnServerInitialMetadata, call, d, c); |
|
|
|
|
promise_filter_detail::InterceptServerToClientMessage( |
|
|
|
@ -1139,7 +1232,8 @@ class ImplementChannelFilter : public ChannelFilter, |
|
|
|
|
auto* call = promise_filter_detail::MakeFilterCall<Derived>( |
|
|
|
|
static_cast<Derived*>(this)); |
|
|
|
|
promise_filter_detail::InterceptClientToServerMessage( |
|
|
|
|
&Derived::Call::OnClientToServerMessage, call, call_args); |
|
|
|
|
&Derived::Call::OnClientToServerMessage, |
|
|
|
|
&Derived::Call::OnClientToServerHalfClose, call, call_args); |
|
|
|
|
promise_filter_detail::InterceptServerInitialMetadata( |
|
|
|
|
&Derived::Call::OnServerInitialMetadata, call, call_args); |
|
|
|
|
promise_filter_detail::InterceptServerToClientMessage( |
|
|
|
|