From f78992ceb2e7bbab18b7f02002c82579de2f3cce Mon Sep 17 00:00:00 2001 From: "kyle.cao" <2426009680@qq.com> Date: Thu, 30 Sep 2021 18:55:02 +0800 Subject: [PATCH] support parameter (#147) * support cypher parameter * fix ci --- example/GraphClientSimpleExample.py | 23 +- nebula2/common/ttypes.py | 15 + nebula2/fbthrift/server/TAsyncioServer.py | 4 +- nebula2/fbthrift/util/TValidator.py | 2 +- nebula2/gclient/net/Connection.py | 46 ++ nebula2/gclient/net/Session.py | 116 ++++ nebula2/graph/GraphService-fuzzer | 2 +- nebula2/graph/GraphService-remote | 2 + nebula2/graph/GraphService.py | 643 +++++++++++++++++++ nebula2/meta/MetaService-fuzzer | 2 +- nebula2/meta/MetaService-remote | 1 + nebula2/meta/MetaService.py | 265 +++++++- nebula2/meta/constants.py | 2 +- nebula2/meta/ttypes.py | 115 +++- 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 ++++++++++------ 23 files changed, 1921 insertions(+), 246 deletions(-) diff --git a/example/GraphClientSimpleExample.py b/example/GraphClientSimpleExample.py index 7a43e13d..c50e1dbe 100644 --- a/example/GraphClientSimpleExample.py +++ b/example/GraphClientSimpleExample.py @@ -11,6 +11,7 @@ from nebula2.gclient.net import ConnectionPool from nebula2.Config import Config +from nebula2.common import * from FormatResp import print_resp if __name__ == '__main__': @@ -44,7 +45,7 @@ assert resp.is_succeeded(), resp.error_msg() # insert edges - client.execute( + resp = client.execute( 'INSERT EDGE like(likeness) VALUES "Bob"->"Lily":(80.0);') assert resp.is_succeeded(), resp.error_msg() @@ -52,10 +53,28 @@ assert resp.is_succeeded(), resp.error_msg() print_resp(resp) - resp = client.execute('FETCH PROP ON like "Bob"->"Lily"') + 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') 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/common/ttypes.py b/nebula2/common/ttypes.py index 3d3d8922..0af0f0f8 100644 --- a/nebula2/common/ttypes.py +++ b/nebula2/common/ttypes.py @@ -135,6 +135,7 @@ class ErrorCode: E_BALANCER_FAILURE = -2047 E_JOB_NOT_FINISHED = -2048 E_TASK_REPORT_OUT_DATE = -2049 + E_JOB_NOT_IN_SPACE = -2050 E_INVALID_JOB = -2065 E_BACKUP_BUILDING_INDEX = -2066 E_BACKUP_SPACE_NOT_FOUND = -2067 @@ -178,6 +179,10 @@ class ErrorCode: E_USER_CANCEL = -3052 E_TASK_EXECUTION_FAILED = -3053 E_PLAN_IS_KILLED = -3060 + E_NO_TERM = -3070 + E_OUTDATED_TERM = -3071 + E_OUTDATED_EDGE = -3072 + E_WRITE_WRITE_CONFLICT = -3073 E_UNKNOWN = -8000 _VALUES_TO_NAMES = { @@ -252,6 +257,7 @@ class ErrorCode: -2047: "E_BALANCER_FAILURE", -2048: "E_JOB_NOT_FINISHED", -2049: "E_TASK_REPORT_OUT_DATE", + -2050: "E_JOB_NOT_IN_SPACE", -2065: "E_INVALID_JOB", -2066: "E_BACKUP_BUILDING_INDEX", -2067: "E_BACKUP_SPACE_NOT_FOUND", @@ -295,6 +301,10 @@ class ErrorCode: -3052: "E_USER_CANCEL", -3053: "E_TASK_EXECUTION_FAILED", -3060: "E_PLAN_IS_KILLED", + -3070: "E_NO_TERM", + -3071: "E_OUTDATED_TERM", + -3072: "E_OUTDATED_EDGE", + -3073: "E_WRITE_WRITE_CONFLICT", -8000: "E_UNKNOWN", } @@ -370,6 +380,7 @@ class ErrorCode: "E_BALANCER_FAILURE": -2047, "E_JOB_NOT_FINISHED": -2048, "E_TASK_REPORT_OUT_DATE": -2049, + "E_JOB_NOT_IN_SPACE": -2050, "E_INVALID_JOB": -2065, "E_BACKUP_BUILDING_INDEX": -2066, "E_BACKUP_SPACE_NOT_FOUND": -2067, @@ -413,6 +424,10 @@ class ErrorCode: "E_USER_CANCEL": -3052, "E_TASK_EXECUTION_FAILED": -3053, "E_PLAN_IS_KILLED": -3060, + "E_NO_TERM": -3070, + "E_OUTDATED_TERM": -3071, + "E_OUTDATED_EDGE": -3072, + "E_WRITE_WRITE_CONFLICT": -3073, "E_UNKNOWN": -8000, } diff --git a/nebula2/fbthrift/server/TAsyncioServer.py b/nebula2/fbthrift/server/TAsyncioServer.py index abc09376..f467e1eb 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 thrift.server.TServer. If None, - thrift.server.TServer.TServerEventHandler is used. Specify a custom handler + event_handler must be a subclass of nebula2.fbthrift.server.TServer. If None, + nebula2.fbthrift.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 0bcb0bb1..1d437102 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('thrift.validator') +_log = logging.getLogger('nebula2.fbthrift.validator') import sys if sys.version_info[0] >= 3: diff --git a/nebula2/gclient/net/Connection.py b/nebula2/gclient/net/Connection.py index 88314e28..218c187d 100644 --- a/nebula2/gclient/net/Connection.py +++ b/nebula2/gclient/net/Connection.py @@ -105,6 +105,29 @@ 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 @@ -128,6 +151,29 @@ def execute_json(self, session_id, stmt): 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 16bd3095..7244ea61 100644 --- a/nebula2/gclient/net/Session.py +++ b/nebula2/gclient/net/Session.py @@ -60,6 +60,38 @@ def execute(self, stmt): 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) + 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.executeWithParameter(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) + raise + 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 @@ -142,6 +174,90 @@ def execute_json(self, stmt): 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/graph/GraphService-fuzzer b/nebula2/graph/GraphService-fuzzer index 1857e335..b8c07170 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 -thrift.util.fuzzer.fuzz_service(GraphService, ttypes, constants) +nebula2.fbthrift.util.fuzzer.fuzz_service(GraphService, ttypes, constants) diff --git a/nebula2/graph/GraphService-remote b/nebula2/graph/GraphService-remote index 0f79a1db..e34b504d 100755 --- a/nebula2/graph/GraphService-remote +++ b/nebula2/graph/GraphService-remote @@ -45,7 +45,9 @@ 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')]), } SERVICE_NAMES = ['GraphService', ] diff --git a/nebula2/graph/GraphService.py b/nebula2/graph/GraphService.py index 8521a3ba..eac116ab 100644 --- a/nebula2/graph/GraphService.py +++ b/nebula2/graph/GraphService.py @@ -66,6 +66,15 @@ 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: @@ -74,6 +83,15 @@ def executeJson(self, sessionId=None, stmt=None): """ pass + def executeJsonWithParameter(self, sessionId=None, stmt=None, parameterMap=None): + """ + Parameters: + - sessionId + - stmt + - parameterMap + """ + pass + class ContextIface: def authenticate(self, handler_ctx, username=None, password=None): @@ -99,6 +117,15 @@ 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: @@ -107,6 +134,15 @@ def executeJson(self, handler_ctx, sessionId=None, stmt=None): """ pass + def executeJsonWithParameter(self, handler_ctx, sessionId=None, stmt=None, parameterMap=None): + """ + Parameters: + - sessionId + - stmt + - parameterMap + """ + pass + # HELPER FUNCTIONS AND STRUCTURES @@ -624,6 +660,250 @@ 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: @@ -832,6 +1112,249 @@ def executeJson_result__setstate__(self, state): executeJson_result.__getstate__ = lambda self: self.__dict__.copy() executeJson_result.__setstate__ = executeJson_result__setstate__ +class executeJsonWithParameter_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 = {} + (_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() + 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('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.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(executeJsonWithParameter_args) +executeJsonWithParameter_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 +) + +executeJsonWithParameter_args.thrift_struct_annotations = { +} +executeJsonWithParameter_args.thrift_field_annotations = { +} + +def executeJsonWithParameter_args__init__(self, sessionId=None, stmt=None, parameterMap=None,): + self.sessionId = sessionId + self.stmt = stmt + self.parameterMap = parameterMap + +executeJsonWithParameter_args.__init__ = executeJsonWithParameter_args__init__ + +def executeJsonWithParameter_args__setstate__(self, state): + state.setdefault('sessionId', None) + state.setdefault('stmt', None) + state.setdefault('parameterMap', None) + self.__dict__ = state + +executeJsonWithParameter_args.__getstate__ = lambda self: self.__dict__.copy() +executeJsonWithParameter_args.__setstate__ = executeJsonWithParameter_args__setstate__ + +class executeJsonWithParameter_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.STRING: + self.success = 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('executeJsonWithParameter_result') + if self.success != None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success) + 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(executeJsonWithParameter_result) +executeJsonWithParameter_result.thrift_spec = ( + (0, TType.STRING, 'success', False, None, 2, ), # 0 +) + +executeJsonWithParameter_result.thrift_struct_annotations = { +} +executeJsonWithParameter_result.thrift_field_annotations = { +} + +def executeJsonWithParameter_result__init__(self, success=None,): + self.success = success + +executeJsonWithParameter_result.__init__ = executeJsonWithParameter_result__init__ + +def executeJsonWithParameter_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__ + class Client(Iface): def __enter__(self): return self @@ -925,6 +1448,40 @@ 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: @@ -957,6 +1514,40 @@ 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): + """ + Parameters: + - sessionId + - stmt + - parameterMap + """ + self.send_executeJsonWithParameter(sessionId, stmt, parameterMap) + return self.recv_executeJsonWithParameter() + + 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 + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_executeJsonWithParameter(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.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "executeJsonWithParameter failed: unknown result"); + class Processor(Iface, TProcessor): _onewayMethods = ("signout",) @@ -972,8 +1563,12 @@ 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 def onewayMethods(self): l = [] @@ -1014,6 +1609,17 @@ 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() @@ -1025,6 +1631,17 @@ 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() + try: + result.success = self._handler.executeJsonWithParameter(args.sessionId, args.stmt, args.parameterMap) + except: + ex = sys.exc_info()[1] + self._event_handler.handlerError(handler_ctx, 'executeJsonWithParameter', ex) + result = Thrift.TApplicationException(message=repr(ex)) + return result + Iface._processor_type = Processor class ContextProcessor(ContextIface, TProcessor): @@ -1041,8 +1658,12 @@ 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 def onewayMethods(self): l = [] @@ -1083,6 +1704,17 @@ 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() @@ -1094,6 +1726,17 @@ 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() + try: + result.success = self._handler.executeJsonWithParameter(handler_ctx, args.sessionId, args.stmt, args.parameterMap) + except: + ex = sys.exc_info()[1] + self._event_handler.handlerError(handler_ctx, 'executeJsonWithParameter', ex) + result = Thrift.TApplicationException(message=repr(ex)) + return result + ContextIface._processor_type = ContextProcessor fix_spec(all_structs) diff --git a/nebula2/meta/MetaService-fuzzer b/nebula2/meta/MetaService-fuzzer index cb23ff5c..669090c3 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 -thrift.util.fuzzer.fuzz_service(MetaService, ttypes, constants) +nebula2.fbthrift.util.fuzzer.fuzz_service(MetaService, ttypes, constants) diff --git a/nebula2/meta/MetaService-remote b/nebula2/meta/MetaService-remote index a844700a..cc2eab49 100755 --- a/nebula2/meta/MetaService-remote +++ b/nebula2/meta/MetaService-remote @@ -46,6 +46,7 @@ FUNCTIONS = { 'dropSpace': Function('dropSpace', 'MetaService', 'ExecResp', [('DropSpaceReq', 'req', 'DropSpaceReq')]), 'getSpace': Function('getSpace', 'MetaService', 'GetSpaceResp', [('GetSpaceReq', 'req', 'GetSpaceReq')]), 'listSpaces': Function('listSpaces', 'MetaService', 'ListSpacesResp', [('ListSpacesReq', 'req', 'ListSpacesReq')]), + 'createSpaceAs': Function('createSpaceAs', 'MetaService', 'ExecResp', [('CreateSpaceAsReq', 'req', 'CreateSpaceAsReq')]), 'createTag': Function('createTag', 'MetaService', 'ExecResp', [('CreateTagReq', 'req', 'CreateTagReq')]), 'alterTag': Function('alterTag', 'MetaService', 'ExecResp', [('AlterTagReq', 'req', 'AlterTagReq')]), 'dropTag': Function('dropTag', 'MetaService', 'ExecResp', [('DropTagReq', 'req', 'DropTagReq')]), diff --git a/nebula2/meta/MetaService.py b/nebula2/meta/MetaService.py index 52fea759..b18cae26 100644 --- a/nebula2/meta/MetaService.py +++ b/nebula2/meta/MetaService.py @@ -13,7 +13,7 @@ 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, 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, 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 import nebula2.common.ttypes from nebula2.fbthrift.Thrift import TProcessor @@ -71,6 +71,13 @@ def listSpaces(self, req=None): """ pass + def createSpaceAs(self, req=None): + """ + Parameters: + - req + """ + pass + def createTag(self, req=None): """ Parameters: @@ -689,6 +696,13 @@ def listSpaces(self, handler_ctx, req=None): """ pass + def createSpaceAs(self, handler_ctx, req=None): + """ + Parameters: + - req + """ + pass + def createTag(self, handler_ctx, req=None): """ Parameters: @@ -2052,6 +2066,199 @@ def listSpaces_result__setstate__(self, state): listSpaces_result.__getstate__ = lambda self: self.__dict__.copy() listSpaces_result.__setstate__ = listSpaces_result__setstate__ +class createSpaceAs_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 = CreateSpaceAsReq() + 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('createSpaceAs_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(createSpaceAs_args) +createSpaceAs_args.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'req', [CreateSpaceAsReq, CreateSpaceAsReq.thrift_spec, False], None, 2, ), # 1 +) + +createSpaceAs_args.thrift_struct_annotations = { +} +createSpaceAs_args.thrift_field_annotations = { +} + +def createSpaceAs_args__init__(self, req=None,): + self.req = req + +createSpaceAs_args.__init__ = createSpaceAs_args__init__ + +def createSpaceAs_args__setstate__(self, state): + state.setdefault('req', None) + self.__dict__ = state + +createSpaceAs_args.__getstate__ = lambda self: self.__dict__.copy() +createSpaceAs_args.__setstate__ = createSpaceAs_args__setstate__ + +class createSpaceAs_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 = ExecResp() + 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('createSpaceAs_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(createSpaceAs_result) +createSpaceAs_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [ExecResp, ExecResp.thrift_spec, False], None, 2, ), # 0 +) + +createSpaceAs_result.thrift_struct_annotations = { +} +createSpaceAs_result.thrift_field_annotations = { +} + +def createSpaceAs_result__init__(self, success=None,): + self.success = success + +createSpaceAs_result.__init__ = createSpaceAs_result__init__ + +def createSpaceAs_result__setstate__(self, state): + state.setdefault('success', None) + self.__dict__ = state + +createSpaceAs_result.__getstate__ = lambda self: self.__dict__.copy() +createSpaceAs_result.__setstate__ = createSpaceAs_result__setstate__ + class createTag_args: """ Attributes: @@ -18399,6 +18606,36 @@ def recv_listSpaces(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "listSpaces failed: unknown result"); + def createSpaceAs(self, req=None): + """ + Parameters: + - req + """ + self.send_createSpaceAs(req) + return self.recv_createSpaceAs() + + def send_createSpaceAs(self, req=None): + self._oprot.writeMessageBegin('createSpaceAs', TMessageType.CALL, self._seqid) + args = createSpaceAs_args() + args.req = req + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_createSpaceAs(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = createSpaceAs_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "createSpaceAs failed: unknown result"); + def createTag(self, req=None): """ Parameters: @@ -20936,6 +21173,8 @@ def __init__(self, handler): self._priorityMap["getSpace"] = TPriority.NORMAL self._processMap["listSpaces"] = Processor.process_listSpaces self._priorityMap["listSpaces"] = TPriority.NORMAL + self._processMap["createSpaceAs"] = Processor.process_createSpaceAs + self._priorityMap["createSpaceAs"] = TPriority.NORMAL self._processMap["createTag"] = Processor.process_createTag self._priorityMap["createTag"] = TPriority.NORMAL self._processMap["alterTag"] = Processor.process_alterTag @@ -21157,6 +21396,17 @@ def process_listSpaces(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result + @thrift_process_method(createSpaceAs_args, oneway=False) + def process_createSpaceAs(self, args, handler_ctx): + result = createSpaceAs_result() + try: + result.success = self._handler.createSpaceAs(args.req) + except: + ex = sys.exc_info()[1] + self._event_handler.handlerError(handler_ctx, 'createSpaceAs', ex) + result = Thrift.TApplicationException(message=repr(ex)) + return result + @thrift_process_method(createTag_args, oneway=False) def process_createTag(self, args, handler_ctx): result = createTag_result() @@ -22099,6 +22349,8 @@ def __init__(self, handler): self._priorityMap["getSpace"] = TPriority.NORMAL self._processMap["listSpaces"] = ContextProcessor.process_listSpaces self._priorityMap["listSpaces"] = TPriority.NORMAL + self._processMap["createSpaceAs"] = ContextProcessor.process_createSpaceAs + self._priorityMap["createSpaceAs"] = TPriority.NORMAL self._processMap["createTag"] = ContextProcessor.process_createTag self._priorityMap["createTag"] = TPriority.NORMAL self._processMap["alterTag"] = ContextProcessor.process_alterTag @@ -22320,6 +22572,17 @@ def process_listSpaces(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result + @thrift_process_method(createSpaceAs_args, oneway=False) + def process_createSpaceAs(self, args, handler_ctx): + result = createSpaceAs_result() + try: + result.success = self._handler.createSpaceAs(handler_ctx, args.req) + except: + ex = sys.exc_info()[1] + self._event_handler.handlerError(handler_ctx, 'createSpaceAs', ex) + result = Thrift.TApplicationException(message=repr(ex)) + return result + @thrift_process_method(createTag_args, oneway=False) def process_createTag(self, args, handler_ctx): result = createTag_result() diff --git a/nebula2/meta/constants.py b/nebula2/meta/constants.py index 87ee9e03..e368b678 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, 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, 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 diff --git a/nebula2/meta/ttypes.py b/nebula2/meta/ttypes.py index c47df918..ffc00ea4 100644 --- a/nebula2/meta/ttypes.py +++ b/nebula2/meta/ttypes.py @@ -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', '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', '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'] class AlterSchemaOp: ADD = 1 @@ -3569,6 +3569,93 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ +class CreateSpaceAsReq: + """ + Attributes: + - old_space_name + - new_space_name + """ + + 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.old_space_name = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.new_space_name = 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('CreateSpaceAsReq') + if self.old_space_name != None: + oprot.writeFieldBegin('old_space_name', TType.STRING, 1) + oprot.writeString(self.old_space_name) + oprot.writeFieldEnd() + if self.new_space_name != None: + oprot.writeFieldBegin('new_space_name', TType.STRING, 2) + oprot.writeString(self.new_space_name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def __repr__(self): + L = [] + padding = ' ' * 4 + if self.old_space_name is not None: + value = pprint.pformat(self.old_space_name, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' old_space_name=%s' % (value)) + if self.new_space_name is not None: + value = pprint.pformat(self.new_space_name, indent=0) + value = padding.join(value.splitlines(True)) + L.append(' new_space_name=%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 DropSpaceReq: """ Attributes: @@ -18357,6 +18444,32 @@ def CreateSpaceReq__setstate__(self, state): CreateSpaceReq.__getstate__ = lambda self: self.__dict__.copy() CreateSpaceReq.__setstate__ = CreateSpaceReq__setstate__ +all_structs.append(CreateSpaceAsReq) +CreateSpaceAsReq.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'old_space_name', False, None, 2, ), # 1 + (2, TType.STRING, 'new_space_name', False, None, 2, ), # 2 +) + +CreateSpaceAsReq.thrift_struct_annotations = { +} +CreateSpaceAsReq.thrift_field_annotations = { +} + +def CreateSpaceAsReq__init__(self, old_space_name=None, new_space_name=None,): + self.old_space_name = old_space_name + self.new_space_name = new_space_name + +CreateSpaceAsReq.__init__ = CreateSpaceAsReq__init__ + +def CreateSpaceAsReq__setstate__(self, state): + state.setdefault('old_space_name', None) + state.setdefault('new_space_name', None) + self.__dict__ = state + +CreateSpaceAsReq.__getstate__ = lambda self: self.__dict__.copy() +CreateSpaceAsReq.__setstate__ = CreateSpaceAsReq__setstate__ + all_structs.append(DropSpaceReq) DropSpaceReq.thrift_spec = ( None, # 0 diff --git a/nebula2/storage/GeneralStorageService-fuzzer b/nebula2/storage/GeneralStorageService-fuzzer index e7fd4bfe..1a350711 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 -thrift.util.fuzzer.fuzz_service(GeneralStorageService, ttypes, constants) +nebula2.fbthrift.util.fuzzer.fuzz_service(GeneralStorageService, ttypes, constants) diff --git a/nebula2/storage/GeneralStorageService.py b/nebula2/storage/GeneralStorageService.py index afda312c..08a03f12 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, GetValueRequest, GetValueResponse +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 import nebula2.common.ttypes import nebula2.meta.ttypes diff --git a/nebula2/storage/GraphStorageService-fuzzer b/nebula2/storage/GraphStorageService-fuzzer index d1dd4e47..fd285d56 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 -thrift.util.fuzzer.fuzz_service(GraphStorageService, ttypes, constants) +nebula2.fbthrift.util.fuzzer.fuzz_service(GraphStorageService, ttypes, constants) diff --git a/nebula2/storage/GraphStorageService-remote b/nebula2/storage/GraphStorageService-remote index aabdfe14..6d253096 100755 --- a/nebula2/storage/GraphStorageService-remote +++ b/nebula2/storage/GraphStorageService-remote @@ -56,7 +56,8 @@ 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')]), - 'addEdgesAtomic': Function('addEdgesAtomic', 'GraphStorageService', 'ExecResponse', [('AddEdgesRequest', 'req', 'AddEdgesRequest')]), + 'chainUpdateEdge': Function('chainUpdateEdge', 'GraphStorageService', 'UpdateResponse', [('UpdateEdgeRequest', 'req', 'UpdateEdgeRequest')]), + 'chainAddEdges': Function('chainAddEdges', 'GraphStorageService', 'ExecResponse', [('AddEdgesRequest', 'req', 'AddEdgesRequest')]), } SERVICE_NAMES = ['GraphStorageService', ] diff --git a/nebula2/storage/GraphStorageService.py b/nebula2/storage/GraphStorageService.py index ead48b07..d46e321b 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, GetValueRequest, GetValueResponse +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 import nebula2.common.ttypes import nebula2.meta.ttypes @@ -142,7 +142,14 @@ def lookupAndTraverse(self, req=None): """ pass - def addEdgesAtomic(self, req=None): + def chainUpdateEdge(self, req=None): + """ + Parameters: + - req + """ + pass + + def chainAddEdges(self, req=None): """ Parameters: - req @@ -249,7 +256,14 @@ def lookupAndTraverse(self, handler_ctx, req=None): """ pass - def addEdgesAtomic(self, handler_ctx, req=None): + def chainUpdateEdge(self, handler_ctx, req=None): + """ + Parameters: + - req + """ + pass + + def chainAddEdges(self, handler_ctx, req=None): """ Parameters: - req @@ -2961,7 +2975,200 @@ def lookupAndTraverse_result__setstate__(self, state): lookupAndTraverse_result.__getstate__ = lambda self: self.__dict__.copy() lookupAndTraverse_result.__setstate__ = lookupAndTraverse_result__setstate__ -class addEdgesAtomic_args: +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: """ Attributes: - req @@ -3005,7 +3212,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('addEdgesAtomic_args') + oprot.writeStructBegin('chainAddEdges_args') if self.req != None: oprot.writeFieldBegin('req', TType.STRUCT, 1) self.req.write(oprot) @@ -3035,30 +3242,30 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -all_structs.append(addEdgesAtomic_args) -addEdgesAtomic_args.thrift_spec = ( +all_structs.append(chainAddEdges_args) +chainAddEdges_args.thrift_spec = ( None, # 0 (1, TType.STRUCT, 'req', [AddEdgesRequest, AddEdgesRequest.thrift_spec, False], None, 2, ), # 1 ) -addEdgesAtomic_args.thrift_struct_annotations = { +chainAddEdges_args.thrift_struct_annotations = { } -addEdgesAtomic_args.thrift_field_annotations = { +chainAddEdges_args.thrift_field_annotations = { } -def addEdgesAtomic_args__init__(self, req=None,): +def chainAddEdges_args__init__(self, req=None,): self.req = req -addEdgesAtomic_args.__init__ = addEdgesAtomic_args__init__ +chainAddEdges_args.__init__ = chainAddEdges_args__init__ -def addEdgesAtomic_args__setstate__(self, state): +def chainAddEdges_args__setstate__(self, state): state.setdefault('req', None) self.__dict__ = state -addEdgesAtomic_args.__getstate__ = lambda self: self.__dict__.copy() -addEdgesAtomic_args.__setstate__ = addEdgesAtomic_args__setstate__ +chainAddEdges_args.__getstate__ = lambda self: self.__dict__.copy() +chainAddEdges_args.__setstate__ = chainAddEdges_args__setstate__ -class addEdgesAtomic_result: +class chainAddEdges_result: """ Attributes: - success @@ -3102,7 +3309,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('addEdgesAtomic_result') + oprot.writeStructBegin('chainAddEdges_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) @@ -3132,27 +3339,27 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -all_structs.append(addEdgesAtomic_result) -addEdgesAtomic_result.thrift_spec = ( +all_structs.append(chainAddEdges_result) +chainAddEdges_result.thrift_spec = ( (0, TType.STRUCT, 'success', [ExecResponse, ExecResponse.thrift_spec, False], None, 2, ), # 0 ) -addEdgesAtomic_result.thrift_struct_annotations = { +chainAddEdges_result.thrift_struct_annotations = { } -addEdgesAtomic_result.thrift_field_annotations = { +chainAddEdges_result.thrift_field_annotations = { } -def addEdgesAtomic_result__init__(self, success=None,): +def chainAddEdges_result__init__(self, success=None,): self.success = success -addEdgesAtomic_result.__init__ = addEdgesAtomic_result__init__ +chainAddEdges_result.__init__ = chainAddEdges_result__init__ -def addEdgesAtomic_result__setstate__(self, state): +def chainAddEdges_result__setstate__(self, state): state.setdefault('success', None) self.__dict__ = state -addEdgesAtomic_result.__getstate__ = lambda self: self.__dict__.copy() -addEdgesAtomic_result.__setstate__ = addEdgesAtomic_result__setstate__ +chainAddEdges_result.__getstate__ = lambda self: self.__dict__.copy() +chainAddEdges_result.__setstate__ = chainAddEdges_result__setstate__ class Client(Iface): def __enter__(self): @@ -3589,35 +3796,65 @@ def recv_lookupAndTraverse(self, ): return result.success raise TApplicationException(TApplicationException.MISSING_RESULT, "lookupAndTraverse failed: unknown result"); - def addEdgesAtomic(self, req=None): + 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): """ Parameters: - req """ - self.send_addEdgesAtomic(req) - return self.recv_addEdgesAtomic() + self.send_chainAddEdges(req) + return self.recv_chainAddEdges() - def send_addEdgesAtomic(self, req=None): - self._oprot.writeMessageBegin('addEdgesAtomic', TMessageType.CALL, self._seqid) - args = addEdgesAtomic_args() + def send_chainAddEdges(self, req=None): + self._oprot.writeMessageBegin('chainAddEdges', TMessageType.CALL, self._seqid) + args = chainAddEdges_args() args.req = req args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_addEdgesAtomic(self, ): + def recv_chainAddEdges(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x - result = addEdgesAtomic_result() + result = chainAddEdges_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success - raise TApplicationException(TApplicationException.MISSING_RESULT, "addEdgesAtomic failed: unknown result"); + raise TApplicationException(TApplicationException.MISSING_RESULT, "chainAddEdges failed: unknown result"); class Processor(Iface, TProcessor): @@ -3656,8 +3893,10 @@ def __init__(self, handler): self._priorityMap["lookupIndex"] = TPriority.NORMAL self._processMap["lookupAndTraverse"] = Processor.process_lookupAndTraverse self._priorityMap["lookupAndTraverse"] = TPriority.NORMAL - self._processMap["addEdgesAtomic"] = Processor.process_addEdgesAtomic - self._priorityMap["addEdgesAtomic"] = TPriority.NORMAL + self._processMap["chainUpdateEdge"] = Processor.process_chainUpdateEdge + self._priorityMap["chainUpdateEdge"] = TPriority.NORMAL + self._processMap["chainAddEdges"] = Processor.process_chainAddEdges + self._priorityMap["chainAddEdges"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -3821,14 +4060,25 @@ def process_lookupAndTraverse(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(addEdgesAtomic_args, oneway=False) - def process_addEdgesAtomic(self, args, handler_ctx): - result = addEdgesAtomic_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() try: - result.success = self._handler.addEdgesAtomic(args.req) + result.success = self._handler.chainAddEdges(args.req) except: ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'addEdgesAtomic', ex) + self._event_handler.handlerError(handler_ctx, 'chainAddEdges', ex) result = Thrift.TApplicationException(message=repr(ex)) return result @@ -3870,8 +4120,10 @@ def __init__(self, handler): self._priorityMap["lookupIndex"] = TPriority.NORMAL self._processMap["lookupAndTraverse"] = ContextProcessor.process_lookupAndTraverse self._priorityMap["lookupAndTraverse"] = TPriority.NORMAL - self._processMap["addEdgesAtomic"] = ContextProcessor.process_addEdgesAtomic - self._priorityMap["addEdgesAtomic"] = TPriority.NORMAL + self._processMap["chainUpdateEdge"] = ContextProcessor.process_chainUpdateEdge + self._priorityMap["chainUpdateEdge"] = TPriority.NORMAL + self._processMap["chainAddEdges"] = ContextProcessor.process_chainAddEdges + self._priorityMap["chainAddEdges"] = TPriority.NORMAL def onewayMethods(self): l = [] @@ -4035,14 +4287,25 @@ def process_lookupAndTraverse(self, args, handler_ctx): result = Thrift.TApplicationException(message=repr(ex)) return result - @thrift_process_method(addEdgesAtomic_args, oneway=False) - def process_addEdgesAtomic(self, args, handler_ctx): - result = addEdgesAtomic_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() try: - result.success = self._handler.addEdgesAtomic(handler_ctx, args.req) + result.success = self._handler.chainAddEdges(handler_ctx, args.req) except: ex = sys.exc_info()[1] - self._event_handler.handlerError(handler_ctx, 'addEdgesAtomic', ex) + self._event_handler.handlerError(handler_ctx, 'chainAddEdges', ex) result = Thrift.TApplicationException(message=repr(ex)) return result diff --git a/nebula2/storage/StorageAdminService-fuzzer b/nebula2/storage/StorageAdminService-fuzzer index 4096544d..83c36585 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 -thrift.util.fuzzer.fuzz_service(StorageAdminService, ttypes, constants) +nebula2.fbthrift.util.fuzzer.fuzz_service(StorageAdminService, ttypes, constants) diff --git a/nebula2/storage/StorageAdminService.py b/nebula2/storage/StorageAdminService.py index 5994824d..093a7b78 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, GetValueRequest, GetValueResponse +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 import nebula2.common.ttypes import nebula2.meta.ttypes diff --git a/nebula2/storage/constants.py b/nebula2/storage/constants.py index 20c86230..5477e8fa 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, GetValueRequest, GetValueResponse +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 diff --git a/nebula2/storage/ttypes.py b/nebula2/storage/ttypes.py index e15f3c3f..df78c3d3 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', 'GetValueRequest', 'GetValueResponse'] +__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'] class StatType: SUM = 1 @@ -4437,8 +4437,7 @@ class IndexSpec: """ Attributes: - contexts - - is_edge - - tag_or_edge_id + - schema_id """ thrift_spec = None @@ -4479,13 +4478,9 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - 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() + if ftype == TType.STRUCT: + self.schema_id = nebula2.common.ttypes.SchemaID() + self.schema_id.read(iprot) else: iprot.skip(ftype) else: @@ -4508,13 +4503,9 @@ def write(self, oprot): iter418.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() - 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) + if self.schema_id != None: + oprot.writeFieldBegin('schema_id', TType.STRUCT, 2) + self.schema_id.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -4526,14 +4517,10 @@ def __repr__(self): value = pprint.pformat(self.contexts, indent=0) value = padding.join(value.splitlines(True)) L.append(' contexts=%s' % (value)) - if self.is_edge is not None: - value = pprint.pformat(self.is_edge, indent=0) + if self.schema_id is not None: + value = pprint.pformat(self.schema_id, indent=0) value = padding.join(value.splitlines(True)) - 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)) + L.append(' schema_id=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -4557,6 +4544,7 @@ class LookupIndexRequest: - indices - return_columns - common + - limit """ thrift_spec = None @@ -4626,6 +4614,11 @@ 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() @@ -4665,6 +4658,10 @@ 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() @@ -4691,6 +4688,10 @@ 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): @@ -8011,10 +8012,10 @@ class InternalTxnRequest: """ Attributes: - txn_id - - space_id - - part_id - - position - - data + - term_of_parts + - add_edge_req + - upd_edge_req + - edge_ver """ thrift_spec = None @@ -8043,53 +8044,69 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.I32: - self.space_id = iprot.readI32() + 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() else: iprot.skip(ftype) elif fid == 3: - if ftype == TType.I32: - self.part_id = iprot.readI32() + if ftype == TType.STRUCT: + self.add_edge_req = AddEdgesRequest() + self.add_edge_req.read(iprot) else: iprot.skip(ftype) elif fid == 4: - if ftype == TType.I32: - self.position = iprot.readI32() + if ftype == TType.STRUCT: + self.upd_edge_req = UpdateEdgeRequest() + self.upd_edge_req.read(iprot) else: iprot.skip(ftype) elif fid == 5: - 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) + 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) else: while iprot.peekList(): - _elem618 = iprot.readString() - _elem611.append(_elem618) + _elem628 = iprot.readI64() + _val621.append(_elem628) iprot.readListEnd() - self.data.append(_elem611) + self.edge_ver[_key620] = _val621 else: - while iprot.peekList(): - _elem619 = [] - (_etype623, _size620) = iprot.readListBegin() - if _size620 >= 0: - for _i624 in six.moves.range(_size620): - _elem625 = iprot.readString() - _elem619.append(_elem625) + 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) else: while iprot.peekList(): - _elem626 = iprot.readString() - _elem619.append(_elem626) + _elem637 = iprot.readI64() + _val630.append(_elem637) iprot.readListEnd() - self.data.append(_elem619) - iprot.readListEnd() + self.edge_ver[_key629] = _val630 + iprot.readMapEnd() else: iprot.skip(ftype) else: @@ -8109,27 +8126,32 @@ def write(self, oprot): oprot.writeFieldBegin('txn_id', TType.I64, 1) oprot.writeI64(self.txn_id) oprot.writeFieldEnd() - 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.position != None: - oprot.writeFieldBegin('position', TType.I32, 4) - oprot.writeI32(self.position) + 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() 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) + 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) oprot.writeListEnd() - oprot.writeListEnd() + oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8141,22 +8163,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.space_id is not None: - value = pprint.pformat(self.space_id, indent=0) + if self.term_of_parts is not None: + value = pprint.pformat(self.term_of_parts, indent=0) value = padding.join(value.splitlines(True)) - L.append(' space_id=%s' % (value)) - if self.part_id is not None: - value = pprint.pformat(self.part_id, indent=0) + L.append(' term_of_parts=%s' % (value)) + if self.add_edge_req is not None: + value = pprint.pformat(self.add_edge_req, indent=0) value = padding.join(value.splitlines(True)) - L.append(' part_id=%s' % (value)) - if self.position is not None: - value = pprint.pformat(self.position, indent=0) + L.append(' add_edge_req=%s' % (value)) + if self.upd_edge_req is not None: + value = pprint.pformat(self.upd_edge_req, indent=0) value = padding.join(value.splitlines(True)) - L.append(' position=%s' % (value)) - if self.data is not None: - value = pprint.pformat(self.data, indent=0) + L.append(' upd_edge_req=%s' % (value)) + if self.edge_ver is not None: + value = pprint.pformat(self.edge_ver, indent=0) value = padding.join(value.splitlines(True)) - L.append(' data=%s' % (value)) + L.append(' edge_ver=%s' % (value)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -8172,12 +8194,15 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -class GetValueRequest: +class ChainAddEdgesRequest: """ Attributes: - space_id - - part_id - - key + - parts + - prop_names + - if_not_exists + - term + - edge_version """ thrift_spec = None @@ -8206,13 +8231,74 @@ def read(self, iprot): else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.I32: - self.part_id = iprot.readI32() + 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() else: iprot.skip(ftype) elif fid == 3: - if ftype == TType.STRING: - self.key = iprot.readString() + 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() else: iprot.skip(ftype) else: @@ -8227,18 +8313,40 @@ 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('GetValueRequest') + oprot.writeStructBegin('ChainAddEdgesRequest') if self.space_id != None: oprot.writeFieldBegin('space_id', TType.I32, 1) oprot.writeI32(self.space_id) oprot.writeFieldEnd() - if self.part_id != None: - oprot.writeFieldBegin('part_id', TType.I32, 2) - oprot.writeI32(self.part_id) + 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.key != None: - oprot.writeFieldBegin('key', TType.STRING, 3) - oprot.writeString(self.key) + 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) + oprot.writeFieldEnd() + if self.edge_version != None: + oprot.writeFieldBegin('edge_version', TType.I64, 6) + oprot.writeI64(self.edge_version) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8250,14 +8358,26 @@ 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.part_id is not None: - value = pprint.pformat(self.part_id, indent=0) + if self.parts is not None: + value = pprint.pformat(self.parts, indent=0) value = padding.join(value.splitlines(True)) - L.append(' part_id=%s' % (value)) - if self.key is not None: - value = pprint.pformat(self.key, indent=0) + 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(' key=%s' % (value)) + 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) + 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)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -8273,11 +8393,14 @@ def __ne__(self, other): if not six.PY2: __hash__ = object.__hash__ -class GetValueResponse: +class ChainUpdateEdgeRequest: """ Attributes: - - result - - value + - update_edge_request + - term + - edge_version + - space_id + - parts """ thrift_spec = None @@ -8302,13 +8425,38 @@ def read(self, iprot): break if fid == 1: if ftype == TType.STRUCT: - self.result = ResponseCommon() - self.result.read(iprot) + self.update_edge_request = UpdateEdgeRequest() + self.update_edge_request.read(iprot) else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.STRING: - self.value = iprot.readString() + 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() else: iprot.skip(ftype) else: @@ -8323,14 +8471,29 @@ 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('GetValueResponse') - if self.result != None: - oprot.writeFieldBegin('result', TType.STRUCT, 1) - self.result.write(oprot) + 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.value != None: - oprot.writeFieldBegin('value', TType.STRING, 2) - oprot.writeString(self.value) + 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.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() oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -8338,14 +8501,26 @@ def write(self, oprot): def __repr__(self): L = [] padding = ' ' * 4 - if self.result is not None: - value = pprint.pformat(self.result, indent=0) + 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(' result=%s' % (value)) - if self.value is not None: - value = pprint.pformat(self.value, indent=0) + 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(' value=%s' % (value)) + 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) + 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)) return "%s(%s)" % (self.__class__.__name__, "\n" + ",\n".join(L) if L else '') def __eq__(self, other): @@ -9376,8 +9551,7 @@ 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.BOOL, 'is_edge', None, None, 0, ), # 2 - (3, TType.I32, 'tag_or_edge_id', None, None, 0, ), # 3 + (2, TType.STRUCT, 'schema_id', [nebula2.common.ttypes.SchemaID, nebula2.common.ttypes.SchemaID.thrift_spec, True], None, 2, ), # 2 ) IndexSpec.thrift_struct_annotations = { @@ -9385,17 +9559,15 @@ def IndexQueryContext__setstate__(self, state): IndexSpec.thrift_field_annotations = { } -def IndexSpec__init__(self, contexts=None, is_edge=None, tag_or_edge_id=None,): +def IndexSpec__init__(self, contexts=None, schema_id=None,): self.contexts = contexts - self.is_edge = is_edge - self.tag_or_edge_id = tag_or_edge_id + self.schema_id = schema_id IndexSpec.__init__ = IndexSpec__init__ def IndexSpec__setstate__(self, state): state.setdefault('contexts', None) - state.setdefault('is_edge', None) - state.setdefault('tag_or_edge_id', None) + state.setdefault('schema_id', None) self.__dict__ = state IndexSpec.__getstate__ = lambda self: self.__dict__.copy() @@ -9409,6 +9581,7 @@ 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 = { @@ -9416,12 +9589,13 @@ 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,): +def LookupIndexRequest__init__(self, space_id=None, parts=None, indices=None, return_columns=None, common=None, limit=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__ @@ -9431,6 +9605,7 @@ 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() @@ -10277,10 +10452,10 @@ def KVRemoveRequest__setstate__(self, state): InternalTxnRequest.thrift_spec = ( None, # 0 (1, TType.I64, 'txn_id', None, None, 2, ), # 1 - (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 + (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 ) InternalTxnRequest.thrift_struct_annotations = { @@ -10288,80 +10463,98 @@ def KVRemoveRequest__setstate__(self, state): InternalTxnRequest.thrift_field_annotations = { } -def InternalTxnRequest__init__(self, txn_id=None, space_id=None, part_id=None, position=None, data=None,): +def InternalTxnRequest__init__(self, txn_id=None, term_of_parts=None, add_edge_req=None, upd_edge_req=None, edge_ver=None,): self.txn_id = txn_id - self.space_id = space_id - self.part_id = part_id - self.position = position - self.data = data + 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 InternalTxnRequest.__init__ = InternalTxnRequest__init__ def InternalTxnRequest__setstate__(self, state): state.setdefault('txn_id', None) - state.setdefault('space_id', None) - state.setdefault('part_id', None) - state.setdefault('position', None) - state.setdefault('data', None) + state.setdefault('term_of_parts', None) + state.setdefault('add_edge_req', None) + state.setdefault('upd_edge_req', None) + state.setdefault('edge_ver', None) self.__dict__ = state InternalTxnRequest.__getstate__ = lambda self: self.__dict__.copy() InternalTxnRequest.__setstate__ = InternalTxnRequest__setstate__ -all_structs.append(GetValueRequest) -GetValueRequest.thrift_spec = ( +all_structs.append(ChainAddEdgesRequest) +ChainAddEdgesRequest.thrift_spec = ( None, # 0 (1, TType.I32, 'space_id', None, None, 2, ), # 1 - (2, TType.I32, 'part_id', None, None, 2, ), # 2 - (3, TType.STRING, 'key', False, None, 2, ), # 3 + (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 ) -GetValueRequest.thrift_struct_annotations = { +ChainAddEdgesRequest.thrift_struct_annotations = { } -GetValueRequest.thrift_field_annotations = { +ChainAddEdgesRequest.thrift_field_annotations = { } -def GetValueRequest__init__(self, space_id=None, part_id=None, key=None,): +def ChainAddEdgesRequest__init__(self, space_id=None, parts=None, prop_names=None, if_not_exists=None, term=None, edge_version=None,): self.space_id = space_id - self.part_id = part_id - self.key = key + self.parts = parts + self.prop_names = prop_names + self.if_not_exists = if_not_exists + self.term = term + self.edge_version = edge_version -GetValueRequest.__init__ = GetValueRequest__init__ +ChainAddEdgesRequest.__init__ = ChainAddEdgesRequest__init__ -def GetValueRequest__setstate__(self, state): +def ChainAddEdgesRequest__setstate__(self, state): state.setdefault('space_id', None) - state.setdefault('part_id', None) - state.setdefault('key', 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) self.__dict__ = state -GetValueRequest.__getstate__ = lambda self: self.__dict__.copy() -GetValueRequest.__setstate__ = GetValueRequest__setstate__ +ChainAddEdgesRequest.__getstate__ = lambda self: self.__dict__.copy() +ChainAddEdgesRequest.__setstate__ = ChainAddEdgesRequest__setstate__ -all_structs.append(GetValueResponse) -GetValueResponse.thrift_spec = ( +all_structs.append(ChainUpdateEdgeRequest) +ChainUpdateEdgeRequest.thrift_spec = ( None, # 0 - (1, TType.STRUCT, 'result', [ResponseCommon, ResponseCommon.thrift_spec, False], None, 0, ), # 1 - (2, TType.STRING, 'value', False, None, 2, ), # 2 + (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 ) -GetValueResponse.thrift_struct_annotations = { +ChainUpdateEdgeRequest.thrift_struct_annotations = { } -GetValueResponse.thrift_field_annotations = { +ChainUpdateEdgeRequest.thrift_field_annotations = { } -def GetValueResponse__init__(self, result=None, value=None,): - self.result = result - self.value = value +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 -GetValueResponse.__init__ = GetValueResponse__init__ +ChainUpdateEdgeRequest.__init__ = ChainUpdateEdgeRequest__init__ -def GetValueResponse__setstate__(self, state): - state.setdefault('result', None) - state.setdefault('value', None) +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) self.__dict__ = state -GetValueResponse.__getstate__ = lambda self: self.__dict__.copy() -GetValueResponse.__setstate__ = GetValueResponse__setstate__ +ChainUpdateEdgeRequest.__getstate__ = lambda self: self.__dict__.copy() +ChainUpdateEdgeRequest.__setstate__ = ChainUpdateEdgeRequest__setstate__ fix_spec(all_structs) del all_structs