Examples of PermissionStatus


Examples of org.apache.hadoop.fs.permission.PermissionStatus

          } else {
            long first = ((numBlocks == 1) ? blocks[0].getNumBytes(): 0);
            blockSize = Math.max(fsNamesys.getDefaultBlockSize(), first);
          }
        }
        PermissionStatus permissions = fsNamesys.getUpgradePermission();
        if (imgVersion <= -11) {
          permissions = PermissionStatus.read(in);
        }
        fsDir.unprotectedAddFile(name.toString(), permissions,
            blocks, replication, modificationTime, blockSize);
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

      return;
    }
    String target = lostFound + file.getPath();
    String errmsg = "Failed to move " + file.getPath() + " to /lost+found";
    try {
      PermissionStatus ps = new PermissionStatus(
          file.getOwner(), file.getGroup(), file.getPermission());
      if (!nn.namesystem.dir.mkdirs(target, ps, false, FSNamesystem.now())) {
        LOG.warn(errmsg);
        return;
      }
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

    Block blk = new Block();
    for (int i = 0; i < numBlocks; i++) {
      blk.readFields(in);
      blocks[i] = new BlockInfo(blk, blockReplication);
    }
    PermissionStatus perm = PermissionStatus.read(in);
    String clientName = readString(in);
    String clientMachine = readString(in);

    // These locations are not used at all
    int numLocs = in.readInt();
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

    if (LayoutVersion.supports(Feature.DISKSPACE_QUOTA, imgVersion)
        && blocks == null) {
      dsQuota = in.readLong();
    }

    PermissionStatus permissions = namesystem.getUpgradePermission();
    if (imgVersion <= -11) {
      permissions = PermissionStatus.read(in);
    }

    return INode.newINode(permissions, blocks, replication,
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

      return;
    }
    String target = lostFound + file.getPath();
    String errmsg = "Failed to move " + file.getPath() + " to /lost+found";
    try {
      PermissionStatus ps = new PermissionStatus(
          file.getOwner(), file.getGroup(), file.getPermission());
      if (!nn.namesystem.dir.mkdirs(target, ps, false, FSNamesystem.now())) {
        LOG.warn(errmsg);
        return;
      }
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

          long first = ((blocks.length == 1)? blocks[0].getNumBytes(): 0);
          blockSize = Math.max(fsNamesys.getDefaultBlockSize(), first);
        }
      }
     
      PermissionStatus permissions = fsNamesys.getUpgradePermission();
      if (addCloseOp.permissions != null) {
        permissions = addCloseOp.permissions;
      }


      // The open lease transaction re-creates a file if necessary.
      // Delete the file if it already exists.
      if (FSNamesystem.LOG.isDebugEnabled()) {
        FSNamesystem.LOG.debug(op.opCode + ": " + addCloseOp.path +
            " numblocks : " + blocks.length +
            " clientHolder " + addCloseOp.clientName +
            " clientMachine " + addCloseOp.clientMachine);
      }

      INodeFile node = fsDir.updateINodefile(addCloseOp.path, permissions,
          blocks, replication, addCloseOp.mtime, addCloseOp.atime, blockSize,
          addCloseOp.clientName, addCloseOp.clientMachine);
     
      if (addCloseOp.opCode == FSEditLogOpCodes.OP_ADD) {
        if (!node.isUnderConstruction()) {
          throw new IOException("INodeFile : " + node
              + " is not under construction");
        }
        INodeFileUnderConstruction cons = (INodeFileUnderConstruction) node;
        if (!cons.getClientName().equals(addCloseOp.clientName)) {
          fsNamesys.leaseManager.removeLease(cons.getClientName(),
              addCloseOp.path);
          FSNamesystem.LOG.info("Updating client name for : " + addCloseOp.path
              + " from : " + cons.getClientName() + " to : "
              + addCloseOp.clientName);
        }
        cons.setClientName(addCloseOp.clientName);
        cons.setClientMachine(addCloseOp.clientMachine);
        fsNamesys.leaseManager.addLease(cons.getClientName(),
                                        addCloseOp.path,
                                        cons.getModificationTime());
      } else {
        INodeFile newNode = node;
        if (node.isUnderConstruction()) {
          INodeFileUnderConstruction pendingFile = (INodeFileUnderConstruction) node;
          newNode = pendingFile.convertToInodeFile();
          newNode.setAccessTime(addCloseOp.atime);
          fsNamesys.leaseManager.removeLease(pendingFile.getClientName(),
              addCloseOp.path);
          fsDir.replaceNode(addCloseOp.path, node, newNode);
        }
      }
      break;
    }
    case OP_SET_REPLICATION: {
      SetReplicationOp setReplicationOp = (SetReplicationOp)op;
      short replication = fsNamesys.adjustReplication(
          setReplicationOp.replication);
      fsDir.unprotectedSetReplication(setReplicationOp.path,
                                      replication, null);
      break;
    }
    case OP_CONCAT_DELETE: {
      ConcatDeleteOp concatDeleteOp = (ConcatDeleteOp)op;
      fsDir.unprotectedConcat(concatDeleteOp.trg, concatDeleteOp.srcs,
          concatDeleteOp.timestamp);
      break;
    }
    case OP_RENAME: {
      RenameOp renameOp = (RenameOp)op;
      HdfsFileStatus dinfo = fsDir.getHdfsFileInfo(renameOp.dst);
      fsDir.unprotectedRenameTo(renameOp.src, renameOp.dst,
                                renameOp.timestamp);
      fsNamesys.changeLease(renameOp.src, renameOp.dst, dinfo);
      break;
    }
    case OP_DELETE: {
      DeleteOp deleteOp = (DeleteOp)op;
      fsDir.unprotectedDelete(deleteOp.path, deleteOp.timestamp);
      break;
    }
    case OP_MKDIR: {
      MkdirOp mkdirOp = (MkdirOp)op;
      PermissionStatus permissions = fsNamesys.getUpgradePermission();
      if (mkdirOp.permissions != null) {
        permissions = mkdirOp.permissions;
      }

      fsDir.unprotectedMkdir(mkdirOp.path, permissions,
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

    if (!checkPathLength(src)) {
      throw new IOException("create: Pathname too long.  Limit "
                            + MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
    }
    namesystem.startFile(src,
        new PermissionStatus(FSNamesystem.getCurrentUGI().getUserName(),
            null, masked),
        clientName, clientMachine, overwrite, createParent, replication, blockSize);
    InjectionHandler.processEventIO(InjectionEvent.NAMENODE_AFTER_CREATE_FILE);
    myMetrics.numFilesCreated.inc();
    myMetrics.numCreateFileOps.inc();
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

    if (!checkPathLength(src)) {
      throw new IOException("mkdirs: Pathname too long.  Limit "
                            + MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
    }
    boolean value =  namesystem.mkdirs(src,
        new PermissionStatus(FSNamesystem.getCurrentUGI().getUserName(),
            null, masked));
    if (value) {
      myMetrics.numMkdirs.inc();
    }
    return value;
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

 
  static void addFiles(FSEditLog editLog, int numFiles, short replication,
                         int blocksPerFile, long startingBlockId, long blockSize,
                         FileNameGenerator nameGenerator) {
   
    PermissionStatus p = new PermissionStatus("joeDoe", "people",
                                      new FsPermission((short)0777));
    INodeId inodeId = new INodeId();
    INodeDirectory dirInode = new INodeDirectory(inodeId.nextValue(), null, p,
      0L);
    editLog.logMkDir(BASE_PATH, dirInode);
View Full Code Here

Examples of org.apache.hadoop.fs.permission.PermissionStatus

   * For a given path, build a tree of INodes and return the leaf node.
   */
  private INode createTreeOfInodes(String path) throws QuotaExceededException {
    byte[][] components = INode.getPathComponents(path);
    FsPermission perm = FsPermission.createImmutable((short)0755);
    PermissionStatus permstatus = PermissionStatus.createImmutable("", "", perm);
   
    long id = 0;
    INodeDirectory prev = new INodeDirectory(++id, new byte[0], permstatus, 0);
    INodeDirectory dir = null;
    for (byte[] component : components) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.