public static MountPointInfo createRandom() { Random random = new Random(); String ufsUri = CommonUtils.randomAlphaNumString(random.nextInt(10)); String ufsType = CommonUtils.randomAlphaNumString(random.nextInt(10)); long ufsCapacityBytes = random.nextLong(); long ufsUsedBytes = random.nextLong(); boolean readOnly = random.nextBoolean(); Map<String, String> properties = new HashMap<>(); for (int i = 0, n = random.nextInt(10) + 1; i < n; i++) { properties.put(CommonUtils.randomAlphaNumString(random.nextInt(5)), CommonUtils.randomAlphaNumString(random.nextInt(5))); } MountPointInfo result = new MountPointInfo(); result.setUfsUri(ufsUri); result.setUfsType(ufsType); result.setUfsCapacityBytes(ufsCapacityBytes); result.setUfsUsedBytes(ufsUsedBytes); result.setReadOnly(readOnly); result.setProperties(properties); return result; } }
/** * @return the {@link MountPointInfo} for the mount point */ public MountPointInfo toMountPointInfo() { MountPointInfo info = new MountPointInfo(); info.setUfsUri(mUfsUri.toString()); info.setReadOnly(mOptions.getReadOnly()); info.setProperties(mOptions.getProperties()); info.setShared(mOptions.getShared()); return info; }
/** * Converts a proto type to a wire type. * * @param mountPointPInfo the proto type to convert * @return the converted wire type */ public static MountPointInfo fromProto(alluxio.grpc.MountPointInfo mountPointPInfo) { return new MountPointInfo().setUfsUri(mountPointPInfo.getUfsUri()) .setUfsType(mountPointPInfo.getUfsType()) .setUfsCapacityBytes(mountPointPInfo.getUfsCapacityBytes()) .setUfsUsedBytes(mountPointPInfo.getUfsUsedBytes()) .setReadOnly(mountPointPInfo.getReadOnly()) .setProperties(mountPointPInfo.getPropertiesMap()).setShared(mountPointPInfo.getShared()); }
/** * @return the {@link MountPointInfo} for the mount point */ public MountPointInfo toMountPointInfo() { MountPointInfo info = new MountPointInfo(); info.setUfsUri(mUfsUri.toString()); info.setReadOnly(mOptions.isReadOnly()); info.setProperties(mOptions.getProperties()); info.setShared(mOptions.isShared()); return info; }
/** * Creates a new instance of {@link MountPointInfo} from thrift representation. * * @param info the thrift representation of a mount point information * @return the instance */ public static MountPointInfo fromThrift(alluxio.thrift.MountPointInfo info) { return new MountPointInfo() .setUfsUri(info.getUfsUri()) .setUfsType(info.getUfsType()) .setUfsCapacityBytes(info.getUfsCapacityBytes()) .setUfsUsedBytes(info.getUfsUsedBytes()) .setReadOnly(info.isReadOnly()) .setProperties(info.getProperties()) .setShared(info.isShared()); }