Example usage for org.apache.hadoop.hdfs DFSOutputStream getFileId

List of usage examples for org.apache.hadoop.hdfs DFSOutputStream getFileId

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs DFSOutputStream getFileId.

Prototype

@VisibleForTesting
    public long getFileId() 

Source Link

Usage

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Same as {@link #create(String, FsPermission, EnumSet, boolean, short, long, Progressable, int, ChecksumOpt)} with the addition of favoredNodes
 * that is//from  w  w  w .  j a  va  2 s .  c o m
 * a hint to where the namenode should place the file blocks.
 * The favored nodes hint is not persisted in HDFS. Hence it may be honored
 * at the creation time only. HDFS could move the blocks during balancing or
 * replication, to move the blocks from favored nodes. A value of null means
 * no favored nodes for this create
 */
public DFSOutputStream create(String src, FsPermission permission, EnumSet<CreateFlag> flag,
        boolean createParent, short replication, long blockSize, Progressable progress, int buffersize,
        ChecksumOpt checksumOpt, InetSocketAddress[] favoredNodes) throws IOException {
    checkOpen();
    if (permission == null) {
        permission = FsPermission.getFileDefault();
    }
    FsPermission masked = permission.applyUMask(dfsClientConf.getuMask());
    if (LOG.isDebugEnabled()) {
        LOG.debug(src + ": masked=" + masked);
    }
    final DFSOutputStream result = DFSOutputStream.newStreamForCreate(this, src, masked, flag, createParent,
            replication, blockSize, progress, buffersize, dfsClientConf.createChecksum(checksumOpt),
            getFavoredNodesStr(favoredNodes));
    beginFileLease(result.getFileId(), result);
    return result;
}

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

/**
 * Same as {{@link #create(String, FsPermission, EnumSet, short, long, Progressable, int, ChecksumOpt)} except that the permission
 * is absolute (ie has already been masked with umask.
 *///from w ww .  j  av  a2s . co m
public DFSOutputStream primitiveCreate(String src, FsPermission absPermission, EnumSet<CreateFlag> flag,
        boolean createParent, short replication, long blockSize, Progressable progress, int buffersize,
        ChecksumOpt checksumOpt) throws IOException, UnresolvedLinkException {
    checkOpen();
    CreateFlag.validate(flag);
    DFSOutputStream result = primitiveAppend(src, flag, buffersize, progress);
    if (result == null) {
        DataChecksum checksum = dfsClientConf.createChecksum(checksumOpt);
        result = DFSOutputStream.newStreamForCreate(this, src, absPermission, flag, createParent, replication,
                blockSize, progress, buffersize, checksum, null);
    }
    beginFileLease(result.getFileId(), result);
    return result;
}

From source file:com.mellanox.r4h.DFSClient.java

License:Apache License

private DFSOutputStream append(String src, int buffersize, EnumSet<CreateFlag> flag, String[] favoredNodes,
        Progressable progress) throws IOException {
    checkOpen();/*from w ww  .j  a v a  2s  .co m*/
    final DFSOutputStream result = callAppend(src, buffersize, flag, progress, favoredNodes);
    beginFileLease(result.getFileId(), result);
    return result;
}