public interface BlockWorker extends Worker, SessionCleanable
Modifier and Type | Method and Description |
---|---|
void |
abortBlock(long sessionId,
long blockId)
Aborts the temporary block created by the session.
|
void |
asyncCache(AsyncCacheRequest request)
Deprecated.
This method will be deprecated as of v3.0, use
cache(alluxio.grpc.CacheRequest) |
void |
cache(CacheRequest request)
Submits the cache request to cache manager to execute.
|
void |
clearMetrics()
Clears the worker metrics.
|
void |
commitBlock(long sessionId,
long blockId,
boolean pinOnCreate)
Commits a block to Alluxio managed space.
|
void |
commitBlockInUfs(long blockId,
long length)
Commits a block in UFS.
|
String |
createBlock(long sessionId,
long blockId,
int tier,
CreateBlockOptions createBlockOptions)
Creates a block in Alluxio managed space.
|
BlockReader |
createBlockReader(long sessionId,
long blockId,
long offset,
boolean positionShort,
Protocol.OpenUfsBlockOptions options)
Creates the block reader to read from Alluxio block or UFS block.
|
BlockWriter |
createBlockWriter(long sessionId,
long blockId)
Creates a
BlockWriter for an existing temporary block which is already created by
createBlock(long, long, int, alluxio.worker.block.CreateBlockOptions) . |
BlockReader |
createUfsBlockReader(long sessionId,
long blockId,
long offset,
boolean positionShort,
Protocol.OpenUfsBlockOptions options)
Creates a block reader to read a UFS block starting from given block offset.
|
void |
freeWorker()
Frees all blocks in the current worker by deleting all block store directories.
|
BlockStore |
getBlockStore() |
Configuration |
getConfiguration(GetConfigurationPOptions options) |
FileInfo |
getFileInfo(long fileId)
Gets the file information.
|
BlockHeartbeatReport |
getReport()
Gets a report for the periodic heartbeat to master.
|
BlockStoreMeta |
getStoreMeta()
Gets the metadata for the entire block store.
|
BlockStoreMeta |
getStoreMetaFull()
Similar as
getStoreMeta() except that this also contains full blockId
list. |
List<String> |
getWhiteList() |
WorkerNetAddress |
getWorkerAddress() |
AtomicReference<Long> |
getWorkerId() |
CompletableFuture<List<BlockStatus>> |
load(List<Block> fileBlocks,
UfsReadOptions options)
Load blocks into alluxio.
|
void |
removeBlock(long sessionId,
long blockId)
Frees a block from Alluxio managed space.
|
void |
requestSpace(long sessionId,
long blockId,
long additionalBytes)
Request an amount of space for a block in its storage directory.
|
void |
updatePinList(Set<Long> pinnedInodes)
Sets the pinlist for the underlying block store.
|
close, getDependencies, getName, getServices, start, stop
cleanupSession
AtomicReference<Long> getWorkerId()
void abortBlock(long sessionId, long blockId) throws IOException
sessionId
- the id of the clientblockId
- the id of the block to be abortedIOException
void commitBlock(long sessionId, long blockId, boolean pinOnCreate)
sessionId
- the id of the clientblockId
- the id of the block to commitpinOnCreate
- whether to pin block on createvoid commitBlockInUfs(long blockId, long length)
blockId
- the id of the block to commitlength
- length of the block to commitString createBlock(long sessionId, long blockId, int tier, CreateBlockOptions createBlockOptions)
createBlockWriter(long, long)
to get a writer for writing to the block.
The block will be temporary until it is committed by commitBlock(long, long, boolean)
.
Throws an IllegalArgumentException
if the location does not belong to tiered storage.sessionId
- the id of the clientblockId
- the id of the block to createtier
- the tier to place the new block in
BlockStoreLocation.ANY_TIER
for any tiercreateBlockOptions
- the createBlockOptionsBlockWriter createBlockWriter(long sessionId, long blockId) throws IOException
BlockWriter
for an existing temporary block which is already created by
createBlock(long, long, int, alluxio.worker.block.CreateBlockOptions)
.sessionId
- the id of the clientblockId
- the id of the block to be opened for writingIOException
BlockHeartbeatReport getReport()
BlockStoreMeta getStoreMeta()
BlockStoreMeta getStoreMetaFull()
getStoreMeta()
except that this also contains full blockId
list. This function is expensive.BlockReader createBlockReader(long sessionId, long blockId, long offset, boolean positionShort, Protocol.OpenUfsBlockOptions options) throws IOException
sessionId
- the client session IDblockId
- the ID of the UFS block to readoffset
- the offset within the blockpositionShort
- whether the operation is using positioned read to a small buffer sizeoptions
- the optionsIOException
- if it fails to get block readerBlockReader createUfsBlockReader(long sessionId, long blockId, long offset, boolean positionShort, Protocol.OpenUfsBlockOptions options) throws IOException
sessionId
- the client session IDblockId
- the ID of the UFS block to readoffset
- the offset within the blockpositionShort
- whether the operation is using positioned read to a small buffer sizeoptions
- the optionsIOException
- if it fails to get block readervoid removeBlock(long sessionId, long blockId) throws IOException
sessionId
- the id of the clientblockId
- the id of the block to be freedIOException
void freeWorker() throws IOException
IOException
- if free failsvoid requestSpace(long sessionId, long blockId, long additionalBytes)
sessionId
- the id of the clientblockId
- the id of the block to allocate space toadditionalBytes
- the amount of bytes to allocate@Deprecated void asyncCache(AsyncCacheRequest request)
cache(alluxio.grpc.CacheRequest)
request
- the async cache requestvoid cache(CacheRequest request) throws AlluxioException, IOException
request
- the cache requestAlluxioException
IOException
CompletableFuture<List<BlockStatus>> load(List<Block> fileBlocks, UfsReadOptions options)
fileBlocks
- list of fileBlocks, one file blocks contains blocks belong to one fileoptions
- read ufs optionsvoid updatePinList(Set<Long> pinnedInodes)
pinnedInodes
- a set of pinned inodesFileInfo getFileInfo(long fileId) throws IOException
fileId
- the file idIOException
void clearMetrics()
Configuration getConfiguration(GetConfigurationPOptions options)
options
- method optionsBlockStore getBlockStore()
WorkerNetAddress getWorkerAddress()
Copyright © 2023. All Rights Reserved.