Java Code Examples for org.apache.hadoop.hdfs.server.namenode.INodeWithAdditionalFields#isFile()

The following examples show how to use org.apache.hadoop.hdfs.server.namenode.INodeWithAdditionalFields#isFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FSImageFormatPBSnapshot.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * save all the snapshot diff to fsimage
 */
public void serializeSnapshotDiffSection(OutputStream out)
    throws IOException {
  INodeMap inodesMap = fsn.getFSDirectory().getINodeMap();
  final List<INodeReference> refList = parent.getSaverContext()
      .getRefList();
  int i = 0;
  Iterator<INodeWithAdditionalFields> iter = inodesMap.getMapIterator();
  while (iter.hasNext()) {
    INodeWithAdditionalFields inode = iter.next();
    if (inode.isFile()) {
      serializeFileDiffList(inode.asFile(), out);
    } else if (inode.isDirectory()) {
      serializeDirDiffList(inode.asDirectory(), refList, out);
    }
    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(headers,
      FSImageFormatProtobuf.SectionName.SNAPSHOT_DIFF);
}
 
Example 2
Source File: FSImageFormatPBSnapshot.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * save all the snapshot diff to fsimage
 */
public void serializeSnapshotDiffSection(OutputStream out)
    throws IOException {
  INodeMap inodesMap = fsn.getFSDirectory().getINodeMap();
  final List<INodeReference> refList = parent.getSaverContext()
      .getRefList();
  int i = 0;
  Iterator<INodeWithAdditionalFields> iter = inodesMap.getMapIterator();
  while (iter.hasNext()) {
    INodeWithAdditionalFields inode = iter.next();
    if (inode.isFile()) {
      serializeFileDiffList(inode.asFile(), out);
    } else if (inode.isDirectory()) {
      serializeDirDiffList(inode.asDirectory(), refList, out);
    }
    ++i;
    if (i % FSImageFormatProtobuf.Saver.CHECK_CANCEL_INTERVAL == 0) {
      context.checkCancelled();
    }
  }
  parent.commitSection(headers,
      FSImageFormatProtobuf.SectionName.SNAPSHOT_DIFF);
}
 
Example 3
Source File: GSetSeperatorWrapper.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
@Override
public INodeWithAdditionalFields put(INodeWithAdditionalFields element) {
  if (element.isFile()) {
    return fileSet.put(element, element);
  }
  return dirSet.put(element, element);
}
 
Example 4
Source File: GSetSeperatorWrapper.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
@Override
public INodeWithAdditionalFields put(INodeWithAdditionalFields element) {
  if (element.isFile()) {
    return fileSet.put(element, element);
  }
  return dirSet.put(element, element);
}
 
Example 5
Source File: GSetSeperatorWrapper.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
@Override
public INodeWithAdditionalFields put(INodeWithAdditionalFields element) {
  if (element.isFile()) {
    return fileSet.put(element, element);
  }
  return dirSet.put(element, element);
}
 
Example 6
Source File: GSetSeperatorWrapper.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
@Override
public INodeWithAdditionalFields put(INodeWithAdditionalFields element) {
  if (element.isFile()) {
    return fileSet.put(element, element);
  }
  return dirSet.put(element, element);
}
 
Example 7
Source File: GSetSeperatorWrapper.java    From NNAnalytics with Apache License 2.0 5 votes vote down vote up
@Override
public INodeWithAdditionalFields put(INodeWithAdditionalFields element) {
  if (element.isFile()) {
    return fileSet.put(element, element);
  }
  return dirSet.put(element, element);
}