Java 类org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotFSImageFormat.ReferenceMap 实例源码

项目:hadoop    文件:DirectoryWithSnapshotFeature.java   
@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);
}
项目:aliyun-oss-hadoop-fs    文件:DirectoryWithSnapshotFeature.java   
@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);
}
项目:big-c    文件:DirectoryWithSnapshotFeature.java   
@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);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DirectoryWithSnapshotFeature.java   
@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);
}
项目:hadoop-plus    文件:INodeDirectoryWithSnapshot.java   
@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);
}
项目:FlexMap    文件:DirectoryWithSnapshotFeature.java   
@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);
}
项目:hadoop-TCP    文件:INodeDirectoryWithSnapshot.java   
@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);
}
项目:hardfs    文件:INodeDirectoryWithSnapshot.java   
@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);
}
项目:hadoop    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(((INodeReference.DstReference) ref).getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:hadoop    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}
项目:hadoop    文件:FileDiff.java   
@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);
  }
}
项目:hadoop    文件:DirectoryWithSnapshotFeature.java   
/** 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);
  }
}
项目:hadoop    文件:FSImageFormat.java   
/**
 * Saves inode and increments progress counter.
 *
 * @param inode INode to save
 * @param out DataOutputStream to receive inode
 * @param writeUnderConstruction boolean true if this is under construction
 * @param referenceMap ReferenceMap containing reference inodes
 * @param counter Counter to increment for namenode startup progress
 * @throws IOException thrown if there is an I/O error
 */
private void saveINode2Image(INode inode, DataOutputStream out,
    boolean writeUnderConstruction, ReferenceMap referenceMap,
    Counter counter) throws IOException {
  FSImageSerialization.saveINode2Image(inode, out, writeUnderConstruction,
    referenceMap);
  // Intentionally do not increment counter for reference inodes, because it
  // is too difficult at this point to assess whether or not this is a
  // reference that counts toward quota.
  if (!(inode instanceof INodeReference)) {
    counter.increment();
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(ref.getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:aliyun-oss-hadoop-fs    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}
项目:aliyun-oss-hadoop-fs    文件:FileDiff.java   
@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);
  }
}
项目:aliyun-oss-hadoop-fs    文件:DirectoryWithSnapshotFeature.java   
/** 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);
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormat.java   
/**
 * Saves inode and increments progress counter.
 *
 * @param inode INode to save
 * @param out DataOutputStream to receive inode
 * @param writeUnderConstruction boolean true if this is under construction
 * @param referenceMap ReferenceMap containing reference inodes
 * @param counter Counter to increment for namenode startup progress
 * @throws IOException thrown if there is an I/O error
 */
private void saveINode2Image(INode inode, DataOutputStream out,
    boolean writeUnderConstruction, ReferenceMap referenceMap,
    Counter counter) throws IOException {
  FSImageSerialization.saveINode2Image(inode, out, writeUnderConstruction,
    referenceMap);
  // Intentionally do not increment counter for reference inodes, because it
  // is too difficult at this point to assess whether or not this is a
  // reference that counts toward quota.
  if (!(inode instanceof INodeReference)) {
    counter.increment();
  }
}
项目:big-c    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(((INodeReference.DstReference) ref).getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:big-c    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}
项目:big-c    文件:FileDiff.java   
@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);
  }
}
项目:big-c    文件:DirectoryWithSnapshotFeature.java   
/** 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);
  }
}
项目:big-c    文件:FSImageFormat.java   
/**
 * Saves inode and increments progress counter.
 *
 * @param inode INode to save
 * @param out DataOutputStream to receive inode
 * @param writeUnderConstruction boolean true if this is under construction
 * @param referenceMap ReferenceMap containing reference inodes
 * @param counter Counter to increment for namenode startup progress
 * @throws IOException thrown if there is an I/O error
 */
