Пример #1
0
 def get(self, key):
     """
     1. Get the highest Rendezvous node for the given key.
     2. Retrieve the DBClient instance reference by the node.
     3. Get the value by the key via client's get(). 
     :param key: a string key.
     :param value: a string key-value pair dictionary to be stored in DB. 
     :return a GetResposne - [email protected]
     """
     # TODO
     highest_node = self.get_node(key)
     server_channel = self.maps[str(highest_node)]
     stub = db_pb2.DBStub(channel=server_channel)
     req = db_pb2.GetRequest(id=key)
     return stub.get(req)
Пример #2
0
 def get(self, _id):
     req = db_pb2.GetRequest(id=_id)
     return self.stub.get(req)
Пример #3
0
 def get(self, key):
     req = db_pb2.GetRequest(id=key)
     return self.stub.get(req)
Пример #4
0
def get(stub, userId):
    req = db_pb2.GetRequest(UserID=userId)
    res = stub.Get(req)
    return res.Value