예제 #1
0
            /// <exception cref="System.IO.IOException"/>
            private INodeReference LoadINodeReference(FsImageProto.INodeReferenceSection.INodeReference
                                                      r)
            {
                long  referredId = r.GetReferredId();
                INode referred   = fsDir.GetInode(referredId);

                INodeReference.WithCount withCount = (INodeReference.WithCount)referred.GetParentReference
                                                         ();
                if (withCount == null)
                {
                    withCount = new INodeReference.WithCount(null, referred);
                }
                INodeReference @ref;

                if (r.HasDstSnapshotId())
                {
                    // DstReference
                    @ref = new INodeReference.DstReference(null, withCount, r.GetDstSnapshotId());
                }
                else
                {
                    @ref = new INodeReference.WithName(null, withCount, r.GetName().ToByteArray(), r.
                                                       GetLastSnapshotId());
                }
                return(@ref);
            }
예제 #2
0
 private void DumpINodeReference(FsImageProto.INodeReferenceSection.INodeReference
                                 r)
 {
     @out.Write("<ref>");
     O("referredId", r.GetReferredId()).O("name", r.GetName().ToStringUtf8()).O("dstSnapshotId"
                                                                                , r.GetDstSnapshotId()).O("lastSnapshotId", r.GetLastSnapshotId());
     @out.Write("</ref>\n");
 }
예제 #3
0
 /// <exception cref="System.IO.IOException"/>
 private void DumpINodeReferenceSection(InputStream @in)
 {
     @out.Write("<INodeReferenceSection>");
     while (true)
     {
         FsImageProto.INodeReferenceSection.INodeReference e = FsImageProto.INodeReferenceSection.INodeReference
                                                               .ParseDelimitedFrom(@in);
         if (e == null)
         {
             break;
         }
         DumpINodeReference(e);
     }
     @out.Write("</INodeReferenceSection>");
 }
예제 #4
0
            /// <summary>
            /// The sequence of the ref node in refList must be strictly the same with
            /// the sequence in fsimage
            /// </summary>
            /// <exception cref="System.IO.IOException"/>
            public void LoadINodeReferenceSection(InputStream @in)
            {
                IList <INodeReference> refList = parent.GetLoaderContext().GetRefList();

                while (true)
                {
                    FsImageProto.INodeReferenceSection.INodeReference e = FsImageProto.INodeReferenceSection.INodeReference
                                                                          .ParseDelimitedFrom(@in);
                    if (e == null)
                    {
                        break;
                    }
                    INodeReference @ref = LoadINodeReference(e);
                    refList.AddItem(@ref);
                }
            }
예제 #5
0
        /// <exception cref="System.IO.IOException"/>
        private static ImmutableList <long> LoadINodeReferenceSection(InputStream @in)
        {
            Log.Info("Loading inode references");
            ImmutableList.Builder <long> builder = ImmutableList.Builder();
            long counter = 0;

            while (true)
            {
                FsImageProto.INodeReferenceSection.INodeReference e = FsImageProto.INodeReferenceSection.INodeReference
                                                                      .ParseDelimitedFrom(@in);
                if (e == null)
                {
                    break;
                }
                ++counter;
                builder.Add(e.GetReferredId());
            }
            Log.Info("Loaded " + counter + " inode references");
            return((ImmutableList <long>)builder.Build());
        }