Exemple #1
0
            public static FsImageProto.INodeSection.INodeDirectory.Builder BuildINodeDirectory
                (INodeDirectoryAttributes dir, FSImageFormatProtobuf.SaverContext state)
            {
                QuotaCounts quota = dir.GetQuotaCounts();

                FsImageProto.INodeSection.INodeDirectory.Builder b = FsImageProto.INodeSection.INodeDirectory
                                                                     .NewBuilder().SetModificationTime(dir.GetModificationTime()).SetNsQuota(quota.GetNameSpace
                                                                                                                                                 ()).SetDsQuota(quota.GetStorageSpace()).SetPermission(BuildPermissionStatus(dir,
                                                                                                                                                                                                                             state.GetStringMap()));
                if (quota.GetTypeSpaces().AnyGreaterOrEqual(0))
                {
                    b.SetTypeQuotas(BuildQuotaByStorageTypeEntries(quota));
                }
                AclFeature f = dir.GetAclFeature();

                if (f != null)
                {
                    b.SetAcl(BuildAclEntries(f, state.GetStringMap()));
                }
                XAttrFeature xAttrFeature = dir.GetXAttrFeature();

                if (xAttrFeature != null)
                {
                    b.SetXAttrs(BuildXAttrs(xAttrFeature, state.GetStringMap()));
                }
                return(b);
            }
Exemple #2
0
            public static FsImageProto.INodeSection.INodeFile.Builder BuildINodeFile(INodeFileAttributes
                                                                                     file, FSImageFormatProtobuf.SaverContext state)
            {
                FsImageProto.INodeSection.INodeFile.Builder b = FsImageProto.INodeSection.INodeFile
                                                                .NewBuilder().SetAccessTime(file.GetAccessTime()).SetModificationTime(file.GetModificationTime
                                                                                                                                          ()).SetPermission(BuildPermissionStatus(file, state.GetStringMap())).SetPreferredBlockSize
                                                                    (file.GetPreferredBlockSize()).SetReplication(file.GetFileReplication()).SetStoragePolicyID
                                                                    (file.GetLocalStoragePolicyID());
                AclFeature f = file.GetAclFeature();

                if (f != null)
                {
                    b.SetAcl(BuildAclEntries(f, state.GetStringMap()));
                }
                XAttrFeature xAttrFeature = file.GetXAttrFeature();

                if (xAttrFeature != null)
                {
                    b.SetXAttrs(BuildXAttrs(xAttrFeature, state.GetStringMap()));
                }
                return(b);
            }
Exemple #3
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);
 }