Package tachyon.client

Examples of tachyon.client.TachyonFS


    return getHadoopVersion().startsWith("2");
  }

  private void mockTachyonFSGet() throws IOException {
    mockStatic(TachyonFS.class);
    TachyonFS tachyonFS = mock(TachyonFS.class);
    when(TachyonFS.get(anyString(), anyInt(), anyBoolean())).thenReturn(tachyonFS);
  }
View Full Code Here


    if (argv.length != 2) {
      System.out.println("Usage: tfs cat <path>");
      return -1;
    }
    TachyonURI path = new TachyonURI(argv[1]);
    TachyonFS tachyonClient = createFS(path);
    TachyonFile tFile = tachyonClient.getFile(path);

    if (tFile == null) {
      System.out.println(path + " does not exist.");
      return -1;
    }
View Full Code Here

    File src = new File(srcPath);
    if (!src.exists()) {
      System.out.println("Local path " + srcPath + " does not exist.");
      return -1;
    }
    TachyonFS tachyonClient = createFS(dstPath);
    int ret = copyPath(src, tachyonClient, dstPath);
    if (ret == 0) {
      System.out.println("Copied " + srcPath + " to " + dstPath);
    }
    return ret;
View Full Code Here

    }

    TachyonURI srcPath = new TachyonURI(argv[1]);
    String dstPath = argv[2];
    File dst = new File(dstPath);
    TachyonFS tachyonClient = createFS(srcPath);
    TachyonFile tFile = tachyonClient.getFile(srcPath);

    // tachyonClient.getFile() catches FileDoesNotExist exceptions and returns null
    if (tFile == null) {
      throw new IOException(srcPath.toString());
    }
View Full Code Here

   * @param answer the results, the mapping from file id to file path
   * @throws IOException
   */
  private void faultTestDataCreation(TachyonURI folderName, List<Pair<Integer, TachyonURI>> answer)
      throws IOException {
    TachyonFS tfs = mLocalTachyonClusterMultiMaster.getClient();
    if (!tfs.exist(folderName)) {
      tfs.mkdir(folderName);
      answer.add(new Pair<Integer, TachyonURI>(tfs.getFileId(folderName), folderName));
    }

    for (int k = 0; k < 10; k ++) {
      TachyonURI path =
          new TachyonURI(folderName + TachyonURI.SEPARATOR + folderName.toString().substring(1) + k);
      answer.add(new Pair<Integer, TachyonURI>(tfs.createFile(path), path));
    }
  }
View Full Code Here

   *
   * @param answer the correct results
   * @throws IOException
   */
  private void faultTestDataCheck(List<Pair<Integer, TachyonURI>> answer) throws IOException {
    TachyonFS tfs = mLocalTachyonClusterMultiMaster.getClient();
    List<String> files = TestUtils.listFiles(tfs, TachyonURI.SEPARATOR);
    Assert.assertEquals(answer.size(), files.size());
    for (int k = 0; k < answer.size(); k ++) {
      Assert.assertEquals(answer.get(k).getSecond().toString(),
          tfs.getFile(answer.get(k).getFirst()).getPath());
      Assert.assertEquals(answer.get(k).getFirst().intValue(),
          tfs.getFileId(answer.get(k).getSecond()));
    }
  }
View Full Code Here

  @Test
  public void getClientsTest() throws IOException {
    int clients = 10;
    mTfs.createFile(new TachyonURI("/0"), 1024);
    for (int k = 1; k < clients; k ++) {
      TachyonFS tfs = mLocalTachyonClusterMultiMaster.getClient();
      tfs.createFile(new TachyonURI(TachyonURI.SEPARATOR + k), 1024);
    }
    List<String> files = TestUtils.listFiles(mTfs, TachyonURI.SEPARATOR);
    Assert.assertEquals(clients, files.size());
    for (int k = 0; k < clients; k ++) {
      Assert.assertEquals(TachyonURI.SEPARATOR + k, files.get(k));
View Full Code Here

  /**
   * Returns a {@link tachyon.client.TachyonFS} client. This client does not need to be closed
   * directly, but can be closed by calling {@link #close()} on this object.
   */
  public TachyonFS getClient() throws IOException {
    final TachyonFS fs = TachyonFS.get(new TachyonURI(mUriSuppliers.get()));
    mClients.add(fs);
    return fs;
  }
View Full Code Here

    mLength = length;
  }

  @Override
  public Boolean call() throws Exception {
    TachyonFS client = TachyonFS.get(mMasterLocation);

    write(client, mFilePath, mWriteType, mDeleteIfExists, mLength);
    return read(client, mFilePath, mReadType);
  }
View Full Code Here

    mNumFiles = numFiles;
  }

  @Override
  public Boolean call() throws Exception {
    TachyonFS tachyonClient = TachyonFS.get(mLocation);
    createDependency(tachyonClient);
    writeFile(tachyonClient);
    return readFile(tachyonClient);
  }
View Full Code Here

TOP

Related Classes of tachyon.client.TachyonFS

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.