当前位置: 首页>>代码示例>>Java>>正文


Java FSImageSerialization类代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.FSImageSerialization的典型用法代码示例。如果您正苦于以下问题:Java FSImageSerialization类的具体用法?Java FSImageSerialization怎么用?Java FSImageSerialization使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FSImageSerialization类属于org.apache.hadoop.hdfs.server.namenode包,在下文中一共展示了FSImageSerialization类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeINodeReferenceWithCount

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
public void writeINodeReferenceWithCount(
    INodeReference.WithCount withCount, DataOutput out,
    boolean writeUnderConstruction) throws IOException {
  final INode referred = withCount.getReferredINode();
  final long id = withCount.getId();
  final boolean firstReferred = !referenceMap.containsKey(id);
  out.writeBoolean(firstReferred);

  if (firstReferred) {
    FSImageSerialization.saveINode2Image(referred, out,
        writeUnderConstruction, this);
    referenceMap.put(id, withCount);
  } else {
    out.writeLong(id);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:SnapshotFSImageFormat.java

示例2: write

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
@Override
void write(DataOutput out, ReferenceMap referenceMap) throws IOException {
  writeSnapshot(out);
  out.writeInt(childrenSize);

  // Write snapshotINode
  out.writeBoolean(isSnapshotRoot);
  if (!isSnapshotRoot) {
    if (snapshotINode != null) {
      out.writeBoolean(true);
      FSImageSerialization.writeINodeDirectoryAttributes(snapshotINode, out);
    } else {
      out.writeBoolean(false);
    }
  }
  // Write diff. Node need to write poseriorDiff, since diffs is a list.
  diff.write(out, referenceMap);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:DirectoryWithSnapshotFeature.java

示例3: write

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
@Override
void write(DataOutput out, ReferenceMap referenceMap) throws IOException {
  writeSnapshot(out);
  out.writeInt(childrenSize);

  // write snapshotINode
  if (isSnapshotRoot()) {
    out.writeBoolean(true);
  } else {
    out.writeBoolean(false);
    if (snapshotINode != null) {
      out.writeBoolean(true);
      FSImageSerialization.writeINodeDirectoryAttributes(snapshotINode, out);
    } else {
      out.writeBoolean(false);
    }
  }
  // Write diff. Node need to write poseriorDiff, since diffs is a list.
  diff.write(out, referenceMap);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:21,代码来源:INodeDirectoryWithSnapshot.java

示例4: loadCreatedList

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
/**
 * Load the created list from fsimage.
 * @param parent The directory that the created list belongs to.
 * @param in The {@link DataInput} to read.
 * @return The created list.
 */
private static List<INode> loadCreatedList(INodeDirectory parent,
    DataInput in) throws IOException {
  // read the size of the created list
  int createdSize = in.readInt();
  List<INode> createdList = new ArrayList<INode>(createdSize);
  for (int i = 0; i < createdSize; i++) {
    byte[] createdNodeName = FSImageSerialization.readLocalName(in);
    INode created = loadCreated(createdNodeName, parent);
    createdList.add(created);
  }
  return createdList;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:SnapshotFSImageFormat.java

示例5: write

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
@Override
void write(DataOutput out, ReferenceMap referenceMap) throws IOException {
  writeSnapshot(out);
  out.writeLong(fileSize);

  // write snapshotINode
  if (snapshotINode != null) {
    out.writeBoolean(true);
    FSImageSerialization.writeINodeFileAttributes(snapshotINode, out);
  } else {
    out.writeBoolean(false);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:FileDiff.java

示例6: writeDeleted

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
/** Serialize {@link #deleted} */
private void writeDeleted(DataOutput out,
    ReferenceMap referenceMap) throws IOException {
  final List<INode> deleted = getList(ListType.DELETED);
  out.writeInt(deleted.size());
  for (INode node : deleted) {
    FSImageSerialization.saveINode2Image(node, out, true, referenceMap);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:DirectoryWithSnapshotFeature.java

示例7: readINodePath

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
private String readINodePath(DataInputStream in, String parentName)
    throws IOException {
  String pathName = FSImageSerialization.readString(in);
  if (parentName != null) {  // local name
    pathName = "/" + pathName;
    if (!"/".equals(parentName)) { // children of non-root directory
      pathName = parentName + pathName;
    }
  }
  return pathName;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:ImageLoaderCurrent.java

示例8: processDirectory

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
private int processDirectory(DataInputStream in, ImageVisitor v,
   boolean skipBlocks) throws IOException {
  String parentName = FSImageSerialization.readString(in);
  int numChildren = in.readInt();
  for (int i=0; i<numChildren; i++) {
    processINode(in, v, skipBlocks, parentName);
  }
  return numChildren;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:10,代码来源:ImageLoaderCurrent.java

示例9: loadCreatedList

import org.apache.hadoop.hdfs.server.namenode.FSImageSerialization; //导入依赖的package包/类
/**
 * Load the created list from fsimage.
 * @param parent The directory that the created list belongs to.
 * @param in The {@link DataInput} to read.
 * @return The created list.
 */
private static List<INode> loadCreatedList(INodeDirectoryWithSnapshot parent,
    DataInput in) throws IOException {
  // read the size of the created list
  int createdSize = in.readInt();
  List<INode> createdList = new ArrayList<INode>(createdSize);
  for (int i = 0; i < createdSize; i++) {
    byte[] createdNodeName = FSImageSerialization.readLocalName(in);
    INode created = loadCreated(createdNodeName, parent);
    createdList.add(created);
  }
  return createdList;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:SnapshotFSImageFormat.java


注:本文中的org.apache.hadoop.hdfs.server.namenode.FSImageSerialization类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。