Ejemplo n.º 1
0
    def Read(self,request,context):
        """
        Reads a file from data node. This should simply call
        dfss.Read() with the proper parameters.

        ReadRequest takes the following parameters:
            1. string file_name
            2. string timestamp

        ReadReply takes the following parameters:
            1. bytes reply_file
            2. bool success
        """
        
        if DEBUG:
            print("Requesting NameNode.Read")

        file_path = request.file_path
        timestamp = request.timestamp
        nn = Namenode()
        data_nodes = nn.get(file_path, timestamp)
        if DEBUG: 
            print("Processing namenode.get() successful.")
            print("Response should be completed")
        return namenode_pb2.ReadReply(datanodes=data_nodes, success=True)