def init_find_successorlist(self, id, ip, need_pred):
     find_sl_request = server_pb2.FindSucclistRequest(inc_id=self.id, inc_ip=self.local_addr)
     channel = grpc.insecure_channel(ip)
     # grpc.channel_ready_future(channel).result()
     stub = server_pb2_grpc.ServerStub(channel)
     pred_resp = 0
     if need_pred:
         empty_request = server_pb2.EmptyRequest()
         pred_resp = stub.find_predecessor(empty_request, timeout=self.GLOBAL_TIMEOUT)
     find_sl_resp = stub.find_succlist(find_sl_request, timeout=self.GLOBAL_TIMEOUT)
     return find_sl_resp, pred_resp
Esempio n. 2
0
def getNodeStatus(addr):
    find_request = server_pb2.EmptyRequest()
    channel = grpc.insecure_channel(addr)
    stub = server_pb2_grpc.ServerStub(channel)
    find_resp = stub.get_node_status(find_request)
    print("id:\t", find_resp.id)
    print("ip:\t", find_resp.ip)
    print("pred_id:\t", find_resp.pred_id)
    print("pred_ip:\t", find_resp.pred_ip)
    print("suclist:")
    for i in range(len(find_resp.suclist_id)):
        print(find_resp.suclist_id[i], find_resp.suclist_ip[i])
    print("finger table:")
    for i in range(len(find_resp.finger_id)):
        print(find_resp.finger_id[i], find_resp.finger_ip[i])
Esempio n. 3
0
 def updateBloomFilter(self):
     return self.stub.updateBloomFilter(server_pb2.EmptyRequest())
Esempio n. 4
0
 def getUniqueDateIds(self):
     dates = self.stub.getUniqueDateIds(server_pb2.EmptyRequest())
     return dates