12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ from thrift.python.server_impl.python_async_processor cimport SerializedRequest
16
+
15
17
import asyncio
16
18
import sys
17
19
import traceback
@@ -20,16 +22,17 @@ from cpython.ref cimport PyObject
20
22
cimport cython
21
23
from cython.operator cimport dereference
22
24
from 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
24
26
from libcpp.optional cimport optional
25
27
from libcpp.pair cimport pair
28
+ from libcpp.string cimport string
26
29
from libcpp.unordered_set cimport unordered_set
27
30
from libcpp.utility cimport move as cmove
28
31
from libcpp.vector cimport vector as cvector
29
32
30
33
from folly cimport cFollyPromise, cFollyUnit, c_unit
31
34
from folly.executor cimport get_executor
32
- from folly.iobuf cimport IOBuf, from_unique_ptr
35
+ from folly.iobuf cimport IOBuf, cIOBuf, from_unique_ptr
33
36
34
37
from thrift.py3.stream cimport (
35
38
cServerStream,
@@ -43,13 +46,12 @@ from thrift.python.exceptions cimport (
43
46
cTApplicationException,
44
47
cTApplicationExceptionType__UNKNOWN,
45
48
)
46
- from thrift.python.protocol cimport Protocol
49
+ from thrift.python.protocol cimport Protocol, RpcKind
47
50
from thrift.python.serializer import serialize_iobuf
48
51
from thrift.python.server_impl.request_context cimport (
49
52
Cpp2RequestContext,
50
53
handleAddressCallback,
51
54
RequestContext,
52
- SocketAddress,
53
55
THRIFT_REQUEST_CONTEXT,
54
56
)
55
57
from thrift.python.streaming.py_promise cimport (
@@ -71,14 +73,8 @@ from thrift.python.streaming.sink cimport (
71
73
from thrift.python.types cimport ServiceInterface as cServiceInterface
72
74
73
75
74
- ctypedef unique_ptr[cIOBuf] UniqueIOBuf
75
- ctypedef cResponseAndServerStream[UniqueIOBuf, UniqueIOBuf] StreamResponse
76
- ctypedef cResponseAndSinkConsumer[UniqueIOBuf, UniqueIOBuf, UniqueIOBuf] SinkResponse
77
-
78
76
@cython.final
79
77
cdef class ServerSink_IOBuf:
80
- cdef unique_ptr[cSinkConsumer[UniqueIOBuf, UniqueIOBuf]] _cSink
81
-
82
78
@staticmethod
83
79
cdef _fbthrift_create(object sink_callback):
84
80
cdef ServerSink_IOBuf inst = ServerSink_IOBuf.__new__ (ServerSink_IOBuf)
@@ -88,8 +84,6 @@ cdef class ServerSink_IOBuf:
88
84
return inst
89
85
90
86
cdef class ResponseAndSinkConsumer:
91
- cdef unique_ptr[SinkResponse] _cResponseSink
92
-
93
87
@staticmethod
94
88
cdef _fbthrift_create(object val, object sink):
95
89
cdef ResponseAndSinkConsumer inst = ResponseAndSinkConsumer.__new__ (ResponseAndSinkConsumer)
@@ -103,8 +97,6 @@ cdef class ResponseAndSinkConsumer:
103
97
104
98
105
99
cdef class Promise_Sink(Promise_Py):
106
- cdef cFollyPromise[SinkResponse]* _cPromise
107
-
108
100
def __cinit__ (self ):
109
101
self ._cPromise = new cFollyPromise[SinkResponse](cFollyPromise[SinkResponse].makeEmpty())
110
102
@@ -129,8 +121,6 @@ cdef class Promise_Sink(Promise_Py):
129
121
return inst
130
122
131
123
cdef class Promise_Stream(Promise_Py):
132
- cdef cFollyPromise[StreamResponse]* cPromise
133
-
134
124
def __cinit__ (self ):
135
125
self .cPromise = new cFollyPromise[StreamResponse](cFollyPromise[StreamResponse].makeEmpty())
136
126
@@ -154,8 +144,6 @@ cdef class Promise_Stream(Promise_Py):
154
144
155
145
156
146
cdef class Promise_cFollyUnit(Promise_Py):
157
- cdef cFollyPromise[cFollyUnit]* cPromise
158
-
159
147
def __cinit__ (self ):
160
148
self .cPromise = new cFollyPromise[cFollyUnit](cFollyPromise[cFollyUnit].makeEmpty())
161
149
@@ -178,8 +166,6 @@ cdef class Promise_cFollyUnit(Promise_Py):
178
166
return inst
179
167
180
168
cdef class ServerStream_IOBuf(ServerStream):
181
- cdef unique_ptr[cServerStream[UniqueIOBuf]] cStream
182
-
183
169
@staticmethod
184
170
cdef _fbthrift_create(object stream):
185
171
cdef ServerStream_IOBuf inst = ServerStream_IOBuf.__new__ (ServerStream_IOBuf)
@@ -193,8 +179,6 @@ cdef class ServerStream_IOBuf(ServerStream):
193
179
return inst
194
180
195
181
cdef class ResponseAndServerStream:
196
- cdef unique_ptr[StreamResponse] cResponseStream
197
-
198
182
@staticmethod
199
183
cdef _fbthrift_create(object val, object stream):
200
184
cdef ResponseAndServerStream inst = ResponseAndServerStream.__new__ (ResponseAndServerStream)
0 commit comments