/* fsid */ /// <exception cref="System.IO.IOException"/> public static Nfs3FileAttributes GetFileAttr(DFSClient client, string fileIdPath, IdMappingServiceProvider iug) { HdfsFileStatus fs = GetFileStatus(client, fileIdPath); return(fs == null ? null : GetNfs3FileAttrFromFileStatus(fs, iug)); }
// TODO: maybe not efficient /// <exception cref="System.IO.IOException"/> public static WccData CreateWccData(WccAttr preOpAttr, DFSClient dfsClient, string fileIdPath, IdMappingServiceProvider iug) { Nfs3FileAttributes postOpDirAttr = GetFileAttr(dfsClient, fileIdPath, iug); return(new WccData(preOpAttr, postOpDirAttr)); }
public static Nfs3FileAttributes GetNfs3FileAttrFromFileStatus(HdfsFileStatus fs, IdMappingServiceProvider iug) { NfsFileType fileType = fs.IsDir() ? NfsFileType.Nfsdir : NfsFileType.Nfsreg; fileType = fs.IsSymlink() ? NfsFileType.Nfslnk : fileType; int nlink = (fileType == NfsFileType.Nfsdir) ? fs.GetChildrenNum() + 2 : 1; long size = (fileType == NfsFileType.Nfsdir) ? GetDirSize(fs.GetChildrenNum()) : fs.GetLen(); return(new Nfs3FileAttributes(fileType, nlink, fs.GetPermission().ToShort(), iug. GetUidAllowingUnknown(fs.GetOwner()), iug.GetGidAllowingUnknown(fs.GetGroup()), size, 0, fs.GetFileId(), fs.GetModificationTime(), fs.GetAccessTime(), new Nfs3FileAttributes.Specdata3 ())); }
/// <summary>If the file is in cache, update the size based on the cached data size</summary> /// <exception cref="System.IO.IOException"/> internal virtual Nfs3FileAttributes GetFileAttr(DFSClient client, FileHandle fileHandle , IdMappingServiceProvider iug) { string fileIdPath = Nfs3Utils.GetFileIdPath(fileHandle); Nfs3FileAttributes attr = Nfs3Utils.GetFileAttr(client, fileIdPath, iug); if (attr != null) { OpenFileCtx openFileCtx = fileContextCache.Get(fileHandle); if (openFileCtx != null) { attr.SetSize(openFileCtx.GetNextOffset()); attr.SetUsed(openFileCtx.GetNextOffset()); } } return(attr); }
internal WriteManager(IdMappingServiceProvider iug, NfsConfiguration config, bool aixCompatMode) { this.iug = iug; this.config = config; this.aixCompatMode = aixCompatMode; streamTimeout = config.GetLong(NfsConfigKeys.DfsNfsStreamTimeoutKey, NfsConfigKeys .DfsNfsStreamTimeoutDefault); Log.Info("Stream timeout is " + streamTimeout + "ms."); if (streamTimeout < NfsConfigKeys.DfsNfsStreamTimeoutMinDefault) { Log.Info("Reset stream timeout to minimum value " + NfsConfigKeys.DfsNfsStreamTimeoutMinDefault + "ms."); streamTimeout = NfsConfigKeys.DfsNfsStreamTimeoutMinDefault; } maxStreams = config.GetInt(NfsConfigKeys.DfsNfsMaxOpenFilesKey, NfsConfigKeys.DfsNfsMaxOpenFilesDefault ); Log.Info("Maximum open streams is " + maxStreams); this.fileContextCache = new OpenFileCtxCache(config, streamTimeout); }
public SysSecurityHandler(CredentialsSys credentialsSys, IdMappingServiceProvider iug) { this.mCredentialsSys = credentialsSys; this.iug = iug; }