From 636a6a3dcec38b62aba332513fded59623f9ad90 Mon Sep 17 00:00:00 2001 From: CPWstatic <13495049+CPWstatic@users.noreply.github.com> Date: Mon, 11 Oct 2021 11:48:25 +0800 Subject: [PATCH] Check client version. --- example/GraphClientSimpleExample.py | 23 +- nebula2/Exception.py | 3 + nebula2/common/constants.py | 4 +- nebula2/common/ttypes.py | 141 ++++- nebula2/fbthrift/server/TAsyncioServer.py | 4 +- nebula2/fbthrift/util/TValidator.py | 2 +- nebula2/gclient/net/Connection.py | 92 +-- nebula2/gclient/net/Session.py | 203 +------ nebula2/gclient/net/__init__.py | 2 +- nebula2/graph/GraphService-fuzzer | 2 +- nebula2/graph/GraphService-remote | 3 +- nebula2/graph/GraphService.py | 524 +++-------------- nebula2/graph/constants.py | 2 +- nebula2/graph/ttypes.py | 213 ++++++- nebula2/meta/MetaService-fuzzer | 2 +- nebula2/meta/MetaService-remote | 1 + nebula2/meta/MetaService.py | 267 ++++++++- nebula2/meta/constants.py | 2 +- nebula2/meta/ttypes.py | 273 ++++++++- nebula2/storage/GeneralStorageService-fuzzer | 2 +- nebula2/storage/GeneralStorageService.py | 2 +- nebula2/storage/GraphStorageService-fuzzer | 2 +- nebula2/storage/GraphStorageService-remote | 3 +- nebula2/storage/GraphStorageService.py | 359 ++---------- nebula2/storage/StorageAdminService-fuzzer | 2 +- nebula2/storage/StorageAdminService.py | 2 +- nebula2/storage/constants.py | 2 +- nebula2/storage/ttypes.py | 555 ++++++------------- 28 files changed, 1224 insertions(+), 1468 deletions(-) diff --git a/example/GraphClientSimpleExample.py b/example/GraphClientSimpleExample.py index c50e1dbe..7a43e13d 100644 --- a/example/GraphClientSimpleExample.py +++ b/example/GraphClientSimpleExample.py @@ -11,7 +11,6 @@ from nebula2.gclient.net import ConnectionPool from nebula2.Config import Config -from nebula2.common import * from FormatResp import print_resp if __name__ == '__main__': @@ -45,7 +44,7 @@ assert resp.is_succeeded(), resp.error_msg() # insert edges - resp = client.execute( + client.execute( 'INSERT EDGE like(likeness) VALUES "Bob"->"Lily":(80.0);') assert resp.is_succeeded(), resp.error_msg() @@ -53,28 +52,10 @@ assert resp.is_succeeded(), resp.error_msg() print_resp(resp) - bval = ttypes.Value() - bval.set_bVal(True) - ival = ttypes.Value() - ival.set_iVal(3) - sval = ttypes.Value() - sval.set_sVal("Cypher Parameter") - params={"p1":ival,"p2":bval,"p3":sval} - - # test parameter interface - resp = client.execute_parameter('RETURN abs($p1)+3, toBoolean($p2) and false, toLower($p3)+1',params) - assert resp.is_succeeded(), resp.error_msg() - print_resp(resp) - # test compatibility - resp = client.execute('RETURN 3') + resp = client.execute('FETCH PROP ON like "Bob"->"Lily"') assert resp.is_succeeded(), resp.error_msg() print_resp(resp) - # get the result in json format - resp_json = client.execute_json_with_parameter("yield 1", params) - json_obj = json.loads(resp_json) - print(json.dumps(json_obj, indent=2, sort_keys=True)) - # drop space resp = client.execute('DROP SPACE test') assert resp.is_succeeded(), resp.error_msg() diff --git a/nebula2/Exception.py b/nebula2/Exception.py index 499168b6..8ecd2ba9 100644 --- a/nebula2/Exception.py +++ b/nebula2/Exception.py @@ -79,3 +79,6 @@ def __init__(self, code=E_UNKNOWN, message=None): self.type = code self.message = message +class ClientServerIncompatibleException(Exception): + def __init__(self, message): + Exception.__init__(self, f'Current client is not compatible with remote server: {message}') diff --git a/nebula2/common/constants.py b/nebula2/common/constants.py index 4bc90db0..dbb00124 100644 --- a/nebula2/common/constants.py +++ b/nebula2/common/constants.py @@ -14,5 +14,7 @@ -from .ttypes import UTF8STRINGS, NullType, ErrorCode, SchemaID, Date, Time, DateTime, Value, NList, NMap, NSet, Row, DataSet, Tag, Vertex, Edge, Step, Path, HostAddr, KeyValue, LogInfo, DirInfo, NodeInfo, PartitionBackupInfo, CheckpointInfo, GraphSpaceID, PartitionID, TagID, EdgeType, EdgeRanking, LogID, TermID, Timestamp, IndexID, Port, SessionID, ExecutionPlanID +from .ttypes import UTF8STRINGS, NullType, ErrorCode, SchemaID, Date, Time, DateTime, Value, NList, NMap, NSet, Row, DataSet, Geography, Tag, Vertex, Edge, Step, Path, HostAddr, KeyValue, LogInfo, DirInfo, NodeInfo, PartitionBackupInfo, CheckpointInfo, GraphSpaceID, PartitionID, TagID, EdgeType, EdgeRanking, LogID, TermID, Timestamp, IndexID, Port, SessionID, ExecutionPlanID + +version = "2.6.0" diff --git a/nebula2/common/ttypes.py b/nebula2/common/ttypes.py index 0af0f0f8..d36d6974 100644 --- a/nebula2/common/ttypes.py +++ b/nebula2/common/ttypes.py @@ -16,7 +16,7 @@ import pprint import warnings -from nebula2.fbthrift import Thrift +from thrift import Thrift from nebula2.fbthrift.transport import TTransport from nebula2.fbthrift.protocol import TBinaryProtocol from nebula2.fbthrift.protocol import TCompactProtocol @@ -29,7 +29,7 @@ all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'NullType', 'ErrorCode', 'SchemaID', 'Date', 'Time', 'DateTime', 'Value', 'NList', 'NMap', 'NSet', 'Row', 'DataSet', 'Tag', 'Vertex', 'Edge', 'Step', 'Path', 'HostAddr', 'KeyValue', 'LogInfo', 'DirInfo', 'NodeInfo', 'PartitionBackupInfo', 'CheckpointInfo', 'GraphSpaceID', 'PartitionID', 'TagID', 'EdgeType', 'EdgeRanking', 'LogID', 'TermID', 'Timestamp', 'IndexID', 'Port', 'SessionID', 'ExecutionPlanID'] +__all__ = ['UTF8STRINGS', 'NullType', 'ErrorCode', 'SchemaID', 'Date', 'Time', 'DateTime', 'Value', 'NList', 'NMap', 'NSet', 'Row', 'DataSet', 'Geography', 'Tag', 'Vertex', 'Edge', 'Step', 'Path', 'HostAddr', 'KeyValue', 'LogInfo', 'DirInfo', 'NodeInfo', 'PartitionBackupInfo', 'CheckpointInfo', 'GraphSpaceID', 'PartitionID', 'TagID', 'EdgeType', 'EdgeRanking', 'LogID', 'TermID', 'Timestamp', 'IndexID', 'Port', 'SessionID', 'ExecutionPlanID'] class NullType: __NULL__ = 0 @@ -183,6 +183,7 @@ class ErrorCode: E_OUTDATED_TERM = -3071 E_OUTDATED_EDGE = -3072 E_WRITE_WRITE_CONFLICT = -3073 + E_CLIENT_SERVER_INCOMPATIBLE = -3061 E_UNKNOWN = -8000 _VALUES_TO_NAMES = { @@ -305,6 +306,7 @@ class ErrorCode: -3071: "E_OUTDATED_TERM", -3072: "E_OUTDATED_EDGE", -3073: "E_WRITE_WRITE_CONFLICT", + -3061: "E_CLIENT_SERVER_INCOMPATIBLE", -8000: "E_UNKNOWN", } @@ -428,6 +430,7 @@ class ErrorCode: "E_OUTDATED_TERM": -3071, "E_OUTDATED_EDGE": -3072, "E_WRITE_WRITE_CONFLICT": -3073, + "E_CLIENT_SERVER_INCOMPATIBLE": -3061, "E_UNKNOWN": -8000, } @@ -936,6 +939,7 @@ class Value(object): - mVal - uVal - gVal + - ggVal """ thrift_spec = None @@ -957,6 +961,7 @@ class Value(object): MVAL = 13 UVAL = 14 GVAL = 15 + GGVAL = 16 @staticmethod def isUnion(): @@ -1022,6 +1027,10 @@ def get_gVal(self): assert self.field == 15 return self.value + def get_ggVal(self): + assert self.field == 16 + return self.value + def set_nVal(self, value): self.field = 1 self.value = value @@ -1082,6 +1091,10 @@ def set_gVal(self, value): self.field = 15 self.value = value + def set_ggVal(self, value): + self.field = 16 + self.value = value + def getType(self): return self.field @@ -1148,6 +1161,10 @@ def __repr__(self): padding = ' ' * 5 value = padding.join(value.splitlines(True)) member = '\n %s=%s' % ('gVal', value) + if self.field == 16: + padding = ' ' * 6 + value = padding.join(value.splitlines(True)) + member = '\n %s=%s' % ('ggVal', value) return "%s(%s)" % (self.__class__.__name__, member) def read(self, iprot): @@ -1280,6 +1297,14 @@ def read(self, iprot): self.set_gVal(gVal) else: iprot.skip(ftype) + elif fid == 16: + if ftype == TType.STRUCT: + ggVal = Geography() + ggVal.read(iprot) + assert self.field == 0 and self.value is None + self.set_ggVal(ggVal) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1368,6 +1393,11 @@ def write(self, oprot): gVal = self.value gVal.write(oprot) oprot.writeFieldEnd() + if self.field == 16: + oprot.writeFieldBegin('ggVal', TType.STRUCT, 16) + ggVal = self.value + ggVal.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeUnionEnd() @@ -1850,6 +1880,79 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ +class Geography: + """ + Attributes: + - wkb + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.wkb = iprot.readString().decode('utf-8') if UTF8STRINGS else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('Geography') + if self.wkb != None: + oprot.writeFieldBegin('wkb', TType.STRING, 1) + oprot.writeString(self.wkb.encode('utf-8')) if UTF8STRINGS and not isinstance(self.wkb, bytes) else oprot.writeString(self.wkb) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.wkb is not None: + value = pprint.pformat(self.wkb, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' wkb=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + class Tag: """ Attributes: @@ -3262,6 +3365,7 @@ def DateTime__setstate__(self, state): (13, TType.STRUCT, 'mVal', [NMap, NMap.thrift_spec, False], None, 2, ), # 13 (14, TType.STRUCT, 'uVal', [NSet, NSet.thrift_spec, False], None, 2, ), # 14 (15, TType.STRUCT, 'gVal', [DataSet, DataSet.thrift_spec, False], None, 2, ), # 15 + (16, TType.STRUCT, 'ggVal', [Geography, Geography.thrift_spec, False], None, 2, ), # 16 ) Value.thrift_struct_annotations = { @@ -3289,9 +3393,12 @@ def DateTime__setstate__(self, state): 15: { "cpp.ref_type": "unique", }, + 16: { + "cpp.ref_type": "unique", + }, } -def Value__init__(self, nVal=None, bVal=None, iVal=None, fVal=None, sVal=None, dVal=None, tVal=None, dtVal=None, vVal=None, eVal=None, pVal=None, lVal=None, mVal=None, uVal=None, gVal=None,): +def Value__init__(self, nVal=None, bVal=None, iVal=None, fVal=None, sVal=None, dVal=None, tVal=None, dtVal=None, vVal=None, eVal=None, pVal=None, lVal=None, mVal=None, uVal=None, gVal=None, ggVal=None,): self.field = 0 self.value = None if nVal is not None: @@ -3354,6 +3461,10 @@ def Value__init__(self, nVal=None, bVal=None, iVal=None, fVal=None, sVal=None, d assert self.field == 0 and self.value is None self.field = 15 self.value = gVal + if ggVal is not None: + assert self.field == 0 and self.value is None + self.field = 16 + self.value = ggVal Value.__init__ = Value__init__ @@ -3480,6 +3591,30 @@ def DataSet__setstate__(self, state): DataSet.__getstate__ = lambda self: self.__dict__.copy() DataSet.__setstate__ = DataSet__setstate__ +all_structs.append(Geography) +Geography.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'wkb', True, None, 2, ), # 1 +) + +Geography.thrift_struct_annotations = { + "cpp.type": "nebula::Geography", +} +Geography.thrift_field_annotations = { +} + +def Geography__init__(self, wkb=None,): + self.wkb = wkb + +Geography.__init__ = Geography__init__ + +def Geography__setstate__(self, state): + state.setdefault('wkb', None) + self.__dict__ = state + +Geography.__getstate__ = lambda self: self.__dict__.copy() +Geography.__setstate__ = Geography__setstate__ + all_structs.append(Tag) Tag.thrift_spec = ( None, # 0 diff --git a/nebula2/fbthrift/server/TAsyncioServer.py b/nebula2/fbthrift/server/TAsyncioServer.py index f467e1eb..abc09376 100644 --- a/nebula2/fbthrift/server/TAsyncioServer.py +++ b/nebula2/fbthrift/server/TAsyncioServer.py @@ -69,8 +69,8 @@ async def ThriftAsyncServerFactory( ssl is an instance of ssl.SSLContext. If None (default) or False SSL/TLS is not used. - event_handler must be a subclass of nebula2.fbthrift.server.TServer. If None, - nebula2.fbthrift.server.TServer.TServerEventHandler is used. Specify a custom handler + event_handler must be a subclass of thrift.server.TServer. If None, + thrift.server.TServer.TServerEventHandler is used. Specify a custom handler for custom event handling (e.g. handling new connections) protocol_factory is a function that takes a triplet of diff --git a/nebula2/fbthrift/util/TValidator.py b/nebula2/fbthrift/util/TValidator.py index 1d437102..0bcb0bb1 100644 --- a/nebula2/fbthrift/util/TValidator.py +++ b/nebula2/fbthrift/util/TValidator.py @@ -22,7 +22,7 @@ from nebula2.fbthrift.Thrift import TType import logging -_log = logging.getLogger('nebula2.fbthrift.validator') +_log = logging.getLogger('thrift.validator') import sys if sys.version_info[0] >= 3: diff --git a/nebula2/gclient/net/Connection.py b/nebula2/gclient/net/Connection.py index 218c187d..deaac909 100644 --- a/nebula2/gclient/net/Connection.py +++ b/nebula2/gclient/net/Connection.py @@ -14,10 +14,12 @@ from nebula2.common.ttypes import ErrorCode from nebula2.graph import GraphService +from nebula2.graph.ttypes import VerifyClientVersionReq from nebula2.Exception import ( AuthFailedException, IOErrorException, + ClientServerIncompatibleException, ) from nebula2.gclient.net.AuthResult import AuthResult @@ -44,16 +46,17 @@ def open(self, ip, port, timeout): self._ip = ip self._port = port self._timeout = timeout - try: - s = TSocket.TSocket(self._ip, self._port) - if timeout > 0: - s.setTimeout(timeout) - transport = TTransport.TBufferedTransport(s) - protocol = TBinaryProtocol.TBinaryProtocol(transport) - transport.open() - self._connection = GraphService.Client(protocol) - except Exception: - raise + s = TSocket.TSocket(self._ip, self._port) + if timeout > 0: + s.setTimeout(timeout) + transport = TTransport.TBufferedTransport(s) + protocol = TBinaryProtocol.TBinaryProtocol(transport) + transport.open() + self._connection = GraphService.Client(protocol) + resp = self._connection.verifyClientVersion(VerifyClientVersionReq()) + if resp.error_code != ErrorCode.SUCCEEDED: + self._connection._iprot.trans.close() + raise ClientVersionRejectedException(resp.error_msg) def _reopen(self): """reopen the connection @@ -105,75 +108,6 @@ def execute(self, session_id, stmt): raise IOErrorException(IOErrorException.E_UNKNOWN, te.message); raise - def execute_parameter(self, session_id, stmt, params): - """execute interface with session_id and ngql - :param session_id: the session id get from result of authenticate interface - :param stmt: the ngql - :param params: parameter map - :return: ExecutionResponse - """ - try: - resp = self._connection.executeWithParameter(session_id, stmt, params) - return resp - except Exception as te: - if isinstance(te, TTransportException): - if te.message.find("timed out") > 0: - self._reopen() - raise IOErrorException(IOErrorException.E_TIMEOUT, te.message) - elif te.type == TTransportException.END_OF_FILE: - raise IOErrorException(IOErrorException.E_CONNECT_BROKEN, te.message) - elif te.type == TTransportException.NOT_OPEN: - raise IOErrorException(IOErrorException.E_NOT_OPEN, te.message) - else: - raise IOErrorException(IOErrorException.E_UNKNOWN, te.message); - raise - - def execute_json(self, session_id, stmt): - """execute_json interface with session_id and ngql - - :param session_id: the session id get from result of authenticate interface - :param stmt: the ngql - :return: string json representing the execution result - """ - try: - resp = self._connection.executeJson(session_id, stmt) - return resp - except Exception as te: - if isinstance(te, TTransportException): - if te.message.find("timed out") > 0: - self._reopen() - raise IOErrorException(IOErrorException.E_TIMEOUT, te.message) - elif te.type == TTransportException.END_OF_FILE: - raise IOErrorException(IOErrorException.E_CONNECT_BROKEN, te.message) - elif te.type == TTransportException.NOT_OPEN: - raise IOErrorException(IOErrorException.E_NOT_OPEN, te.message) - else: - raise IOErrorException(IOErrorException.E_UNKNOWN, te.message); - raise - - def execute_json_with_parameter(self, session_id, stmt, params): - """execute_json interface with session_id and ngql - - :param session_id: the session id get from result of authenticate interface - :param stmt: the ngql - :return: string json representing the execution result - """ - try: - resp = self._connection.executeJsonWithParameter(session_id, stmt) - return resp - except Exception as te: - if isinstance(te, TTransportException): - if te.message.find("timed out") > 0: - self._reopen() - raise IOErrorException(IOErrorException.E_TIMEOUT, te.message) - elif te.type == TTransportException.END_OF_FILE: - raise IOErrorException(IOErrorException.E_CONNECT_BROKEN, te.message) - elif te.type == TTransportException.NOT_OPEN: - raise IOErrorException(IOErrorException.E_NOT_OPEN, te.message) - else: - raise IOErrorException(IOErrorException.E_UNKNOWN, te.message); - raise - def signout(self, session_id): """tells the graphd can release the session info diff --git a/nebula2/gclient/net/Session.py b/nebula2/gclient/net/Session.py index 7244ea61..3c9745f5 100644 --- a/nebula2/gclient/net/Session.py +++ b/nebula2/gclient/net/Session.py @@ -38,41 +38,6 @@ def execute(self, stmt): start_time = time.time() resp = self._connection.execute(self._session_id, stmt) end_time = time.time() - return ResultSet(resp, - all_latency=int( - (end_time - start_time) * 1000000), - timezone_offset=self._timezone_offset) - except IOErrorException as ie: - if ie.type == IOErrorException.E_CONNECT_BROKEN: - self._pool.update_servers_status() - if self._retry_connect: - if not self._reconnect(): - logging.warning('Retry connect failed') - raise IOErrorException( - IOErrorException.E_ALL_BROKEN, ie.message) - resp = self._connection.execute(self._session_id, stmt) - end_time = time.time() - return ResultSet(resp, - all_latency=int( - (end_time - start_time) * 1000000), - timezone_offset=self._timezone_offset) - raise - except Exception: - raise - - def execute_parameter(self, stmt, params): - """execute statement - - :param stmt: the ngql - :param params: parameter map - :return: ResultSet - """ - if self._connection is None: - raise RuntimeError('The session has released') - try: - start_time = time.time() - resp = self._connection.execute_parameter(self._session_id, stmt, params) - end_time = time.time() return ResultSet(resp, all_latency=int((end_time - start_time) * 1000000), timezone_offset=self._timezone_offset) @@ -83,7 +48,7 @@ def execute_parameter(self, stmt, params): if not self._reconnect(): logging.warning('Retry connect failed') raise IOErrorException(IOErrorException.E_ALL_BROKEN, ie.message) - resp = self._connection.executeWithParameter(self._session_id, stmt, params) + resp = self._connection.execute(self._session_id, stmt) end_time = time.time() return ResultSet(resp, all_latency=int((end_time - start_time) * 1000000), @@ -92,172 +57,6 @@ def execute_parameter(self, stmt, params): except Exception: raise - def execute_json(self, stmt): - """execute statement and return the result as a JSON string - Date and Datetime will be returned in UTC - JSON struct: - { - "results": [ - { - "columns": [], - "data": [ - { - "row": [ - "row-data" - ], - "meta": [ - "metadata" - ] - } - ], - "latencyInUs": 0, - "spaceName": "", - "planDesc ": { - "planNodeDescs": [ - { - "name": "", - "id": 0, - "outputVar": "", - "description": { - "key": "" - }, - "profiles": [ - { - "rows": 1, - "execDurationInUs": 0, - "totalDurationInUs": 0, - "otherStats": {} - } - ], - "branchInfo": { - "isDoBranch": false, - "conditionNodeId": -1 - }, - "dependencies": [] - } - ], - "nodeIndexMap": {}, - "format": "", - "optimize_time_in_us": 0 - }, - "comment ": "" - } - ], - "errors": [ - { - "code": 0, - "message": "" - } - ] - } - - :param stmt: the ngql - :return: JSON string - """ - if self._connection is None: - raise RuntimeError('The session has released') - try: - resp_json = self._connection.execute_json(self._session_id, stmt) - return resp_json - except IOErrorException as ie: - if ie.type == IOErrorException.E_CONNECT_BROKEN: - self._pool.update_servers_status() - if self._retry_connect: - if not self._reconnect(): - logging.warning('Retry connect failed') - raise IOErrorException( - IOErrorException.E_ALL_BROKEN, ie.message) - resp_json = self._connection.execute_json( - self._session_id, stmt) - return resp_json - raise - except Exception: - raise - - - def execute_json_with_parameter(self, stmt, params): - """execute statement and return the result as a JSON string - Date and Datetime will be returned in UTC - JSON struct: - { - "results": [ - { - "columns": [], - "data": [ - { - "row": [ - "row-data" - ], - "meta": [ - "metadata" - ] - } - ], - "latencyInUs": 0, - "spaceName": "", - "planDesc ": { - "planNodeDescs": [ - { - "name": "", - "id": 0, - "outputVar": "", - "description": { - "key": "" - }, - "profiles": [ - { - "rows": 1, - "execDurationInUs": 0, - "totalDurationInUs": 0, - "otherStats": {} - } - ], - "branchInfo": { - "isDoBranch": false, - "conditionNodeId": -1 - }, - "dependencies": [] - } - ], - "nodeIndexMap": {}, - "format": "", - "optimize_time_in_us": 0 - }, - "comment ": "" - } - ], - "errors": [ - { - "code": 0, - "message": "" - } - ] - } - - :param stmt: the ngql - :param params: parameter map - :return: JSON string - """ - if self._connection is None: - raise RuntimeError('The session has released') - try: - resp_json = self._connection.execute_json_with_parameter(self._session_id, stmt, params) - return resp_json - except IOErrorException as ie: - if ie.type == IOErrorException.E_CONNECT_BROKEN: - self._pool.update_servers_status() - if self._retry_connect: - if not self._reconnect(): - logging.warning('Retry connect failed') - raise IOErrorException( - IOErrorException.E_ALL_BROKEN, ie.message) - resp_json = self._connection.execute_json_with_parameter( - self._session_id, stmt, params) - return resp_json - raise - except Exception: - raise - def release(self): """release the connection to pool, and the session couldn't been use again diff --git a/nebula2/gclient/net/__init__.py b/nebula2/gclient/net/__init__.py index 8b9667d3..790d8113 100644 --- a/nebula2/gclient/net/__init__.py +++ b/nebula2/gclient/net/__init__.py @@ -24,4 +24,4 @@ from nebula2.gclient.net.Connection import Connection from nebula2.gclient.net.ConnectionPool import ConnectionPool -logging.basicConfig(level=logging.INFO, format='[%(asctime)s]:%(message)s') +logging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(levelname)-8s [%(filename)s:%(lineno)d]:%(message)s') diff --git a/nebula2/graph/GraphService-fuzzer b/nebula2/graph/GraphService-fuzzer index b8c07170..1857e335 100755 --- a/nebula2/graph/GraphService-fuzzer +++ b/nebula2/graph/GraphService-fuzzer @@ -42,4 +42,4 @@ from . import ttypes from . import constants import nebula2.fbthrift.util.fuzzer -nebula2.fbthrift.util.fuzzer.fuzz_service(GraphService, ttypes, constants) +thrift.util.fuzzer.fuzz_service(GraphService, ttypes, constants) diff --git a/nebula2/graph/GraphService-remote b/nebula2/graph/GraphService-remote index e34b504d..3b88e261 100755 --- a/nebula2/graph/GraphService-remote +++ b/nebula2/graph/GraphService-remote @@ -45,9 +45,8 @@ FUNCTIONS = { 'authenticate': Function('authenticate', 'GraphService', 'AuthResponse', [('binary', 'username', 'binary'), ('binary', 'password', 'binary')]), 'signout': Function('signout', 'GraphService', None, [('i64', 'sessionId', 'i64')]), 'execute': Function('execute', 'GraphService', 'ExecutionResponse', [('i64', 'sessionId', 'i64'), ('binary', 'stmt', 'binary')]), - 'executeWithParameter': Function('executeWithParameter', 'GraphService', 'ExecutionResponse', [('i64', 'sessionId', 'i64'), ('binary', 'stmt', 'binary'), ('map', 'parameterMap', 'map')]), 'executeJson': Function('executeJson', 'GraphService', 'binary', [('i64', 'sessionId', 'i64'), ('binary', 'stmt', 'binary')]), - 'executeJsonWithParameter': Function('executeJsonWithParameter', 'GraphService', 'binary', [('i64', 'sessionId', 'i64'), ('binary', 'stmt', 'binary'), ('map', 'parameterMap', 'map')]), + 'verifyClientVersion': Function('verifyClientVersion', 'GraphService', 'VerifyClientVersionResp', [('VerifyClientVersionReq', 'req', 'VerifyClientVersionReq')]), } SERVICE_NAMES = ['GraphService', ] diff --git a/nebula2/graph/GraphService.py b/nebula2/graph/GraphService.py index eac116ab..f79a025c 100644 --- a/nebula2/graph/GraphService.py +++ b/nebula2/graph/GraphService.py @@ -13,13 +13,13 @@ from nebula2.fbthrift.protocol.TProtocol import TProtocolException -from .ttypes import UTF8STRINGS, ProfilingStats, PlanNodeBranchInfo, Pair, PlanNodeDescription, PlanDescription, ExecutionResponse, AuthResponse +from .ttypes import UTF8STRINGS, ProfilingStats, PlanNodeBranchInfo, Pair, PlanNodeDescription, PlanDescription, ExecutionResponse, AuthResponse, VerifyClientVersionResp, VerifyClientVersionReq import nebula2.common.ttypes from nebula2.fbthrift.Thrift import TProcessor import pprint import warnings -from nebula2.fbthrift import Thrift +from thrift import Thrift from nebula2.fbthrift.transport import TTransport from nebula2.fbthrift.protocol import TBinaryProtocol from nebula2.fbthrift.protocol import TCompactProtocol @@ -66,15 +66,6 @@ def execute(self, sessionId=None, stmt=None): """ pass - def executeWithParameter(self, sessionId=None, stmt=None, parameterMap=None): - """ - Parameters: - - sessionId - - stmt - - parameterMap - """ - pass - def executeJson(self, sessionId=None, stmt=None): """ Parameters: @@ -83,12 +74,10 @@ def executeJson(self, sessionId=None, stmt=None): """ pass - def executeJsonWithParameter(self, sessionId=None, stmt=None, parameterMap=None): + def verifyClientVersion(self, req=None): """ Parameters: - - sessionId - - stmt - - parameterMap + - req """ pass @@ -117,15 +106,6 @@ def execute(self, handler_ctx, sessionId=None, stmt=None): """ pass - def executeWithParameter(self, handler_ctx, sessionId=None, stmt=None, parameterMap=None): - """ - Parameters: - - sessionId - - stmt - - parameterMap - """ - pass - def executeJson(self, handler_ctx, sessionId=None, stmt=None): """ Parameters: @@ -134,12 +114,10 @@ def executeJson(self, handler_ctx, sessionId=None, stmt=None): """ pass - def executeJsonWithParameter(self, handler_ctx, sessionId=None, stmt=None, parameterMap=None): + def verifyClientVersion(self, handler_ctx, req=None): """ Parameters: - - sessionId - - stmt - - parameterMap + - req """ pass @@ -660,250 +638,6 @@ def execute_result__setstate__(self, state): execute_result.__getstate__ = lambda self: self.__dict__.copy() execute_result.__setstate__ = execute_result__setstate__ -class executeWithParameter_args: - """ - Attributes: - - sessionId - - stmt - - parameterMap - """ - - thrift_spec = None - thrift_field_annotations = None - thrift_struct_annotations = None - __init__ = None - @staticmethod - def isUnion(): - return False - - def read(self, iprot): - if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) - return - if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) - return - iprot.readStructBegin() - while True: - (fname, ftype, fid) = iprot.readFieldBegin() - if ftype == TType.STOP: - break - if fid == 1: - if ftype == TType.I64: - self.sessionId = iprot.readI64() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRING: - self.stmt = iprot.readString() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.MAP: - self.parameterMap = {} - (_ktype55, _vtype56, _size54 ) = iprot.readMapBegin() - if _size54 >= 0: - for _i58 in six.moves.range(_size54): - _key59 = iprot.readString() - _val60 = nebula2.common.ttypes.Value() - _val60.read(iprot) - self.parameterMap[_key59] = _val60 - else: - while iprot.peekMap(): - _key61 = iprot.readString() - _val62 = nebula2.common.ttypes.Value() - _val62.read(iprot) - self.parameterMap[_key61] = _val62 - iprot.readMapEnd() - else: - iprot.skip(ftype) - else: - iprot.skip(ftype) - iprot.readFieldEnd() - iprot.readStructEnd() - - def write(self, oprot): - if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) - return - if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) - return - oprot.writeStructBegin('executeWithParameter_args') - if self.sessionId != None: - oprot.writeFieldBegin('sessionId', TType.I64, 1) - oprot.writeI64(self.sessionId) - oprot.writeFieldEnd() - if self.stmt != None: - oprot.writeFieldBegin('stmt', TType.STRING, 2) - oprot.writeString(self.stmt) - oprot.writeFieldEnd() - if self.parameterMap != None: - oprot.writeFieldBegin('parameterMap', TType.MAP, 3) - oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(self.parameterMap)) - for kiter63,viter64 in self.parameterMap.items(): - oprot.writeString(kiter63) - viter64.write(oprot) - oprot.writeMapEnd() - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def __repr__(self): - L = [] - padding = ' ' * 4 - if self.sessionId is not None: - value = pprint.pformat(self.sessionId, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' sessionId=%s' % (value)) - if self.stmt is not None: - value = pprint.pformat(self.stmt, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' stmt=%s' % (value)) - if self.parameterMap is not None: - value = pprint.pformat(self.parameterMap, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' parameterMap=%s' % (value)) - return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - return not (self == other) - - # Override the __hash__ function for Python3 - t10434117 - if not six.PY2: - __hash__ = object.__hash__ - -all_structs.append(executeWithParameter_args) -executeWithParameter_args.thrift_spec = ( - None, # 0 - (1, TType.I64, 'sessionId', None, None, 2, ), # 1 - (2, TType.STRING, 'stmt', False, None, 2, ), # 2 - (3, TType.MAP, 'parameterMap', (TType.STRING,False,TType.STRUCT,[nebula2.common.ttypes.Value, nebula2.common.ttypes.Value.thrift_spec, True]), None, 2, ), # 3 -) - -executeWithParameter_args.thrift_struct_annotations = { -} -executeWithParameter_args.thrift_field_annotations = { -} - -def executeWithParameter_args__init__(self, sessionId=None, stmt=None, parameterMap=None,): - self.sessionId = sessionId - self.stmt = stmt - self.parameterMap = parameterMap - -executeWithParameter_args.__init__ = executeWithParameter_args__init__ - -def executeWithParameter_args__setstate__(self, state): - state.setdefault('sessionId', None) - state.setdefault('stmt', None) - state.setdefault('parameterMap', None) - self.__dict__ = state - -executeWithParameter_args.__getstate__ = lambda self: self.__dict__.copy() -executeWithParameter_args.__setstate__ = executeWithParameter_args__setstate__ - -class executeWithParameter_result: - """ - Attributes: - - success - """ - - thrift_spec = None - thrift_field_annotations = None - thrift_struct_annotations = None - __init__ = None - @staticmethod - def isUnion(): - return False - - def read(self, iprot): - if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) - return - if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) - return - iprot.readStructBegin() - while True: - (fname, ftype, fid) = iprot.readFieldBegin() - if ftype == TType.STOP: - break - if fid == 0: - if ftype == TType.STRUCT: - self.success = ExecutionResponse() - self.success.read(iprot) - else: - iprot.skip(ftype) - else: - iprot.skip(ftype) - iprot.readFieldEnd() - iprot.readStructEnd() - - def write(self, oprot): - if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) - return - if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) - return - oprot.writeStructBegin('executeWithParameter_result') - if self.success != None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def __repr__(self): - L = [] - padding = ' ' * 4 - if self.success is not None: - value = pprint.pformat(self.success, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' success=%s' % (value)) - return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - return not (self == other) - - # Override the __hash__ function for Python3 - t10434117 - if not six.PY2: - __hash__ = object.__hash__ - -all_structs.append(executeWithParameter_result) -executeWithParameter_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [ExecutionResponse, ExecutionResponse.thrift_spec, False], None, 2, ), # 0 -) - -executeWithParameter_result.thrift_struct_annotations = { -} -executeWithParameter_result.thrift_field_annotations = { -} - -def executeWithParameter_result__init__(self, success=None,): - self.success = success - -executeWithParameter_result.__init__ = executeWithParameter_result__init__ - -def executeWithParameter_result__setstate__(self, state): - state.setdefault('success', None) - self.__dict__ = state - -executeWithParameter_result.__getstate__ = lambda self: self.__dict__.copy() -executeWithParameter_result.__setstate__ = executeWithParameter_result__setstate__ - class executeJson_args: """ Attributes: @@ -1112,12 +846,10 @@ def executeJson_result__setstate__(self, state): executeJson_result.__getstate__ = lambda self: self.__dict__.copy() executeJson_result.__setstate__ = executeJson_result__setstate__ -class executeJsonWithParameter_args: +class verifyClientVersion_args: """ Attributes: - - sessionId - - stmt - - parameterMap + - req """ thrift_spec = None @@ -1141,32 +873,9 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 1: - if ftype == TType.I64: - self.sessionId = iprot.readI64() - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRING: - self.stmt = iprot.readString() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.MAP: - self.parameterMap = {} - (_ktype66, _vtype67, _size65 ) = iprot.readMapBegin() - if _size65 >= 0: - for _i69 in six.moves.range(_size65): - _key70 = iprot.readString() - _val71 = nebula2.common.ttypes.Value() - _val71.read(iprot) - self.parameterMap[_key70] = _val71 - else: - while iprot.peekMap(): - _key72 = iprot.readString() - _val73 = nebula2.common.ttypes.Value() - _val73.read(iprot) - self.parameterMap[_key72] = _val73 - iprot.readMapEnd() + if ftype == TType.STRUCT: + self.req = VerifyClientVersionReq() + self.req.read(iprot) else: iprot.skip(ftype) else: @@ -1181,22 +890,10 @@ def write(self, oprot): if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return - oprot.writeStructBegin('executeJsonWithParameter_args') - if self.sessionId != None: - oprot.writeFieldBegin('sessionId', TType.I64, 1) - oprot.writeI64(self.sessionId) - oprot.writeFieldEnd() - if self.stmt != None: - oprot.writeFieldBegin('stmt', TType.STRING, 2) - oprot.writeString(self.stmt) - oprot.writeFieldEnd() - if self.parameterMap != None: - oprot.writeFieldBegin('parameterMap', TType.MAP, 3) - oprot.writeMapBegin(TType.STRING, TType.STRUCT, len(self.parameterMap)) - for kiter74,viter75 in self.parameterMap.items(): - oprot.writeString(kiter74) - viter75.write(oprot) - oprot.writeMapEnd() + oprot.writeStructBegin('verifyClientVersion_args') + if self.req != None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1204,18 +901,10 @@ def write(self, oprot): def __repr__(self): L = [] padding = ' ' * 4 - if self.sessionId is not None: - value = pprint.pformat(self.sessionId, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' sessionId=%s' % (value)) - if self.stmt is not None: - value = pprint.pformat(self.stmt, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' stmt=%s' % (value)) - if self.parameterMap is not None: - value = pprint.pformat(self.parameterMap, indent=0) + if self.req is not None: + value = pprint.pformat(self.req, indent=0) value = padding.join(value.splitlines(True)) - L.append(' parameterMap=%s' % (value)) + L.append(' req=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -1231,36 +920,30 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -all_structs.append(executeJsonWithParameter_args) -executeJsonWithParameter_args.thrift_spec = ( +all_structs.append(verifyClientVersion_args) +verifyClientVersion_args.thrift_spec = ( None, # 0 - (1, TType.I64, 'sessionId', None, None, 2, ), # 1 - (2, TType.STRING, 'stmt', False, None, 2, ), # 2 - (3, TType.MAP, 'parameterMap', (TType.STRING,False,TType.STRUCT,[nebula2.common.ttypes.Value, nebula2.common.ttypes.Value.thrift_spec, True]), None, 2, ), # 3 + (1, TType.STRUCT, 'req', [VerifyClientVersionReq, VerifyClientVersionReq.thrift_spec, False], None, 2, ), # 1 ) -executeJsonWithParameter_args.thrift_struct_annotations = { +verifyClientVersion_args.thrift_struct_annotations = { } -executeJsonWithParameter_args.thrift_field_annotations = { +verifyClientVersion_args.thrift_field_annotations = { } -def executeJsonWithParameter_args__init__(self, sessionId=None, stmt=None, parameterMap=None,): - self.sessionId = sessionId - self.stmt = stmt - self.parameterMap = parameterMap +def verifyClientVersion_args__init__(self, req=None,): + self.req = req -executeJsonWithParameter_args.__init__ = executeJsonWithParameter_args__init__ +verifyClientVersion_args.__init__ = verifyClientVersion_args__init__ -def executeJsonWithParameter_args__setstate__(self, state): - state.setdefault('sessionId', None) - state.setdefault('stmt', None) - state.setdefault('parameterMap', None) +def verifyClientVersion_args__setstate__(self, state): + state.setdefault('req', None) self.__dict__ = state -executeJsonWithParameter_args.__getstate__ = lambda self: self.__dict__.copy() -executeJsonWithParameter_args.__setstate__ = executeJsonWithParameter_args__setstate__ +verifyClientVersion_args.__getstate__ = lambda self: self.__dict__.copy() +verifyClientVersion_args.__setstate__ = verifyClientVersion_args__setstate__ -class executeJsonWithParameter_result: +class verifyClientVersion_result: """ Attributes: - success @@ -1287,8 +970,9 @@ def read(self, iprot): if ftype == TType.STOP: break if fid == 0: - if ftype == TType.STRING: - self.success = iprot.readString() + if ftype == TType.STRUCT: + self.success = VerifyClientVersionResp() + self.success.read(iprot) else: iprot.skip(ftype) else: @@ -1303,10 +987,10 @@ def write(self, oprot): if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return - oprot.writeStructBegin('executeJsonWithParameter_result') + oprot.writeStructBegin('verifyClientVersion_result') if self.success != None: - oprot.writeFieldBegin('success', TType.STRING, 0) - oprot.writeString(self.success) + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -1333,27 +1017,27 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -all_structs.append(executeJsonWithParameter_result) -executeJsonWithParameter_result.thrift_spec = ( - (0, TType.STRING, 'success', False, None, 2, ), # 0 +all_structs.append(verifyClientVersion_result) +verifyClientVersion_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [VerifyClientVersionResp, VerifyClientVersionResp.thrift_spec, False], None, 2, ), # 0 ) -executeJsonWithParameter_result.thrift_struct_annotations = { +verifyClientVersion_result.thrift_struct_annotations = { } -executeJsonWithParameter_result.thrift_field_annotations = { +verifyClientVersion_result.thrift_field_annotations = { } -def executeJsonWithParameter_result__init__(self, success=None,): +def verifyClientVersion_result__init__(self, success=None,): self.success = success -executeJsonWithParameter_result.__init__ = executeJsonWithParameter_result__init__ +verifyClientVersion_result.__init__ = verifyClientVersion_result__init__ -def executeJsonWithParameter_result__setstate__(self, state): +def verifyClientVersion_result__setstate__(self, state): state.setdefault('success', None) self.__dict__ = state -executeJsonWithParameter_result.__getstate__ = lambda self: self.__dict__.copy() -executeJsonWithParameter_result.__setstate__ = executeJsonWithParameter_result__setstate__ +verifyClientVersion_result.__getstate__ = lambda self: self.__dict__.copy() +verifyClientVersion_result.__setstate__ = verifyClientVersion_result__setstate__ class Client(Iface): def __enter__(self): @@ -1448,40 +1132,6 @@ def recv_execute(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "execute failed: unknown result"); - def executeWithParameter(self, sessionId=None, stmt=None, parameterMap=None): - """ - Parameters: - - sessionId - - stmt - - parameterMap - """ - self.send_executeWithParameter(sessionId, stmt, parameterMap) - return self.recv_executeWithParameter() - - def send_executeWithParameter(self, sessionId=None, stmt=None, parameterMap=None): - self._oprot.writeMessageBegin('executeWithParameter', TMessageType.CALL, self._seqid) - args = executeWithParameter_args() - args.sessionId = sessionId - args.stmt = stmt - args.parameterMap = parameterMap - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_executeWithParameter(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = executeWithParameter_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success != None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "executeWithParameter failed: unknown result"); - def executeJson(self, sessionId=None, stmt=None): """ Parameters: @@ -1514,39 +1164,35 @@ def recv_executeJson(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "executeJson failed: unknown result"); - def executeJsonWithParameter(self, sessionId=None, stmt=None, parameterMap=None): + def verifyClientVersion(self, req=None): """ Parameters: - - sessionId - - stmt - - parameterMap + - req """ - self.send_executeJsonWithParameter(sessionId, stmt, parameterMap) - return self.recv_executeJsonWithParameter() + self.send_verifyClientVersion(req) + return self.recv_verifyClientVersion() - def send_executeJsonWithParameter(self, sessionId=None, stmt=None, parameterMap=None): - self._oprot.writeMessageBegin('executeJsonWithParameter', TMessageType.CALL, self._seqid) - args = executeJsonWithParameter_args() - args.sessionId = sessionId - args.stmt = stmt - args.parameterMap = parameterMap + def send_verifyClientVersion(self, req=None): + self._oprot.writeMessageBegin('verifyClientVersion', TMessageType.CALL, self._seqid) + args = verifyClientVersion_args() + args.req = req args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_executeJsonWithParameter(self, ): + def recv_verifyClientVersion(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x - result = executeJsonWithParameter_result() + result = verifyClientVersion_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "executeJsonWithParameter failed: unknown result"); + raise TApplicationException(TApplicationException.MISSING_RESULT, "verifyClientVersion failed: unknown result"); class Processor(Iface, TProcessor): @@ -1563,12 +1209,10 @@ def __init__(self, handler): self._priorityMap["signout"] = TPriority.NORMAL self._processMap["execute"] = Processor.process_execute self._priorityMap["execute"] = TPriority.NORMAL - self._processMap["executeWithParameter"] = Processor.process_executeWithParameter - self._priorityMap["executeWithParameter"] = TPriority.NORMAL self._processMap["executeJson"] = Processor.process_executeJson self._priorityMap["executeJson"] = TPriority.NORMAL - self._processMap["executeJsonWithParameter"] = Processor.process_executeJsonWithParameter - self._priorityMap["executeJsonWithParameter"] = TPriority.NORMAL + self._processMap["verifyClientVersion"] = Processor.process_verifyClientVersion + self._priorityMap["verifyClientVersion"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -1609,17 +1253,6 @@ def process_execute(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(executeWithParameter_args, oneway=False) - def process_executeWithParameter(self, args, handler_ctx): - result = executeWithParameter_result() - try: - result.success = self._handler.executeWithParameter(args.sessionId, args.stmt, args.parameterMap) - except: - ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'executeWithParameter', ex) - result = Thrift.TApplicationException(message=repr(ex)) - return result - @thrift_process_method(executeJson_args, oneway=False) def process_executeJson(self, args, handler_ctx): result = executeJson_result() @@ -1631,14 +1264,14 @@ def process_executeJson(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(executeJsonWithParameter_args, oneway=False) - def process_executeJsonWithParameter(self, args, handler_ctx): - result = executeJsonWithParameter_result() + @thrift_process_method(verifyClientVersion_args, oneway=False) + def process_verifyClientVersion(self, args, handler_ctx): + result = verifyClientVersion_result() try: - result.success = self._handler.executeJsonWithParameter(args.sessionId, args.stmt, args.parameterMap) + result.success = self._handler.verifyClientVersion(args.req) except: ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'executeJsonWithParameter', ex) + self._event_handler.handlerError(handler_ctx, 'verifyClientVersion', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @@ -1658,12 +1291,10 @@ def __init__(self, handler): self._priorityMap["signout"] = TPriority.NORMAL self._processMap["execute"] = ContextProcessor.process_execute self._priorityMap["execute"] = TPriority.NORMAL - self._processMap["executeWithParameter"] = ContextProcessor.process_executeWithParameter - self._priorityMap["executeWithParameter"] = TPriority.NORMAL self._processMap["executeJson"] = ContextProcessor.process_executeJson self._priorityMap["executeJson"] = TPriority.NORMAL - self._processMap["executeJsonWithParameter"] = ContextProcessor.process_executeJsonWithParameter - self._priorityMap["executeJsonWithParameter"] = TPriority.NORMAL + self._processMap["verifyClientVersion"] = ContextProcessor.process_verifyClientVersion + self._priorityMap["verifyClientVersion"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -1704,17 +1335,6 @@ def process_execute(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(executeWithParameter_args, oneway=False) - def process_executeWithParameter(self, args, handler_ctx): - result = executeWithParameter_result() - try: - result.success = self._handler.executeWithParameter(handler_ctx, args.sessionId, args.stmt, args.parameterMap) - except: - ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'executeWithParameter', ex) - result = Thrift.TApplicationException(message=repr(ex)) - return result - @thrift_process_method(executeJson_args, oneway=False) def process_executeJson(self, args, handler_ctx): result = executeJson_result() @@ -1726,14 +1346,14 @@ def process_executeJson(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(executeJsonWithParameter_args, oneway=False) - def process_executeJsonWithParameter(self, args, handler_ctx): - result = executeJsonWithParameter_result() + @thrift_process_method(verifyClientVersion_args, oneway=False) + def process_verifyClientVersion(self, args, handler_ctx): + result = verifyClientVersion_result() try: - result.success = self._handler.executeJsonWithParameter(handler_ctx, args.sessionId, args.stmt, args.parameterMap) + result.success = self._handler.verifyClientVersion(handler_ctx, args.req) except: ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'executeJsonWithParameter', ex) + self._event_handler.handlerError(handler_ctx, 'verifyClientVersion', ex) result = Thrift.TApplicationException(message=repr(ex)) return result diff --git a/nebula2/graph/constants.py b/nebula2/graph/constants.py index fa06a708..9055e7c4 100644 --- a/nebula2/graph/constants.py +++ b/nebula2/graph/constants.py @@ -16,5 +16,5 @@ import nebula2.common.ttypes -from .ttypes import UTF8STRINGS, ProfilingStats, PlanNodeBranchInfo, Pair, PlanNodeDescription, PlanDescription, ExecutionResponse, AuthResponse +from .ttypes import UTF8STRINGS, ProfilingStats, PlanNodeBranchInfo, Pair, PlanNodeDescription, PlanDescription, ExecutionResponse, AuthResponse, VerifyClientVersionResp, VerifyClientVersionReq diff --git a/nebula2/graph/ttypes.py b/nebula2/graph/ttypes.py index 416e0d60..15a058c9 100644 --- a/nebula2/graph/ttypes.py +++ b/nebula2/graph/ttypes.py @@ -18,7 +18,7 @@ import pprint import warnings -from nebula2.fbthrift import Thrift +from thrift import Thrift from nebula2.fbthrift.transport import TTransport from nebula2.fbthrift.protocol import TBinaryProtocol from nebula2.fbthrift.protocol import TCompactProtocol @@ -31,7 +31,7 @@ all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'ProfilingStats', 'PlanNodeBranchInfo', 'Pair', 'PlanNodeDescription', 'PlanDescription', 'ExecutionResponse', 'AuthResponse'] +__all__ = ['UTF8STRINGS', 'ProfilingStats', 'PlanNodeBranchInfo', 'Pair', 'PlanNodeDescription', 'PlanDescription', 'ExecutionResponse', 'AuthResponse', 'VerifyClientVersionResp', 'VerifyClientVersionReq'] class ProfilingStats: """ @@ -973,6 +973,166 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ +class VerifyClientVersionResp: + """ + Attributes: + - error_code + - error_msg + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.error_code = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.error_msg = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('VerifyClientVersionResp') + if self.error_code != None: + oprot.writeFieldBegin('error_code', TType.I32, 1) + oprot.writeI32(self.error_code) + oprot.writeFieldEnd() + if self.error_msg != None: + oprot.writeFieldBegin('error_msg', TType.STRING, 2) + oprot.writeString(self.error_msg) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.error_code is not None: + value = pprint.pformat(self.error_code, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' error_code=%s' % (value)) + if self.error_msg is not None: + value = pprint.pformat(self.error_msg, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' error_msg=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + +class VerifyClientVersionReq: + """ + Attributes: + - version + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.version = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('VerifyClientVersionReq') + if self.version != None: + oprot.writeFieldBegin('version', TType.STRING, 1) + oprot.writeString(self.version) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.version is not None: + value = pprint.pformat(self.version, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' version=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + all_structs.append(ProfilingStats) ProfilingStats.thrift_spec = ( None, # 0 @@ -1213,5 +1373,54 @@ def AuthResponse__setstate__(self, state): AuthResponse.__getstate__ = lambda self: self.__dict__.copy() AuthResponse.__setstate__ = AuthResponse__setstate__ +all_structs.append(VerifyClientVersionResp) +VerifyClientVersionResp.thrift_spec = ( + None, # 0 + (1, TType.I32, 'error_code', nebula2.common.ttypes.ErrorCode, None, 0, ), # 1 + (2, TType.STRING, 'error_msg', False, None, 1, ), # 2 +) + +VerifyClientVersionResp.thrift_struct_annotations = { +} +VerifyClientVersionResp.thrift_field_annotations = { +} + +def VerifyClientVersionResp__init__(self, error_code=None, error_msg=None,): + self.error_code = error_code + self.error_msg = error_msg + +VerifyClientVersionResp.__init__ = VerifyClientVersionResp__init__ + +def VerifyClientVersionResp__setstate__(self, state): + state.setdefault('error_code', None) + state.setdefault('error_msg', None) + self.__dict__ = state + +VerifyClientVersionResp.__getstate__ = lambda self: self.__dict__.copy() +VerifyClientVersionResp.__setstate__ = VerifyClientVersionResp__setstate__ + +all_structs.append(VerifyClientVersionReq) +VerifyClientVersionReq.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'version', False, "2.6.0", 0, ), # 1 +) + +VerifyClientVersionReq.thrift_struct_annotations = { +} +VerifyClientVersionReq.thrift_field_annotations = { +} + +def VerifyClientVersionReq__init__(self, version=VerifyClientVersionReq.thrift_spec[1][4],): + self.version = version + +VerifyClientVersionReq.__init__ = VerifyClientVersionReq__init__ + +def VerifyClientVersionReq__setstate__(self, state): + state.setdefault('version', "2.6.0") + self.__dict__ = state + +VerifyClientVersionReq.__getstate__ = lambda self: self.__dict__.copy() +VerifyClientVersionReq.__setstate__ = VerifyClientVersionReq__setstate__ + fix_spec(all_structs) del all_structs diff --git a/nebula2/meta/MetaService-fuzzer b/nebula2/meta/MetaService-fuzzer index 669090c3..cb23ff5c 100755 --- a/nebula2/meta/MetaService-fuzzer +++ b/nebula2/meta/MetaService-fuzzer @@ -42,4 +42,4 @@ from . import ttypes from . import constants import nebula2.fbthrift.util.fuzzer -nebula2.fbthrift.util.fuzzer.fuzz_service(MetaService, ttypes, constants) +thrift.util.fuzzer.fuzz_service(MetaService, ttypes, constants) diff --git a/nebula2/meta/MetaService-remote b/nebula2/meta/MetaService-remote index cc2eab49..c8366d48 100755 --- a/nebula2/meta/MetaService-remote +++ b/nebula2/meta/MetaService-remote @@ -131,6 +131,7 @@ FUNCTIONS = { 'reportTaskFinish': Function('reportTaskFinish', 'MetaService', 'ExecResp', [('ReportTaskReq', 'req', 'ReportTaskReq')]), 'listCluster': Function('listCluster', 'MetaService', 'ListClusterInfoResp', [('ListClusterInfoReq', 'req', 'ListClusterInfoReq')]), 'getMetaDirInfo': Function('getMetaDirInfo', 'MetaService', 'GetMetaDirInfoResp', [('GetMetaDirInfoReq', 'req', 'GetMetaDirInfoReq')]), + 'verifyClientVersion': Function('verifyClientVersion', 'MetaService', 'VerifyClientVersionResp', [('VerifyClientVersionReq', 'req', 'VerifyClientVersionReq')]), } SERVICE_NAMES = ['MetaService', ] diff --git a/nebula2/meta/MetaService.py b/nebula2/meta/MetaService.py index b18cae26..ffc8d4e6 100644 --- a/nebula2/meta/MetaService.py +++ b/nebula2/meta/MetaService.py @@ -13,13 +13,13 @@ from nebula2.fbthrift.protocol.TProtocol import TProtocolException -from .ttypes import UTF8STRINGS, AlterSchemaOp, RoleType, PropertyType, IsolationLevel, HostStatus, SnapshotStatus, AdminJobOp, AdminCmd, JobStatus, ListHostType, HostRole, TaskResult, ConfigModule, ConfigMode, ListenerType, FTServiceType, QueryStatus, ID, ColumnTypeDef, ColumnDef, SchemaProp, Schema, IdName, SpaceDesc, SpaceItem, TagItem, AlterSchemaItem, EdgeItem, IndexItem, HostItem, UserItem, RoleItem, ExecResp, AdminJobReq, JobDesc, TaskDesc, AdminJobResult, AdminJobResp, Correlativity, StatsItem, CreateSpaceReq, CreateSpaceAsReq, DropSpaceReq, ListSpacesReq, ListSpacesResp, GetSpaceReq, GetSpaceResp, CreateTagReq, AlterTagReq, DropTagReq, ListTagsReq, ListTagsResp, GetTagReq, GetTagResp, CreateEdgeReq, AlterEdgeReq, GetEdgeReq, GetEdgeResp, DropEdgeReq, ListEdgesReq, ListEdgesResp, ListHostsReq, ListHostsResp, PartItem, ListPartsReq, ListPartsResp, GetPartsAllocReq, GetPartsAllocResp, MultiPutReq, GetReq, GetResp, MultiGetReq, MultiGetResp, RemoveReq, RemoveRangeReq, ScanReq, ScanResp, HBResp, LeaderInfo, HBReq, IndexFieldDef, CreateTagIndexReq, DropTagIndexReq, GetTagIndexReq, GetTagIndexResp, ListTagIndexesReq, ListTagIndexesResp, CreateEdgeIndexReq, DropEdgeIndexReq, GetEdgeIndexReq, GetEdgeIndexResp, ListEdgeIndexesReq, ListEdgeIndexesResp, RebuildIndexReq, CreateUserReq, DropUserReq, AlterUserReq, GrantRoleReq, RevokeRoleReq, ListUsersReq, ListUsersResp, ListRolesReq, ListRolesResp, GetUserRolesReq, ChangePasswordReq, BalanceReq, BalanceTask, BalanceResp, LeaderBalanceReq, ConfigItem, RegConfigReq, GetConfigReq, GetConfigResp, SetConfigReq, ListConfigsReq, ListConfigsResp, CreateSnapshotReq, DropSnapshotReq, ListSnapshotsReq, Snapshot, ListSnapshotsResp, ListIndexStatusReq, IndexStatus, ListIndexStatusResp, AddZoneReq, DropZoneReq, AddHostIntoZoneReq, DropHostFromZoneReq, GetZoneReq, GetZoneResp, ListZonesReq, Zone, ListZonesResp, AddGroupReq, DropGroupReq, AddZoneIntoGroupReq, DropZoneFromGroupReq, GetGroupReq, GetGroupResp, ListGroupsReq, Group, ListGroupsResp, AddListenerReq, RemoveListenerReq, ListListenerReq, ListenerInfo, ListListenerResp, GetStatsReq, GetStatsResp, BackupInfo, SpaceBackupInfo, BackupMeta, CreateBackupReq, CreateBackupResp, HostPair, RestoreMetaReq, FTClient, SignInFTServiceReq, SignOutFTServiceReq, ListFTClientsReq, ListFTClientsResp, FTIndex, CreateFTIndexReq, DropFTIndexReq, ListFTIndexesReq, ListFTIndexesResp, QueryDesc, Session, CreateSessionReq, CreateSessionResp, UpdateSessionsReq, UpdateSessionsResp, ListSessionsReq, ListSessionsResp, GetSessionReq, GetSessionResp, RemoveSessionReq, KillQueryReq, ReportTaskReq, ListClusterInfoResp, ListClusterInfoReq, GetMetaDirInfoResp, GetMetaDirInfoReq, SchemaVer, ClusterID +from .ttypes import UTF8STRINGS, AlterSchemaOp, RoleType, GeoShape, PropertyType, IsolationLevel, HostStatus, SnapshotStatus, AdminJobOp, AdminCmd, JobStatus, ListHostType, HostRole, TaskResult, ConfigModule, ConfigMode, ListenerType, FTServiceType, QueryStatus, ID, ColumnTypeDef, ColumnDef, SchemaProp, Schema, IdName, SpaceDesc, SpaceItem, TagItem, AlterSchemaItem, EdgeItem, IndexItem, HostItem, UserItem, RoleItem, ExecResp, AdminJobReq, JobDesc, TaskDesc, AdminJobResult, AdminJobResp, Correlativity, StatsItem, CreateSpaceReq, CreateSpaceAsReq, DropSpaceReq, ListSpacesReq, ListSpacesResp, GetSpaceReq, GetSpaceResp, CreateTagReq, AlterTagReq, DropTagReq, ListTagsReq, ListTagsResp, GetTagReq, GetTagResp, CreateEdgeReq, AlterEdgeReq, GetEdgeReq, GetEdgeResp, DropEdgeReq, ListEdgesReq, ListEdgesResp, ListHostsReq, ListHostsResp, PartItem, ListPartsReq, ListPartsResp, GetPartsAllocReq, GetPartsAllocResp, MultiPutReq, GetReq, GetResp, MultiGetReq, MultiGetResp, RemoveReq, RemoveRangeReq, ScanReq, ScanResp, HBResp, LeaderInfo, HBReq, IndexFieldDef, CreateTagIndexReq, DropTagIndexReq, GetTagIndexReq, GetTagIndexResp, ListTagIndexesReq, ListTagIndexesResp, CreateEdgeIndexReq, DropEdgeIndexReq, GetEdgeIndexReq, GetEdgeIndexResp, ListEdgeIndexesReq, ListEdgeIndexesResp, RebuildIndexReq, CreateUserReq, DropUserReq, AlterUserReq, GrantRoleReq, RevokeRoleReq, ListUsersReq, ListUsersResp, ListRolesReq, ListRolesResp, GetUserRolesReq, ChangePasswordReq, BalanceReq, BalanceTask, BalanceResp, LeaderBalanceReq, ConfigItem, RegConfigReq, GetConfigReq, GetConfigResp, SetConfigReq, ListConfigsReq, ListConfigsResp, CreateSnapshotReq, DropSnapshotReq, ListSnapshotsReq, Snapshot, ListSnapshotsResp, ListIndexStatusReq, IndexStatus, ListIndexStatusResp, AddZoneReq, DropZoneReq, AddHostIntoZoneReq, DropHostFromZoneReq, GetZoneReq, GetZoneResp, ListZonesReq, Zone, ListZonesResp, AddGroupReq, DropGroupReq, AddZoneIntoGroupReq, DropZoneFromGroupReq, GetGroupReq, GetGroupResp, ListGroupsReq, Group, ListGroupsResp, AddListenerReq, RemoveListenerReq, ListListenerReq, ListenerInfo, ListListenerResp, GetStatsReq, GetStatsResp, BackupInfo, SpaceBackupInfo, BackupMeta, CreateBackupReq, CreateBackupResp, HostPair, RestoreMetaReq, FTClient, SignInFTServiceReq, SignOutFTServiceReq, ListFTClientsReq, ListFTClientsResp, FTIndex, CreateFTIndexReq, DropFTIndexReq, ListFTIndexesReq, ListFTIndexesResp, QueryDesc, Session, CreateSessionReq, CreateSessionResp, UpdateSessionsReq, UpdateSessionsResp, ListSessionsReq, ListSessionsResp, GetSessionReq, GetSessionResp, RemoveSessionReq, KillQueryReq, ReportTaskReq, ListClusterInfoResp, ListClusterInfoReq, GetMetaDirInfoResp, GetMetaDirInfoReq, VerifyClientVersionResp, VerifyClientVersionReq, SchemaVer, ClusterID import nebula2.common.ttypes from nebula2.fbthrift.Thrift import TProcessor import pprint import warnings -from nebula2.fbthrift import Thrift +from thrift import Thrift from nebula2.fbthrift.transport import TTransport from nebula2.fbthrift.protocol import TBinaryProtocol from nebula2.fbthrift.protocol import TCompactProtocol @@ -666,6 +666,13 @@ def getMetaDirInfo(self, req=None): """ pass + def verifyClientVersion(self, req=None): + """ + Parameters: + - req + """ + pass + class ContextIface: def createSpace(self, handler_ctx, req=None): @@ -1291,6 +1298,13 @@ def getMetaDirInfo(self, handler_ctx, req=None): """ pass + def verifyClientVersion(self, handler_ctx, req=None): + """ + Parameters: + - req + """ + pass + # HELPER FUNCTIONS AND STRUCTURES @@ -18471,6 +18485,199 @@ def getMetaDirInfo_result__setstate__(self, state): getMetaDirInfo_result.__getstate__ = lambda self: self.__dict__.copy() getMetaDirInfo_result.__setstate__ = getMetaDirInfo_result__setstate__ +class verifyClientVersion_args: + """ + Attributes: + - req + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.req = VerifyClientVersionReq() + self.req.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('verifyClientVersion_args') + if self.req != None: + oprot.writeFieldBegin('req', TType.STRUCT, 1) + self.req.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.req is not None: + value = pprint.pformat(self.req, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' req=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + +all_structs.append(verifyClientVersion_args) +verifyClientVersion_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', [VerifyClientVersionReq, VerifyClientVersionReq.thrift_spec, False], None, 2, ), # 1 +) + +verifyClientVersion_args.thrift_struct_annotations = { +} +verifyClientVersion_args.thrift_field_annotations = { +} + +def verifyClientVersion_args__init__(self, req=None,): + self.req = req + +verifyClientVersion_args.__init__ = verifyClientVersion_args__init__ + +def verifyClientVersion_args__setstate__(self, state): + state.setdefault('req', None) + self.__dict__ = state + +verifyClientVersion_args.__getstate__ = lambda self: self.__dict__.copy() +verifyClientVersion_args.__setstate__ = verifyClientVersion_args__setstate__ + +class verifyClientVersion_result: + """ + Attributes: + - success + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRUCT: + self.success = VerifyClientVersionResp() + self.success.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('verifyClientVersion_result') + if self.success != None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.success is not None: + value = pprint.pformat(self.success, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' success=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + +all_structs.append(verifyClientVersion_result) +verifyClientVersion_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [VerifyClientVersionResp, VerifyClientVersionResp.thrift_spec, False], None, 2, ), # 0 +) + +verifyClientVersion_result.thrift_struct_annotations = { +} +verifyClientVersion_result.thrift_field_annotations = { +} + +def verifyClientVersion_result__init__(self, success=None,): + self.success = success + +verifyClientVersion_result.__init__ = verifyClientVersion_result__init__ + +def verifyClientVersion_result__setstate__(self, state): + state.setdefault('success', None) + self.__dict__ = state + +verifyClientVersion_result.__getstate__ = lambda self: self.__dict__.copy() +verifyClientVersion_result.__setstate__ = verifyClientVersion_result__setstate__ + class Client(Iface): def __enter__(self): return self @@ -21156,6 +21363,36 @@ def recv_getMetaDirInfo(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "getMetaDirInfo failed: unknown result"); + def verifyClientVersion(self, req=None): + """ + Parameters: + - req + """ + self.send_verifyClientVersion(req) + return self.recv_verifyClientVersion() + + def send_verifyClientVersion(self, req=None): + self._oprot.writeMessageBegin('verifyClientVersion', TMessageType.CALL, self._seqid) + args = verifyClientVersion_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_verifyClientVersion(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = verifyClientVersion_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "verifyClientVersion failed: unknown result"); + class Processor(Iface, TProcessor): _onewayMethods = () @@ -21343,6 +21580,8 @@ def __init__(self, handler): self._priorityMap["listCluster"] = TPriority.NORMAL self._processMap["getMetaDirInfo"] = Processor.process_getMetaDirInfo self._priorityMap["getMetaDirInfo"] = TPriority.NORMAL + self._processMap["verifyClientVersion"] = Processor.process_verifyClientVersion + self._priorityMap["verifyClientVersion"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -22331,6 +22570,17 @@ def process_getMetaDirInfo(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result + @thrift_process_method(verifyClientVersion_args, oneway=False) + def process_verifyClientVersion(self, args, handler_ctx): + result = verifyClientVersion_result() + try: + result.success = self._handler.verifyClientVersion(args.req) + except: + ex = sys.exc_info()[1] + self._event_handler.handlerError(handler_ctx, 'verifyClientVersion', ex) + result = Thrift.TApplicationException(message=repr(ex)) + return result + Iface._processor_type = Processor class ContextProcessor(ContextIface, TProcessor): @@ -22519,6 +22769,8 @@ def __init__(self, handler): self._priorityMap["listCluster"] = TPriority.NORMAL self._processMap["getMetaDirInfo"] = ContextProcessor.process_getMetaDirInfo self._priorityMap["getMetaDirInfo"] = TPriority.NORMAL + self._processMap["verifyClientVersion"] = ContextProcessor.process_verifyClientVersion + self._priorityMap["verifyClientVersion"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -23507,6 +23759,17 @@ def process_getMetaDirInfo(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result + @thrift_process_method(verifyClientVersion_args, oneway=False) + def process_verifyClientVersion(self, args, handler_ctx): + result = verifyClientVersion_result() + try: + result.success = self._handler.verifyClientVersion(handler_ctx, args.req) + except: + ex = sys.exc_info()[1] + self._event_handler.handlerError(handler_ctx, 'verifyClientVersion', ex) + result = Thrift.TApplicationException(message=repr(ex)) + return result + ContextIface._processor_type = ContextProcessor fix_spec(all_structs) diff --git a/nebula2/meta/constants.py b/nebula2/meta/constants.py index e368b678..39b81f67 100644 --- a/nebula2/meta/constants.py +++ b/nebula2/meta/constants.py @@ -16,5 +16,5 @@ import nebula2.common.ttypes -from .ttypes import UTF8STRINGS, AlterSchemaOp, RoleType, PropertyType, IsolationLevel, HostStatus, SnapshotStatus, AdminJobOp, AdminCmd, JobStatus, ListHostType, HostRole, TaskResult, ConfigModule, ConfigMode, ListenerType, FTServiceType, QueryStatus, ID, ColumnTypeDef, ColumnDef, SchemaProp, Schema, IdName, SpaceDesc, SpaceItem, TagItem, AlterSchemaItem, EdgeItem, IndexItem, HostItem, UserItem, RoleItem, ExecResp, AdminJobReq, JobDesc, TaskDesc, AdminJobResult, AdminJobResp, Correlativity, StatsItem, CreateSpaceReq, CreateSpaceAsReq, DropSpaceReq, ListSpacesReq, ListSpacesResp, GetSpaceReq, GetSpaceResp, CreateTagReq, AlterTagReq, DropTagReq, ListTagsReq, ListTagsResp, GetTagReq, GetTagResp, CreateEdgeReq, AlterEdgeReq, GetEdgeReq, GetEdgeResp, DropEdgeReq, ListEdgesReq, ListEdgesResp, ListHostsReq, ListHostsResp, PartItem, ListPartsReq, ListPartsResp, GetPartsAllocReq, GetPartsAllocResp, MultiPutReq, GetReq, GetResp, MultiGetReq, MultiGetResp, RemoveReq, RemoveRangeReq, ScanReq, ScanResp, HBResp, LeaderInfo, HBReq, IndexFieldDef, CreateTagIndexReq, DropTagIndexReq, GetTagIndexReq, GetTagIndexResp, ListTagIndexesReq, ListTagIndexesResp, CreateEdgeIndexReq, DropEdgeIndexReq, GetEdgeIndexReq, GetEdgeIndexResp, ListEdgeIndexesReq, ListEdgeIndexesResp, RebuildIndexReq, CreateUserReq, DropUserReq, AlterUserReq, GrantRoleReq, RevokeRoleReq, ListUsersReq, ListUsersResp, ListRolesReq, ListRolesResp, GetUserRolesReq, ChangePasswordReq, BalanceReq, BalanceTask, BalanceResp, LeaderBalanceReq, ConfigItem, RegConfigReq, GetConfigReq, GetConfigResp, SetConfigReq, ListConfigsReq, ListConfigsResp, CreateSnapshotReq, DropSnapshotReq, ListSnapshotsReq, Snapshot, ListSnapshotsResp, ListIndexStatusReq, IndexStatus, ListIndexStatusResp, AddZoneReq, DropZoneReq, AddHostIntoZoneReq, DropHostFromZoneReq, GetZoneReq, GetZoneResp, ListZonesReq, Zone, ListZonesResp, AddGroupReq, DropGroupReq, AddZoneIntoGroupReq, DropZoneFromGroupReq, GetGroupReq, GetGroupResp, ListGroupsReq, Group, ListGroupsResp, AddListenerReq, RemoveListenerReq, ListListenerReq, ListenerInfo, ListListenerResp, GetStatsReq, GetStatsResp, BackupInfo, SpaceBackupInfo, BackupMeta, CreateBackupReq, CreateBackupResp, HostPair, RestoreMetaReq, FTClient, SignInFTServiceReq, SignOutFTServiceReq, ListFTClientsReq, ListFTClientsResp, FTIndex, CreateFTIndexReq, DropFTIndexReq, ListFTIndexesReq, ListFTIndexesResp, QueryDesc, Session, CreateSessionReq, CreateSessionResp, UpdateSessionsReq, UpdateSessionsResp, ListSessionsReq, ListSessionsResp, GetSessionReq, GetSessionResp, RemoveSessionReq, KillQueryReq, ReportTaskReq, ListClusterInfoResp, ListClusterInfoReq, GetMetaDirInfoResp, GetMetaDirInfoReq, SchemaVer, ClusterID +from .ttypes import UTF8STRINGS, AlterSchemaOp, RoleType, GeoShape, PropertyType, IsolationLevel, HostStatus, SnapshotStatus, AdminJobOp, AdminCmd, JobStatus, ListHostType, HostRole, TaskResult, ConfigModule, ConfigMode, ListenerType, FTServiceType, QueryStatus, ID, ColumnTypeDef, ColumnDef, SchemaProp, Schema, IdName, SpaceDesc, SpaceItem, TagItem, AlterSchemaItem, EdgeItem, IndexItem, HostItem, UserItem, RoleItem, ExecResp, AdminJobReq, JobDesc, TaskDesc, AdminJobResult, AdminJobResp, Correlativity, StatsItem, CreateSpaceReq, CreateSpaceAsReq, DropSpaceReq, ListSpacesReq, ListSpacesResp, GetSpaceReq, GetSpaceResp, CreateTagReq, AlterTagReq, DropTagReq, ListTagsReq, ListTagsResp, GetTagReq, GetTagResp, CreateEdgeReq, AlterEdgeReq, GetEdgeReq, GetEdgeResp, DropEdgeReq, ListEdgesReq, ListEdgesResp, ListHostsReq, ListHostsResp, PartItem, ListPartsReq, ListPartsResp, GetPartsAllocReq, GetPartsAllocResp, MultiPutReq, GetReq, GetResp, MultiGetReq, MultiGetResp, RemoveReq, RemoveRangeReq, ScanReq, ScanResp, HBResp, LeaderInfo, HBReq, IndexFieldDef, CreateTagIndexReq, DropTagIndexReq, GetTagIndexReq, GetTagIndexResp, ListTagIndexesReq, ListTagIndexesResp, CreateEdgeIndexReq, DropEdgeIndexReq, GetEdgeIndexReq, GetEdgeIndexResp, ListEdgeIndexesReq, ListEdgeIndexesResp, RebuildIndexReq, CreateUserReq, DropUserReq, AlterUserReq, GrantRoleReq, RevokeRoleReq, ListUsersReq, ListUsersResp, ListRolesReq, ListRolesResp, GetUserRolesReq, ChangePasswordReq, BalanceReq, BalanceTask, BalanceResp, LeaderBalanceReq, ConfigItem, RegConfigReq, GetConfigReq, GetConfigResp, SetConfigReq, ListConfigsReq, ListConfigsResp, CreateSnapshotReq, DropSnapshotReq, ListSnapshotsReq, Snapshot, ListSnapshotsResp, ListIndexStatusReq, IndexStatus, ListIndexStatusResp, AddZoneReq, DropZoneReq, AddHostIntoZoneReq, DropHostFromZoneReq, GetZoneReq, GetZoneResp, ListZonesReq, Zone, ListZonesResp, AddGroupReq, DropGroupReq, AddZoneIntoGroupReq, DropZoneFromGroupReq, GetGroupReq, GetGroupResp, ListGroupsReq, Group, ListGroupsResp, AddListenerReq, RemoveListenerReq, ListListenerReq, ListenerInfo, ListListenerResp, GetStatsReq, GetStatsResp, BackupInfo, SpaceBackupInfo, BackupMeta, CreateBackupReq, CreateBackupResp, HostPair, RestoreMetaReq, FTClient, SignInFTServiceReq, SignOutFTServiceReq, ListFTClientsReq, ListFTClientsResp, FTIndex, CreateFTIndexReq, DropFTIndexReq, ListFTIndexesReq, ListFTIndexesResp, QueryDesc, Session, CreateSessionReq, CreateSessionResp, UpdateSessionsReq, UpdateSessionsResp, ListSessionsReq, ListSessionsResp, GetSessionReq, GetSessionResp, RemoveSessionReq, KillQueryReq, ReportTaskReq, ListClusterInfoResp, ListClusterInfoReq, GetMetaDirInfoResp, GetMetaDirInfoReq, VerifyClientVersionResp, VerifyClientVersionReq, SchemaVer, ClusterID diff --git a/nebula2/meta/ttypes.py b/nebula2/meta/ttypes.py index ffc00ea4..af6f1706 100644 --- a/nebula2/meta/ttypes.py +++ b/nebula2/meta/ttypes.py @@ -18,7 +18,7 @@ import pprint import warnings -from nebula2.fbthrift import Thrift +from thrift import Thrift from nebula2.fbthrift.transport import TTransport from nebula2.fbthrift.protocol import TBinaryProtocol from nebula2.fbthrift.protocol import TCompactProtocol @@ -31,7 +31,7 @@ all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'AlterSchemaOp', 'RoleType', 'PropertyType', 'IsolationLevel', 'HostStatus', 'SnapshotStatus', 'AdminJobOp', 'AdminCmd', 'JobStatus', 'ListHostType', 'HostRole', 'TaskResult', 'ConfigModule', 'ConfigMode', 'ListenerType', 'FTServiceType', 'QueryStatus', 'ID', 'ColumnTypeDef', 'ColumnDef', 'SchemaProp', 'Schema', 'IdName', 'SpaceDesc', 'SpaceItem', 'TagItem', 'AlterSchemaItem', 'EdgeItem', 'IndexItem', 'HostItem', 'UserItem', 'RoleItem', 'ExecResp', 'AdminJobReq', 'JobDesc', 'TaskDesc', 'AdminJobResult', 'AdminJobResp', 'Correlativity', 'StatsItem', 'CreateSpaceReq', 'CreateSpaceAsReq', 'DropSpaceReq', 'ListSpacesReq', 'ListSpacesResp', 'GetSpaceReq', 'GetSpaceResp', 'CreateTagReq', 'AlterTagReq', 'DropTagReq', 'ListTagsReq', 'ListTagsResp', 'GetTagReq', 'GetTagResp', 'CreateEdgeReq', 'AlterEdgeReq', 'GetEdgeReq', 'GetEdgeResp', 'DropEdgeReq', 'ListEdgesReq', 'ListEdgesResp', 'ListHostsReq', 'ListHostsResp', 'PartItem', 'ListPartsReq', 'ListPartsResp', 'GetPartsAllocReq', 'GetPartsAllocResp', 'MultiPutReq', 'GetReq', 'GetResp', 'MultiGetReq', 'MultiGetResp', 'RemoveReq', 'RemoveRangeReq', 'ScanReq', 'ScanResp', 'HBResp', 'LeaderInfo', 'HBReq', 'IndexFieldDef', 'CreateTagIndexReq', 'DropTagIndexReq', 'GetTagIndexReq', 'GetTagIndexResp', 'ListTagIndexesReq', 'ListTagIndexesResp', 'CreateEdgeIndexReq', 'DropEdgeIndexReq', 'GetEdgeIndexReq', 'GetEdgeIndexResp', 'ListEdgeIndexesReq', 'ListEdgeIndexesResp', 'RebuildIndexReq', 'CreateUserReq', 'DropUserReq', 'AlterUserReq', 'GrantRoleReq', 'RevokeRoleReq', 'ListUsersReq', 'ListUsersResp', 'ListRolesReq', 'ListRolesResp', 'GetUserRolesReq', 'ChangePasswordReq', 'BalanceReq', 'BalanceTask', 'BalanceResp', 'LeaderBalanceReq', 'ConfigItem', 'RegConfigReq', 'GetConfigReq', 'GetConfigResp', 'SetConfigReq', 'ListConfigsReq', 'ListConfigsResp', 'CreateSnapshotReq', 'DropSnapshotReq', 'ListSnapshotsReq', 'Snapshot', 'ListSnapshotsResp', 'ListIndexStatusReq', 'IndexStatus', 'ListIndexStatusResp', 'AddZoneReq', 'DropZoneReq', 'AddHostIntoZoneReq', 'DropHostFromZoneReq', 'GetZoneReq', 'GetZoneResp', 'ListZonesReq', 'Zone', 'ListZonesResp', 'AddGroupReq', 'DropGroupReq', 'AddZoneIntoGroupReq', 'DropZoneFromGroupReq', 'GetGroupReq', 'GetGroupResp', 'ListGroupsReq', 'Group', 'ListGroupsResp', 'AddListenerReq', 'RemoveListenerReq', 'ListListenerReq', 'ListenerInfo', 'ListListenerResp', 'GetStatsReq', 'GetStatsResp', 'BackupInfo', 'SpaceBackupInfo', 'BackupMeta', 'CreateBackupReq', 'CreateBackupResp', 'HostPair', 'RestoreMetaReq', 'FTClient', 'SignInFTServiceReq', 'SignOutFTServiceReq', 'ListFTClientsReq', 'ListFTClientsResp', 'FTIndex', 'CreateFTIndexReq', 'DropFTIndexReq', 'ListFTIndexesReq', 'ListFTIndexesResp', 'QueryDesc', 'Session', 'CreateSessionReq', 'CreateSessionResp', 'UpdateSessionsReq', 'UpdateSessionsResp', 'ListSessionsReq', 'ListSessionsResp', 'GetSessionReq', 'GetSessionResp', 'RemoveSessionReq', 'KillQueryReq', 'ReportTaskReq', 'ListClusterInfoResp', 'ListClusterInfoReq', 'GetMetaDirInfoResp', 'GetMetaDirInfoReq', 'SchemaVer', 'ClusterID'] +__all__ = ['UTF8STRINGS', 'AlterSchemaOp', 'RoleType', 'GeoShape', 'PropertyType', 'IsolationLevel', 'HostStatus', 'SnapshotStatus', 'AdminJobOp', 'AdminCmd', 'JobStatus', 'ListHostType', 'HostRole', 'TaskResult', 'ConfigModule', 'ConfigMode', 'ListenerType', 'FTServiceType', 'QueryStatus', 'ID', 'ColumnTypeDef', 'ColumnDef', 'SchemaProp', 'Schema', 'IdName', 'SpaceDesc', 'SpaceItem', 'TagItem', 'AlterSchemaItem', 'EdgeItem', 'IndexItem', 'HostItem', 'UserItem', 'RoleItem', 'ExecResp', 'AdminJobReq', 'JobDesc', 'TaskDesc', 'AdminJobResult', 'AdminJobResp', 'Correlativity', 'StatsItem', 'CreateSpaceReq', 'CreateSpaceAsReq', 'DropSpaceReq', 'ListSpacesReq', 'ListSpacesResp', 'GetSpaceReq', 'GetSpaceResp', 'CreateTagReq', 'AlterTagReq', 'DropTagReq', 'ListTagsReq', 'ListTagsResp', 'GetTagReq', 'GetTagResp', 'CreateEdgeReq', 'AlterEdgeReq', 'GetEdgeReq', 'GetEdgeResp', 'DropEdgeReq', 'ListEdgesReq', 'ListEdgesResp', 'ListHostsReq', 'ListHostsResp', 'PartItem', 'ListPartsReq', 'ListPartsResp', 'GetPartsAllocReq', 'GetPartsAllocResp', 'MultiPutReq', 'GetReq', 'GetResp', 'MultiGetReq', 'MultiGetResp', 'RemoveReq', 'RemoveRangeReq', 'ScanReq', 'ScanResp', 'HBResp', 'LeaderInfo', 'HBReq', 'IndexFieldDef', 'CreateTagIndexReq', 'DropTagIndexReq', 'GetTagIndexReq', 'GetTagIndexResp', 'ListTagIndexesReq', 'ListTagIndexesResp', 'CreateEdgeIndexReq', 'DropEdgeIndexReq', 'GetEdgeIndexReq', 'GetEdgeIndexResp', 'ListEdgeIndexesReq', 'ListEdgeIndexesResp', 'RebuildIndexReq', 'CreateUserReq', 'DropUserReq', 'AlterUserReq', 'GrantRoleReq', 'RevokeRoleReq', 'ListUsersReq', 'ListUsersResp', 'ListRolesReq', 'ListRolesResp', 'GetUserRolesReq', 'ChangePasswordReq', 'BalanceReq', 'BalanceTask', 'BalanceResp', 'LeaderBalanceReq', 'ConfigItem', 'RegConfigReq', 'GetConfigReq', 'GetConfigResp', 'SetConfigReq', 'ListConfigsReq', 'ListConfigsResp', 'CreateSnapshotReq', 'DropSnapshotReq', 'ListSnapshotsReq', 'Snapshot', 'ListSnapshotsResp', 'ListIndexStatusReq', 'IndexStatus', 'ListIndexStatusResp', 'AddZoneReq', 'DropZoneReq', 'AddHostIntoZoneReq', 'DropHostFromZoneReq', 'GetZoneReq', 'GetZoneResp', 'ListZonesReq', 'Zone', 'ListZonesResp', 'AddGroupReq', 'DropGroupReq', 'AddZoneIntoGroupReq', 'DropZoneFromGroupReq', 'GetGroupReq', 'GetGroupResp', 'ListGroupsReq', 'Group', 'ListGroupsResp', 'AddListenerReq', 'RemoveListenerReq', 'ListListenerReq', 'ListenerInfo', 'ListListenerResp', 'GetStatsReq', 'GetStatsResp', 'BackupInfo', 'SpaceBackupInfo', 'BackupMeta', 'CreateBackupReq', 'CreateBackupResp', 'HostPair', 'RestoreMetaReq', 'FTClient', 'SignInFTServiceReq', 'SignOutFTServiceReq', 'ListFTClientsReq', 'ListFTClientsResp', 'FTIndex', 'CreateFTIndexReq', 'DropFTIndexReq', 'ListFTIndexesReq', 'ListFTIndexesResp', 'QueryDesc', 'Session', 'CreateSessionReq', 'CreateSessionResp', 'UpdateSessionsReq', 'UpdateSessionsResp', 'ListSessionsReq', 'ListSessionsResp', 'GetSessionReq', 'GetSessionResp', 'RemoveSessionReq', 'KillQueryReq', 'ReportTaskReq', 'ListClusterInfoResp', 'ListClusterInfoReq', 'GetMetaDirInfoResp', 'GetMetaDirInfoReq', 'VerifyClientVersionResp', 'VerifyClientVersionReq', 'SchemaVer', 'ClusterID'] class AlterSchemaOp: ADD = 1 @@ -76,6 +76,26 @@ class RoleType: "GUEST": 5, } +class GeoShape: + ANY = 0 + POINT = 1 + LINESTRING = 2 + POLYGON = 3 + + _VALUES_TO_NAMES = { + 0: "ANY", + 1: "POINT", + 2: "LINESTRING", + 3: "POLYGON", + } + + _NAMES_TO_VALUES = { + "ANY": 0, + "POINT": 1, + "LINESTRING": 2, + "POLYGON": 3, + } + class PropertyType: UNKNOWN = 0 BOOL = 1 @@ -92,6 +112,7 @@ class PropertyType: DATE = 24 DATETIME = 25 TIME = 26 + GEOGRAPHY = 31 _VALUES_TO_NAMES = { 0: "UNKNOWN", @@ -109,6 +130,7 @@ class PropertyType: 24: "DATE", 25: "DATETIME", 26: "TIME", + 31: "GEOGRAPHY", } _NAMES_TO_VALUES = { @@ -127,6 +149,7 @@ class PropertyType: "DATE": 24, "DATETIME": 25, "TIME": 26, + "GEOGRAPHY": 31, } class IsolationLevel: @@ -603,6 +626,7 @@ class ColumnTypeDef: Attributes: - type - type_length + - geo_shape """ thrift_spec = None @@ -635,6 +659,11 @@ def read(self, iprot): self.type_length = iprot.readI16() else: iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.geo_shape = iprot.readI32() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -656,6 +685,10 @@ def write(self, oprot): oprot.writeFieldBegin('type_length', TType.I16, 2) oprot.writeI16(self.type_length) oprot.writeFieldEnd() + if self.geo_shape != None: + oprot.writeFieldBegin('geo_shape', TType.I32, 3) + oprot.writeI32(self.geo_shape) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -670,6 +703,10 @@ def __repr__(self): value = pprint.pformat(self.type_length, indent=0) value = padding.join(value.splitlines(True)) L.append(' type_length=%s' % (value)) + if self.geo_shape is not None: + value = pprint.pformat(self.geo_shape, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' geo_shape=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -17648,6 +17685,181 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ +class VerifyClientVersionResp: + """ + Attributes: + - code + - leader + - error_msg + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.I32: + self.code = iprot.readI32() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.leader = nebula2.common.ttypes.HostAddr() + self.leader.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.error_msg = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('VerifyClientVersionResp') + if self.code != None: + oprot.writeFieldBegin('code', TType.I32, 1) + oprot.writeI32(self.code) + oprot.writeFieldEnd() + if self.leader != None: + oprot.writeFieldBegin('leader', TType.STRUCT, 2) + self.leader.write(oprot) + oprot.writeFieldEnd() + if self.error_msg != None: + oprot.writeFieldBegin('error_msg', TType.STRING, 3) + oprot.writeString(self.error_msg) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.code is not None: + value = pprint.pformat(self.code, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' code=%s' % (value)) + if self.leader is not None: + value = pprint.pformat(self.leader, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' leader=%s' % (value)) + if self.error_msg is not None: + value = pprint.pformat(self.error_msg, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' error_msg=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + +class VerifyClientVersionReq: + """ + Attributes: + - version + """ + + thrift_spec = None + thrift_field_annotations = None + thrift_struct_annotations = None + __init__ = None + @staticmethod + def isUnion(): + return False + + def read(self, iprot): + if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) + return + if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: + fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.version = iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) + return + if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: + oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) + return + oprot.writeStructBegin('VerifyClientVersionReq') + if self.version != None: + oprot.writeFieldBegin('version', TType.STRING, 1) + oprot.writeString(self.version) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.version is not None: + value = pprint.pformat(self.version, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' version=%s' % (value)) + return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + # Override the __hash__ function for Python3 - t10434117 + if not six.PY2: + __hash__ = object.__hash__ + SchemaVer = UnimplementedTypedef() ClusterID = UnimplementedTypedef() all_structs.append(ID) @@ -17696,6 +17908,7 @@ def ID__init__(self, space_id=None, tag_id=None, edge_type=None, index_id=None, None, # 0 (1, TType.I32, 'type', PropertyType, None, 0, ), # 1 (2, TType.I16, 'type_length', None, 0, 1, ), # 2 + (3, TType.I32, 'geo_shape', GeoShape, None, 1, ), # 3 ) ColumnTypeDef.thrift_struct_annotations = { @@ -17703,15 +17916,17 @@ def ID__init__(self, space_id=None, tag_id=None, edge_type=None, index_id=None, ColumnTypeDef.thrift_field_annotations = { } -def ColumnTypeDef__init__(self, type=None, type_length=ColumnTypeDef.thrift_spec[2][4],): +def ColumnTypeDef__init__(self, type=None, type_length=ColumnTypeDef.thrift_spec[2][4], geo_shape=None,): self.type = type self.type_length = type_length + self.geo_shape = geo_shape ColumnTypeDef.__init__ = ColumnTypeDef__init__ def ColumnTypeDef__setstate__(self, state): state.setdefault('type', None) state.setdefault('type_length', 0) + state.setdefault('geo_shape', None) self.__dict__ = state ColumnTypeDef.__getstate__ = lambda self: self.__dict__.copy() @@ -22146,5 +22361,57 @@ def GetMetaDirInfoResp__setstate__(self, state): GetMetaDirInfoReq.thrift_field_annotations = { } +all_structs.append(VerifyClientVersionResp) +VerifyClientVersionResp.thrift_spec = ( + None, # 0 + (1, TType.I32, 'code', nebula2.common.ttypes.ErrorCode, None, 2, ), # 1 + (2, TType.STRUCT, 'leader', [nebula2.common.ttypes.HostAddr, nebula2.common.ttypes.HostAddr.thrift_spec, False], None, 2, ), # 2 + (3, TType.STRING, 'error_msg', False, None, 1, ), # 3 +) + +VerifyClientVersionResp.thrift_struct_annotations = { +} +VerifyClientVersionResp.thrift_field_annotations = { +} + +def VerifyClientVersionResp__init__(self, code=None, leader=None, error_msg=None,): + self.code = code + self.leader = leader + self.error_msg = error_msg + +VerifyClientVersionResp.__init__ = VerifyClientVersionResp__init__ + +def VerifyClientVersionResp__setstate__(self, state): + state.setdefault('code', None) + state.setdefault('leader', None) + state.setdefault('error_msg', None) + self.__dict__ = state + +VerifyClientVersionResp.__getstate__ = lambda self: self.__dict__.copy() +VerifyClientVersionResp.__setstate__ = VerifyClientVersionResp__setstate__ + +all_structs.append(VerifyClientVersionReq) +VerifyClientVersionReq.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'version', False, "2.6.0", 0, ), # 1 +) + +VerifyClientVersionReq.thrift_struct_annotations = { +} +VerifyClientVersionReq.thrift_field_annotations = { +} + +def VerifyClientVersionReq__init__(self, version=VerifyClientVersionReq.thrift_spec[1][4],): + self.version = version + +VerifyClientVersionReq.__init__ = VerifyClientVersionReq__init__ + +def VerifyClientVersionReq__setstate__(self, state): + state.setdefault('version', "2.6.0") + self.__dict__ = state + +VerifyClientVersionReq.__getstate__ = lambda self: self.__dict__.copy() +VerifyClientVersionReq.__setstate__ = VerifyClientVersionReq__setstate__ + fix_spec(all_structs) del all_structs diff --git a/nebula2/storage/GeneralStorageService-fuzzer b/nebula2/storage/GeneralStorageService-fuzzer index 1a350711..e7fd4bfe 100755 --- a/nebula2/storage/GeneralStorageService-fuzzer +++ b/nebula2/storage/GeneralStorageService-fuzzer @@ -42,4 +42,4 @@ from . import ttypes from . import constants import nebula2.fbthrift.util.fuzzer -nebula2.fbthrift.util.fuzzer.fuzz_service(GeneralStorageService, ttypes, constants) +thrift.util.fuzzer.fuzz_service(GeneralStorageService, ttypes, constants) diff --git a/nebula2/storage/GeneralStorageService.py b/nebula2/storage/GeneralStorageService.py index 08a03f12..afda312c 100644 --- a/nebula2/storage/GeneralStorageService.py +++ b/nebula2/storage/GeneralStorageService.py @@ -13,7 +13,7 @@ from nebula2.fbthrift.protocol.TProtocol import TProtocolException -from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, ChainAddEdgesRequest, ChainUpdateEdgeRequest +from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, GetValueRequest, GetValueResponse import nebula2.common.ttypes import nebula2.meta.ttypes diff --git a/nebula2/storage/GraphStorageService-fuzzer b/nebula2/storage/GraphStorageService-fuzzer index fd285d56..d1dd4e47 100755 --- a/nebula2/storage/GraphStorageService-fuzzer +++ b/nebula2/storage/GraphStorageService-fuzzer @@ -42,4 +42,4 @@ from . import ttypes from . import constants import nebula2.fbthrift.util.fuzzer -nebula2.fbthrift.util.fuzzer.fuzz_service(GraphStorageService, ttypes, constants) +thrift.util.fuzzer.fuzz_service(GraphStorageService, ttypes, constants) diff --git a/nebula2/storage/GraphStorageService-remote b/nebula2/storage/GraphStorageService-remote index 6d253096..aabdfe14 100755 --- a/nebula2/storage/GraphStorageService-remote +++ b/nebula2/storage/GraphStorageService-remote @@ -56,8 +56,7 @@ FUNCTIONS = { 'getUUID': Function('getUUID', 'GraphStorageService', 'GetUUIDResp', [('GetUUIDReq', 'req', 'GetUUIDReq')]), 'lookupIndex': Function('lookupIndex', 'GraphStorageService', 'LookupIndexResp', [('LookupIndexRequest', 'req', 'LookupIndexRequest')]), 'lookupAndTraverse': Function('lookupAndTraverse', 'GraphStorageService', 'GetNeighborsResponse', [('LookupAndTraverseRequest', 'req', 'LookupAndTraverseRequest')]), - 'chainUpdateEdge': Function('chainUpdateEdge', 'GraphStorageService', 'UpdateResponse', [('UpdateEdgeRequest', 'req', 'UpdateEdgeRequest')]), - 'chainAddEdges': Function('chainAddEdges', 'GraphStorageService', 'ExecResponse', [('AddEdgesRequest', 'req', 'AddEdgesRequest')]), + 'addEdgesAtomic': Function('addEdgesAtomic', 'GraphStorageService', 'ExecResponse', [('AddEdgesRequest', 'req', 'AddEdgesRequest')]), } SERVICE_NAMES = ['GraphStorageService', ] diff --git a/nebula2/storage/GraphStorageService.py b/nebula2/storage/GraphStorageService.py index d46e321b..ead48b07 100644 --- a/nebula2/storage/GraphStorageService.py +++ b/nebula2/storage/GraphStorageService.py @@ -13,7 +13,7 @@ from nebula2.fbthrift.protocol.TProtocol import TProtocolException -from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, ChainAddEdgesRequest, ChainUpdateEdgeRequest +from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, GetValueRequest, GetValueResponse import nebula2.common.ttypes import nebula2.meta.ttypes @@ -142,14 +142,7 @@ def lookupAndTraverse(self, req=None): """ pass - def chainUpdateEdge(self, req=None): - """ - Parameters: - - req - """ - pass - - def chainAddEdges(self, req=None): + def addEdgesAtomic(self, req=None): """ Parameters: - req @@ -256,14 +249,7 @@ def lookupAndTraverse(self, handler_ctx, req=None): """ pass - def chainUpdateEdge(self, handler_ctx, req=None): - """ - Parameters: - - req - """ - pass - - def chainAddEdges(self, handler_ctx, req=None): + def addEdgesAtomic(self, handler_ctx, req=None): """ Parameters: - req @@ -2975,200 +2961,7 @@ def lookupAndTraverse_result__setstate__(self, state): lookupAndTraverse_result.__getstate__ = lambda self: self.__dict__.copy() lookupAndTraverse_result.__setstate__ = lookupAndTraverse_result__setstate__ -class chainUpdateEdge_args: - """ - Attributes: - - req - """ - - thrift_spec = None - thrift_field_annotations = None - thrift_struct_annotations = None - __init__ = None - @staticmethod - def isUnion(): - return False - - def read(self, iprot): - if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) - return - if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) - return - iprot.readStructBegin() - while True: - (fname, ftype, fid) = iprot.readFieldBegin() - if ftype == TType.STOP: - break - if fid == 1: - if ftype == TType.STRUCT: - self.req = UpdateEdgeRequest() - self.req.read(iprot) - else: - iprot.skip(ftype) - else: - iprot.skip(ftype) - iprot.readFieldEnd() - iprot.readStructEnd() - - def write(self, oprot): - if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) - return - if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) - return - oprot.writeStructBegin('chainUpdateEdge_args') - if self.req != None: - oprot.writeFieldBegin('req', TType.STRUCT, 1) - self.req.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def __repr__(self): - L = [] - padding = ' ' * 4 - if self.req is not None: - value = pprint.pformat(self.req, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' req=%s' % (value)) - return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - return not (self == other) - - # Override the __hash__ function for Python3 - t10434117 - if not six.PY2: - __hash__ = object.__hash__ - -all_structs.append(chainUpdateEdge_args) -chainUpdateEdge_args.thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'req', [UpdateEdgeRequest, UpdateEdgeRequest.thrift_spec, False], None, 2, ), # 1 -) - -chainUpdateEdge_args.thrift_struct_annotations = { -} -chainUpdateEdge_args.thrift_field_annotations = { -} - -def chainUpdateEdge_args__init__(self, req=None,): - self.req = req - -chainUpdateEdge_args.__init__ = chainUpdateEdge_args__init__ - -def chainUpdateEdge_args__setstate__(self, state): - state.setdefault('req', None) - self.__dict__ = state - -chainUpdateEdge_args.__getstate__ = lambda self: self.__dict__.copy() -chainUpdateEdge_args.__setstate__ = chainUpdateEdge_args__setstate__ - -class chainUpdateEdge_result: - """ - Attributes: - - success - """ - - thrift_spec = None - thrift_field_annotations = None - thrift_struct_annotations = None - __init__ = None - @staticmethod - def isUnion(): - return False - - def read(self, iprot): - if (isinstance(iprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0) - return - if (isinstance(iprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(iprot, THeaderProtocol.THeaderProtocolAccelerate) and iprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastproto is not None: - fastproto.decode(self, iprot.trans, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2) - return - iprot.readStructBegin() - while True: - (fname, ftype, fid) = iprot.readFieldBegin() - if ftype == TType.STOP: - break - if fid == 0: - if ftype == TType.STRUCT: - self.success = UpdateResponse() - self.success.read(iprot) - else: - iprot.skip(ftype) - else: - iprot.skip(ftype) - iprot.readFieldEnd() - iprot.readStructEnd() - - def write(self, oprot): - if (isinstance(oprot, TBinaryProtocol.TBinaryProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_BINARY_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=0)) - return - if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: - oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) - return - oprot.writeStructBegin('chainUpdateEdge_result') - if self.success != None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def __repr__(self): - L = [] - padding = ' ' * 4 - if self.success is not None: - value = pprint.pformat(self.success, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' success=%s' % (value)) - return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - return not (self == other) - - # Override the __hash__ function for Python3 - t10434117 - if not six.PY2: - __hash__ = object.__hash__ - -all_structs.append(chainUpdateEdge_result) -chainUpdateEdge_result.thrift_spec = ( - (0, TType.STRUCT, 'success', [UpdateResponse, UpdateResponse.thrift_spec, False], None, 2, ), # 0 -) - -chainUpdateEdge_result.thrift_struct_annotations = { -} -chainUpdateEdge_result.thrift_field_annotations = { -} - -def chainUpdateEdge_result__init__(self, success=None,): - self.success = success - -chainUpdateEdge_result.__init__ = chainUpdateEdge_result__init__ - -def chainUpdateEdge_result__setstate__(self, state): - state.setdefault('success', None) - self.__dict__ = state - -chainUpdateEdge_result.__getstate__ = lambda self: self.__dict__.copy() -chainUpdateEdge_result.__setstate__ = chainUpdateEdge_result__setstate__ - -class chainAddEdges_args: +class addEdgesAtomic_args: """ Attributes: - req @@ -3212,7 +3005,7 @@ def write(self, oprot): if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return - oprot.writeStructBegin('chainAddEdges_args') + oprot.writeStructBegin('addEdgesAtomic_args') if self.req != None: oprot.writeFieldBegin('req', TType.STRUCT, 1) self.req.write(oprot) @@ -3242,30 +3035,30 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -all_structs.append(chainAddEdges_args) -chainAddEdges_args.thrift_spec = ( +all_structs.append(addEdgesAtomic_args) +addEdgesAtomic_args.thrift_spec = ( None, # 0 (1, TType.STRUCT, 'req', [AddEdgesRequest, AddEdgesRequest.thrift_spec, False], None, 2, ), # 1 ) -chainAddEdges_args.thrift_struct_annotations = { +addEdgesAtomic_args.thrift_struct_annotations = { } -chainAddEdges_args.thrift_field_annotations = { +addEdgesAtomic_args.thrift_field_annotations = { } -def chainAddEdges_args__init__(self, req=None,): +def addEdgesAtomic_args__init__(self, req=None,): self.req = req -chainAddEdges_args.__init__ = chainAddEdges_args__init__ +addEdgesAtomic_args.__init__ = addEdgesAtomic_args__init__ -def chainAddEdges_args__setstate__(self, state): +def addEdgesAtomic_args__setstate__(self, state): state.setdefault('req', None) self.__dict__ = state -chainAddEdges_args.__getstate__ = lambda self: self.__dict__.copy() -chainAddEdges_args.__setstate__ = chainAddEdges_args__setstate__ +addEdgesAtomic_args.__getstate__ = lambda self: self.__dict__.copy() +addEdgesAtomic_args.__setstate__ = addEdgesAtomic_args__setstate__ -class chainAddEdges_result: +class addEdgesAtomic_result: """ Attributes: - success @@ -3309,7 +3102,7 @@ def write(self, oprot): if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return - oprot.writeStructBegin('chainAddEdges_result') + oprot.writeStructBegin('addEdgesAtomic_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) @@ -3339,27 +3132,27 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -all_structs.append(chainAddEdges_result) -chainAddEdges_result.thrift_spec = ( +all_structs.append(addEdgesAtomic_result) +addEdgesAtomic_result.thrift_spec = ( (0, TType.STRUCT, 'success', [ExecResponse, ExecResponse.thrift_spec, False], None, 2, ), # 0 ) -chainAddEdges_result.thrift_struct_annotations = { +addEdgesAtomic_result.thrift_struct_annotations = { } -chainAddEdges_result.thrift_field_annotations = { +addEdgesAtomic_result.thrift_field_annotations = { } -def chainAddEdges_result__init__(self, success=None,): +def addEdgesAtomic_result__init__(self, success=None,): self.success = success -chainAddEdges_result.__init__ = chainAddEdges_result__init__ +addEdgesAtomic_result.__init__ = addEdgesAtomic_result__init__ -def chainAddEdges_result__setstate__(self, state): +def addEdgesAtomic_result__setstate__(self, state): state.setdefault('success', None) self.__dict__ = state -chainAddEdges_result.__getstate__ = lambda self: self.__dict__.copy() -chainAddEdges_result.__setstate__ = chainAddEdges_result__setstate__ +addEdgesAtomic_result.__getstate__ = lambda self: self.__dict__.copy() +addEdgesAtomic_result.__setstate__ = addEdgesAtomic_result__setstate__ class Client(Iface): def __enter__(self): @@ -3796,65 +3589,35 @@ def recv_lookupAndTraverse(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "lookupAndTraverse failed: unknown result"); - def chainUpdateEdge(self, req=None): - """ - Parameters: - - req - """ - self.send_chainUpdateEdge(req) - return self.recv_chainUpdateEdge() - - def send_chainUpdateEdge(self, req=None): - self._oprot.writeMessageBegin('chainUpdateEdge', TMessageType.CALL, self._seqid) - args = chainUpdateEdge_args() - args.req = req - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_chainUpdateEdge(self, ): - (fname, mtype, rseqid) = self._iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(self._iprot) - self._iprot.readMessageEnd() - raise x - result = chainUpdateEdge_result() - result.read(self._iprot) - self._iprot.readMessageEnd() - if result.success != None: - return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "chainUpdateEdge failed: unknown result"); - - def chainAddEdges(self, req=None): + def addEdgesAtomic(self, req=None): """ Parameters: - req """ - self.send_chainAddEdges(req) - return self.recv_chainAddEdges() + self.send_addEdgesAtomic(req) + return self.recv_addEdgesAtomic() - def send_chainAddEdges(self, req=None): - self._oprot.writeMessageBegin('chainAddEdges', TMessageType.CALL, self._seqid) - args = chainAddEdges_args() + def send_addEdgesAtomic(self, req=None): + self._oprot.writeMessageBegin('addEdgesAtomic', TMessageType.CALL, self._seqid) + args = addEdgesAtomic_args() args.req = req args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_chainAddEdges(self, ): + def recv_addEdgesAtomic(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x - result = chainAddEdges_result() + result = addEdgesAtomic_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "chainAddEdges failed: unknown result"); + raise TApplicationException(TApplicationException.MISSING_RESULT, "addEdgesAtomic failed: unknown result"); class Processor(Iface, TProcessor): @@ -3893,10 +3656,8 @@ def __init__(self, handler): self._priorityMap["lookupIndex"] = TPriority.NORMAL self._processMap["lookupAndTraverse"] = Processor.process_lookupAndTraverse self._priorityMap["lookupAndTraverse"] = TPriority.NORMAL - self._processMap["chainUpdateEdge"] = Processor.process_chainUpdateEdge - self._priorityMap["chainUpdateEdge"] = TPriority.NORMAL - self._processMap["chainAddEdges"] = Processor.process_chainAddEdges - self._priorityMap["chainAddEdges"] = TPriority.NORMAL + self._processMap["addEdgesAtomic"] = Processor.process_addEdgesAtomic + self._priorityMap["addEdgesAtomic"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -4060,25 +3821,14 @@ def process_lookupAndTraverse(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(chainUpdateEdge_args, oneway=False) - def process_chainUpdateEdge(self, args, handler_ctx): - result = chainUpdateEdge_result() - try: - result.success = self._handler.chainUpdateEdge(args.req) - except: - ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'chainUpdateEdge', ex) - result = Thrift.TApplicationException(message=repr(ex)) - return result - - @thrift_process_method(chainAddEdges_args, oneway=False) - def process_chainAddEdges(self, args, handler_ctx): - result = chainAddEdges_result() + @thrift_process_method(addEdgesAtomic_args, oneway=False) + def process_addEdgesAtomic(self, args, handler_ctx): + result = addEdgesAtomic_result() try: - result.success = self._handler.chainAddEdges(args.req) + result.success = self._handler.addEdgesAtomic(args.req) except: ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'chainAddEdges', ex) + self._event_handler.handlerError(handler_ctx, 'addEdgesAtomic', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @@ -4120,10 +3870,8 @@ def __init__(self, handler): self._priorityMap["lookupIndex"] = TPriority.NORMAL self._processMap["lookupAndTraverse"] = ContextProcessor.process_lookupAndTraverse self._priorityMap["lookupAndTraverse"] = TPriority.NORMAL - self._processMap["chainUpdateEdge"] = ContextProcessor.process_chainUpdateEdge - self._priorityMap["chainUpdateEdge"] = TPriority.NORMAL - self._processMap["chainAddEdges"] = ContextProcessor.process_chainAddEdges - self._priorityMap["chainAddEdges"] = TPriority.NORMAL + self._processMap["addEdgesAtomic"] = ContextProcessor.process_addEdgesAtomic + self._priorityMap["addEdgesAtomic"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -4287,25 +4035,14 @@ def process_lookupAndTraverse(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(chainUpdateEdge_args, oneway=False) - def process_chainUpdateEdge(self, args, handler_ctx): - result = chainUpdateEdge_result() - try: - result.success = self._handler.chainUpdateEdge(handler_ctx, args.req) - except: - ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'chainUpdateEdge', ex) - result = Thrift.TApplicationException(message=repr(ex)) - return result - - @thrift_process_method(chainAddEdges_args, oneway=False) - def process_chainAddEdges(self, args, handler_ctx): - result = chainAddEdges_result() + @thrift_process_method(addEdgesAtomic_args, oneway=False) + def process_addEdgesAtomic(self, args, handler_ctx): + result = addEdgesAtomic_result() try: - result.success = self._handler.chainAddEdges(handler_ctx, args.req) + result.success = self._handler.addEdgesAtomic(handler_ctx, args.req) except: ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'chainAddEdges', ex) + self._event_handler.handlerError(handler_ctx, 'addEdgesAtomic', ex) result = Thrift.TApplicationException(message=repr(ex)) return result diff --git a/nebula2/storage/StorageAdminService-fuzzer b/nebula2/storage/StorageAdminService-fuzzer index 83c36585..4096544d 100755 --- a/nebula2/storage/StorageAdminService-fuzzer +++ b/nebula2/storage/StorageAdminService-fuzzer @@ -42,4 +42,4 @@ from . import ttypes from . import constants import nebula2.fbthrift.util.fuzzer -nebula2.fbthrift.util.fuzzer.fuzz_service(StorageAdminService, ttypes, constants) +thrift.util.fuzzer.fuzz_service(StorageAdminService, ttypes, constants) diff --git a/nebula2/storage/StorageAdminService.py b/nebula2/storage/StorageAdminService.py index 093a7b78..5994824d 100644 --- a/nebula2/storage/StorageAdminService.py +++ b/nebula2/storage/StorageAdminService.py @@ -13,7 +13,7 @@ from nebula2.fbthrift.protocol.TProtocol import TProtocolException -from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, ChainAddEdgesRequest, ChainUpdateEdgeRequest +from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, GetValueRequest, GetValueResponse import nebula2.common.ttypes import nebula2.meta.ttypes diff --git a/nebula2/storage/constants.py b/nebula2/storage/constants.py index 5477e8fa..20c86230 100644 --- a/nebula2/storage/constants.py +++ b/nebula2/storage/constants.py @@ -17,5 +17,5 @@ import nebula2.meta.ttypes -from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, ChainAddEdgesRequest, ChainUpdateEdgeRequest +from .ttypes import UTF8STRINGS, StatType, OrderDirection, EdgeDirection, ScanType, EngineSignType, RequestCommon, PartitionResult, ResponseCommon, StatProp, Expr, EdgeProp, VertexProp, OrderBy, TraverseSpec, GetNeighborsRequest, GetNeighborsResponse, ExecResponse, GetPropRequest, GetPropResponse, NewTag, NewVertex, EdgeKey, NewEdge, AddVerticesRequest, AddEdgesRequest, DeleteVerticesRequest, DeleteEdgesRequest, DelTags, DeleteTagsRequest, UpdateResponse, UpdatedProp, UpdateVertexRequest, UpdateEdgeRequest, GetUUIDReq, GetUUIDResp, LookupIndexResp, IndexColumnHint, IndexQueryContext, IndexSpec, LookupIndexRequest, LookupAndTraverseRequest, ScanVertexRequest, ScanVertexResponse, ScanEdgeRequest, ScanEdgeResponse, TaskPara, AddAdminTaskRequest, StopAdminTaskRequest, AdminExecResp, TransLeaderReq, AddPartReq, AddLearnerReq, RemovePartReq, MemberChangeReq, CatchUpDataReq, GetLeaderReq, CreateCPRequest, DropCPRequest, BlockingSignRequest, GetLeaderPartsResp, CheckPeersReq, RebuildIndexRequest, CreateCPResp, ListClusterInfoResp, ListClusterInfoReq, KVGetRequest, KVGetResponse, KVPutRequest, KVRemoveRequest, InternalTxnRequest, GetValueRequest, GetValueResponse diff --git a/nebula2/storage/ttypes.py b/nebula2/storage/ttypes.py index df78c3d3..e15f3c3f 100644 --- a/nebula2/storage/ttypes.py +++ b/nebula2/storage/ttypes.py @@ -32,7 +32,7 @@ all_structs = [] UTF8STRINGS = bool(0) or sys.version_info.major >= 3 -__all__ = ['UTF8STRINGS', 'StatType', 'OrderDirection', 'EdgeDirection', 'ScanType', 'EngineSignType', 'RequestCommon', 'PartitionResult', 'ResponseCommon', 'StatProp', 'Expr', 'EdgeProp', 'VertexProp', 'OrderBy', 'TraverseSpec', 'GetNeighborsRequest', 'GetNeighborsResponse', 'ExecResponse', 'GetPropRequest', 'GetPropResponse', 'NewTag', 'NewVertex', 'EdgeKey', 'NewEdge', 'AddVerticesRequest', 'AddEdgesRequest', 'DeleteVerticesRequest', 'DeleteEdgesRequest', 'DelTags', 'DeleteTagsRequest', 'UpdateResponse', 'UpdatedProp', 'UpdateVertexRequest', 'UpdateEdgeRequest', 'GetUUIDReq', 'GetUUIDResp', 'LookupIndexResp', 'IndexColumnHint', 'IndexQueryContext', 'IndexSpec', 'LookupIndexRequest', 'LookupAndTraverseRequest', 'ScanVertexRequest', 'ScanVertexResponse', 'ScanEdgeRequest', 'ScanEdgeResponse', 'TaskPara', 'AddAdminTaskRequest', 'StopAdminTaskRequest', 'AdminExecResp', 'TransLeaderReq', 'AddPartReq', 'AddLearnerReq', 'RemovePartReq', 'MemberChangeReq', 'CatchUpDataReq', 'GetLeaderReq', 'CreateCPRequest', 'DropCPRequest', 'BlockingSignRequest', 'GetLeaderPartsResp', 'CheckPeersReq', 'RebuildIndexRequest', 'CreateCPResp', 'ListClusterInfoResp', 'ListClusterInfoReq', 'KVGetRequest', 'KVGetResponse', 'KVPutRequest', 'KVRemoveRequest', 'InternalTxnRequest', 'ChainAddEdgesRequest', 'ChainUpdateEdgeRequest'] +__all__ = ['UTF8STRINGS', 'StatType', 'OrderDirection', 'EdgeDirection', 'ScanType', 'EngineSignType', 'RequestCommon', 'PartitionResult', 'ResponseCommon', 'StatProp', 'Expr', 'EdgeProp', 'VertexProp', 'OrderBy', 'TraverseSpec', 'GetNeighborsRequest', 'GetNeighborsResponse', 'ExecResponse', 'GetPropRequest', 'GetPropResponse', 'NewTag', 'NewVertex', 'EdgeKey', 'NewEdge', 'AddVerticesRequest', 'AddEdgesRequest', 'DeleteVerticesRequest', 'DeleteEdgesRequest', 'DelTags', 'DeleteTagsRequest', 'UpdateResponse', 'UpdatedProp', 'UpdateVertexRequest', 'UpdateEdgeRequest', 'GetUUIDReq', 'GetUUIDResp', 'LookupIndexResp', 'IndexColumnHint', 'IndexQueryContext', 'IndexSpec', 'LookupIndexRequest', 'LookupAndTraverseRequest', 'ScanVertexRequest', 'ScanVertexResponse', 'ScanEdgeRequest', 'ScanEdgeResponse', 'TaskPara', 'AddAdminTaskRequest', 'StopAdminTaskRequest', 'AdminExecResp', 'TransLeaderReq', 'AddPartReq', 'AddLearnerReq', 'RemovePartReq', 'MemberChangeReq', 'CatchUpDataReq', 'GetLeaderReq', 'CreateCPRequest', 'DropCPRequest', 'BlockingSignRequest', 'GetLeaderPartsResp', 'CheckPeersReq', 'RebuildIndexRequest', 'CreateCPResp', 'ListClusterInfoResp', 'ListClusterInfoReq', 'KVGetRequest', 'KVGetResponse', 'KVPutRequest', 'KVRemoveRequest', 'InternalTxnRequest', 'GetValueRequest', 'GetValueResponse'] class StatType: SUM = 1 @@ -4437,7 +4437,8 @@ class IndexSpec: """ Attributes: - contexts - - schema_id + - is_edge + - tag_or_edge_id """ thrift_spec = None @@ -4478,9 +4479,13 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.STRUCT: - self.schema_id = nebula2.common.ttypes.SchemaID() - self.schema_id.read(iprot) + if ftype == TType.BOOL: + self.is_edge = iprot.readBool() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I32: + self.tag_or_edge_id = iprot.readI32() else: iprot.skip(ftype) else: @@ -4503,9 +4508,13 @@ def write(self, oprot): iter418.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() - if self.schema_id != None: - oprot.writeFieldBegin('schema_id', TType.STRUCT, 2) - self.schema_id.write(oprot) + if self.is_edge != None: + oprot.writeFieldBegin('is_edge', TType.BOOL, 2) + oprot.writeBool(self.is_edge) + oprot.writeFieldEnd() + if self.tag_or_edge_id != None: + oprot.writeFieldBegin('tag_or_edge_id', TType.I32, 3) + oprot.writeI32(self.tag_or_edge_id) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -4517,10 +4526,14 @@ def __repr__(self): value = pprint.pformat(self.contexts, indent=0) value = padding.join(value.splitlines(True)) L.append(' contexts=%s' % (value)) - if self.schema_id is not None: - value = pprint.pformat(self.schema_id, indent=0) + if self.is_edge is not None: + value = pprint.pformat(self.is_edge, indent=0) value = padding.join(value.splitlines(True)) - L.append(' schema_id=%s' % (value)) + L.append(' is_edge=%s' % (value)) + if self.tag_or_edge_id is not None: + value = pprint.pformat(self.tag_or_edge_id, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' tag_or_edge_id=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -4544,7 +4557,6 @@ class LookupIndexRequest: - indices - return_columns - common - - limit """ thrift_spec = None @@ -4614,11 +4626,6 @@ def read(self, iprot): self.common.read(iprot) else: iprot.skip(ftype) - elif fid == 6: - if ftype == TType.I64: - self.limit = iprot.readI64() - else: - iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -4658,10 +4665,6 @@ def write(self, oprot): oprot.writeFieldBegin('common', TType.STRUCT, 5) self.common.write(oprot) oprot.writeFieldEnd() - if self.limit != None: - oprot.writeFieldBegin('limit', TType.I64, 6) - oprot.writeI64(self.limit) - oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -4688,10 +4691,6 @@ def __repr__(self): value = pprint.pformat(self.common, indent=0) value = padding.join(value.splitlines(True)) L.append(' common=%s' % (value)) - if self.limit is not None: - value = pprint.pformat(self.limit, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' limit=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -8012,10 +8011,10 @@ class InternalTxnRequest: """ Attributes: - txn_id - - term_of_parts - - add_edge_req - - upd_edge_req - - edge_ver + - space_id + - part_id + - position + - data """ thrift_spec = None @@ -8044,69 +8043,53 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.MAP: - self.term_of_parts = {} - (_ktype607, _vtype608, _size606 ) = iprot.readMapBegin() - if _size606 >= 0: - for _i610 in six.moves.range(_size606): - _key611 = iprot.readI32() - _val612 = iprot.readI64() - self.term_of_parts[_key611] = _val612 - else: - while iprot.peekMap(): - _key613 = iprot.readI32() - _val614 = iprot.readI64() - self.term_of_parts[_key613] = _val614 - iprot.readMapEnd() + if ftype == TType.I32: + self.space_id = iprot.readI32() else: iprot.skip(ftype) elif fid == 3: - if ftype == TType.STRUCT: - self.add_edge_req = AddEdgesRequest() - self.add_edge_req.read(iprot) + if ftype == TType.I32: + self.part_id = iprot.readI32() else: iprot.skip(ftype) elif fid == 4: - if ftype == TType.STRUCT: - self.upd_edge_req = UpdateEdgeRequest() - self.upd_edge_req.read(iprot) + if ftype == TType.I32: + self.position = iprot.readI32() else: iprot.skip(ftype) elif fid == 5: - if ftype == TType.MAP: - self.edge_ver = {} - (_ktype616, _vtype617, _size615 ) = iprot.readMapBegin() - if _size615 >= 0: - for _i619 in six.moves.range(_size615): - _key620 = iprot.readI32() - _val621 = [] - (_etype625, _size622) = iprot.readListBegin() - if _size622 >= 0: - for _i626 in six.moves.range(_size622): - _elem627 = iprot.readI64() - _val621.append(_elem627) + if ftype == TType.LIST: + self.data = [] + (_etype609, _size606) = iprot.readListBegin() + if _size606 >= 0: + for _i610 in six.moves.range(_size606): + _elem611 = [] + (_etype615, _size612) = iprot.readListBegin() + if _size612 >= 0: + for _i616 in six.moves.range(_size612): + _elem617 = iprot.readString() + _elem611.append(_elem617) else: while iprot.peekList(): - _elem628 = iprot.readI64() - _val621.append(_elem628) + _elem618 = iprot.readString() + _elem611.append(_elem618) iprot.readListEnd() - self.edge_ver[_key620] = _val621 + self.data.append(_elem611) else: - while iprot.peekMap(): - _key629 = iprot.readI32() - _val630 = [] - (_etype634, _size631) = iprot.readListBegin() - if _size631 >= 0: - for _i635 in six.moves.range(_size631): - _elem636 = iprot.readI64() - _val630.append(_elem636) + while iprot.peekList(): + _elem619 = [] + (_etype623, _size620) = iprot.readListBegin() + if _size620 >= 0: + for _i624 in six.moves.range(_size620): + _elem625 = iprot.readString() + _elem619.append(_elem625) else: while iprot.peekList(): - _elem637 = iprot.readI64() - _val630.append(_elem637) + _elem626 = iprot.readString() + _elem619.append(_elem626) iprot.readListEnd() - self.edge_ver[_key629] = _val630 - iprot.readMapEnd() + self.data.append(_elem619) + iprot.readListEnd() else: iprot.skip(ftype) else: @@ -8126,32 +8109,27 @@ def write(self, oprot): oprot.writeFieldBegin('txn_id', TType.I64, 1) oprot.writeI64(self.txn_id) oprot.writeFieldEnd() - if self.term_of_parts != None: - oprot.writeFieldBegin('term_of_parts', TType.MAP, 2) - oprot.writeMapBegin(TType.I32, TType.I64, len(self.term_of_parts)) - for kiter638,viter639 in self.term_of_parts.items(): - oprot.writeI32(kiter638) - oprot.writeI64(viter639) - oprot.writeMapEnd() + if self.space_id != None: + oprot.writeFieldBegin('space_id', TType.I32, 2) + oprot.writeI32(self.space_id) + oprot.writeFieldEnd() + if self.part_id != None: + oprot.writeFieldBegin('part_id', TType.I32, 3) + oprot.writeI32(self.part_id) oprot.writeFieldEnd() - if self.add_edge_req != None: - oprot.writeFieldBegin('add_edge_req', TType.STRUCT, 3) - self.add_edge_req.write(oprot) - oprot.writeFieldEnd() - if self.upd_edge_req != None: - oprot.writeFieldBegin('upd_edge_req', TType.STRUCT, 4) - self.upd_edge_req.write(oprot) - oprot.writeFieldEnd() - if self.edge_ver != None: - oprot.writeFieldBegin('edge_ver', TType.MAP, 5) - oprot.writeMapBegin(TType.I32, TType.LIST, len(self.edge_ver)) - for kiter640,viter641 in self.edge_ver.items(): - oprot.writeI32(kiter640) - oprot.writeListBegin(TType.I64, len(viter641)) - for iter642 in viter641: - oprot.writeI64(iter642) + if self.position != None: + oprot.writeFieldBegin('position', TType.I32, 4) + oprot.writeI32(self.position) + oprot.writeFieldEnd() + if self.data != None: + oprot.writeFieldBegin('data', TType.LIST, 5) + oprot.writeListBegin(TType.LIST, len(self.data)) + for iter627 in self.data: + oprot.writeListBegin(TType.STRING, len(iter627)) + for iter628 in iter627: + oprot.writeString(iter628) oprot.writeListEnd() - oprot.writeMapEnd() + oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8163,22 +8141,22 @@ def __repr__(self): value = pprint.pformat(self.txn_id, indent=0) value = padding.join(value.splitlines(True)) L.append(' txn_id=%s' % (value)) - if self.term_of_parts is not None: - value = pprint.pformat(self.term_of_parts, indent=0) + if self.space_id is not None: + value = pprint.pformat(self.space_id, indent=0) value = padding.join(value.splitlines(True)) - L.append(' term_of_parts=%s' % (value)) - if self.add_edge_req is not None: - value = pprint.pformat(self.add_edge_req, indent=0) + L.append(' space_id=%s' % (value)) + if self.part_id is not None: + value = pprint.pformat(self.part_id, indent=0) value = padding.join(value.splitlines(True)) - L.append(' add_edge_req=%s' % (value)) - if self.upd_edge_req is not None: - value = pprint.pformat(self.upd_edge_req, indent=0) + L.append(' part_id=%s' % (value)) + if self.position is not None: + value = pprint.pformat(self.position, indent=0) value = padding.join(value.splitlines(True)) - L.append(' upd_edge_req=%s' % (value)) - if self.edge_ver is not None: - value = pprint.pformat(self.edge_ver, indent=0) + L.append(' position=%s' % (value)) + if self.data is not None: + value = pprint.pformat(self.data, indent=0) value = padding.join(value.splitlines(True)) - L.append(' edge_ver=%s' % (value)) + L.append(' data=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -8194,15 +8172,12 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -class ChainAddEdgesRequest: +class GetValueRequest: """ Attributes: - space_id - - parts - - prop_names - - if_not_exists - - term - - edge_version + - part_id + - key """ thrift_spec = None @@ -8231,74 +8206,13 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.MAP: - self.parts = {} - (_ktype644, _vtype645, _size643 ) = iprot.readMapBegin() - if _size643 >= 0: - for _i647 in six.moves.range(_size643): - _key648 = iprot.readI32() - _val649 = [] - (_etype653, _size650) = iprot.readListBegin() - if _size650 >= 0: - for _i654 in six.moves.range(_size650): - _elem655 = NewEdge() - _elem655.read(iprot) - _val649.append(_elem655) - else: - while iprot.peekList(): - _elem656 = NewEdge() - _elem656.read(iprot) - _val649.append(_elem656) - iprot.readListEnd() - self.parts[_key648] = _val649 - else: - while iprot.peekMap(): - _key657 = iprot.readI32() - _val658 = [] - (_etype662, _size659) = iprot.readListBegin() - if _size659 >= 0: - for _i663 in six.moves.range(_size659): - _elem664 = NewEdge() - _elem664.read(iprot) - _val658.append(_elem664) - else: - while iprot.peekList(): - _elem665 = NewEdge() - _elem665.read(iprot) - _val658.append(_elem665) - iprot.readListEnd() - self.parts[_key657] = _val658 - iprot.readMapEnd() + if ftype == TType.I32: + self.part_id = iprot.readI32() else: iprot.skip(ftype) elif fid == 3: - if ftype == TType.LIST: - self.prop_names = [] - (_etype669, _size666) = iprot.readListBegin() - if _size666 >= 0: - for _i670 in six.moves.range(_size666): - _elem671 = iprot.readString() - self.prop_names.append(_elem671) - else: - while iprot.peekList(): - _elem672 = iprot.readString() - self.prop_names.append(_elem672) - iprot.readListEnd() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.BOOL: - self.if_not_exists = iprot.readBool() - else: - iprot.skip(ftype) - elif fid == 5: - if ftype == TType.I64: - self.term = iprot.readI64() - else: - iprot.skip(ftype) - elif fid == 6: - if ftype == TType.I64: - self.edge_version = iprot.readI64() + if ftype == TType.STRING: + self.key = iprot.readString() else: iprot.skip(ftype) else: @@ -8313,40 +8227,18 @@ def write(self, oprot): if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return - oprot.writeStructBegin('ChainAddEdgesRequest') + oprot.writeStructBegin('GetValueRequest') if self.space_id != None: oprot.writeFieldBegin('space_id', TType.I32, 1) oprot.writeI32(self.space_id) oprot.writeFieldEnd() - if self.parts != None: - oprot.writeFieldBegin('parts', TType.MAP, 2) - oprot.writeMapBegin(TType.I32, TType.LIST, len(self.parts)) - for kiter673,viter674 in self.parts.items(): - oprot.writeI32(kiter673) - oprot.writeListBegin(TType.STRUCT, len(viter674)) - for iter675 in viter674: - iter675.write(oprot) - oprot.writeListEnd() - oprot.writeMapEnd() - oprot.writeFieldEnd() - if self.prop_names != None: - oprot.writeFieldBegin('prop_names', TType.LIST, 3) - oprot.writeListBegin(TType.STRING, len(self.prop_names)) - for iter676 in self.prop_names: - oprot.writeString(iter676) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.if_not_exists != None: - oprot.writeFieldBegin('if_not_exists', TType.BOOL, 4) - oprot.writeBool(self.if_not_exists) - oprot.writeFieldEnd() - if self.term != None: - oprot.writeFieldBegin('term', TType.I64, 5) - oprot.writeI64(self.term) + if self.part_id != None: + oprot.writeFieldBegin('part_id', TType.I32, 2) + oprot.writeI32(self.part_id) oprot.writeFieldEnd() - if self.edge_version != None: - oprot.writeFieldBegin('edge_version', TType.I64, 6) - oprot.writeI64(self.edge_version) + if self.key != None: + oprot.writeFieldBegin('key', TType.STRING, 3) + oprot.writeString(self.key) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8358,26 +8250,14 @@ def __repr__(self): value = pprint.pformat(self.space_id, indent=0) value = padding.join(value.splitlines(True)) L.append(' space_id=%s' % (value)) - if self.parts is not None: - value = pprint.pformat(self.parts, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' parts=%s' % (value)) - if self.prop_names is not None: - value = pprint.pformat(self.prop_names, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' prop_names=%s' % (value)) - if self.if_not_exists is not None: - value = pprint.pformat(self.if_not_exists, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' if_not_exists=%s' % (value)) - if self.term is not None: - value = pprint.pformat(self.term, indent=0) + if self.part_id is not None: + value = pprint.pformat(self.part_id, indent=0) value = padding.join(value.splitlines(True)) - L.append(' term=%s' % (value)) - if self.edge_version is not None: - value = pprint.pformat(self.edge_version, indent=0) + L.append(' part_id=%s' % (value)) + if self.key is not None: + value = pprint.pformat(self.key, indent=0) value = padding.join(value.splitlines(True)) - L.append(' edge_version=%s' % (value)) + L.append(' key=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -8393,14 +8273,11 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -class ChainUpdateEdgeRequest: +class GetValueResponse: """ Attributes: - - update_edge_request - - term - - edge_version - - space_id - - parts + - result + - value """ thrift_spec = None @@ -8425,38 +8302,13 @@ def read(self, iprot): break if fid == 1: if ftype == TType.STRUCT: - self.update_edge_request = UpdateEdgeRequest() - self.update_edge_request.read(iprot) + self.result = ResponseCommon() + self.result.read(iprot) else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.I64: - self.term = iprot.readI64() - else: - iprot.skip(ftype) - elif fid == 3: - if ftype == TType.I64: - self.edge_version = iprot.readI64() - else: - iprot.skip(ftype) - elif fid == 4: - if ftype == TType.I32: - self.space_id = iprot.readI32() - else: - iprot.skip(ftype) - elif fid == 5: - if ftype == TType.LIST: - self.parts = [] - (_etype680, _size677) = iprot.readListBegin() - if _size677 >= 0: - for _i681 in six.moves.range(_size677): - _elem682 = iprot.readI32() - self.parts.append(_elem682) - else: - while iprot.peekList(): - _elem683 = iprot.readI32() - self.parts.append(_elem683) - iprot.readListEnd() + if ftype == TType.STRING: + self.value = iprot.readString() else: iprot.skip(ftype) else: @@ -8471,29 +8323,14 @@ def write(self, oprot): if (isinstance(oprot, TCompactProtocol.TCompactProtocolAccelerated) or (isinstance(oprot, THeaderProtocol.THeaderProtocolAccelerate) and oprot.get_protocol_id() == THeaderProtocol.THeaderProtocol.T_COMPACT_PROTOCOL)) and self.thrift_spec is not None and fastproto is not None: oprot.trans.write(fastproto.encode(self, [self.__class__, self.thrift_spec, False], utf8strings=UTF8STRINGS, protoid=2)) return - oprot.writeStructBegin('ChainUpdateEdgeRequest') - if self.update_edge_request != None: - oprot.writeFieldBegin('update_edge_request', TType.STRUCT, 1) - self.update_edge_request.write(oprot) - oprot.writeFieldEnd() - if self.term != None: - oprot.writeFieldBegin('term', TType.I64, 2) - oprot.writeI64(self.term) - oprot.writeFieldEnd() - if self.edge_version != None: - oprot.writeFieldBegin('edge_version', TType.I64, 3) - oprot.writeI64(self.edge_version) - oprot.writeFieldEnd() - if self.space_id != None: - oprot.writeFieldBegin('space_id', TType.I32, 4) - oprot.writeI32(self.space_id) + oprot.writeStructBegin('GetValueResponse') + if self.result != None: + oprot.writeFieldBegin('result', TType.STRUCT, 1) + self.result.write(oprot) oprot.writeFieldEnd() - if self.parts != None: - oprot.writeFieldBegin('parts', TType.LIST, 5) - oprot.writeListBegin(TType.I32, len(self.parts)) - for iter684 in self.parts: - oprot.writeI32(iter684) - oprot.writeListEnd() + if self.value != None: + oprot.writeFieldBegin('value', TType.STRING, 2) + oprot.writeString(self.value) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8501,26 +8338,14 @@ def write(self, oprot): def __repr__(self): L = [] padding = ' ' * 4 - if self.update_edge_request is not None: - value = pprint.pformat(self.update_edge_request, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' update_edge_request=%s' % (value)) - if self.term is not None: - value = pprint.pformat(self.term, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' term=%s' % (value)) - if self.edge_version is not None: - value = pprint.pformat(self.edge_version, indent=0) - value = padding.join(value.splitlines(True)) - L.append(' edge_version=%s' % (value)) - if self.space_id is not None: - value = pprint.pformat(self.space_id, indent=0) + if self.result is not None: + value = pprint.pformat(self.result, indent=0) value = padding.join(value.splitlines(True)) - L.append(' space_id=%s' % (value)) - if self.parts is not None: - value = pprint.pformat(self.parts, indent=0) + L.append(' result=%s' % (value)) + if self.value is not None: + value = pprint.pformat(self.value, indent=0) value = padding.join(value.splitlines(True)) - L.append(' parts=%s' % (value)) + L.append(' value=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -9551,7 +9376,8 @@ def IndexQueryContext__setstate__(self, state): IndexSpec.thrift_spec = ( None, # 0 (1, TType.LIST, 'contexts', (TType.STRUCT,[IndexQueryContext, IndexQueryContext.thrift_spec, False]), None, 0, ), # 1 - (2, TType.STRUCT, 'schema_id', [nebula2.common.ttypes.SchemaID, nebula2.common.ttypes.SchemaID.thrift_spec, True], None, 2, ), # 2 + (2, TType.BOOL, 'is_edge', None, None, 0, ), # 2 + (3, TType.I32, 'tag_or_edge_id', None, None, 0, ), # 3 ) IndexSpec.thrift_struct_annotations = { @@ -9559,15 +9385,17 @@ def IndexQueryContext__setstate__(self, state): IndexSpec.thrift_field_annotations = { } -def IndexSpec__init__(self, contexts=None, schema_id=None,): +def IndexSpec__init__(self, contexts=None, is_edge=None, tag_or_edge_id=None,): self.contexts = contexts - self.schema_id = schema_id + self.is_edge = is_edge + self.tag_or_edge_id = tag_or_edge_id IndexSpec.__init__ = IndexSpec__init__ def IndexSpec__setstate__(self, state): state.setdefault('contexts', None) - state.setdefault('schema_id', None) + state.setdefault('is_edge', None) + state.setdefault('tag_or_edge_id', None) self.__dict__ = state IndexSpec.__getstate__ = lambda self: self.__dict__.copy() @@ -9581,7 +9409,6 @@ def IndexSpec__setstate__(self, state): (3, TType.STRUCT, 'indices', [IndexSpec, IndexSpec.thrift_spec, False], None, 2, ), # 3 (4, TType.LIST, 'return_columns', (TType.STRING,False), None, 1, ), # 4 (5, TType.STRUCT, 'common', [RequestCommon, RequestCommon.thrift_spec, False], None, 1, ), # 5 - (6, TType.I64, 'limit', None, None, 1, ), # 6 ) LookupIndexRequest.thrift_struct_annotations = { @@ -9589,13 +9416,12 @@ def IndexSpec__setstate__(self, state): LookupIndexRequest.thrift_field_annotations = { } -def LookupIndexRequest__init__(self, space_id=None, parts=None, indices=None, return_columns=None, common=None, limit=None,): +def LookupIndexRequest__init__(self, space_id=None, parts=None, indices=None, return_columns=None, common=None,): self.space_id = space_id self.parts = parts self.indices = indices self.return_columns = return_columns self.common = common - self.limit = limit LookupIndexRequest.__init__ = LookupIndexRequest__init__ @@ -9605,7 +9431,6 @@ def LookupIndexRequest__setstate__(self, state): state.setdefault('indices', None) state.setdefault('return_columns', None) state.setdefault('common', None) - state.setdefault('limit', None) self.__dict__ = state LookupIndexRequest.__getstate__ = lambda self: self.__dict__.copy() @@ -10452,10 +10277,10 @@ def KVRemoveRequest__setstate__(self, state): InternalTxnRequest.thrift_spec = ( None, # 0 (1, TType.I64, 'txn_id', None, None, 2, ), # 1 - (2, TType.MAP, 'term_of_parts', (TType.I32,None,TType.I64,None), None, 2, ), # 2 - (3, TType.STRUCT, 'add_edge_req', [AddEdgesRequest, AddEdgesRequest.thrift_spec, False], None, 1, ), # 3 - (4, TType.STRUCT, 'upd_edge_req', [UpdateEdgeRequest, UpdateEdgeRequest.thrift_spec, False], None, 1, ), # 4 - (5, TType.MAP, 'edge_ver', (TType.I32,None,TType.LIST,(TType.I64,None)), None, 1, ), # 5 + (2, TType.I32, 'space_id', None, None, 2, ), # 2 + (3, TType.I32, 'part_id', None, None, 2, ), # 3 + (4, TType.I32, 'position', None, None, 2, ), # 4 + (5, TType.LIST, 'data', (TType.LIST,(TType.STRING,False)), None, 2, ), # 5 ) InternalTxnRequest.thrift_struct_annotations = { @@ -10463,98 +10288,80 @@ def KVRemoveRequest__setstate__(self, state): InternalTxnRequest.thrift_field_annotations = { } -def InternalTxnRequest__init__(self, txn_id=None, term_of_parts=None, add_edge_req=None, upd_edge_req=None, edge_ver=None,): +def InternalTxnRequest__init__(self, txn_id=None, space_id=None, part_id=None, position=None, data=None,): self.txn_id = txn_id - self.term_of_parts = term_of_parts - self.add_edge_req = add_edge_req - self.upd_edge_req = upd_edge_req - self.edge_ver = edge_ver + self.space_id = space_id + self.part_id = part_id + self.position = position + self.data = data InternalTxnRequest.__init__ = InternalTxnRequest__init__ def InternalTxnRequest__setstate__(self, state): state.setdefault('txn_id', None) - state.setdefault('term_of_parts', None) - state.setdefault('add_edge_req', None) - state.setdefault('upd_edge_req', None) - state.setdefault('edge_ver', None) + state.setdefault('space_id', None) + state.setdefault('part_id', None) + state.setdefault('position', None) + state.setdefault('data', None) self.__dict__ = state InternalTxnRequest.__getstate__ = lambda self: self.__dict__.copy() InternalTxnRequest.__setstate__ = InternalTxnRequest__setstate__ -all_structs.append(ChainAddEdgesRequest) -ChainAddEdgesRequest.thrift_spec = ( +all_structs.append(GetValueRequest) +GetValueRequest.thrift_spec = ( None, # 0 (1, TType.I32, 'space_id', None, None, 2, ), # 1 - (2, TType.MAP, 'parts', (TType.I32,None,TType.LIST,(TType.STRUCT,[NewEdge, NewEdge.thrift_spec, False])), None, 2, ), # 2 - (3, TType.LIST, 'prop_names', (TType.STRING,False), None, 2, ), # 3 - (4, TType.BOOL, 'if_not_exists', None, None, 2, ), # 4 - (5, TType.I64, 'term', None, None, 2, ), # 5 - (6, TType.I64, 'edge_version', None, None, 1, ), # 6 + (2, TType.I32, 'part_id', None, None, 2, ), # 2 + (3, TType.STRING, 'key', False, None, 2, ), # 3 ) -ChainAddEdgesRequest.thrift_struct_annotations = { +GetValueRequest.thrift_struct_annotations = { } -ChainAddEdgesRequest.thrift_field_annotations = { +GetValueRequest.thrift_field_annotations = { } -def ChainAddEdgesRequest__init__(self, space_id=None, parts=None, prop_names=None, if_not_exists=None, term=None, edge_version=None,): +def GetValueRequest__init__(self, space_id=None, part_id=None, key=None,): self.space_id = space_id - self.parts = parts - self.prop_names = prop_names - self.if_not_exists = if_not_exists - self.term = term - self.edge_version = edge_version + self.part_id = part_id + self.key = key -ChainAddEdgesRequest.__init__ = ChainAddEdgesRequest__init__ +GetValueRequest.__init__ = GetValueRequest__init__ -def ChainAddEdgesRequest__setstate__(self, state): +def GetValueRequest__setstate__(self, state): state.setdefault('space_id', None) - state.setdefault('parts', None) - state.setdefault('prop_names', None) - state.setdefault('if_not_exists', None) - state.setdefault('term', None) - state.setdefault('edge_version', None) + state.setdefault('part_id', None) + state.setdefault('key', None) self.__dict__ = state -ChainAddEdgesRequest.__getstate__ = lambda self: self.__dict__.copy() -ChainAddEdgesRequest.__setstate__ = ChainAddEdgesRequest__setstate__ +GetValueRequest.__getstate__ = lambda self: self.__dict__.copy() +GetValueRequest.__setstate__ = GetValueRequest__setstate__ -all_structs.append(ChainUpdateEdgeRequest) -ChainUpdateEdgeRequest.thrift_spec = ( +all_structs.append(GetValueResponse) +GetValueResponse.thrift_spec = ( None, # 0 - (1, TType.STRUCT, 'update_edge_request', [UpdateEdgeRequest, UpdateEdgeRequest.thrift_spec, False], None, 2, ), # 1 - (2, TType.I64, 'term', None, None, 2, ), # 2 - (3, TType.I64, 'edge_version', None, None, 1, ), # 3 - (4, TType.I32, 'space_id', None, None, 2, ), # 4 - (5, TType.LIST, 'parts', (TType.I32,None), None, 0, ), # 5 + (1, TType.STRUCT, 'result', [ResponseCommon, ResponseCommon.thrift_spec, False], None, 0, ), # 1 + (2, TType.STRING, 'value', False, None, 2, ), # 2 ) -ChainUpdateEdgeRequest.thrift_struct_annotations = { +GetValueResponse.thrift_struct_annotations = { } -ChainUpdateEdgeRequest.thrift_field_annotations = { +GetValueResponse.thrift_field_annotations = { } -def ChainUpdateEdgeRequest__init__(self, update_edge_request=None, term=None, edge_version=None, space_id=None, parts=None,): - self.update_edge_request = update_edge_request - self.term = term - self.edge_version = edge_version - self.space_id = space_id - self.parts = parts +def GetValueResponse__init__(self, result=None, value=None,): + self.result = result + self.value = value -ChainUpdateEdgeRequest.__init__ = ChainUpdateEdgeRequest__init__ +GetValueResponse.__init__ = GetValueResponse__init__ -def ChainUpdateEdgeRequest__setstate__(self, state): - state.setdefault('update_edge_request', None) - state.setdefault('term', None) - state.setdefault('edge_version', None) - state.setdefault('space_id', None) - state.setdefault('parts', None) +def GetValueResponse__setstate__(self, state): + state.setdefault('result', None) + state.setdefault('value', None) self.__dict__ = state -ChainUpdateEdgeRequest.__getstate__ = lambda self: self.__dict__.copy() -ChainUpdateEdgeRequest.__setstate__ = ChainUpdateEdgeRequest__setstate__ +GetValueResponse.__getstate__ = lambda self: self.__dict__.copy() +GetValueResponse.__setstate__ = GetValueResponse__setstate__ fix_spec(all_structs) del all_structs