private FsCreateModes(FsPermission masked, FsPermission unmasked) { super(masked); this.unmasked = unmasked; assert masked.getUnmasked() == null; assert unmasked.getUnmasked() == null; }
/** * Create from masked and unmasked modes. */ public static FsCreateModes create(FsPermission masked, FsPermission unmasked) { assert masked.getUnmasked() == null; assert unmasked.getUnmasked() == null; return new FsCreateModes(masked, unmasked); }
/** * Create from unmasked mode and umask. * * If the mode is already an FsCreateModes object, return it. */ public static FsPermission applyUMask(FsPermission mode, FsPermission umask) { if (mode.getUnmasked() != null) { return mode; } return create(mode.applyUMask(umask), mode); }
modes.getUnmasked() != null) { child.setPermission(modes.getUnmasked()); if (!AclStorage.copyINodeDefaultAcl(child)) { if (LOG.isDebugEnabled()) {
@Override public boolean mkdirs(Path f, FsPermission permission) throws IOException { statistics.incrementWriteOps(1); storageStatistics.incrementOpCounter(OpType.MKDIRS); final HttpOpParam.Op op = PutOpParam.Op.MKDIRS; final FsPermission modes = applyUMask(permission); return new FsPathBooleanRunner(op, f, new PermissionParam(modes.getMasked()), new UnmaskedPermissionParam(modes.getUnmasked()) ).run(); }
@Override public boolean mkdirs(String src, FsPermission masked, boolean createParent) throws IOException { MkdirsRequestProto.Builder builder = MkdirsRequestProto.newBuilder() .setSrc(src) .setMasked(PBHelperClient.convert(masked)) .setCreateParent(createParent); FsPermission unmasked = masked.getUnmasked(); if (unmasked != null) { builder.setUnmasked(PBHelperClient.convert(unmasked)); } MkdirsRequestProto req = builder.build(); try { return rpcProxy.mkdirs(null, req).getResult(); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } }
@Override public FSDataOutputStream create(final Path f, final FsPermission permission, final boolean overwrite, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { statistics.incrementWriteOps(1); storageStatistics.incrementOpCounter(OpType.CREATE); final FsPermission modes = applyUMask(permission); final HttpOpParam.Op op = PutOpParam.Op.CREATE; return new FsPathOutputStreamRunner(op, f, bufferSize, new PermissionParam(modes.getMasked()), new UnmaskedPermissionParam(modes.getUnmasked()), new OverwriteParam(overwrite), new BufferSizeParam(bufferSize), new ReplicationParam(replication), new BlockSizeParam(blockSize) ).run(); }
@Override public FSDataOutputStream createNonRecursive(final Path f, final FsPermission permission, final EnumSet<CreateFlag> flag, final int bufferSize, final short replication, final long blockSize, final Progressable progress) throws IOException { statistics.incrementWriteOps(1); storageStatistics.incrementOpCounter(OpType.CREATE_NON_RECURSIVE); final FsPermission modes = applyUMask(permission); final HttpOpParam.Op op = PutOpParam.Op.CREATE; return new FsPathOutputStreamRunner(op, f, bufferSize, new PermissionParam(modes.getMasked()), new UnmaskedPermissionParam(modes.getUnmasked()), new CreateFlagParam(flag), new CreateParentParam(false), new BufferSizeParam(bufferSize), new ReplicationParam(replication), new BlockSizeParam(blockSize) ).run(); }
builder.setEcPolicyName(ecPolicyName); FsPermission unmasked = masked.getUnmasked(); if (unmasked != null) { builder.setUnmasked(PBHelperClient.convert(unmasked));