use of org.smartdata.model.CompactFileState in project SSM by Intel-bigdata.
the class SmartFileSystem method getFileLinkStatus.
@Override
public FileStatus getFileLinkStatus(final Path f) throws IOException {
FileStatus fileStatus = super.getFileLinkStatus(f);
if (fileStatus.getLen() == 0) {
Path target = getLinkTarget(f);
FileState fileState = smartDFSClient.getFileState(getPathName(target));
if (fileState instanceof CompactFileState) {
fileStatus = getFileStatus(target);
}
} else {
Path target = getLinkTarget(f);
FileState fileState = smartDFSClient.getFileState(getPathName(target));
if (fileState instanceof CompressionFileState) {
fileStatus = getFileStatus(target);
}
}
return fileStatus;
}
use of org.smartdata.model.CompactFileState in project SSM by Intel-bigdata.
the class SmartFileSystem method getFileBlockLocations.
@Override
public BlockLocation[] getFileBlockLocations(Path p, final long start, final long len) throws IOException {
BlockLocation[] blockLocations = super.getFileBlockLocations(p, start, len);
if (blockLocations.length == 0) {
FileState fileState = smartDFSClient.getFileState(getPathName(p));
if (fileState instanceof CompactFileState) {
FileContainerInfo fileContainerInfo = ((CompactFileState) fileState).getFileContainerInfo();
String containerFile = fileContainerInfo.getContainerFilePath();
long offset = fileContainerInfo.getOffset();
blockLocations = super.getFileBlockLocations(new Path(containerFile), offset + start, len);
for (BlockLocation blockLocation : blockLocations) {
blockLocation.setOffset(blockLocation.getOffset() - offset);
}
}
}
return blockLocations;
}
use of org.smartdata.model.CompactFileState in project SSM by Intel-bigdata.
the class SmartFileSystem method listStatus.
@Override
public FileStatus[] listStatus(Path p) throws IOException {
FileStatus[] oldStatus = super.listStatus(p);
ArrayList<FileStatus> newStatus = new ArrayList<>(oldStatus.length);
for (FileStatus status : oldStatus) {
if (oldStatus == null) {
newStatus.add(null);
continue;
}
if (status.getLen() == 0) {
FileState fileState = smartDFSClient.getFileState(getPathName(status.getPath()));
if (fileState instanceof CompactFileState) {
long len = ((CompactFileState) fileState).getFileContainerInfo().getLength();
newStatus.add(new FileStatus(len, status.isDirectory(), status.getReplication(), status.getBlockSize(), status.getModificationTime(), status.getAccessTime(), status.getPermission(), status.getOwner(), status.getGroup(), status.isSymlink() ? status.getSymlink() : null, status.getPath()));
} else {
newStatus.add(status);
}
} else {
FileState fileState = smartDFSClient.getFileState(getPathName(status.getPath()));
if (fileState instanceof CompressionFileState) {
long len = ((CompressionFileState) fileState).getOriginalLength();
newStatus.add(new FileStatus(len, status.isDirectory(), status.getReplication(), status.getBlockSize(), status.getModificationTime(), status.getAccessTime(), status.getPermission(), status.getOwner(), status.getGroup(), status.isSymlink() ? status.getSymlink() : null, status.getPath()));
} else {
newStatus.add(status);
}
}
}
return newStatus.toArray(new FileStatus[oldStatus.length]);
}
use of org.smartdata.model.CompactFileState in project SSM by Intel-bigdata.
the class SmartDFSClient method listCorruptFileBlocks.
@Override
public CorruptFileBlocks listCorruptFileBlocks(String path, String cookie) throws IOException {
CorruptFileBlocks corruptFileBlocks = super.listCorruptFileBlocks(path, cookie);
FileState fileState = getFileState(path);
if (fileState instanceof CompactFileState) {
corruptFileBlocks = super.listCorruptFileBlocks(((CompactFileState) fileState).getFileContainerInfo().getContainerFilePath(), cookie);
}
return corruptFileBlocks;
}
use of org.smartdata.model.CompactFileState in project SSM by Intel-bigdata.
the class SmartDFSClient method getBlockSize.
@Override
public long getBlockSize(String f) throws IOException {
long blockSize = super.getBlockSize(f);
FileState fileState = getFileState(f);
if (fileState instanceof CompactFileState) {
blockSize = super.getBlockSize(((CompactFileState) fileState).getFileContainerInfo().getContainerFilePath());
}
return blockSize;
}
Aggregations