public static SnapshottableDirectoryStatus convert( SnapshottableDirectoryStatusProto sdirStatusProto) { if (sdirStatusProto == null) { return null; } final HdfsFileStatusProto status = sdirStatusProto.getDirStatus(); return new SnapshottableDirectoryStatus( status.getModificationTime(), status.getAccessTime(), PBHelper.convert(status.getPermission()), status.getOwner(), status.getGroup(), status.getPath().toByteArray(), status.getFileId(), status.getChildrenNum(), sdirStatusProto.getSnapshotNumber(), sdirStatusProto.getSnapshotQuota(), sdirStatusProto.getParentFullpath().toByteArray()); }
public static SnapshottableDirectoryStatusProto convert( SnapshottableDirectoryStatus status) { if (status == null) { return null; } int snapshotNumber = status.getSnapshotNumber(); int snapshotQuota = status.getSnapshotQuota(); byte[] parentFullPath = status.getParentFullPath(); ByteString parentFullPathBytes = ByteString.copyFrom( parentFullPath == null ? DFSUtil.EMPTY_BYTES : parentFullPath); HdfsFileStatusProto fs = convert(status.getDirStatus()); SnapshottableDirectoryStatusProto.Builder builder = SnapshottableDirectoryStatusProto .newBuilder().setSnapshotNumber(snapshotNumber) .setSnapshotQuota(snapshotQuota).setParentFullpath(parentFullPathBytes) .setDirStatus(fs); return builder.build(); }
public static SnapshottableDirectoryStatus[] convert( SnapshottableDirectoryListingProto sdlp) { if (sdlp == null) return null; List<SnapshottableDirectoryStatusProto> list = sdlp .getSnapshottableDirListingList(); if (list.isEmpty()) { return new SnapshottableDirectoryStatus[0]; } else { SnapshottableDirectoryStatus[] result = new SnapshottableDirectoryStatus[list.size()]; for (int i = 0; i < list.size(); i++) { result[i] = PBHelper.convert(list.get(i)); } return result; } }
public static SnapshottableDirectoryStatus[] convert( SnapshottableDirectoryListingProto sdlp) { if (sdlp == null) return null; List<SnapshottableDirectoryStatusProto> list = sdlp .getSnapshottableDirListingList(); if (list.isEmpty()) { return new SnapshottableDirectoryStatus[0]; } else { SnapshottableDirectoryStatus[] result = new SnapshottableDirectoryStatus[list.size()]; for (int i = 0; i < list.size(); i++) { result[i] = convert(list.get(i)); } return result; } }
public static SnapshottableDirectoryStatus convert( SnapshottableDirectoryStatusProto sdirStatusProto) { if (sdirStatusProto == null) { return null; } final HdfsFileStatusProto status = sdirStatusProto.getDirStatus(); return new SnapshottableDirectoryStatus( status.getModificationTime(), status.getAccessTime(), convert(status.getPermission()), status.getOwner(), status.getGroup(), status.getPath().toByteArray(), status.getFileId(), status.getChildrenNum(), sdirStatusProto.getSnapshotNumber(), sdirStatusProto.getSnapshotQuota(), sdirStatusProto.getParentFullpath().toByteArray()); }
public static SnapshottableDirectoryStatusProto convert( SnapshottableDirectoryStatus status) { if (status == null) { return null; } int snapshotNumber = status.getSnapshotNumber(); int snapshotQuota = status.getSnapshotQuota(); byte[] parentFullPath = status.getParentFullPath(); ByteString parentFullPathBytes = getByteString( parentFullPath == null ? DFSUtilClient.EMPTY_BYTES : parentFullPath); HdfsFileStatusProto fs = convert(status.getDirStatus()); SnapshottableDirectoryStatusProto.Builder builder = SnapshottableDirectoryStatusProto .newBuilder() .setSnapshotNumber(snapshotNumber) .setSnapshotQuota(snapshotQuota) .setParentFullpath(parentFullPathBytes) .setDirStatus(fs); return builder.build(); }
public static SnapshottableDirectoryListingProto convert( SnapshottableDirectoryStatus[] status) { if (status == null) return null; SnapshottableDirectoryStatusProto[] protos = new SnapshottableDirectoryStatusProto[status.length]; for (int i = 0; i < status.length; i++) { protos[i] = PBHelper.convert(status[i]); } List<SnapshottableDirectoryStatusProto> protoList = Arrays.asList(protos); return SnapshottableDirectoryListingProto.newBuilder() .addAllSnapshottableDirListing(protoList).build(); }
public static SnapshottableDirectoryListingProto convert( SnapshottableDirectoryStatus[] status) { if (status == null) return null; SnapshottableDirectoryStatusProto[] protos = new SnapshottableDirectoryStatusProto[status.length]; for (int i = 0; i < status.length; i++) { protos[i] = convert(status[i]); } List<SnapshottableDirectoryStatusProto> protoList = Arrays.asList(protos); return SnapshottableDirectoryListingProto.newBuilder() .addAllSnapshottableDirListing(protoList).build(); }