@Override public RemoteIterator<LocatedFileStatus> list(FileSystem fs, Path path) throws IOException { return fs.listLocatedStatus(path); } }
@Override protected RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f, final PathFilter filter) throws FileNotFoundException, IOException { return fs.listLocatedStatus(f, filter); }
/** List files and its block locations in a directory. */ @Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException { return fs.listLocatedStatus(f); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws FileNotFoundException, IOException { // TODO important for splits return super.listLocatedStatus(f); }
/** * List the statuses of the files/directories in the given path if the path is * a directory. * * @param f * given path * @return the statuses of the files/directories in the given patch * @throws IOException */ @Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException { return fs.listLocatedStatus(f, DEFAULT_FILTER); }
/** * List the statuses of the files/directories in the given path if the path is * a directory. * Return the file's status and block locations If the path is a file. * * If a returned status is a file, it contains the file's block locations. * * @param f is the path * * @return an iterator that traverses statuses of the files/directories * in the given path * * @throws FileNotFoundException If <code>f</code> does not exist * @throws IOException If an I/O error occurred */ public RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f) throws FileNotFoundException, IOException { return listLocatedStatus(f, DEFAULT_FILTER); }
public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws java.io.FileNotFoundException, java.io.IOException { return this.underlyingFs.listLocatedStatus(replaceScheme(f, this.replacementScheme, this.underlyingScheme)); }
private Stack<RemoteIterator<LocatedFileStatus>> itors = new Stack<>(); private RemoteIterator<LocatedFileStatus> curItor = listLocatedStatus(f); private LocatedFileStatus curFile;
public static List<FileStatus> listLocatedStatus(final FileSystem fs, final Path path, final PathFilter filter ) throws IOException { RemoteIterator<LocatedFileStatus> itr = fs.listLocatedStatus(path); List<FileStatus> result = new ArrayList<FileStatus>(); while(itr.hasNext()) { FileStatus stat = itr.next(); if (filter == null || filter.accept(stat.getPath())) { result.add(stat); } } return result; }
/** * Process the input stat. * If it is a file, return the file stat. * If it is a directory, traverse the directory if recursive is true; * ignore it if recursive is false. * @param stat input status * @throws IOException if any IO error occurs */ private void handleFileStat(LocatedFileStatus stat) throws IOException { if (stat.isFile()) { // file curFile = stat; } else if (recursive) { // directory itors.push(curItor); curItor = listLocatedStatus(stat.getPath()); } }
public static List<FileStatus> listLocatedStatus(final FileSystem fs, final Path path, final PathFilter filter ) throws IOException { RemoteIterator<LocatedFileStatus> itr = fs.listLocatedStatus(path); List<FileStatus> result = new ArrayList<FileStatus>(); while(itr.hasNext()) { FileStatus stat = itr.next(); if (filter == null || filter.accept(stat.getPath())) { result.add(stat); } } return result; }
@Override public void killOlderThan(long timestamp) throws IOException { Path taskLogDir = new Path(config.getDirectory()); FileSystem fs = taskLogDir.getFileSystem(hadoopConfig); if (fs.exists(taskLogDir)) { if (!fs.isDirectory(taskLogDir)) { throw new IOE("taskLogDir [%s] must be a directory.", taskLogDir); } RemoteIterator<LocatedFileStatus> iter = fs.listLocatedStatus(taskLogDir); while (iter.hasNext()) { LocatedFileStatus file = iter.next(); if (file.getModificationTime() < timestamp) { Path p = file.getPath(); log.info("Deleting hdfs task log [%s].", p.toUri().toString()); fs.delete(p, true); } if (Thread.currentThread().isInterrupted()) { throw new IOException( new InterruptedException("Thread interrupted. Couldn't delete all tasklogs.") ); } } } } }
LOG.debug("Scanning " + dir.toString() + " for WAL files"); RemoteIterator<LocatedFileStatus> iter = fs.listLocatedStatus(dir); if (!iter.hasNext()) return Collections.emptyList(); while (iter.hasNext()) {
RemoteIterator<LocatedFileStatus> it = fs.listLocatedStatus(backupRootPath);
@Override public RemoteIterator<LocatedFileStatus>listLocatedStatus(final Path f, final PathFilter filter) throws FileNotFoundException, IOException { final InodeTree.ResolveResult<FileSystem> res = fsState.resolve(getUriPath(f), true); final RemoteIterator<LocatedFileStatus> statusIter = res.targetFileSystem.listLocatedStatus(res.remainingPath); if (res.isInternalDir()) { return statusIter; } return new RemoteIterator<LocatedFileStatus>() { @Override public boolean hasNext() throws IOException { return statusIter.hasNext(); } @Override public LocatedFileStatus next() throws IOException { final LocatedFileStatus status = statusIter.next(); return (LocatedFileStatus)fixFileStatus(status, getChrootedPath(res, status, f)); } }; }
/** * List located status delegation */ public static RemoteIterator<LocatedFileStatus> listLocatedFileStatus(FileSystem fs, Path path, PathFilter filter) throws FileNotFoundException, IOException{ return fs.listLocatedStatus(path, filter); } }
/** List files and its block locations in a directory. */ @Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException { return fs.listLocatedStatus(f); }
/** List files and its block locations in a directory. */ @Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException { return fs.listLocatedStatus(f); }
@Override public RemoteIterator<LocatedFileStatus> listLocatedStatus(Path f) throws IOException { return fs.listLocatedStatus(f); }
@Override public LocatedFileStatus[] listLocatedStatus(final Path f) throws IOException { RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> fileStatus = this.fs.listLocatedStatus(new org.apache.hadoop.fs.Path(f.toString())); ArrayList<HadoopLocatedFileStatus> result = new ArrayList<>(); while (fileStatus.hasNext()) { result.add(new HadoopLocatedFileStatus(fileStatus.next())); } return result.toArray(new HadoopLocatedFileStatus[0]); }