/// <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); }
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"); }
/// <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()); }