|
19 | 19 | IPROTO_TUPLE, |
20 | 20 | IPROTO_FUNCTION_NAME, |
21 | 21 | IPROTO_ITERATOR, |
| 22 | + IPROTO_SERVER_UUID, |
| 23 | + IPROTO_CLUSTER_UUID, |
| 24 | + IPROTO_VCLOCK, |
22 | 25 | IPROTO_EXPR, |
23 | 26 | REQUEST_TYPE_PING, |
24 | 27 | REQUEST_TYPE_SELECT, |
|
28 | 31 | REQUEST_TYPE_UPDATE, |
29 | 32 | REQUEST_TYPE_CALL, |
30 | 33 | REQUEST_TYPE_EVAL, |
31 | | - REQUEST_TYPE_AUTHENTICATE |
| 34 | + REQUEST_TYPE_AUTHENTICATE, |
| 35 | + REQUEST_TYPE_JOIN, |
| 36 | + REQUEST_TYPE_SUBSCRIBE |
32 | 37 | ) |
33 | 38 |
|
34 | 39 |
|
@@ -226,3 +231,35 @@ class RequestPing(Request): |
226 | 231 | def __init__(self, conn): |
227 | 232 | super(RequestPing, self).__init__(conn) |
228 | 233 | self._bytes = self.header(0) |
| 234 | + |
| 235 | +class RequestJoin(Request): |
| 236 | + |
| 237 | + ''' |
| 238 | + Represents JOIN request |
| 239 | + ''' |
| 240 | + request_type = REQUEST_TYPE_JOIN |
| 241 | + |
| 242 | + # pylint: disable=W0231 |
| 243 | + def __init__(self, conn, server_uuid): |
| 244 | + super(RequestJoin, self).__init__(conn) |
| 245 | + request_body = msgpack.dumps({ IPROTO_SERVER_UUID: server_uuid }) |
| 246 | + self._bytes = self.header(len(request_body)) + request_body |
| 247 | + |
| 248 | +class RequestSubscribe(Request): |
| 249 | + |
| 250 | + ''' |
| 251 | + Represents SUBSCRIBE request |
| 252 | + ''' |
| 253 | + request_type = REQUEST_TYPE_SUBSCRIBE |
| 254 | + |
| 255 | + # pylint: disable=W0231 |
| 256 | + def __init__(self, conn, cluster_uuid, server_uuid, vclock): |
| 257 | + super(RequestSubscribe, self).__init__(conn) |
| 258 | + assert isinstance(vclock, dict) |
| 259 | + |
| 260 | + request_body = msgpack.dumps({ |
| 261 | + IPROTO_CLUSTER_UUID: cluster_uuid, |
| 262 | + IPROTO_SERVER_UUID: server_uuid, |
| 263 | + IPROTO_VCLOCK: vclock |
| 264 | + }) |
| 265 | + self._bytes = self.header(len(request_body)) + request_body |
0 commit comments