public ArchiveHdfsLogReader()

in ratis-logservice/src/main/java/org/apache/ratis/logservice/impl/ArchiveHdfsLogReader.java [56:76]


  public ArchiveHdfsLogReader(Configuration configuration, String archiveLocation)
      throws IOException {
    this.hdfs = FileSystem.get(configuration);
    Path archiveLocationPath = new Path(archiveLocation);
    if (!hdfs.exists(archiveLocationPath)) {
      throw new FileNotFoundException(archiveLocation);
    }
    files = Arrays.asList(hdfs.listStatus(archiveLocationPath));
    if (files.size() > 0) {
      Collections.sort(files, new Comparator<FileStatus>() {
        @Override public int compare(FileStatus o1, FileStatus o2) {
          //ascending order
          //currently written file (without _recordId_) will be sorted at the last
          return LogServiceUtils.getRecordIdFromRolledArchiveFile(o1.getPath())
              .compareTo(LogServiceUtils.getRecordIdFromRolledArchiveFile(o2.getPath()));
        }
      });
      openNextFilePath();
      loadNext();
    }
  }