@ThreadSafe public final class BlockStoreClient extends Object
BlockStoreClient
constructors.Modifier and Type | Method and Description |
---|---|
static BlockStoreClient |
create(FileSystemContext context)
Creates an Alluxio block store with default local hostname.
|
long |
getCapacityBytes()
Gets the total capacity of Alluxio's BlockStore.
|
Pair<WorkerNetAddress,BlockInStream.BlockInStreamSource> |
getDataSourceAndType(BlockInfo info,
URIStatus status,
BlockLocationPolicy policy,
Map<WorkerNetAddress,Long> failedWorkers)
Gets the data source and type of data source of a block.
|
BlockInfo |
getInfo(long blockId)
Gets the block info of a block, if it exists.
|
BlockInStream |
getInStream(BlockInfo info,
InStreamOptions options,
Map<WorkerNetAddress,Long> failedWorkers)
|
BlockInStream |
getInStream(long blockId,
InStreamOptions options)
Gets a stream to read the data of a block.
|
BlockInStream |
getInStream(long blockId,
InStreamOptions options,
Map<WorkerNetAddress,Long> failedWorkers)
Gets a stream to read the data of a block.
|
BlockOutStream |
getOutStream(long blockId,
long blockSize,
OutStreamOptions options)
Gets a stream to write data to a block based on the options.
|
BlockOutStream |
getOutStream(long blockId,
long blockSize,
WorkerNetAddress address,
OutStreamOptions options)
Gets a stream to write data to a block.
|
long |
getUsedBytes()
Gets the used bytes of Alluxio's BlockStore.
|
public static BlockStoreClient create(FileSystemContext context)
context
- the file system contextBlockStoreClient
createdpublic BlockInfo getInfo(long blockId) throws IOException
blockId
- the blockId to obtain information aboutBlockInfo
containing the metadata of the blockIOException
public BlockInStream getInStream(long blockId, InStreamOptions options) throws IOException
blockId
- the id of the block to readoptions
- the options associated with the read requestIOException
public BlockInStream getInStream(long blockId, InStreamOptions options, Map<WorkerNetAddress,Long> failedWorkers) throws IOException
blockId
- the id of the block to readoptions
- the options associated with the read requestfailedWorkers
- the map of worker's addresses to most recent failure timeIOException
public BlockInStream getInStream(BlockInfo info, InStreamOptions options, Map<WorkerNetAddress,Long> failedWorkers) throws IOException
info
- the block infooptions
- the options associated with the read requestfailedWorkers
- the map of worker's addresses to most recent failure timeIOException
public Pair<WorkerNetAddress,BlockInStream.BlockInStreamSource> getDataSourceAndType(BlockInfo info, URIStatus status, BlockLocationPolicy policy, Map<WorkerNetAddress,Long> failedWorkers) throws IOException
info
- the info of the block to readstatus
- the URIStatus associated with the read requestpolicy
- the policy determining the Alluxio worker locationfailedWorkers
- the map of worker's addresses to most recent failure timeIOException
public BlockOutStream getOutStream(long blockId, long blockSize, WorkerNetAddress address, OutStreamOptions options) throws IOException
blockId
- the block to writeblockSize
- the standard block size to writeaddress
- the address of the worker to write the block to, fails if the worker cannot
serve the requestoptions
- the output stream optionsBlockOutStream
which can be used to write data to the block in a streaming
fashionIOException
public BlockOutStream getOutStream(long blockId, long blockSize, OutStreamOptions options) throws IOException
blockId
- the block to writeblockSize
- the standard block size to writeoptions
- the output stream optionBlockOutStream
which can be used to write data to the block in a streaming
fashionIOException
public long getCapacityBytes() throws IOException
IOException
public long getUsedBytes() throws IOException
IOException
Copyright © 2023. All Rights Reserved.