Skip to content

Commit ad92571

Browse files
sazonovkirillfacebook-github-bot
authored andcommitted
Add serviceSchemaProvider to ServiceInterceptorBase::InitParams
Reviewed By: praihan Differential Revision: D70865130 fbshipit-source-id: f67b88246f737304073c7db4d5c0e85470dd93c0
1 parent 02b872f commit ad92571

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

third-party/thrift/src/thrift/lib/cpp2/server/ServiceInterceptorBase.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
#include <variant>
2020

2121
#include <folly/coro/Task.h>
22+
#include <folly/memory/not_null.h>
2223

24+
#include <thrift/lib/cpp2/schema/SyntaxGraph.h>
2325
#include <thrift/lib/cpp2/server/ServiceInterceptorStorage.h>
2426
#include <thrift/lib/cpp2/server/metrics/InterceptorMetricCallback.h>
2527

@@ -56,7 +58,14 @@ class ServiceInterceptorBase {
5658
*/
5759
virtual const ServiceInterceptorQualifiedName& getQualifiedName() const = 0;
5860

59-
struct InitParams {};
61+
struct InitParams {
62+
#ifdef THRIFT_SCHEMA_AVAILABLE
63+
using ServiceSchema =
64+
std::vector<folly::not_null<const schema::ServiceNode*>>;
65+
ServiceSchema serviceSchema;
66+
#endif
67+
};
68+
6069
virtual folly::coro::Task<void> co_onStartServing(InitParams);
6170

6271
struct ConnectionInfo {

third-party/thrift/src/thrift/lib/cpp2/server/ThriftServer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,11 @@ void ThriftServer::callOnStartServing() {
17881788
#if FOLLY_HAS_COROUTINES
17891789
{
17901790
ServiceInterceptorBase::InitParams initParams;
1791+
#ifdef THRIFT_SCHEMA_AVAILABLE
1792+
initParams.serviceSchema =
1793+
decoratedProcessorFactory_->getServiceSchemaNodes();
1794+
#endif
1795+
17911796
std::vector<folly::coro::Task<void>> tasks;
17921797
for (const auto& interceptor : getServiceInterceptors()) {
17931798
tasks.emplace_back(interceptor->co_onStartServing(initParams));

0 commit comments

Comments
 (0)