Re-sync with internal repository
[hiphop-php.git] / third-party / thrift / src / thrift / compiler / test / fixtures / no-legacy-apis / gen-py3 / module / services_wrapper.cpp
blob516fa810343ce781d04d7d6e97dc34a3937898e0
1 /**
2 * Autogenerated by Thrift
4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5 * @generated
6 */
8 #include <src/gen-py3/module/services_wrapper.h>
9 #include <src/gen-py3/module/services_api.h>
10 #include <thrift/lib/cpp2/async/AsyncProcessor.h>
12 namespace test {
13 namespace fixtures {
14 namespace basic {
16 MyServiceWrapper::MyServiceWrapper(PyObject *obj, folly::Executor* exc)
17 : if_object(obj), executor(exc)
19 import_test__fixtures__basic__module__services();
23 void MyServiceWrapper::async_tm_query(
24 std::unique_ptr<apache::thrift::HandlerCallback<std::unique_ptr<::test::fixtures::basic::MyStruct>>> callback
25 , std::unique_ptr<::test::fixtures::basic::MyUnion> u
26 ) {
27 auto ctx = callback->getRequestContext();
28 folly::via(
29 this->executor,
30 [this, ctx,
31 callback = std::move(callback),
32 u = std::move(u) ]() mutable {
33 auto [promise, future] = folly::makePromiseContract<std::unique_ptr<::test::fixtures::basic::MyStruct>>();
34 call_cy_MyService_query(
35 this->if_object,
36 ctx,
37 std::move(promise),
38 std::move(u) );
39 std::move(future).via(this->executor).thenTry([callback = std::move(callback)](folly::Try<std::unique_ptr<::test::fixtures::basic::MyStruct>>&& t) {
40 (void)t;
41 callback->complete(std::move(t));
42 });
43 });
45 std::shared_ptr<apache::thrift::ServerInterface> MyServiceInterface(PyObject *if_object, folly::Executor *exc) {
46 return std::make_shared<MyServiceWrapper>(if_object, exc);
48 folly::SemiFuture<folly::Unit> MyServiceWrapper::semifuture_onStartServing() {
49 auto [promise, future] = folly::makePromiseContract<folly::Unit>();
50 call_cy_MyService_onStartServing(
51 this->if_object,
52 std::move(promise)
54 return std::move(future);
56 folly::SemiFuture<folly::Unit> MyServiceWrapper::semifuture_onStopRequested() {
57 auto [promise, future] = folly::makePromiseContract<folly::Unit>();
58 call_cy_MyService_onStopRequested(
59 this->if_object,
60 std::move(promise)
62 return std::move(future);
64 } // namespace test
65 } // namespace fixtures
66 } // namespace basic