public interface BlockWorker extends Worker, SessionCleanable
Modifier and Type | Field and Description |
---|---|
static long |
INVALID_LOCK_ID
Invalid lock ID.
|
Modifier and Type | Method and Description |
---|---|
void |
abortBlock(long sessionId,
long blockId)
Aborts the temporary block created by the session.
|
void |
accessBlock(long sessionId,
long blockId)
Access the block for a given session.
|
void |
asyncCache(AsyncCacheRequest request)
Deprecated.
This method will be deprecated as of v3.0, use
cache |
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,
String medium,
long initialBytes)
Creates a block in Alluxio managed space.
|
BlockReader |
createBlockReader(BlockReadRequest request)
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, java.lang.String, long) . |
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.
|
BlockMeta |
getBlockMeta(long sessionId,
long blockId,
long lockId)
Gets the metadata of a specific block from local storage.
|
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. |
TempBlockMeta |
getTempBlockMeta(long sessionId,
long blockId) |
BlockMeta |
getVolatileBlockMeta(long blockId)
Gets the metadata of a block given its blockId or throws IOException.
|
AtomicReference<Long> |
getWorkerId() |
boolean |
hasBlockMeta(long blockId)
Checks if the storage has a given block.
|
long |
lockBlock(long sessionId,
long blockId)
Obtains a read lock on a block.
|
void |
moveBlock(long sessionId,
long blockId,
int tier)
Moves a block from its current location to a target location, currently only tier level moves
are supported.
|
void |
moveBlockToMedium(long sessionId,
long blockId,
String mediumType)
Moves a block from its current location to a target location, with a specific medium type.
|
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 |
unlockBlock(long lockId)
Releases the lock with the specified lock id.
|
void |
updatePinList(Set<Long> pinnedInodes)
Sets the pinlist for the underlying block store.
|
close, getDependencies, getName, getServices, start, stop
cleanupSession
static final long INVALID_LOCK_ID
AtomicReference<Long> getWorkerId()
void abortBlock(long sessionId, long blockId) throws BlockAlreadyExistsException, BlockDoesNotExistException, InvalidWorkerStateException, IOException
sessionId
- the id of the clientblockId
- the id of the block to be abortedBlockAlreadyExistsException
- if blockId already exists in committed blocksBlockDoesNotExistException
- if the temporary block cannot be foundInvalidWorkerStateException
- if blockId does not belong to sessionIdIOException
void accessBlock(long sessionId, long blockId) throws BlockDoesNotExistException
sessionId
- the id of the clientblockId
- the id of the block to accessBlockDoesNotExistException
- this exception is not thrown in the tiered block store
implementationvoid commitBlock(long sessionId, long blockId, boolean pinOnCreate) throws BlockAlreadyExistsException, BlockDoesNotExistException, InvalidWorkerStateException, IOException, WorkerOutOfSpaceException
sessionId
- the id of the clientblockId
- the id of the block to commitpinOnCreate
- whether to pin block on createBlockAlreadyExistsException
- if blockId already exists in committed blocksBlockDoesNotExistException
- if the temporary block cannot be foundInvalidWorkerStateException
- if blockId does not belong to sessionIdWorkerOutOfSpaceException
- if there is no more space left to hold the blockIOException
void commitBlockInUfs(long blockId, long length) throws IOException
blockId
- the id of the block to commitlength
- length of the block to commitIOException
String createBlock(long sessionId, long blockId, int tier, String medium, long initialBytes) throws BlockAlreadyExistsException, WorkerOutOfSpaceException, IOException
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 tiermedium
- the name of the medium to place the new block ininitialBytes
- the initial amount of bytes to be allocatedBlockAlreadyExistsException
- if blockId already exists, either temporary or committed,
or block in eviction plan already existsWorkerOutOfSpaceException
- if this Store has no more space than the initialBlockSizeIOException
@Nullable TempBlockMeta getTempBlockMeta(long sessionId, long blockId)
sessionId
- the id of the session to get this fileblockId
- the id of the blockBlockWriter createBlockWriter(long sessionId, long blockId) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, IOException
BlockWriter
for an existing temporary block which is already created by
createBlock(long, long, int, java.lang.String, long)
.sessionId
- the id of the clientblockId
- the id of the block to be opened for writingBlockDoesNotExistException
- if the block cannot be foundBlockAlreadyExistsException
- if a committed block with the same ID existsInvalidWorkerStateException
- if the worker state is invalidIOException
BlockHeartbeatReport getReport()
BlockStoreMeta getStoreMeta()
BlockStoreMeta getStoreMetaFull()
getStoreMeta()
except that this also contains full blockId
list. This function is expensive.BlockMeta getVolatileBlockMeta(long blockId) throws BlockDoesNotExistException
blockId
- the block idBlockDoesNotExistException
- if no BlockMeta
for this blockId is foundBlockMeta getBlockMeta(long sessionId, long blockId, long lockId) throws BlockDoesNotExistException, InvalidWorkerStateException
Unlike getVolatileBlockMeta(long)
, this method requires the lock id returned by a
previously acquired lockBlock(long, long)
.
sessionId
- the id of the session to get this fileblockId
- the id of the blocklockId
- the id of the lockBlockDoesNotExistException
- if the block id can not be found in committed blocks or
lockId can not be foundInvalidWorkerStateException
- if session id or block id is not the same as that in the
LockRecord of lockIdboolean hasBlockMeta(long blockId)
blockId
- the block idlong lockBlock(long sessionId, long blockId)
INVALID_LOCK_ID
.sessionId
- the id of the clientblockId
- the id of the block to be lockedINVALID_LOCK_ID
if it failed to lockvoid moveBlock(long sessionId, long blockId, int tier) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, WorkerOutOfSpaceException, IOException
IllegalArgumentException
if the tierAlias is out of range of
tiered storage.sessionId
- the id of the clientblockId
- the id of the block to movetier
- the tier to move the block toBlockDoesNotExistException
- if blockId cannot be foundBlockAlreadyExistsException
- if blockId already exists in committed blocks of the
newLocationInvalidWorkerStateException
- if blockId has not been committedWorkerOutOfSpaceException
- if newLocation does not have enough extra space to hold the
blockIOException
void moveBlockToMedium(long sessionId, long blockId, String mediumType) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, WorkerOutOfSpaceException, IOException
IllegalArgumentException
if the medium type is not one of the listed medium
types.sessionId
- the id of the clientblockId
- the id of the block to movemediumType
- the medium type to move toBlockDoesNotExistException
- if blockId cannot be foundBlockAlreadyExistsException
- if blockId already exists in committed blocks of the
newLocationInvalidWorkerStateException
- if blockId has not been committedWorkerOutOfSpaceException
- if newLocation does not have enough extra space to hold the
blockIOException
BlockReader createBlockReader(BlockReadRequest request) throws BlockDoesNotExistException, IOException
request
- the block read requestBlockDoesNotExistException
- if the requested block does not exist in this workerIOException
- if it fails to get block readerBlockReader createUfsBlockReader(long sessionId, long blockId, long offset, boolean positionShort, Protocol.OpenUfsBlockOptions options) throws BlockDoesNotExistException, 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 optionsBlockDoesNotExistException
- if the block does not exist in the UFS block storeIOException
void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException
sessionId
- the id of the clientblockId
- the id of the block to be freedInvalidWorkerStateException
- if blockId has not been committedBlockDoesNotExistException
- if block cannot be foundIOException
void requestSpace(long sessionId, long blockId, long additionalBytes) throws BlockDoesNotExistException, WorkerOutOfSpaceException, IOException
sessionId
- the id of the clientblockId
- the id of the block to allocate space toadditionalBytes
- the amount of bytes to allocateBlockDoesNotExistException
- if blockId can not be found, or some block in eviction plan
cannot be foundWorkerOutOfSpaceException
- if requested space can not be satisfiedIOException
void unlockBlock(long lockId) throws BlockDoesNotExistException
lockId
- the id of the lock to releaseBlockDoesNotExistException
- if lock id cannot be found@Deprecated void asyncCache(AsyncCacheRequest request)
cache
request
- the async cache requestvoid cache(CacheRequest request) throws AlluxioException, IOException
request
- the cache requestAlluxioException
IOException
void updatePinList(Set<Long> pinnedInodes)
pinnedInodes
- a set of pinned inodesFileInfo getFileInfo(long fileId) throws IOException
fileId
- the file idIOException
void clearMetrics()
Copyright © 2023. All Rights Reserved.