예제 #1
0
 /// <exception cref="System.IO.IOException"/>
 private void Save(OutputStream @out, INodeDirectory n)
 {
     FsImageProto.INodeSection.INodeDirectory.Builder b = BuildINodeDirectory(n, parent
                                                                              .GetSaverContext());
     FsImageProto.INodeSection.INode r = ((FsImageProto.INodeSection.INode)BuildINodeCommon
                                              (n).SetType(FsImageProto.INodeSection.INode.Type.Directory).SetDirectory(b).Build
                                              ());
     r.WriteDelimitedTo(@out);
 }
예제 #2
0
 /// <exception cref="System.IO.IOException"/>
 private void Save(OutputStream @out, INodeSymlink n)
 {
     FSImageFormatProtobuf.SaverContext             state = parent.GetSaverContext();
     FsImageProto.INodeSection.INodeSymlink.Builder b     = FsImageProto.INodeSection.INodeSymlink
                                                            .NewBuilder().SetPermission(BuildPermissionStatus(n, state.GetStringMap())).SetTarget
                                                                (ByteString.CopyFrom(n.GetSymlink())).SetModificationTime(n.GetModificationTime(
                                                                                                                              )).SetAccessTime(n.GetAccessTime());
     FsImageProto.INodeSection.INode r = ((FsImageProto.INodeSection.INode)BuildINodeCommon
                                              (n).SetType(FsImageProto.INodeSection.INode.Type.Symlink).SetSymlink(b).Build());
     r.WriteDelimitedTo(@out);
 }
예제 #3
0
            /// <exception cref="System.IO.IOException"/>
            private void Save(OutputStream @out, INodeFile n)
            {
                FsImageProto.INodeSection.INodeFile.Builder b = BuildINodeFile(n, parent.GetSaverContext
                                                                                   ());
                if (n.GetBlocks() != null)
                {
                    foreach (Block block in n.GetBlocks())
                    {
                        b.AddBlocks(PBHelper.Convert(block));
                    }
                }
                FileUnderConstructionFeature uc = n.GetFileUnderConstructionFeature();

                if (uc != null)
                {
                    FsImageProto.INodeSection.FileUnderConstructionFeature f = ((FsImageProto.INodeSection.FileUnderConstructionFeature
                                                                                 )FsImageProto.INodeSection.FileUnderConstructionFeature.NewBuilder().SetClientName
                                                                                    (uc.GetClientName()).SetClientMachine(uc.GetClientMachine()).Build());
                    b.SetFileUC(f);
                }
                FsImageProto.INodeSection.INode r = ((FsImageProto.INodeSection.INode)BuildINodeCommon
                                                         (n).SetType(FsImageProto.INodeSection.INode.Type.File).SetFile(b).Build());
                r.WriteDelimitedTo(@out);
            }