1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ from thrift.python.server_impl.python_async_processor cimport SerializedRequest
16+
1517import asyncio
1618import sys
1719import traceback
@@ -20,16 +22,17 @@ from cpython.ref cimport PyObject
2022cimport cython
2123from cython.operator cimport dereference
2224from libcpp.map cimport map as cmap
23- from libcpp.memory cimport make_unique, make_shared, static_pointer_cast
25+ from libcpp.memory cimport make_unique, make_shared, static_pointer_cast, unique_ptr
2426from libcpp.optional cimport optional
2527from libcpp.pair cimport pair
28+ from libcpp.string cimport string
2629from libcpp.unordered_set cimport unordered_set
2730from libcpp.utility cimport move as cmove
2831from libcpp.vector cimport vector as cvector
2932
3033from folly cimport cFollyPromise, cFollyUnit, c_unit
3134from folly.executor cimport get_executor
32- from folly.iobuf cimport IOBuf, from_unique_ptr
35+ from folly.iobuf cimport IOBuf, cIOBuf, from_unique_ptr
3336
3437from thrift.py3.stream cimport (
3538 cServerStream,
@@ -43,13 +46,12 @@ from thrift.python.exceptions cimport (
4346 cTApplicationException,
4447 cTApplicationExceptionType__UNKNOWN,
4548)
46- from thrift.python.protocol cimport Protocol
49+ from thrift.python.protocol cimport Protocol, RpcKind
4750from thrift.python.serializer import serialize_iobuf
4851from thrift.python.server_impl.request_context cimport (
4952 Cpp2RequestContext,
5053 handleAddressCallback,
5154 RequestContext,
52- SocketAddress,
5355 THRIFT_REQUEST_CONTEXT,
5456)
5557from thrift.python.streaming.py_promise cimport (
@@ -71,14 +73,8 @@ from thrift.python.streaming.sink cimport (
7173from thrift.python.types cimport ServiceInterface as cServiceInterface
7274
7375
74- ctypedef unique_ptr[cIOBuf] UniqueIOBuf
75- ctypedef cResponseAndServerStream[UniqueIOBuf, UniqueIOBuf] StreamResponse
76- ctypedef cResponseAndSinkConsumer[UniqueIOBuf, UniqueIOBuf, UniqueIOBuf] SinkResponse
77-
7876@cython.final
7977cdef class ServerSink_IOBuf:
80- cdef unique_ptr[cSinkConsumer[UniqueIOBuf, UniqueIOBuf]] _cSink
81-
8278 @staticmethod
8379 cdef _fbthrift_create(object sink_callback):
8480 cdef ServerSink_IOBuf inst = ServerSink_IOBuf.__new__ (ServerSink_IOBuf)
@@ -88,8 +84,6 @@ cdef class ServerSink_IOBuf:
8884 return inst
8985
9086cdef class ResponseAndSinkConsumer:
91- cdef unique_ptr[SinkResponse] _cResponseSink
92-
9387 @staticmethod
9488 cdef _fbthrift_create(object val, object sink):
9589 cdef ResponseAndSinkConsumer inst = ResponseAndSinkConsumer.__new__ (ResponseAndSinkConsumer)
@@ -103,8 +97,6 @@ cdef class ResponseAndSinkConsumer:
10397
10498
10599cdef class Promise_Sink(Promise_Py):
106- cdef cFollyPromise[SinkResponse]* _cPromise
107-
108100 def __cinit__ (self ):
109101 self ._cPromise = new cFollyPromise[SinkResponse](cFollyPromise[SinkResponse].makeEmpty())
110102
@@ -129,8 +121,6 @@ cdef class Promise_Sink(Promise_Py):
129121 return inst
130122
131123cdef class Promise_Stream(Promise_Py):
132- cdef cFollyPromise[StreamResponse]* cPromise
133-
134124 def __cinit__ (self ):
135125 self .cPromise = new cFollyPromise[StreamResponse](cFollyPromise[StreamResponse].makeEmpty())
136126
@@ -154,8 +144,6 @@ cdef class Promise_Stream(Promise_Py):
154144
155145
156146cdef class Promise_cFollyUnit(Promise_Py):
157- cdef cFollyPromise[cFollyUnit]* cPromise
158-
159147 def __cinit__ (self ):
160148 self .cPromise = new cFollyPromise[cFollyUnit](cFollyPromise[cFollyUnit].makeEmpty())
161149
@@ -178,8 +166,6 @@ cdef class Promise_cFollyUnit(Promise_Py):
178166 return inst
179167
180168cdef class ServerStream_IOBuf(ServerStream):
181- cdef unique_ptr[cServerStream[UniqueIOBuf]] cStream
182-
183169 @staticmethod
184170 cdef _fbthrift_create(object stream):
185171 cdef ServerStream_IOBuf inst = ServerStream_IOBuf.__new__ (ServerStream_IOBuf)
@@ -193,8 +179,6 @@ cdef class ServerStream_IOBuf(ServerStream):
193179 return inst
194180
195181cdef class ResponseAndServerStream:
196- cdef unique_ptr[StreamResponse] cResponseStream
197-
198182 @staticmethod
199183 cdef _fbthrift_create(object val, object stream):
200184 cdef ResponseAndServerStream inst = ResponseAndServerStream.__new__ (ResponseAndServerStream)
0 commit comments