mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-03 17:31:58 +08:00
2525 lines
83 KiB
Python
2525 lines
83 KiB
Python
#
|
|
# Autogenerated by Thrift Compiler (0.12.0)
|
|
#
|
|
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
#
|
|
# options string: py
|
|
#
|
|
|
|
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
|
|
from thrift.protocol.TProtocol import TProtocolException
|
|
from thrift.TRecursive import fix_spec
|
|
|
|
import sys
|
|
import logging
|
|
from .ttypes import *
|
|
from thrift.Thrift import TProcessor
|
|
from thrift.transport import TTransport
|
|
all_structs = []
|
|
|
|
|
|
class Iface(object):
|
|
def add_group(self, group):
|
|
"""
|
|
group interfaces
|
|
|
|
Parameters:
|
|
- group
|
|
|
|
"""
|
|
pass
|
|
|
|
def get_group(self, group_id):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
|
|
"""
|
|
pass
|
|
|
|
def del_group(self, group_id):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
|
|
"""
|
|
pass
|
|
|
|
def add_vector(self, group_id, tensor):
|
|
"""
|
|
insert vector interfaces
|
|
|
|
|
|
Parameters:
|
|
- group_id
|
|
- tensor
|
|
|
|
"""
|
|
pass
|
|
|
|
def add_vector_batch(self, group_id, tensor_list):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- tensor_list
|
|
|
|
"""
|
|
pass
|
|
|
|
def add_binary_vector(self, group_id, tensor):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- tensor
|
|
|
|
"""
|
|
pass
|
|
|
|
def add_binary_vector_batch(self, group_id, tensor_list):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- tensor_list
|
|
|
|
"""
|
|
pass
|
|
|
|
def search_vector(self, group_id, top_k, tensor, filter):
|
|
"""
|
|
search interfaces
|
|
you can use filter to reduce search result
|
|
filter.attrib_filter can specify which attribute you need, for example:
|
|
set attrib_filter = {"color":""} means you want to get "color" attribute for result vector
|
|
set attrib_filter = {"color":"red"} means you want to get vectors which has attribute "color" equals "red"
|
|
if filter.time_range is empty, engine will search without time limit
|
|
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor
|
|
- filter
|
|
|
|
"""
|
|
pass
|
|
|
|
def search_vector_batch(self, group_id, top_k, tensor_list, filter):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor_list
|
|
- filter
|
|
|
|
"""
|
|
pass
|
|
|
|
def search_binary_vector(self, group_id, top_k, tensor, filter):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor
|
|
- filter
|
|
|
|
"""
|
|
pass
|
|
|
|
def search_binary_vector_batch(self, group_id, top_k, tensor_list, filter):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor_list
|
|
- filter
|
|
|
|
"""
|
|
pass
|
|
|
|
|
|
class Client(Iface):
|
|
def __init__(self, iprot, oprot=None):
|
|
self._iprot = self._oprot = iprot
|
|
if oprot is not None:
|
|
self._oprot = oprot
|
|
self._seqid = 0
|
|
|
|
def add_group(self, group):
|
|
"""
|
|
group interfaces
|
|
|
|
Parameters:
|
|
- group
|
|
|
|
"""
|
|
self.send_add_group(group)
|
|
self.recv_add_group()
|
|
|
|
def send_add_group(self, group):
|
|
self._oprot.writeMessageBegin('add_group', TMessageType.CALL, self._seqid)
|
|
args = add_group_args()
|
|
args.group = group
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_add_group(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = add_group_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.e is not None:
|
|
raise result.e
|
|
return
|
|
|
|
def get_group(self, group_id):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
|
|
"""
|
|
self.send_get_group(group_id)
|
|
return self.recv_get_group()
|
|
|
|
def send_get_group(self, group_id):
|
|
self._oprot.writeMessageBegin('get_group', TMessageType.CALL, self._seqid)
|
|
args = get_group_args()
|
|
args.group_id = group_id
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_get_group(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = get_group_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.success is not None:
|
|
return result.success
|
|
if result.e is not None:
|
|
raise result.e
|
|
raise TApplicationException(TApplicationException.MISSING_RESULT, "get_group failed: unknown result")
|
|
|
|
def del_group(self, group_id):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
|
|
"""
|
|
self.send_del_group(group_id)
|
|
self.recv_del_group()
|
|
|
|
def send_del_group(self, group_id):
|
|
self._oprot.writeMessageBegin('del_group', TMessageType.CALL, self._seqid)
|
|
args = del_group_args()
|
|
args.group_id = group_id
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_del_group(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = del_group_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.e is not None:
|
|
raise result.e
|
|
return
|
|
|
|
def add_vector(self, group_id, tensor):
|
|
"""
|
|
insert vector interfaces
|
|
|
|
|
|
Parameters:
|
|
- group_id
|
|
- tensor
|
|
|
|
"""
|
|
self.send_add_vector(group_id, tensor)
|
|
self.recv_add_vector()
|
|
|
|
def send_add_vector(self, group_id, tensor):
|
|
self._oprot.writeMessageBegin('add_vector', TMessageType.CALL, self._seqid)
|
|
args = add_vector_args()
|
|
args.group_id = group_id
|
|
args.tensor = tensor
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_add_vector(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = add_vector_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.e is not None:
|
|
raise result.e
|
|
return
|
|
|
|
def add_vector_batch(self, group_id, tensor_list):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- tensor_list
|
|
|
|
"""
|
|
self.send_add_vector_batch(group_id, tensor_list)
|
|
self.recv_add_vector_batch()
|
|
|
|
def send_add_vector_batch(self, group_id, tensor_list):
|
|
self._oprot.writeMessageBegin('add_vector_batch', TMessageType.CALL, self._seqid)
|
|
args = add_vector_batch_args()
|
|
args.group_id = group_id
|
|
args.tensor_list = tensor_list
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_add_vector_batch(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = add_vector_batch_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.e is not None:
|
|
raise result.e
|
|
return
|
|
|
|
def add_binary_vector(self, group_id, tensor):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- tensor
|
|
|
|
"""
|
|
self.send_add_binary_vector(group_id, tensor)
|
|
self.recv_add_binary_vector()
|
|
|
|
def send_add_binary_vector(self, group_id, tensor):
|
|
self._oprot.writeMessageBegin('add_binary_vector', TMessageType.CALL, self._seqid)
|
|
args = add_binary_vector_args()
|
|
args.group_id = group_id
|
|
args.tensor = tensor
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_add_binary_vector(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = add_binary_vector_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.e is not None:
|
|
raise result.e
|
|
return
|
|
|
|
def add_binary_vector_batch(self, group_id, tensor_list):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- tensor_list
|
|
|
|
"""
|
|
self.send_add_binary_vector_batch(group_id, tensor_list)
|
|
self.recv_add_binary_vector_batch()
|
|
|
|
def send_add_binary_vector_batch(self, group_id, tensor_list):
|
|
self._oprot.writeMessageBegin('add_binary_vector_batch', TMessageType.CALL, self._seqid)
|
|
args = add_binary_vector_batch_args()
|
|
args.group_id = group_id
|
|
args.tensor_list = tensor_list
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_add_binary_vector_batch(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = add_binary_vector_batch_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.e is not None:
|
|
raise result.e
|
|
return
|
|
|
|
def search_vector(self, group_id, top_k, tensor, filter):
|
|
"""
|
|
search interfaces
|
|
you can use filter to reduce search result
|
|
filter.attrib_filter can specify which attribute you need, for example:
|
|
set attrib_filter = {"color":""} means you want to get "color" attribute for result vector
|
|
set attrib_filter = {"color":"red"} means you want to get vectors which has attribute "color" equals "red"
|
|
if filter.time_range is empty, engine will search without time limit
|
|
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor
|
|
- filter
|
|
|
|
"""
|
|
self.send_search_vector(group_id, top_k, tensor, filter)
|
|
return self.recv_search_vector()
|
|
|
|
def send_search_vector(self, group_id, top_k, tensor, filter):
|
|
self._oprot.writeMessageBegin('search_vector', TMessageType.CALL, self._seqid)
|
|
args = search_vector_args()
|
|
args.group_id = group_id
|
|
args.top_k = top_k
|
|
args.tensor = tensor
|
|
args.filter = filter
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_search_vector(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = search_vector_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.success is not None:
|
|
return result.success
|
|
if result.e is not None:
|
|
raise result.e
|
|
raise TApplicationException(TApplicationException.MISSING_RESULT, "search_vector failed: unknown result")
|
|
|
|
def search_vector_batch(self, group_id, top_k, tensor_list, filter):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor_list
|
|
- filter
|
|
|
|
"""
|
|
self.send_search_vector_batch(group_id, top_k, tensor_list, filter)
|
|
return self.recv_search_vector_batch()
|
|
|
|
def send_search_vector_batch(self, group_id, top_k, tensor_list, filter):
|
|
self._oprot.writeMessageBegin('search_vector_batch', TMessageType.CALL, self._seqid)
|
|
args = search_vector_batch_args()
|
|
args.group_id = group_id
|
|
args.top_k = top_k
|
|
args.tensor_list = tensor_list
|
|
args.filter = filter
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_search_vector_batch(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = search_vector_batch_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.success is not None:
|
|
return result.success
|
|
if result.e is not None:
|
|
raise result.e
|
|
raise TApplicationException(TApplicationException.MISSING_RESULT, "search_vector_batch failed: unknown result")
|
|
|
|
def search_binary_vector(self, group_id, top_k, tensor, filter):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor
|
|
- filter
|
|
|
|
"""
|
|
self.send_search_binary_vector(group_id, top_k, tensor, filter)
|
|
return self.recv_search_binary_vector()
|
|
|
|
def send_search_binary_vector(self, group_id, top_k, tensor, filter):
|
|
self._oprot.writeMessageBegin('search_binary_vector', TMessageType.CALL, self._seqid)
|
|
args = search_binary_vector_args()
|
|
args.group_id = group_id
|
|
args.top_k = top_k
|
|
args.tensor = tensor
|
|
args.filter = filter
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_search_binary_vector(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = search_binary_vector_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.success is not None:
|
|
return result.success
|
|
if result.e is not None:
|
|
raise result.e
|
|
raise TApplicationException(TApplicationException.MISSING_RESULT, "search_binary_vector failed: unknown result")
|
|
|
|
def search_binary_vector_batch(self, group_id, top_k, tensor_list, filter):
|
|
"""
|
|
Parameters:
|
|
- group_id
|
|
- top_k
|
|
- tensor_list
|
|
- filter
|
|
|
|
"""
|
|
self.send_search_binary_vector_batch(group_id, top_k, tensor_list, filter)
|
|
return self.recv_search_binary_vector_batch()
|
|
|
|
def send_search_binary_vector_batch(self, group_id, top_k, tensor_list, filter):
|
|
self._oprot.writeMessageBegin('search_binary_vector_batch', TMessageType.CALL, self._seqid)
|
|
args = search_binary_vector_batch_args()
|
|
args.group_id = group_id
|
|
args.top_k = top_k
|
|
args.tensor_list = tensor_list
|
|
args.filter = filter
|
|
args.write(self._oprot)
|
|
self._oprot.writeMessageEnd()
|
|
self._oprot.trans.flush()
|
|
|
|
def recv_search_binary_vector_batch(self):
|
|
iprot = self._iprot
|
|
(fname, mtype, rseqid) = iprot.readMessageBegin()
|
|
if mtype == TMessageType.EXCEPTION:
|
|
x = TApplicationException()
|
|
x.read(iprot)
|
|
iprot.readMessageEnd()
|
|
raise x
|
|
result = search_binary_vector_batch_result()
|
|
result.read(iprot)
|
|
iprot.readMessageEnd()
|
|
if result.success is not None:
|
|
return result.success
|
|
if result.e is not None:
|
|
raise result.e
|
|
raise TApplicationException(TApplicationException.MISSING_RESULT, "search_binary_vector_batch failed: unknown result")
|
|
|
|
|
|
class Processor(Iface, TProcessor):
|
|
def __init__(self, handler):
|
|
self._handler = handler
|
|
self._processMap = {}
|
|
self._processMap["add_group"] = Processor.process_add_group
|
|
self._processMap["get_group"] = Processor.process_get_group
|
|
self._processMap["del_group"] = Processor.process_del_group
|
|
self._processMap["add_vector"] = Processor.process_add_vector
|
|
self._processMap["add_vector_batch"] = Processor.process_add_vector_batch
|
|
self._processMap["add_binary_vector"] = Processor.process_add_binary_vector
|
|
self._processMap["add_binary_vector_batch"] = Processor.process_add_binary_vector_batch
|
|
self._processMap["search_vector"] = Processor.process_search_vector
|
|
self._processMap["search_vector_batch"] = Processor.process_search_vector_batch
|
|
self._processMap["search_binary_vector"] = Processor.process_search_binary_vector
|
|
self._processMap["search_binary_vector_batch"] = Processor.process_search_binary_vector_batch
|
|
|
|
def process(self, iprot, oprot):
|
|
(name, type, seqid) = iprot.readMessageBegin()
|
|
if name not in self._processMap:
|
|
iprot.skip(TType.STRUCT)
|
|
iprot.readMessageEnd()
|
|
x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
|
|
oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
|
|
x.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
return
|
|
else:
|
|
self._processMap[name](self, seqid, iprot, oprot)
|
|
return True
|
|
|
|
def process_add_group(self, seqid, iprot, oprot):
|
|
args = add_group_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = add_group_result()
|
|
try:
|
|
self._handler.add_group(args.group)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("add_group", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_get_group(self, seqid, iprot, oprot):
|
|
args = get_group_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = get_group_result()
|
|
try:
|
|
result.success = self._handler.get_group(args.group_id)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("get_group", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_del_group(self, seqid, iprot, oprot):
|
|
args = del_group_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = del_group_result()
|
|
try:
|
|
self._handler.del_group(args.group_id)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("del_group", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_add_vector(self, seqid, iprot, oprot):
|
|
args = add_vector_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = add_vector_result()
|
|
try:
|
|
self._handler.add_vector(args.group_id, args.tensor)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("add_vector", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_add_vector_batch(self, seqid, iprot, oprot):
|
|
args = add_vector_batch_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = add_vector_batch_result()
|
|
try:
|
|
self._handler.add_vector_batch(args.group_id, args.tensor_list)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("add_vector_batch", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_add_binary_vector(self, seqid, iprot, oprot):
|
|
args = add_binary_vector_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = add_binary_vector_result()
|
|
try:
|
|
self._handler.add_binary_vector(args.group_id, args.tensor)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("add_binary_vector", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_add_binary_vector_batch(self, seqid, iprot, oprot):
|
|
args = add_binary_vector_batch_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = add_binary_vector_batch_result()
|
|
try:
|
|
self._handler.add_binary_vector_batch(args.group_id, args.tensor_list)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("add_binary_vector_batch", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_search_vector(self, seqid, iprot, oprot):
|
|
args = search_vector_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = search_vector_result()
|
|
try:
|
|
result.success = self._handler.search_vector(args.group_id, args.top_k, args.tensor, args.filter)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("search_vector", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_search_vector_batch(self, seqid, iprot, oprot):
|
|
args = search_vector_batch_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = search_vector_batch_result()
|
|
try:
|
|
result.success = self._handler.search_vector_batch(args.group_id, args.top_k, args.tensor_list, args.filter)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("search_vector_batch", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_search_binary_vector(self, seqid, iprot, oprot):
|
|
args = search_binary_vector_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = search_binary_vector_result()
|
|
try:
|
|
result.success = self._handler.search_binary_vector(args.group_id, args.top_k, args.tensor, args.filter)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("search_binary_vector", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
def process_search_binary_vector_batch(self, seqid, iprot, oprot):
|
|
args = search_binary_vector_batch_args()
|
|
args.read(iprot)
|
|
iprot.readMessageEnd()
|
|
result = search_binary_vector_batch_result()
|
|
try:
|
|
result.success = self._handler.search_binary_vector_batch(args.group_id, args.top_k, args.tensor_list, args.filter)
|
|
msg_type = TMessageType.REPLY
|
|
except TTransport.TTransportException:
|
|
raise
|
|
except VecException as e:
|
|
msg_type = TMessageType.REPLY
|
|
result.e = e
|
|
except TApplicationException as ex:
|
|
logging.exception('TApplication exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = ex
|
|
except Exception:
|
|
logging.exception('Unexpected exception in handler')
|
|
msg_type = TMessageType.EXCEPTION
|
|
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
|
|
oprot.writeMessageBegin("search_binary_vector_batch", msg_type, seqid)
|
|
result.write(oprot)
|
|
oprot.writeMessageEnd()
|
|
oprot.trans.flush()
|
|
|
|
# HELPER FUNCTIONS AND STRUCTURES
|
|
|
|
|
|
class add_group_args(object):
|
|
"""
|
|
Attributes:
|
|
- group
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group=None,):
|
|
self.group = group
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRUCT:
|
|
self.group = VecGroup()
|
|
self.group.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_group_args')
|
|
if self.group is not None:
|
|
oprot.writeFieldBegin('group', TType.STRUCT, 2)
|
|
self.group.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_group_args)
|
|
add_group_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRUCT, 'group', [VecGroup, None], None, ), # 2
|
|
)
|
|
|
|
|
|
class add_group_result(object):
|
|
"""
|
|
Attributes:
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, e=None,):
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_group_result')
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_group_result)
|
|
add_group_result.thrift_spec = (
|
|
None, # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class get_group_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None,):
|
|
self.group_id = group_id
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('get_group_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(get_group_args)
|
|
get_group_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
)
|
|
|
|
|
|
class get_group_result(object):
|
|
"""
|
|
Attributes:
|
|
- success
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, success=None, e=None,):
|
|
self.success = success
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 0:
|
|
if ftype == TType.STRUCT:
|
|
self.success = VecGroup()
|
|
self.success.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('get_group_result')
|
|
if self.success is not None:
|
|
oprot.writeFieldBegin('success', TType.STRUCT, 0)
|
|
self.success.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(get_group_result)
|
|
get_group_result.thrift_spec = (
|
|
(0, TType.STRUCT, 'success', [VecGroup, None], None, ), # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class del_group_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None,):
|
|
self.group_id = group_id
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('del_group_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(del_group_args)
|
|
del_group_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
)
|
|
|
|
|
|
class del_group_result(object):
|
|
"""
|
|
Attributes:
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, e=None,):
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('del_group_result')
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(del_group_result)
|
|
del_group_result.thrift_spec = (
|
|
None, # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class add_vector_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- tensor
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, tensor=None,):
|
|
self.group_id = group_id
|
|
self.tensor = tensor
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor = VecTensor()
|
|
self.tensor.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_vector_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor is not None:
|
|
oprot.writeFieldBegin('tensor', TType.STRUCT, 3)
|
|
self.tensor.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_vector_args)
|
|
add_vector_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.STRUCT, 'tensor', [VecTensor, None], None, ), # 3
|
|
)
|
|
|
|
|
|
class add_vector_result(object):
|
|
"""
|
|
Attributes:
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, e=None,):
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_vector_result')
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_vector_result)
|
|
add_vector_result.thrift_spec = (
|
|
None, # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class add_vector_batch_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- tensor_list
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, tensor_list=None,):
|
|
self.group_id = group_id
|
|
self.tensor_list = tensor_list
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor_list = VecTensorList()
|
|
self.tensor_list.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_vector_batch_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor_list is not None:
|
|
oprot.writeFieldBegin('tensor_list', TType.STRUCT, 3)
|
|
self.tensor_list.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_vector_batch_args)
|
|
add_vector_batch_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.STRUCT, 'tensor_list', [VecTensorList, None], None, ), # 3
|
|
)
|
|
|
|
|
|
class add_vector_batch_result(object):
|
|
"""
|
|
Attributes:
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, e=None,):
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_vector_batch_result')
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_vector_batch_result)
|
|
add_vector_batch_result.thrift_spec = (
|
|
None, # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class add_binary_vector_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- tensor
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, tensor=None,):
|
|
self.group_id = group_id
|
|
self.tensor = tensor
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor = VecBinaryTensor()
|
|
self.tensor.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_binary_vector_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor is not None:
|
|
oprot.writeFieldBegin('tensor', TType.STRUCT, 3)
|
|
self.tensor.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_binary_vector_args)
|
|
add_binary_vector_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.STRUCT, 'tensor', [VecBinaryTensor, None], None, ), # 3
|
|
)
|
|
|
|
|
|
class add_binary_vector_result(object):
|
|
"""
|
|
Attributes:
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, e=None,):
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_binary_vector_result')
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_binary_vector_result)
|
|
add_binary_vector_result.thrift_spec = (
|
|
None, # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class add_binary_vector_batch_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- tensor_list
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, tensor_list=None,):
|
|
self.group_id = group_id
|
|
self.tensor_list = tensor_list
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor_list = VecBinaryTensorList()
|
|
self.tensor_list.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_binary_vector_batch_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor_list is not None:
|
|
oprot.writeFieldBegin('tensor_list', TType.STRUCT, 3)
|
|
self.tensor_list.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_binary_vector_batch_args)
|
|
add_binary_vector_batch_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.STRUCT, 'tensor_list', [VecBinaryTensorList, None], None, ), # 3
|
|
)
|
|
|
|
|
|
class add_binary_vector_batch_result(object):
|
|
"""
|
|
Attributes:
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, e=None,):
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('add_binary_vector_batch_result')
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(add_binary_vector_batch_result)
|
|
add_binary_vector_batch_result.thrift_spec = (
|
|
None, # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class search_vector_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- top_k
|
|
- tensor
|
|
- filter
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, top_k=None, tensor=None, filter=None,):
|
|
self.group_id = group_id
|
|
self.top_k = top_k
|
|
self.tensor = tensor
|
|
self.filter = filter
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.I64:
|
|
self.top_k = iprot.readI64()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 4:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor = VecTensor()
|
|
self.tensor.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 5:
|
|
if ftype == TType.STRUCT:
|
|
self.filter = VecSearchFilter()
|
|
self.filter.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_vector_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.top_k is not None:
|
|
oprot.writeFieldBegin('top_k', TType.I64, 3)
|
|
oprot.writeI64(self.top_k)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor is not None:
|
|
oprot.writeFieldBegin('tensor', TType.STRUCT, 4)
|
|
self.tensor.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.filter is not None:
|
|
oprot.writeFieldBegin('filter', TType.STRUCT, 5)
|
|
self.filter.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_vector_args)
|
|
search_vector_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.I64, 'top_k', None, None, ), # 3
|
|
(4, TType.STRUCT, 'tensor', [VecTensor, None], None, ), # 4
|
|
(5, TType.STRUCT, 'filter', [VecSearchFilter, None], None, ), # 5
|
|
)
|
|
|
|
|
|
class search_vector_result(object):
|
|
"""
|
|
Attributes:
|
|
- success
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, success=None, e=None,):
|
|
self.success = success
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 0:
|
|
if ftype == TType.STRUCT:
|
|
self.success = VecSearchResult()
|
|
self.success.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_vector_result')
|
|
if self.success is not None:
|
|
oprot.writeFieldBegin('success', TType.STRUCT, 0)
|
|
self.success.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_vector_result)
|
|
search_vector_result.thrift_spec = (
|
|
(0, TType.STRUCT, 'success', [VecSearchResult, None], None, ), # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class search_vector_batch_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- top_k
|
|
- tensor_list
|
|
- filter
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, top_k=None, tensor_list=None, filter=None,):
|
|
self.group_id = group_id
|
|
self.top_k = top_k
|
|
self.tensor_list = tensor_list
|
|
self.filter = filter
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.I64:
|
|
self.top_k = iprot.readI64()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 4:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor_list = VecTensorList()
|
|
self.tensor_list.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 5:
|
|
if ftype == TType.STRUCT:
|
|
self.filter = VecSearchFilter()
|
|
self.filter.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_vector_batch_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.top_k is not None:
|
|
oprot.writeFieldBegin('top_k', TType.I64, 3)
|
|
oprot.writeI64(self.top_k)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor_list is not None:
|
|
oprot.writeFieldBegin('tensor_list', TType.STRUCT, 4)
|
|
self.tensor_list.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.filter is not None:
|
|
oprot.writeFieldBegin('filter', TType.STRUCT, 5)
|
|
self.filter.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_vector_batch_args)
|
|
search_vector_batch_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.I64, 'top_k', None, None, ), # 3
|
|
(4, TType.STRUCT, 'tensor_list', [VecTensorList, None], None, ), # 4
|
|
(5, TType.STRUCT, 'filter', [VecSearchFilter, None], None, ), # 5
|
|
)
|
|
|
|
|
|
class search_vector_batch_result(object):
|
|
"""
|
|
Attributes:
|
|
- success
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, success=None, e=None,):
|
|
self.success = success
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 0:
|
|
if ftype == TType.STRUCT:
|
|
self.success = VecSearchResultList()
|
|
self.success.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_vector_batch_result')
|
|
if self.success is not None:
|
|
oprot.writeFieldBegin('success', TType.STRUCT, 0)
|
|
self.success.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_vector_batch_result)
|
|
search_vector_batch_result.thrift_spec = (
|
|
(0, TType.STRUCT, 'success', [VecSearchResultList, None], None, ), # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class search_binary_vector_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- top_k
|
|
- tensor
|
|
- filter
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, top_k=None, tensor=None, filter=None,):
|
|
self.group_id = group_id
|
|
self.top_k = top_k
|
|
self.tensor = tensor
|
|
self.filter = filter
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.I64:
|
|
self.top_k = iprot.readI64()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 4:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor = VecBinaryTensor()
|
|
self.tensor.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 5:
|
|
if ftype == TType.STRUCT:
|
|
self.filter = VecSearchFilter()
|
|
self.filter.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_binary_vector_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.top_k is not None:
|
|
oprot.writeFieldBegin('top_k', TType.I64, 3)
|
|
oprot.writeI64(self.top_k)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor is not None:
|
|
oprot.writeFieldBegin('tensor', TType.STRUCT, 4)
|
|
self.tensor.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.filter is not None:
|
|
oprot.writeFieldBegin('filter', TType.STRUCT, 5)
|
|
self.filter.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_binary_vector_args)
|
|
search_binary_vector_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.I64, 'top_k', None, None, ), # 3
|
|
(4, TType.STRUCT, 'tensor', [VecBinaryTensor, None], None, ), # 4
|
|
(5, TType.STRUCT, 'filter', [VecSearchFilter, None], None, ), # 5
|
|
)
|
|
|
|
|
|
class search_binary_vector_result(object):
|
|
"""
|
|
Attributes:
|
|
- success
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, success=None, e=None,):
|
|
self.success = success
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 0:
|
|
if ftype == TType.STRUCT:
|
|
self.success = VecSearchResult()
|
|
self.success.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_binary_vector_result')
|
|
if self.success is not None:
|
|
oprot.writeFieldBegin('success', TType.STRUCT, 0)
|
|
self.success.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_binary_vector_result)
|
|
search_binary_vector_result.thrift_spec = (
|
|
(0, TType.STRUCT, 'success', [VecSearchResult, None], None, ), # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
|
|
|
|
class search_binary_vector_batch_args(object):
|
|
"""
|
|
Attributes:
|
|
- group_id
|
|
- top_k
|
|
- tensor_list
|
|
- filter
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, group_id=None, top_k=None, tensor_list=None, filter=None,):
|
|
self.group_id = group_id
|
|
self.top_k = top_k
|
|
self.tensor_list = tensor_list
|
|
self.filter = filter
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 2:
|
|
if ftype == TType.STRING:
|
|
self.group_id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 3:
|
|
if ftype == TType.I64:
|
|
self.top_k = iprot.readI64()
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 4:
|
|
if ftype == TType.STRUCT:
|
|
self.tensor_list = VecBinaryTensorList()
|
|
self.tensor_list.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 5:
|
|
if ftype == TType.STRUCT:
|
|
self.filter = VecSearchFilter()
|
|
self.filter.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_binary_vector_batch_args')
|
|
if self.group_id is not None:
|
|
oprot.writeFieldBegin('group_id', TType.STRING, 2)
|
|
oprot.writeString(self.group_id.encode('utf-8') if sys.version_info[0] == 2 else self.group_id)
|
|
oprot.writeFieldEnd()
|
|
if self.top_k is not None:
|
|
oprot.writeFieldBegin('top_k', TType.I64, 3)
|
|
oprot.writeI64(self.top_k)
|
|
oprot.writeFieldEnd()
|
|
if self.tensor_list is not None:
|
|
oprot.writeFieldBegin('tensor_list', TType.STRUCT, 4)
|
|
self.tensor_list.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.filter is not None:
|
|
oprot.writeFieldBegin('filter', TType.STRUCT, 5)
|
|
self.filter.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_binary_vector_batch_args)
|
|
search_binary_vector_batch_args.thrift_spec = (
|
|
None, # 0
|
|
None, # 1
|
|
(2, TType.STRING, 'group_id', 'UTF8', None, ), # 2
|
|
(3, TType.I64, 'top_k', None, None, ), # 3
|
|
(4, TType.STRUCT, 'tensor_list', [VecBinaryTensorList, None], None, ), # 4
|
|
(5, TType.STRUCT, 'filter', [VecSearchFilter, None], None, ), # 5
|
|
)
|
|
|
|
|
|
class search_binary_vector_batch_result(object):
|
|
"""
|
|
Attributes:
|
|
- success
|
|
- e
|
|
|
|
"""
|
|
|
|
|
|
def __init__(self, success=None, e=None,):
|
|
self.success = success
|
|
self.e = e
|
|
|
|
def read(self, iprot):
|
|
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
|
|
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
|
|
return
|
|
iprot.readStructBegin()
|
|
while True:
|
|
(fname, ftype, fid) = iprot.readFieldBegin()
|
|
if ftype == TType.STOP:
|
|
break
|
|
if fid == 0:
|
|
if ftype == TType.STRUCT:
|
|
self.success = VecSearchResultList()
|
|
self.success.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
elif fid == 1:
|
|
if ftype == TType.STRUCT:
|
|
self.e = VecException()
|
|
self.e.read(iprot)
|
|
else:
|
|
iprot.skip(ftype)
|
|
else:
|
|
iprot.skip(ftype)
|
|
iprot.readFieldEnd()
|
|
iprot.readStructEnd()
|
|
|
|
def write(self, oprot):
|
|
if oprot._fast_encode is not None and self.thrift_spec is not None:
|
|
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
|
|
return
|
|
oprot.writeStructBegin('search_binary_vector_batch_result')
|
|
if self.success is not None:
|
|
oprot.writeFieldBegin('success', TType.STRUCT, 0)
|
|
self.success.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
if self.e is not None:
|
|
oprot.writeFieldBegin('e', TType.STRUCT, 1)
|
|
self.e.write(oprot)
|
|
oprot.writeFieldEnd()
|
|
oprot.writeFieldStop()
|
|
oprot.writeStructEnd()
|
|
|
|
def validate(self):
|
|
return
|
|
|
|
def __repr__(self):
|
|
L = ['%s=%r' % (key, value)
|
|
for key, value in self.__dict__.items()]
|
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
|
|
|
|
def __eq__(self, other):
|
|
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
|
|
|
|
def __ne__(self, other):
|
|
return not (self == other)
|
|
all_structs.append(search_binary_vector_batch_result)
|
|
search_binary_vector_batch_result.thrift_spec = (
|
|
(0, TType.STRUCT, 'success', [VecSearchResultList, None], None, ), # 0
|
|
(1, TType.STRUCT, 'e', [VecException, None], None, ), # 1
|
|
)
|
|
fix_spec(all_structs)
|
|
del all_structs
|
|
|