11 from nebula3.Exception
import InValidHostname
12 from nebula3.storage
import GraphStorageService
13 from nebula3.fbthrift.transport
import TSocket, THeaderTransport, TTransport
14 from nebula3.fbthrift.protocol
import THeaderProtocol
18 def __init__(self, address, timeout, meta_cache):
25 self.
_ip_ip = socket.gethostbyname(address.host)
26 if not isinstance(address.port, int):
27 raise RuntimeError(
'Wrong port type: {}'.format(type(address.port)))
29 raise InValidHostname(str(address.host))
38 buffered_transport = TTransport.TBufferedTransport(s)
39 header_transport = THeaderTransport.THeaderTransport(buffered_transport)
40 protocol = THeaderProtocol.THeaderProtocol(header_transport)
41 header_transport.open()
43 self.
_connection_connection = GraphStorageService.Client(protocol)
47 def scan_vertex(self, req):
50 def scan_edge(self, req):
53 def storage_addr(self):
56 def update_leader_info(self, space_id, part_id, address):
57 self.
_meta_cache_meta_cache.update_storage_leader(space_id, part_id, address)