/// <summary>This can only be called after serializing both INode_Dir and SnapshotDiff /// </summary> /// <exception cref="System.IO.IOException"/> public void SerializeINodeReferenceSection(OutputStream @out) { IList <INodeReference> refList = parent.GetSaverContext().GetRefList(); foreach (INodeReference @ref in refList) { FsImageProto.INodeReferenceSection.INodeReference.Builder rb = BuildINodeReference (@ref); ((FsImageProto.INodeReferenceSection.INodeReference)rb.Build()).WriteDelimitedTo( @out); } parent.CommitSection(headers, FSImageFormatProtobuf.SectionName.InodeReference); }
/// <exception cref="System.IO.IOException"/> private FsImageProto.INodeReferenceSection.INodeReference.Builder BuildINodeReference (INodeReference @ref) { FsImageProto.INodeReferenceSection.INodeReference.Builder rb = FsImageProto.INodeReferenceSection.INodeReference .NewBuilder().SetReferredId(@ref.GetId()); if (@ref is INodeReference.WithName) { rb.SetLastSnapshotId(((INodeReference.WithName)@ref).GetLastSnapshotId()).SetName (ByteString.CopyFrom(@ref.GetLocalNameBytes())); } else { if (@ref is INodeReference.DstReference) { rb.SetDstSnapshotId(@ref.GetDstSnapshotId()); } } return(rb); }