/** * Prints mount information for a mount table. * * @param mountTable the mount table to get information from */ public static void printMountInfo(Map<String, MountPointInfo> mountTable) { for (Map.Entry<String, MountPointInfo> entry : mountTable.entrySet()) { String mMountPoint = entry.getKey(); MountPointInfo mountPointInfo = entry.getValue(); long capacityBytes = mountPointInfo.getUfsCapacityBytes(); long usedBytes = mountPointInfo.getUfsUsedBytes(); String usedPercentageInfo = ""; if (capacityBytes > 0) { int usedPercentage = (int) (100L * usedBytes / capacityBytes); usedPercentageInfo = String.format("(%s%%)", usedPercentage); } String leftAlignFormat = getAlignFormat(mountTable); System.out.format(leftAlignFormat, mountPointInfo.getUfsUri(), mMountPoint, mountPointInfo.getUfsType(), FormatUtils.getSizeFromBytes(capacityBytes), FormatUtils.getSizeFromBytes(usedBytes) + usedPercentageInfo, mountPointInfo.getReadOnly() ? "" : "not ", mountPointInfo.getShared() ? "" : "not "); System.out.println("properties=" + mountPointInfo.getProperties() + ")"); } }
private Capacity getUfsCapacityInternal() { MountPointInfo mountInfo = mFileSystemMaster.getMountTable().get(MountTable.ROOT); if (mountInfo == null) { return new Capacity().setTotal(-1).setUsed(-1); } long capacityBytes = mountInfo.getUfsCapacityBytes(); long usedBytes = mountInfo.getUfsUsedBytes(); return new Capacity().setTotal(capacityBytes).setUsed(usedBytes); }
mountInfo = mFileSystemMaster.getMountPointInfo(new AlluxioURI(MountTable.ROOT)); long capacityBytes = mountInfo.getUfsCapacityBytes(); long usedBytes = mountInfo.getUfsUsedBytes(); long freeBytes = -1;
/** * Converts wire type to proto type. * * @param info the wire representation to convert * @return converted proto representation */ public static alluxio.grpc.MountPointInfo toProto(MountPointInfo info) { return alluxio.grpc.MountPointInfo.newBuilder().setUfsUri(info.getUfsUri()) .setUfsType(info.getUfsType()).setUfsCapacityBytes(info.getUfsCapacityBytes()) .setReadOnly(info.getReadOnly()).putAllProperties(info.getProperties()) .setShared(info.getShared()).build(); }
public void checkEquality(MountPointInfo a, MountPointInfo b) { Assert.assertEquals(a.getUfsUri(), b.getUfsUri()); Assert.assertEquals(a.getUfsType(), b.getUfsType()); Assert.assertEquals(a.getUfsCapacityBytes(), b.getUfsCapacityBytes()); Assert.assertEquals(a.getUfsUsedBytes(), b.getUfsUsedBytes()); Assert.assertEquals(a.getReadOnly(), b.getReadOnly()); Assert.assertEquals(a.getProperties(), b.getProperties()); Assert.assertEquals(a, b); }
long capacityBytes = mountInfo.getUfsCapacityBytes(); long usedBytes = mountInfo.getUfsUsedBytes(); long freeBytes = -1;
private Capacity getUfsCapacityInternal() { MountPointInfo mountInfo = mFileSystemMaster.getMountTable().get(MountTable.ROOT); if (mountInfo == null) { return new Capacity().setTotal(-1).setUsed(-1); } long capacityBytes = mountInfo.getUfsCapacityBytes(); long usedBytes = mountInfo.getUfsUsedBytes(); return new Capacity().setTotal(capacityBytes).setUsed(usedBytes); }