@Override public long getSize() { long size = 0; for (Iterator<Path> i = dirIterator(); i.hasNext(); ) { Path dir = i.next(); try { for (FileStatus st : fs.listStatus(dir)) { size += st.getLen(); } } catch (IOException e) { throw new DatasetIOException("Cannot find size of " + dir, e); } } return size; }
public Iterator<Path> getDirectoryIterator(View view) { if (view instanceof FileSystemView) { return ((FileSystemView<?>) view).dirIterator(); } else if (view instanceof FileSystemDataset) { return ((FileSystemDataset<?>) view).dirIterator(); } else { throw new DatasetException( "Underlying Dataset must be a FileSystemDataset"); } }
@Override public long getLastModified() { long lastMod = -1; for (Iterator<Path> i = dirIterator(); i.hasNext(); ) { Path dir = i.next(); try { for (FileStatus st : fs.listStatus(dir)) { if (lastMod < st.getModificationTime()) { lastMod = st.getModificationTime(); } } } catch (IOException e) { throw new DatasetIOException("Cannot find last modified time of of " + dir, e); } } // if view was marked ready more recently count it as the modified time if (signalManager != null) { long readyTimestamp = signalManager.getReadyTimestamp(getConstraints()); if (lastMod < readyTimestamp) { lastMod = readyTimestamp; } } return lastMod; }