Пример #1
0
  /**
   * Displays the file's all blocks info
   *
   * @param path The TachyonURI path as the input of the command
   * @return 0 if command is successful, -1 if an error occurred.
   * @throws IOException
   */
  public int fileinfo(TachyonURI path) throws IOException {
    TachyonFile fd;
    FileInfo fInfo;
    try {
      fd = mTfs.open(path);
      if (fd == null) {
        System.out.println(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage(path));
        return -1;
      }
      fInfo = mTfs.getInfo(fd);
    } catch (TachyonException e) {
      throw new IOException(e);
    }

    if (fInfo.isFolder) {
      System.out.println(path + " is a directory path so does not have file blocks.");
      return -1;
    }

    System.out.println(path + " with file id " + fd.getFileId() + " has the following blocks: ");
    for (long blockId : fInfo.getBlockIds()) {
      System.out.println(TachyonBlockStore.get().getInfo(blockId));
    }
    return 0;
  }
Пример #2
0
 public int report(TachyonURI path) throws IOException {
   try {
     TachyonFile fd = mTfs.open(path);
     if (fd == null) {
       System.out.println(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage(path));
       return -1;
     }
     mTfs.reportLostFile(fd);
     System.out.println(
         path + " with file id " + fd.getFileId() + " has reported been report lost.");
     listLineages();
     return 0;
   } catch (TachyonException e) {
     throw new IOException(e.getMessage());
   }
 }
Пример #3
0
  /**
   * Displays a list of hosts that have the file specified in argv stored.
   *
   * @param path The TachyonURI path as the input of the command
   * @return 0 if command is successful, -1 if an error occurred.
   * @throws IOException
   */
  public int location(TachyonURI path) throws IOException {
    TachyonFile fd;
    FileInfo fInfo;
    try {
      fd = mTfs.open(path);
      if (fd == null) {
        System.out.println(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage(path));
        return -1;
      }
      fInfo = mTfs.getInfo(fd);
    } catch (TachyonException e) {
      throw new IOException(e);
    }

    System.out.println(path + " with file id " + fd.getFileId() + " is on nodes: ");
    for (long blockId : fInfo.getBlockIds()) {
      for (BlockLocation location : TachyonBlockStore.get().getInfo(blockId).getLocations()) {
        System.out.println(location.getWorkerAddress().getHost());
      }
    }
    return 0;
  }