private void saveINode2Image(INode inode, DataOutputStream out,
    boolean writeUnderConstruction, ReferenceMap referenceMap,
    Counter counter) throws IOException {
  FSImageSerialization.saveINode2Image(inode, out, writeUnderConstruction,
    referenceMap);
  // Intentionally do not increment counter for reference inodes, because it
  // is too difficult at this point to assess whether or not this is a
  // reference that counts toward quota.
  if (!(inode instanceof INodeReference)) {
    counter.increment();
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(((INodeReference.DstReference) ref).getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FileDiff.java   
@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);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:DirectoryWithSnapshotFeature.java   
/** 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);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormat.java   
/**
 * Saves inode and increments progress counter.
 *
 * @param inode INode to save
 * @param out DataOutputStream to receive inode
 * @param writeUnderConstruction boolean true if this is under construction
 * @param referenceMap ReferenceMap containing reference inodes
 * @param counter Counter to increment for namenode startup progress
 * @throws IOException thrown if there is an I/O error
 */
private void saveINode2Image(INode inode, DataOutputStream out,
    boolean writeUnderConstruction, ReferenceMap referenceMap,
    Counter counter) throws IOException {
  FSImageSerialization.saveINode2Image(inode, out, writeUnderConstruction,
    referenceMap);
  // Intentionally do not increment counter for reference inodes, because it
  // is too difficult at this point to assess whether or not this is a
  // reference that counts toward quota.
  if (!(inode instanceof INodeReference)) {
    counter.increment();
  }
}
项目:hadoop-plus    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(((INodeReference.DstReference) ref).getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:hadoop-plus    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);      
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}
项目:hadoop-plus    文件:INodeDirectoryWithSnapshot.java   
/** 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);
  }
}
项目:hadoop-plus    文件:FileWithSnapshot.java   
@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);
  }
}
项目:hadoop-plus    文件:FSImageFormat.java   
/**
 * Saves inode and increments progress counter.
 * 
 * @param inode INode to save
 * @param out DataOutputStream to receive inode
 * @param writeUnderConstruction boolean true if this is under construction
 * @param referenceMap ReferenceMap containing reference inodes
 * @param counter Counter to increment for namenode startup progress
 * @throws IOException thrown if there is an I/O error
 */
private void saveINode2Image(INode inode, DataOutputStream out,
    boolean writeUnderConstruction, ReferenceMap referenceMap,
    Counter counter) throws IOException {
  FSImageSerialization.saveINode2Image(inode, out, writeUnderConstruction,
    referenceMap);
  // Intentionally do not increment counter for reference inodes, because it
  // is too difficult at this point to assess whether or not this is a
  // reference that counts toward quota.
  if (!(inode instanceof INodeReference)) {
    counter.increment();
  }
}
项目:FlexMap    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(((INodeReference.DstReference) ref).getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:FlexMap    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}
项目:FlexMap    文件:FileDiff.java   
@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);
  }
}
项目:FlexMap    文件:DirectoryWithSnapshotFeature.java   
/** 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);
  }
}
项目:FlexMap    文件:FSImageFormat.java   
/**
 * Saves inode and increments progress counter.
 *
 * @param inode INode to save
 * @param out DataOutputStream to receive inode
 * @param writeUnderConstruction boolean true if this is under construction
 * @param referenceMap ReferenceMap containing reference inodes
 * @param counter Counter to increment for namenode startup progress
 * @throws IOException thrown if there is an I/O error
 */
private void saveINode2Image(INode inode, DataOutputStream out,
    boolean writeUnderConstruction, ReferenceMap referenceMap,
    Counter counter) throws IOException {
  FSImageSerialization.saveINode2Image(inode, out, writeUnderConstruction,
    referenceMap);
  // Intentionally do not increment counter for reference inodes, because it
  // is too difficult at this point to assess whether or not this is a
  // reference that counts toward quota.
  if (!(inode instanceof INodeReference)) {
    counter.increment();
  }
}
项目:hadoop-TCP    文件:FSImageSerialization.java   
/** Serialize a {@link INodeReference} node */
private static void writeINodeReference(INodeReference ref, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap
    ) throws IOException {
  writeLocalName(ref, out);
  out.writeLong(ref.getId());
  out.writeShort(0);  // replication
  out.writeLong(0);   // modification time
  out.writeLong(0);   // access time
  out.writeLong(0);   // preferred block size
  out.writeInt(-3);   // # of blocks

  final boolean isWithName = ref instanceof INodeReference.WithName;
  out.writeBoolean(isWithName);

  if (!isWithName) {
    Preconditions.checkState(ref instanceof INodeReference.DstReference);
    // dst snapshot id
    out.writeInt(((INodeReference.DstReference) ref).getDstSnapshotId());
  } else {
    out.writeInt(((INodeReference.WithName) ref).getLastSnapshotId());
  }

  final INodeReference.WithCount withCount
      = (INodeReference.WithCount)ref.getReferredINode();
  referenceMap.writeINodeReferenceWithCount(withCount, out,
      writeUnderConstruction);
}
项目:hadoop-TCP    文件:FSImageSerialization.java   
/**
 * Save one inode's attributes to the image.
 */
public static void saveINode2Image(INode node, DataOutput out,
    boolean writeUnderConstruction, ReferenceMap referenceMap)
    throws IOException {
  if (node.isReference()) {
    writeINodeReference(node.asReference(), out, writeUnderConstruction,
        referenceMap);
  } else if (node.isDirectory()) {
    writeINodeDirectory(node.asDirectory(), out);
  } else if (node.isSymlink()) {
    writeINodeSymlink(node.asSymlink(), out);      
  } else if (node.isFile()) {
    writeINodeFile(node.asFile(), out, writeUnderConstruction);
  }
}