/// <summary> /// Serialize /// <see cref="#deleted"/> /// /// </summary> /// <exception cref="System.IO.IOException"/> private void WriteDeleted(DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap ) { IList <INode> deleted = GetList(Diff.ListType.Deleted); @out.WriteInt(deleted.Count); foreach (INode node in deleted) { FSImageSerialization.SaveINode2Image(node, @out, true, referenceMap); } }
/// <exception cref="System.IO.IOException"/> internal override void Write(DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap) { WriteSnapshot(@out); @out.WriteLong(fileSize); // write snapshotINode if (snapshotINode != null) { @out.WriteBoolean(true); FSImageSerialization.WriteINodeFileAttributes(snapshotINode, @out); } else { @out.WriteBoolean(false); } }
/// <exception cref="System.IO.IOException"/> internal override void Write(DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap) { 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); }
/// <summary>Save SnapshotDiff list for an INodeDirectoryWithSnapshot.</summary> /// <param name="sNode">The directory that the SnapshotDiff list belongs to.</param> /// <param name="out"> /// The /// <see cref="System.IO.DataOutput"/> /// to write. /// </param> /// <exception cref="System.IO.IOException"/> private static void SaveINodeDiffs <N, A, D>(AbstractINodeDiffList <N, A, D> diffs, DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap) where N : INode where A : INodeAttributes where D : AbstractINodeDiff <N, A, D> { // Record the diffs in reversed order, so that we can find the correct // reference for INodes in the created list when loading the FSImage if (diffs == null) { @out.WriteInt(-1); } else { // no diffs IList <D> list = diffs.AsList(); int size = list.Count; @out.WriteInt(size); for (int i = size - 1; i >= 0; i--) { list[i].Write(@out, referenceMap); } } }
/// <exception cref="System.IO.IOException"/> internal abstract void Write(DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap);
/// <summary>Serialize to out</summary> /// <exception cref="System.IO.IOException"/> private void Write(DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap ) { WriteCreated(@out); WriteDeleted(@out, referenceMap); }
/// <exception cref="System.IO.IOException"/> public static void SaveDirectoryDiffList(INodeDirectory dir, DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap) { SaveINodeDiffs(dir.GetDiffs(), @out, referenceMap); }