Tabnine Logo
MountPointInfo
Code IndexAdd Tabnine to your IDE (free)

How to use
MountPointInfo
in
alluxio.wire

Best Java code snippets using alluxio.wire.MountPointInfo (Showing top 16 results out of 315)

origin: Alluxio/alluxio

/**
 * 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() + ")");
 }
}
origin: Alluxio/alluxio

/**
 * 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());
}
origin: Alluxio/alluxio

/**
 * @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;
}
origin: Alluxio/alluxio

/**
 * Gets the mount point information from a mount information.
 *
 * @param mountInfo the mount information to transform
 * @return the mount point information
 */
private MountPointInfo getMountPointInfo(MountInfo mountInfo) {
 MountPointInfo info = mountInfo.toMountPointInfo();
 try (CloseableResource<UnderFileSystem> ufsResource =
      mUfsManager.get(mountInfo.getMountId()).acquireUfsResource()) {
  UnderFileSystem ufs = ufsResource.get();
  info.setUfsType(ufs.getUnderFSType());
  try {
   info.setUfsCapacityBytes(
     ufs.getSpace(info.getUfsUri(), UnderFileSystem.SpaceType.SPACE_TOTAL));
  } catch (IOException e) {
   LOG.warn("Cannot get total capacity of {}", info.getUfsUri(), e);
  }
  try {
   info.setUfsUsedBytes(
     ufs.getSpace(info.getUfsUri(), UnderFileSystem.SpaceType.SPACE_USED));
  } catch (IOException e) {
   LOG.warn("Cannot get used capacity of {}", info.getUfsUri(), e);
  }
 } catch (UnavailableException | NotFoundException e) {
  // We should never reach here
  LOG.error("No UFS cached for {}", info, e);
 }
 return info;
}
origin: Alluxio/alluxio

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);
}
origin: Alluxio/alluxio

 /**
  * Gets the align format according to the longest mount point/under storage path.
  * @param mountTable the mount table to get information from
  * @return the align format for printing mounted info
  */
 private static String getAlignFormat(Map<String, MountPointInfo> mountTable) {
  int mountPointLength = mountTable.entrySet().stream().map(w -> w.getKey().length())
    .max(Comparator.comparing(Integer::intValue)).get();
  int usfLength = mountTable.entrySet().stream().map(w -> w.getValue().getUfsUri().length())
    .max(Comparator.comparing(Integer::intValue)).get();

  String leftAlignFormat = "%-" + usfLength + "s  on  %-" + mountPointLength
    + "s  (%s, capacity=%s, used=%s, %sread-only, %sshared, ";
  return leftAlignFormat;
 }
}
origin: Alluxio/alluxio

 @Override
 public void check(Clients clients) throws Exception {
  FileSystemMasterClient masterClient = clients.getFileSystemMasterClient();
  assertFalse(masterClient.getMountTable().get("/").getReadOnly());
 }
}
origin: org.alluxio/alluxio-core-server-master

/**
 * @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;
}
origin: org.alluxio/alluxio-core-server-master

 mUfsManager.get(mountInfo.getMountId()).acquireUfsResource()) {
UnderFileSystem ufs = ufsResource.get();
info.setUfsType(ufs.getUnderFSType());
try {
 info.setUfsCapacityBytes(
   ufs.getSpace(info.getUfsUri(), UnderFileSystem.SpaceType.SPACE_TOTAL));
} catch (IOException e) {
 info.setUfsUsedBytes(
   ufs.getSpace(info.getUfsUri(), UnderFileSystem.SpaceType.SPACE_USED));
} catch (IOException e) {
origin: Alluxio/alluxio

mountInfo = mFileSystemMaster.getMountPointInfo(new AlluxioURI(MountTable.ROOT));
long capacityBytes = mountInfo.getUfsCapacityBytes();
long usedBytes = mountInfo.getUfsUsedBytes();
long freeBytes = -1;
if (capacityBytes >= 0 && usedBytes >= 0 && capacityBytes >= usedBytes) {
origin: Alluxio/alluxio

/**
 * 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();
}
origin: Alluxio/alluxio

 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;
 }
}
origin: org.alluxio/alluxio-core-server-master

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);
}
origin: Alluxio/alluxio

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);
}
origin: org.alluxio/alluxio-core-common

/**
 * 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());
}
origin: org.alluxio/alluxio-core-server-master

long capacityBytes = mountInfo.getUfsCapacityBytes();
long usedBytes = mountInfo.getUfsUsedBytes();
long freeBytes = -1;
if (capacityBytes >= 0 && usedBytes >= 0 && capacityBytes >= usedBytes) {
alluxio.wireMountPointInfo

Javadoc

The mount point information.

Most used methods

  • getReadOnly
  • getUfsCapacityBytes
  • getUfsUri
  • <init>
    Creates a new instance of MountPointInfo.
  • getProperties
  • getUfsType
  • getUfsUsedBytes
  • setProperties
  • setReadOnly
  • setUfsCapacityBytes
  • setUfsType
  • setUfsUri
  • setUfsType,
  • setUfsUri,
  • setUfsUsedBytes,
  • getShared,
  • setShared,
  • toThrift

Popular in Java

  • Making http requests using okhttp
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Runner (org.openjdk.jmh.runner)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now