Package tachyon

Examples of tachyon.TachyonURI


  }

  @Test
  public void deleteRootTest() throws InvalidPathException, FileAlreadyExistException,
      TachyonException, BlockInfoException {
    Assert.assertFalse(mMasterInfo.delete(new TachyonURI("/"), true));
    Assert.assertFalse(mMasterInfo.delete(new TachyonURI("/"), false));
  }
View Full Code Here


  @Test
  public void lastModificationTimeAddCheckpointTest() throws FileDoesNotExistException,
      SuspectedFileSizeException, FileAlreadyExistException, InvalidPathException,
      BlockInfoException, FileNotFoundException, TachyonException {
    int fileId =
        mMasterInfo.createFile(new TachyonURI("/testFile"), Constants.DEFAULT_BLOCK_SIZE_BYTE);
    long opTimeMs = System.currentTimeMillis();
    mMasterInfo._addCheckpoint(-1, fileId, 1, new TachyonURI("/testPath"), opTimeMs);
    ClientFileInfo fileInfo = mMasterInfo.getClientFileInfo(new TachyonURI("/testFile"));
    Assert.assertEquals(opTimeMs, fileInfo.lastModificationTimeMs);
  }
View Full Code Here

  @Test
  public void lastModificationTimeCompleteFileTest() throws FileDoesNotExistException,
      SuspectedFileSizeException, FileAlreadyExistException, InvalidPathException,
      BlockInfoException, FileNotFoundException, TachyonException {
    int fileId =
        mMasterInfo.createFile(new TachyonURI("/testFile"), Constants.DEFAULT_BLOCK_SIZE_BYTE);
    long opTimeMs = System.currentTimeMillis();
    mMasterInfo._completeFile(fileId, opTimeMs);
    ClientFileInfo fileInfo = mMasterInfo.getClientFileInfo(new TachyonURI("/testFile"));
    Assert.assertEquals(opTimeMs, fileInfo.lastModificationTimeMs);
  }
View Full Code Here

  }

  @Test
  public void lastModificationTimeCreateFileTest() throws InvalidPathException,
      FileAlreadyExistException, FileDoesNotExistException, TachyonException, BlockInfoException {
    Assert.assertTrue(mMasterInfo.mkdirs(new TachyonURI("/testFolder"), true));
    long opTimeMs = System.currentTimeMillis();
    mMasterInfo._createFile(false, new TachyonURI("/testFolder/testFile"), false,
        Constants.DEFAULT_BLOCK_SIZE_BYTE, opTimeMs);
    ClientFileInfo folderInfo = mMasterInfo.getClientFileInfo(new TachyonURI("/testFolder"));
    Assert.assertEquals(opTimeMs, folderInfo.lastModificationTimeMs);
  }
View Full Code Here

  }

  @Test
  public void lastModificationTimeDeleteTest() throws InvalidPathException,
      FileAlreadyExistException, FileDoesNotExistException, TachyonException, BlockInfoException {
    Assert.assertTrue(mMasterInfo.mkdirs(new TachyonURI("/testFolder"), true));
    int fileId =
        mMasterInfo.createFile(new TachyonURI("/testFolder/testFile"),
            Constants.DEFAULT_BLOCK_SIZE_BYTE);
    Assert.assertEquals(2, mMasterInfo.getFileId(new TachyonURI("/testFolder")));
    Assert.assertEquals(fileId, mMasterInfo.getFileId(new TachyonURI("/testFolder/testFile")));
    long opTimeMs = System.currentTimeMillis();
    Assert.assertTrue(mMasterInfo._delete(fileId, true, opTimeMs));
    ClientFileInfo folderInfo = mMasterInfo.getClientFileInfo(new TachyonURI("/testFolder"));
    Assert.assertEquals(opTimeMs, folderInfo.lastModificationTimeMs);
  }
View Full Code Here

  }

  @Test
  public void lastModificationTimeRenameTest() throws InvalidPathException,
      FileAlreadyExistException, FileDoesNotExistException, TachyonException, BlockInfoException {
    Assert.assertTrue(mMasterInfo.mkdirs(new TachyonURI("/testFolder"), true));
    int fileId =
        mMasterInfo.createFile(new TachyonURI("/testFolder/testFile1"),
            Constants.DEFAULT_BLOCK_SIZE_BYTE);
    long opTimeMs = System.currentTimeMillis();
    Assert.assertTrue(mMasterInfo
        ._rename(fileId, new TachyonURI("/testFolder/testFile2"), opTimeMs));
    ClientFileInfo folderInfo = mMasterInfo.getClientFileInfo(new TachyonURI("/testFolder"));
    Assert.assertEquals(opTimeMs, folderInfo.lastModificationTimeMs);
  }
View Full Code Here

  public void listFilesTest() throws InvalidPathException, FileDoesNotExistException,
      FileAlreadyExistException, BlockInfoException, TachyonException {
    HashSet<Integer> ids = new HashSet<Integer>();
    HashSet<Integer> dirIds = new HashSet<Integer>();
    for (int i = 0; i < 10; i ++) {
      TachyonURI dir = new TachyonURI("/i" + i);
      mMasterInfo.mkdirs(dir, true);
      dirIds.add(mMasterInfo.getFileId(dir));
      for (int j = 0; j < 10; j ++) {
        ids.add(mMasterInfo.createFile(dir.join("j" + j), 64));
      }
    }
    HashSet<Integer> listedIds =
        new HashSet<Integer>(mMasterInfo.listFiles(new TachyonURI("/"), true));
    HashSet<Integer> listedDirIds =
        new HashSet<Integer>(mMasterInfo.listFiles(new TachyonURI("/"), false));
    Assert.assertEquals(ids, listedIds);
    Assert.assertEquals(dirIds, listedDirIds);
  }
