Search in sources :

Example 1 with DataWriter

use of alluxio.client.block.stream.DataWriter in project alluxio by Alluxio.

the class AlluxioBlockStore method getOutStream.

/**
 * Gets a stream to write data to a block. The stream can only be backed by Alluxio storage.
 *
 * @param blockId the block to write
 * @param blockSize the standard block size to write
 * @param address the address of the worker to write the block to, fails if the worker cannot
 *        serve the request
 * @param options the output stream options
 * @return an {@link BlockOutStream} which can be used to write data to the block in a streaming
 *         fashion
 */
public BlockOutStream getOutStream(long blockId, long blockSize, WorkerNetAddress address, OutStreamOptions options) throws IOException {
    // No specified location to write to.
    Preconditions.checkNotNull(address, "address");
    LOG.debug("Create BlockOutStream for {} of block size {} at address {}, using options: {}", blockId, blockSize, address, options);
    DataWriter dataWriter = DataWriter.Factory.create(mContext, blockId, blockSize, address, options);
    return new BlockOutStream(dataWriter, blockSize, address);
}
Also used : BlockOutStream(alluxio.client.block.stream.BlockOutStream) DataWriter(alluxio.client.block.stream.DataWriter)

Aggregations

BlockOutStream (alluxio.client.block.stream.BlockOutStream)1 DataWriter (alluxio.client.block.stream.DataWriter)1