예제 #1
0
 /** If the file is in cache, update the size based on the cached data size */
 Nfs3FileAttributes getFileAttr(
     DFSClient client, FileHandle fileHandle, IdMappingServiceProvider iug) throws IOException {
   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;
 }
예제 #2
0
  Nfs3FileAttributes getFileAttr(DFSClient client, FileHandle dirHandle, String fileName)
      throws IOException {
    String fileIdPath = Nfs3Utils.getFileIdPath(dirHandle) + "/" + fileName;
    Nfs3FileAttributes attr = Nfs3Utils.getFileAttr(client, fileIdPath, iug);

    if ((attr != null) && (attr.getType() == NfsFileType.NFSREG.toValue())) {
      OpenFileCtx openFileCtx = fileContextCache.get(new FileHandle(attr.getFileId()));

      if (openFileCtx != null) {
        attr.setSize(openFileCtx.getNextOffset());
        attr.setUsed(openFileCtx.getNextOffset());
      }
    }
    return attr;
  }