View Full Code Here

  @Override
  public FSDataOutputStream append(Path cPath, int bufferSize, Progressable progress)
      throws IOException {
    LOG.info("append(" + cPath + ", " + bufferSize + ", " + progress + ")");
    TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath));
    fromHdfsToTachyon(path);
    int fileId = mTFS.getFileId(path);
    TachyonFile file = mTFS.getFile(fileId);

    if (file.length() > 0) {
View Full Code Here

      int bufferSize, short replication, long blockSize, Progressable progress) throws IOException {
    LOG.info("create(" + cPath + ", " + permission + ", " + overwrite + ", " + bufferSize + ", "
        + replication + ", " + blockSize + ", " + progress + ")");

    if (!CommonConf.get().ASYNC_ENABLED) {
      TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath));
      if (mTFS.exist(path)) {
        if (!mTFS.delete(path, false)) {
          throw new IOException("Failed to delete existing data " + cPath);
        }
      }
      int fileId = mTFS.createFile(path, blockSize);
      TachyonFile file = mTFS.getFile(fileId);
      file.setUFSConf(getConf());
      return new FSDataOutputStream(file.getOutStream(UserConf.get().DEFAULT_WRITE_TYPE), null);
    }

    if (cPath.toString().contains(FIRST_COM_PATH) && !cPath.toString().contains("SUCCESS")) {
      TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath));
      mTFS.createFile(path, blockSize);
      String depPath = path.getPath();
      depPath = depPath.substring(depPath.indexOf(FIRST_COM_PATH) + FIRST_COM_PATH.length());
      depPath = depPath.substring(0, depPath.indexOf(TachyonURI.SEPARATOR));
      int depId = Integer.parseInt(depPath);
      LOG.info("create(" + cPath + ") : " + depPath + " " + depId);
      depPath = path.getPath();
      depPath = depPath.substring(depPath.indexOf("part-") + 5);
      int index = Integer.parseInt(depPath);
      ClientDependencyInfo info = mTFS.getClientDependencyInfo(depId);
      int fileId = info.getChildren().get(index);
      LOG.info("create(" + cPath + ") : " + depPath + " " + index + " " + info + " " + fileId);

      TachyonFile file = mTFS.getFile(fileId);
      file.setUFSConf(getConf());
      // if (file.getBlockSizeByte() != blockSize) {
      // throw new IOException("File already exist with a different blocksize "
      // file.getBlockSizeByte() + " != " + blockSize);
      // }
      return new FSDataOutputStream(file.getOutStream(WriteType.ASYNC_THROUGH), null);
    }

    if (cPath.toString().contains(RECOMPUTE_PATH) && !cPath.toString().contains("SUCCESS")) {
      TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath));
      mTFS.createFile(path, blockSize);
      String depPath = path.getPath();
      depPath = depPath.substring(depPath.indexOf(RECOMPUTE_PATH) + RECOMPUTE_PATH.length());
      depPath = depPath.substring(0, depPath.indexOf(TachyonURI.SEPARATOR));
      int depId = Integer.parseInt(depPath);
      LOG.info("create(" + cPath + ") : " + depPath + " " + depId);
      depPath = path.getPath();
      depPath = depPath.substring(depPath.indexOf("part-") + 5);
      int index = Integer.parseInt(depPath);
      ClientDependencyInfo info = mTFS.getClientDependencyInfo(depId);
      int fileId = info.getChildren().get(index);
      LOG.info("create(" + cPath + ") : " + depPath + " " + index + " " + info + " " + fileId);

      TachyonFile file = mTFS.getFile(fileId);
      file.setUFSConf(getConf());
      // if (file.getBlockSizeByte() != blockSize) {
      // throw new IOException("File already exist with a different blocksize "
      // file.getBlockSizeByte() + " != " + blockSize);
      // }
      return new FSDataOutputStream(file.getOutStream(WriteType.ASYNC_THROUGH), null);
    } else {
      TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath));
      int fileId;
      WriteType type = UserConf.get().DEFAULT_WRITE_TYPE;
      if (mTFS.exist(path)) {
        fileId = mTFS.getFileId(path);
        type = WriteType.MUST_CACHE;
View Full Code Here

  @Override
  @Deprecated
  public FSDataOutputStream createNonRecursive(Path cPath, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress)
      throws IOException {
    TachyonURI path = new TachyonURI(Utils.getPathWithoutScheme(cPath.getParent()));
    fromHdfsToTachyon(path);
    if (!mTFS.exist(path)) {
      throw new FileNotFoundException("Parent directory does not exist!");
    }
    return this.create(cPath, permission, overwrite, bufferSize, replication, blockSize, progress);
View Full Code Here

TOP

Related Classes of tachyon.TachyonURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.