Search in sources :

Example 11 with InodeFile

use of alluxio.master.file.meta.InodeFile in project alluxio by Alluxio.

the class FileSystemMaster method getFileInfoInternal.

/**
   * @param inodePath the {@link LockedInodePath} to get the {@link FileInfo} for
   * @return the {@link FileInfo} for the given inode
   * @throws FileDoesNotExistException if the file does not exist
   * @throws AccessControlException if permission denied
   */
private FileInfo getFileInfoInternal(LockedInodePath inodePath) throws FileDoesNotExistException, AccessControlException {
    Inode<?> inode = inodePath.getInode();
    AlluxioURI uri = inodePath.getUri();
    FileInfo fileInfo = inode.generateClientFileInfo(uri.toString());
    fileInfo.setInMemoryPercentage(getInMemoryPercentage(inode));
    if (inode instanceof InodeFile) {
        try {
            fileInfo.setFileBlockInfos(getFileBlockInfoListInternal(inodePath));
        } catch (InvalidPathException e) {
            throw new FileDoesNotExistException(e.getMessage(), e);
        }
    }
    MountTable.Resolution resolution;
    try {
        resolution = mMountTable.resolve(uri);
    } catch (InvalidPathException e) {
        throw new FileDoesNotExistException(e.getMessage(), e);
    }
    AlluxioURI resolvedUri = resolution.getUri();
    // Only set the UFS path if the path is nested under a mount point.
    if (!uri.equals(resolvedUri)) {
        fileInfo.setUfsPath(resolvedUri.toString());
    }
    Metrics.FILE_INFOS_GOT.inc();
    return fileInfo;
}
Also used : FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) FileInfo(alluxio.wire.FileInfo) InodeFile(alluxio.master.file.meta.InodeFile) MountTable(alluxio.master.file.meta.MountTable) InvalidPathException(alluxio.exception.InvalidPathException) AlluxioURI(alluxio.AlluxioURI)

Aggregations

InodeFile (alluxio.master.file.meta.InodeFile)11 MountTable (alluxio.master.file.meta.MountTable)4 FileBlockInfo (alluxio.wire.FileBlockInfo)4 UnderFileSystem (alluxio.underfs.UnderFileSystem)3 BlockInfo (alluxio.wire.BlockInfo)3 AlluxioURI (alluxio.AlluxioURI)2 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)2 Inode (alluxio.master.file.meta.Inode)2 InodeTree (alluxio.master.file.meta.InodeTree)2 LockedInodePath (alluxio.master.file.meta.LockedInodePath)2 IOException (java.io.IOException)2 AccessControlException (alluxio.exception.AccessControlException)1 BlockInfoException (alluxio.exception.BlockInfoException)1 InvalidPathException (alluxio.exception.InvalidPathException)1 CompleteFileEntry (alluxio.proto.journal.File.CompleteFileEntry)1 FileInfo (alluxio.wire.FileInfo)1 ArrayList (java.util.ArrayList)1