public interface BlockStore extends Closeable, SessionCleanable
Modifier and Type | Method and Description |
---|---|
void |
abortBlock(long sessionId,
long blockId)
Aborts a temporary block.
|
void |
accessBlock(long sessionId,
long blockId)
Notifies the block store that a block was accessed so the block store could update accordingly
the registered listeners such as evictor and allocator on block access.
|
void |
commitBlock(long sessionId,
long blockId,
boolean pinOnCreate)
Commits a block to Alluxio managed space.
|
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.
|
BlockStoreMeta |
getBlockStoreMeta()
Gets the metadata of the entire store in a snapshot.
|
BlockStoreMeta |
getBlockStoreMetaFull()
Similar as
getBlockStoreMeta() except that this includes
more information about the block store (e.g. |
Optional<TempBlockMeta> |
getTempBlockMeta(long blockId)
Gets the temp metadata of a specific block from local storage.
|
Optional<BlockMeta> |
getVolatileBlockMeta(long blockId)
Gets the metadata of a block given its block id or empty if block does not exist.
|
boolean |
hasBlockMeta(long blockId)
Checks if the storage has a given block.
|
boolean |
hasTempBlockMeta(long blockId)
Checks if the storage has a given temp block.
|
CompletableFuture<List<BlockStatus>> |
load(List<Block> fileBlocks,
UfsReadOptions options)
Load blocks into alluxio.
|
void |
moveBlock(long sessionId,
long blockId,
AllocateOptions moveOptions)
Moves an existing block to a new location.
|
Optional<BlockLock> |
pinBlock(long sessionId,
long blockId)
Pins the block indicating subsequent access.
|
void |
registerBlockStoreEventListener(BlockStoreEventListener listener)
Registers a
BlockStoreEventListener to this block store. |
void |
removeBlock(long sessionId,
long blockId)
Removes an existing block.
|
void |
removeInaccessibleStorage()
Remove Storage directories that are no longer accessible.
|
void |
requestSpace(long sessionId,
long blockId,
long additionalBytes)
Requests to increase the size of a temp block.
|
void |
unpinBlock(BlockLock lock)
Unpins an accessed block based on the id (returned by
pinBlock(long, long) ). |
void |
updatePinnedInodes(Set<Long> inodes)
Update the pinned inodes.
|
cleanupSession
void abortBlock(long sessionId, long blockId)
sessionId
- the id of the sessionblockId
- the id of a temp blockvoid accessBlock(long sessionId, long blockId)
sessionId
- the id of the session to access a blockblockId
- the id of an accessed blockvoid 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 createString 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 createBlockOptionsBlockReader 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 readerBlockWriter 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
BlockStoreMeta getBlockStoreMeta()
BlockStoreMeta getBlockStoreMetaFull()
getBlockStoreMeta()
except that this includes
more information about the block store (e.g. blockId list). This is an expensive operation.Optional<TempBlockMeta> getTempBlockMeta(long blockId)
blockId
- the id of the blockboolean hasBlockMeta(long blockId)
blockId
- the block idboolean hasTempBlockMeta(long blockId)
blockId
- the temp block idOptional<BlockMeta> getVolatileBlockMeta(long blockId)
blockId
- the block idvoid moveBlock(long sessionId, long blockId, AllocateOptions moveOptions) throws IOException
sessionId
- the id of the session to move a blockblockId
- the id of an existing blockmoveOptions
- the options for moveIOException
Optional<BlockLock> pinBlock(long sessionId, long blockId)
sessionId
- the id of the session to lock this blockblockId
- the id of the block to lockvoid unpinBlock(BlockLock lock)
pinBlock(long, long)
).lock
- the lock returned by pinBlock(long, long)
void updatePinnedInodes(Set<Long> inodes)
inodes
- a set of inodes that are currently pinnedvoid registerBlockStoreEventListener(BlockStoreEventListener listener)
BlockStoreEventListener
to this block store.listener
- the listener to those eventsvoid removeBlock(long sessionId, long blockId) throws IOException
sessionId
- the id of the session to remove a blockblockId
- the id of an existing blockIOException
void removeInaccessibleStorage()
void requestSpace(long sessionId, long blockId, long additionalBytes)
sessionId
- the id of the session to request spaceblockId
- the id of the temp blockadditionalBytes
- the amount of more space to request in bytes, never be less than 0CompletableFuture<List<BlockStatus>> load(List<Block> fileBlocks, UfsReadOptions options)
fileBlocks
- list of fileBlocks, one file blocks contains blocks belong to one fileoptions
- read ufs optionsCopyright © 2023. All Rights Reserved.