1 /**
2  * Autogenerated by Thrift for src/module.thrift
3  *
4  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5  *  @generated @nocommit
6  */
7 
8 #include "thrift/compiler/test/fixtures/py3/gen-py3cpp/DerivedService.h"
9 #include "thrift/compiler/test/fixtures/py3/gen-py3cpp/DerivedService.tcc"
10 #include "thrift/compiler/test/fixtures/py3/gen-py3cpp/module_metadata.h"
11 #include <thrift/lib/cpp2/gen/service_cpp.h>
12 
13 namespace py3 { namespace simple {
getProcessor()14 std::unique_ptr<apache::thrift::AsyncProcessor> DerivedServiceSvIf::getProcessor() {
15   return std::make_unique<DerivedServiceAsyncProcessor>(this);
16 }
17 
createMethodMetadata()18 DerivedServiceSvIf::CreateMethodMetadataResult DerivedServiceSvIf::createMethodMetadata() {
19   return ::apache::thrift::detail::ap::createMethodMetadataMap<DerivedServiceAsyncProcessor>();
20 }
21 
22 
get_six()23 ::std::int32_t DerivedServiceSvIf::get_six() {
24   apache::thrift::detail::si::throw_app_exn_unimplemented("get_six");
25 }
26 
semifuture_get_six()27 folly::SemiFuture<::std::int32_t> DerivedServiceSvIf::semifuture_get_six() {
28   auto expected{apache::thrift::detail::si::InvocationType::SemiFuture};
29   __fbthrift_invocation_get_six.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::Sync, std::memory_order_relaxed);
30   return get_six();
31 }
32 
future_get_six()33 folly::Future<::std::int32_t> DerivedServiceSvIf::future_get_six() {
34   auto expected{apache::thrift::detail::si::InvocationType::Future};
35   __fbthrift_invocation_get_six.compare_exchange_strong(expected, apache::thrift::detail::si::InvocationType::SemiFuture, std::memory_order_relaxed);
36   return apache::thrift::detail::si::future(semifuture_get_six(), getInternalKeepAlive());
37 }
38 
async_tm_get_six(std::unique_ptr<apache::thrift::HandlerCallback<::std::int32_t>> callback)39 void DerivedServiceSvIf::async_tm_get_six(std::unique_ptr<apache::thrift::HandlerCallback<::std::int32_t>> callback) {
40   // It's possible the coroutine versions will delegate to a future-based
41   // version. If that happens, we need the RequestParams arguments to be
42   // available to the future through the thread-local backchannel, so we create
43   // a RAII object that sets up RequestParams and clears them on destruction.
44   apache::thrift::detail::si::AsyncTmPrep asyncTmPrep(this, callback.get());
45   auto invocationType = __fbthrift_invocation_get_six.load(std::memory_order_relaxed);
46   try {
47     switch (invocationType) {
48       case apache::thrift::detail::si::InvocationType::AsyncTm:
49       {
50         __fbthrift_invocation_get_six.compare_exchange_strong(invocationType, apache::thrift::detail::si::InvocationType::Future, std::memory_order_relaxed);
51         FOLLY_FALLTHROUGH;
52       }
53       case apache::thrift::detail::si::InvocationType::Future:
54       {
55         auto fut = future_get_six();
56         apache::thrift::detail::si::async_tm_future(std::move(callback), std::move(fut));
57         return;
58       }
59       case apache::thrift::detail::si::InvocationType::SemiFuture:
60       {
61         auto fut = semifuture_get_six();
62         apache::thrift::detail::si::async_tm_semifuture(std::move(callback), std::move(fut));
63         return;
64       }
65       case apache::thrift::detail::si::InvocationType::Sync:
66       {
67         callback->result(get_six());
68         return;
69       }
70       default:
71       {
72         folly::assume_unreachable();
73       }
74     }
75   } catch (...) {
76     callback->exception(std::current_exception());
77   }
78 }
79 
get_six()80 ::std::int32_t DerivedServiceSvNull::get_six() {
81   return 0;
82 }
83 
84 
85 
getServiceName()86 const char* DerivedServiceAsyncProcessor::getServiceName() {
87   return "DerivedService";
88 }
89 
getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse & response)90 void DerivedServiceAsyncProcessor::getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) {
91   ::apache::thrift::detail::md::ServiceMetadata<DerivedServiceSvIf>::gen(response);
92 }
93 
processSerializedCompressedRequest(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,apache::thrift::protocol::PROTOCOL_TYPES protType,apache::thrift::Cpp2RequestContext * context,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)94 void DerivedServiceAsyncProcessor::processSerializedCompressedRequest(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, apache::thrift::protocol::PROTOCOL_TYPES protType, apache::thrift::Cpp2RequestContext* context, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
95   apache::thrift::detail::ap::process(this, std::move(req), std::move(serializedRequest), protType, context, eb, tm);
96 }
97 
processSerializedCompressedRequestWithMetadata(apache::thrift::ResponseChannelRequest::UniquePtr req,apache::thrift::SerializedCompressedRequest && serializedRequest,const apache::thrift::AsyncProcessorFactory::MethodMetadata & methodMetadata,apache::thrift::protocol::PROTOCOL_TYPES protType,apache::thrift::Cpp2RequestContext * context,folly::EventBase * eb,apache::thrift::concurrency::ThreadManager * tm)98 void DerivedServiceAsyncProcessor::processSerializedCompressedRequestWithMetadata(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedCompressedRequest&& serializedRequest, const apache::thrift::AsyncProcessorFactory::MethodMetadata& methodMetadata, apache::thrift::protocol::PROTOCOL_TYPES protType, apache::thrift::Cpp2RequestContext* context, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) {
99   apache::thrift::detail::ap::process(this, std::move(req), std::move(serializedRequest), methodMetadata, protType, context, eb, tm);
100 }
101 
getOwnProcessMap()102 const DerivedServiceAsyncProcessor::ProcessMap& DerivedServiceAsyncProcessor::getOwnProcessMap() {
103   return kOwnProcessMap_;
104 }
105 
106 const DerivedServiceAsyncProcessor::ProcessMap DerivedServiceAsyncProcessor::kOwnProcessMap_ {
107   {"get_six", {&DerivedServiceAsyncProcessor::setUpAndProcess_get_six<apache::thrift::CompactProtocolReader, apache::thrift::CompactProtocolWriter>, &DerivedServiceAsyncProcessor::setUpAndProcess_get_six<apache::thrift::BinaryProtocolReader, apache::thrift::BinaryProtocolWriter>}},
108 };
109 
110 }} // py3::simple
111