Tabnine Logo
StorageLocation.getUri
Code IndexAdd Tabnine to your IDE (free)

How to use
getUri
method
in
org.apache.hadoop.hdfs.server.datanode.StorageLocation

Best Java code snippets using org.apache.hadoop.hdfs.server.datanode.StorageLocation.getUri (Showing top 8 results out of 315)

origin: org.apache.hadoop/hadoop-hdfs

public URI getBpURI(String bpid, String currentStorageDir) {
 try {
  File localFile = new File(getUri());
  return new File(new File(localFile, currentStorageDir), bpid).toURI();
 } catch (IllegalArgumentException e) {
  return null;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

private StorageDirectory(File dir, StorageDirType dirType,
  boolean isShared, StorageLocation location) {
 this.root = dir;
 this.lock = null;
 // default dirType is UNDEFINED
 this.dirType = (dirType == null ? NameNodeDirType.UNDEFINED : dirType);
 this.isShared = isShared;
 this.location = location;
 assert location == null || dir == null ||
   dir.getAbsolutePath().startsWith(
     new File(location.getUri()).getAbsolutePath()):
    "The storage location and directory should be equal";
}
origin: org.apache.hadoop/hadoop-hdfs

private static File getStorageLocationFile(StorageLocation location) {
 if (location == null ||
   location.getStorageType() == StorageType.PROVIDED) {
  return null;
 }
 try {
  return new File(location.getUri());
 } catch (IllegalArgumentException e) {
  //if location does not refer to a File
  return null;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

@Override
public void updateWithReplica(StorageLocation replicaLocation) {
 // for local replicas, the replica location is assumed to be a file.
 File diskFile = null;
 try {
  diskFile = new File(replicaLocation.getUri());
 } catch (IllegalArgumentException e) {
  diskFile = null;
 }
 if (null == diskFile) {
  setDirInternal(null);
 } else {
  setDirInternal(diskFile.getParentFile());
 }
}
origin: org.apache.hadoop/hadoop-hdfs

ProvidedVolumeImpl(FsDatasetImpl dataset, String storageID,
  StorageDirectory sd, FileIoProvider fileIoProvider,
  Configuration conf) throws IOException {
 super(dataset, storageID, sd, fileIoProvider, conf, null);
 assert getStorageLocation().getStorageType() == StorageType.PROVIDED:
  "Only provided storages must use ProvidedVolume";
 baseURI = getStorageLocation().getUri();
 df = new ProvidedVolumeDF();
 remoteFS = FileSystem.get(baseURI, conf);
}
origin: ch.cern.hadoop/hadoop-hdfs

static List<StorageLocation> checkStorageLocations(
  Collection<StorageLocation> dataDirs,
  LocalFileSystem localFS, DataNodeDiskChecker dataNodeDiskChecker)
    throws IOException {
 ArrayList<StorageLocation> locations = new ArrayList<StorageLocation>();
 StringBuilder invalidDirs = new StringBuilder();
 for (StorageLocation location : dataDirs) {
  final URI uri = location.getUri();
  try {
   dataNodeDiskChecker.checkDir(localFS, new Path(uri));
   locations.add(location);
  } catch (IOException ioe) {
   LOG.warn("Invalid " + DFS_DATANODE_DATA_DIR_KEY + " "
     + location.getFile() + " : ", ioe);
   invalidDirs.append("\"").append(uri.getPath()).append("\" ");
  }
 }
 if (locations.size() == 0) {
  throw new IOException("All directories in "
    + DFS_DATANODE_DATA_DIR_KEY + " are invalid: "
    + invalidDirs);
 }
 return locations;
}
origin: io.prestosql.hadoop/hadoop-apache

static List<StorageLocation> checkStorageLocations(
  Collection<StorageLocation> dataDirs,
  LocalFileSystem localFS, DataNodeDiskChecker dataNodeDiskChecker)
    throws IOException {
 ArrayList<StorageLocation> locations = new ArrayList<StorageLocation>();
 StringBuilder invalidDirs = new StringBuilder();
 for (StorageLocation location : dataDirs) {
  final URI uri = location.getUri();
  try {
   dataNodeDiskChecker.checkDir(localFS, new Path(uri));
   locations.add(location);
  } catch (IOException ioe) {
   LOG.warn("Invalid " + DFS_DATANODE_DATA_DIR_KEY + " "
     + location.getFile() + " : ", ioe);
   invalidDirs.append("\"").append(uri.getPath()).append("\" ");
  }
 }
 if (locations.size() == 0) {
  throw new IOException("All directories in "
    + DFS_DATANODE_DATA_DIR_KEY + " are invalid: "
    + invalidDirs);
 }
 return locations;
}
origin: ch.cern.hadoop/hadoop-hdfs

assertThat(locations.size(), is(5));
assertThat(locations.get(0).getStorageType(), is(StorageType.DISK));
assertThat(locations.get(0).getUri(), is(dir0.toURI()));
assertThat(locations.get(1).getStorageType(), is(StorageType.DISK));
assertThat(locations.get(1).getUri(), is(dir1.toURI()));
assertThat(locations.get(2).getStorageType(), is(StorageType.SSD));
assertThat(locations.get(2).getUri(), is(dir2.toURI()));
assertThat(locations.get(3).getStorageType(), is(StorageType.DISK));
assertThat(locations.get(3).getUri(), is(dir3.toURI()));
assertThat(locations.get(4).getStorageType(), is(StorageType.RAM_DISK));
assertThat(locations.get(4).getUri(), is(dir4.toURI()));
assertThat(locations.size(), is(2));
assertThat(locations.get(0).getStorageType(), is(StorageType.DISK));
assertThat(locations.get(0).getUri(), is(dir0.toURI()));
assertThat(locations.get(1).getStorageType(), is(StorageType.DISK));
assertThat(locations.get(1).getUri(), is(dir1.toURI()));
org.apache.hadoop.hdfs.server.datanodeStorageLocationgetUri

Popular methods of StorageLocation

  • getFile
  • getStorageType
  • parse
    Attempt to parse a storage uri with storage class and URI. The storage class component of the uri is
  • toString
  • <init>
  • compareTo
  • equals
  • getBpURI
  • getNormalizedUri
  • makeBlockPoolDir
    Create physical directory for block pools on the data node.
  • matchesStorageDirectory
  • normalizeFileURI
  • matchesStorageDirectory,
  • normalizeFileURI

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Option (scala)
  • Top 12 Jupyter Notebook extensions
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