Examples of asDirectory()


Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

        .isEmpty());
   
    assertTrue(hdfs.exists(newfoo));
    INode fooRefNode = fsdir.getINode4Write(newfoo.toString());
    assertTrue(fooRefNode instanceof INodeReference.DstReference);
    INodeDirectory fooNode = fooRefNode.asDirectory();
    // fooNode should be still INodeDirectory (With Snapshot) since we call
    // recordModification before the rename
    assertTrue(fooNode.isWithSnapshot());
    assertTrue(fooNode.getDiffs().asList().isEmpty());
    INodeDirectory barNode = fooNode.getChildrenList(Snapshot.CURRENT_STATE_ID)
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

   
    // check foo and its subtree
    final Path newbar = new Path(newfoo, bar.getName());
    INodeDirectory barNode = fsdir.getINode4Write(newbar.toString())
        .asDirectory();
    assertSame(fooNode.asDirectory(), barNode.getParent());
    // bar should only have a snapshot diff for s0
    List<DirectoryDiff> barDiffList = barNode.getDiffs().asList();
    assertEquals(1, barDiffList.size());
    DirectoryDiff diff = barDiffList.get(0);
    INodeDirectorySnapshottable testNode =
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

 
  static Snapshot read(DataInput in, FSImageFormat.Loader loader)
      throws IOException {
    final int snapshotId = in.readInt();
    final INode root = loader.loadINodeWithLocalName(false, in, false);
    return new Snapshot(snapshotId, root.asDirectory(), null);
  }

  /** The root directory of the snapshot. */
  static public class Root extends INodeDirectory {
    Root(INodeDirectory other) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

        switch (type) {
        case FILEDIFF:
          loadFileDiffList(in, inode.asFile(), entry.getNumOfDiff());
          break;
        case DIRECTORYDIFF:
          loadDirectoryDiffList(in, inode.asDirectory(), entry.getNumOfDiff(),
              refList);
          break;
        }
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

      } else if (topNode.isFile() && topNode.asFile().isWithSnapshot()) {
        INodeFile file = topNode.asFile();
        counts.add(file.getDiffs().deleteSnapshotDiff(post, prior, file,
            collectedBlocks, removedINodes, countDiffChange));
      } else if (topNode.isDirectory()) {
        INodeDirectory dir = topNode.asDirectory();
        ChildrenDiff priorChildrenDiff = null;
        DirectoryWithSnapshotFeature sf = dir.getDirectoryWithSnapshotFeature();
        if (sf != null) {
          // delete files/dirs created after prior. Note that these
          // files/dirs, along with inode, were deleted right after post.
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

        inode = ((WithCount) inode).getParentRef(snapshotId);
      } else {
        INode parent = inode.getParentReference() != null ? inode
            .getParentReference() : inode.getParent();
        if (parent != null && parent instanceof INodeDirectory) {
          int sid = parent.asDirectory().searchChild(inode);
          if (sid < snapshotId) {
            return null;
          }
        }
        if (!(parent instanceof WithCount)) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

    assertFalse(hdfs.exists(foo_s2));
   
    INode fooNode = fsdir.getINode4Write(foo_dir2.toString());
    assertTrue(childrenDiff.getList(ListType.CREATED).get(0) == fooNode);
    assertTrue(fooNode instanceof INodeReference.DstReference);
    List<DirectoryDiff> fooDiffs = ((INodeDirectoryWithSnapshot) fooNode
        .asDirectory()).getDiffs().asList();
    assertEquals(1, fooDiffs.size());
    assertEquals("s1", fooDiffs.get(0).snapshot.getRoot().getLocalName());
   
    // create snapshot on sdir2 and rename again
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

    final Path foo_s3 = SnapshotTestHelper.getSnapshotPath(sdir2, "s3", "foo2");
    assertFalse(hdfs.exists(foo_s2));
    assertTrue(hdfs.exists(foo_s3));
   
    assertTrue(fooNode instanceof INodeReference.DstReference);
    fooDiffs = ((INodeDirectoryWithSnapshot) fooNode.asDirectory()).getDiffs()
        .asList();
    assertEquals(2, fooDiffs.size());
    assertEquals("s1", fooDiffs.get(0).snapshot.getRoot().getLocalName());
    assertEquals("s3", fooDiffs.get(1).snapshot.getRoot().getLocalName());
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

    INode dir2Node = fsdir.getINode4Write(dir2.toString());
    assertTrue(dir2Node.getClass() == INodeDirectorySnapshottable.class);
    Quota.Counts counts = dir2Node.computeQuotaUsage();
    assertEquals(3, counts.get(Quota.NAMESPACE));
    assertEquals(0, counts.get(Quota.DISKSPACE));
    childrenList = ReadOnlyList.Util.asList(dir2Node.asDirectory()
        .getChildrenList(null));
    assertEquals(1, childrenList.size());
    INode subdir2Node = childrenList.get(0);
    assertSame(dir2Node, subdir2Node.getParent());
    assertSame(subdir2Node, fsdir.getINode4Write(subdir2.toString()));
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INode.asDirectory()

    INode dir2Node = fsdir.getINode4Write(dir2.toString());
    assertTrue(dir2Node.getClass() == INodeDirectorySnapshottable.class);
    Quota.Counts counts = dir2Node.computeQuotaUsage();
    assertEquals(4, counts.get(Quota.NAMESPACE));
    assertEquals(0, counts.get(Quota.DISKSPACE));
    childrenList = ReadOnlyList.Util.asList(dir2Node.asDirectory()
        .getChildrenList(null));
    assertEquals(1, childrenList.size());
    INode subdir2Node = childrenList.get(0);
    assertTrue(subdir2Node.getClass() == INodeDirectoryWithSnapshot.class);
    assertSame(dir2Node, subdir2Node.getParent());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.