/** * Returns the creation time of this file * * @return the creation time, in milliseconds * @throws IOException if the underlying file does not exist or its metadata is corrupted */ public long getCreationTimeMs() throws IOException { return getCachedFileStatus().getCreationTimeMs(); }
@Override public FileStatus[] listStatus(Path path) throws IOException { TachyonURI tPath = new TachyonURI(Utils.getPathWithoutScheme(path)); Path hdfsPath = Utils.getHDFSPath(tPath, mUnderFSAddress); LOG.info("listStatus(" + path + "): HDFS Path: " + hdfsPath); if (mStatistics != null) { mStatistics.incrementReadOps(1); } if (!mTFS.exist(tPath)) { throw new FileNotFoundException("File does not exist: " + path); } List<FileInfo> files = mTFS.listStatus(tPath); FileStatus[] ret = new FileStatus[files.size()]; for (int k = 0; k < files.size(); k ++) { FileInfo info = files.get(k); // TODO(hy): Replicate 3 with the number of disk replications. ret[k] = new FileStatus(info.getLength(), info.isFolder, 3, info.getBlockSizeBytes(), info.getCreationTimeMs(), info.getCreationTimeMs(), null, null, null, new Path( mTachyonHeader + info.getPath())); } return ret; }
public UiFileInfo(FileInfo fileInfo) { mId = fileInfo.getFileId(); mName = fileInfo.getName(); mAbsolutePath = fileInfo.getPath(); mBlockSizeBytes = fileInfo.getBlockSizeBytes(); mSize = fileInfo.getLength(); mCreationTimeMs = fileInfo.getCreationTimeMs(); mLastModificationTimeMs = fileInfo.getLastModificationTimeMs(); mInMemory = (100 == fileInfo.inMemoryPercentage); mInMemoryPercent = fileInfo.getInMemoryPercentage(); mIsDirectory = fileInfo.isFolder; mIsPinned = fileInfo.isPinned; mFileLocations = new ArrayList<String>(); for (int i = 0; i < StorageLevelAlias.SIZE; i ++) { mBlocksOnTier.add(new ArrayList<UiBlockInfo>()); } }
/** * Displays information for all directories and files directly under the path specified in argv. * * @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 ls(TachyonURI path) throws IOException { List<FileInfo> files = listStatusSortedByIncreasingCreationTime(path); String format = "%-10s%-25s%-15s%-5s%n"; for (FileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, FormatUtils.getSizeFromBytes(file.getLength()), convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); } return 0; }
/** * Displays information for all directories and files under the path specified in argv * recursively. * * @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 lsr(TachyonURI path) throws IOException { List<FileInfo> files = listStatusSortedByIncreasingCreationTime(path); String format = "%-10s%-25s%-15s%-5s%n"; for (FileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, FormatUtils.getSizeFromBytes(file.getLength()), convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); if (file.isFolder) { lsr(new TachyonURI(path.getScheme(), path.getAuthority(), file.getPath())); } } return 0; }