Package tachyon

Examples of tachyon.TachyonURI


  /**
   * Creates a new TachyonFS and registers it with {@link #mCloser}
   */
  private TachyonFS createFS(final TachyonURI path) throws IOException {
    String qualifiedPath = Utils.validatePath(path.toString());
    return mCloser.register(TachyonFS.get(new TachyonURI(qualifiedPath)));
  }
View Full Code Here


    System.clearProperty("tachyon.user.quota.unit.bytes");
  }

  @Test
  public void recursivePinness() throws Exception {
    int dir0Id = mTfs.getFileId(new TachyonURI("/"));
    TachyonURI folder = new TachyonURI("/myFolder");
    TachyonURI file = new TachyonURI("/myFolder/myFile");

    mTfs.mkdir(folder);
    int dir1Id = mTfs.getFileId(folder);

    int fileId = mTfs.createFile(file);
View Full Code Here

  @Test
  public void newFilesInheritPinness() throws Exception {
    // Children should inherit the isPinned value of their parents on creation.

    // Pin root
    int rootId = mTfs.getFileId(new TachyonURI("/"));
    mTfs.pinFile(rootId);

    // Child file should be pinned
    int file0Id = mTfs.createFile(new TachyonURI("/file0"));
    assertTrue(mMasterInfo.getClientFileInfo(file0Id).isPinned);
    assertEquals(Sets.newHashSet(mMasterInfo.getPinIdList()), Sets.newHashSet(file0Id));

    // Child folder should be pinned
    mTfs.mkdir(new TachyonURI("/folder"));
    int folderId = mTfs.getFileId(new TachyonURI("/folder"));
    assertTrue(mMasterInfo.getClientFileInfo(folderId).isPinned);

    // Granchild file also pinned
    int file1Id = mTfs.createFile(new TachyonURI("/folder/file1"));
    assertTrue(mMasterInfo.getClientFileInfo(file1Id).isPinned);
    assertEquals(Sets.newHashSet(mMasterInfo.getPinIdList()), Sets.newHashSet(file0Id, file1Id));

    // Unpinning child folder should cause its children to be unpinned as well
    mTfs.unpinFile(folderId);
    assertFalse(mMasterInfo.getClientFileInfo(folderId).isPinned);
    assertFalse(mMasterInfo.getClientFileInfo(file1Id).isPinned);
    assertEquals(Sets.newHashSet(mMasterInfo.getPinIdList()), Sets.newHashSet(file0Id));

    // And new grandchildren should be unpinned too.
    int file2Id = mTfs.createFile(new TachyonURI("/folder/file2"));
    assertFalse(mMasterInfo.getClientFileInfo(file2Id).isPinned);
    assertEquals(Sets.newHashSet(mMasterInfo.getPinIdList()), Sets.newHashSet(file0Id));

    // But toplevel children still should be pinned!
    int file3Id = mTfs.createFile(new TachyonURI("/file3"));
    assertTrue(mMasterInfo.getClientFileInfo(file3Id).isPinned);
    assertEquals(Sets.newHashSet(mMasterInfo.getPinIdList()), Sets.newHashSet(file0Id, file3Id));
  }
View Full Code Here

   * @throws IOException
   * @see #get(tachyon.TachyonURI)
   */
  @Deprecated
  public static synchronized TachyonFS get(String tachyonPath) throws IOException {
    return get(new TachyonURI(tachyonPath));
  }
View Full Code Here

   * @return The unique file id. It returns -1 if the creation failed.
   * @throws IOException If file already exists, or path is invalid.
   */
  @Deprecated
  public synchronized int createFile(String path) throws IOException {
    return createFile(new TachyonURI(path));
  }
View Full Code Here

   *         first place), false otherwise.
   * @throws IOException
   */
  @Deprecated
  public synchronized boolean delete(String path, boolean recursive) throws IOException {
    return delete(new TachyonURI(path), recursive);
  }
View Full Code Here

   * @return TachyonFile of the path, or null if the file does not exist.
   * @throws IOException
   */
  @Deprecated
  public synchronized TachyonFile getFile(String path) throws IOException {
    return getFile(new TachyonURI(path));
  }
View Full Code Here

   * to the file's pin setting, or other dynamic properties.
   */
  @Deprecated
  public synchronized TachyonFile getFile(String path, boolean useCachedMetadata)
      throws IOException {
    return getFile(new TachyonURI(path), useCachedMetadata);
  }
View Full Code Here

      if (info == null) {
        mIdToClientFileInfo.remove(fileId);
        return null;
      }

      path = new TachyonURI(info.getPath());
    } else {
      info = mPathToClientFileInfo.get(path.getPath());
      if (!useCachedMetadata || info == null) {
        info = getFileStatus(-1, path);
        updated = true;
View Full Code Here

   */
  @Override
  public synchronized TachyonURI getUri() {
    String scheme = CommonConf.get().USE_ZOOKEEPER ? Constants.SCHEME_FT : Constants.SCHEME;
    String authority = mMasterAddress.getHostName() + ":" + mMasterAddress.getPort();
    return new TachyonURI(scheme, authority, TachyonURI.SEPARATOR);
  }
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.