Exemplo n.º 1
0
            /// <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);
                }
            }
Exemplo n.º 2
0
 /// <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);
     }
 }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
 /// <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);
         }
     }
 }
Exemplo n.º 5
0
 /// <exception cref="System.IO.IOException"/>
 internal abstract void Write(DataOutput @out, SnapshotFSImageFormat.ReferenceMap
                              referenceMap);
Exemplo n.º 6
0
 /// <summary>Serialize to out</summary>
 /// <exception cref="System.IO.IOException"/>
 private void Write(DataOutput @out, SnapshotFSImageFormat.ReferenceMap referenceMap
                    )
 {
     WriteCreated(@out);
     WriteDeleted(@out, referenceMap);
 }
Exemplo n.º 7
0
 /// <exception cref="System.IO.IOException"/>
 public static void SaveDirectoryDiffList(INodeDirectory dir, DataOutput @out, SnapshotFSImageFormat.ReferenceMap
                                          referenceMap)
 {
     SaveINodeDiffs(dir.GetDiffs(), @out, referenceMap);
 }