Interface BlockStore
-
- All Known Subinterfaces:
RemoteFileStore
- All Known Implementing Classes:
AbstractBlockStore
,GlusterFileStore
,LocalBlockStore
,LocalFileStore
,MemoryStore
,SerializedMemoryStore
public interface BlockStore
Interface forBlock
placement.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Block
createBlock(java.lang.String blockId)
Creates a new block.boolean
deleteBlock(java.lang.String blockId)
Deletes a block from this store.java.util.Optional<Block>
readBlock(java.lang.String blockId)
Reads a committed block from this store.void
writeBlock(Block block)
Writes a committed block to this store.
-
-
-
Method Detail
-
createBlock
Block createBlock(java.lang.String blockId) throws BlockWriteException
Creates a new block. A stale data created by previous failed task should be handled during the creation of new block.- Parameters:
blockId
- the ID of the block to create.- Returns:
- the created block.
- Throws:
BlockWriteException
- for any error occurred while trying to create a block. (This exception will be thrown to the scheduler throughExecutor
and have to be handled by the scheduler with fault tolerance mechanism.)
-
writeBlock
void writeBlock(Block block) throws BlockWriteException
Writes a committed block to this store.- Parameters:
block
- the block to write.- Throws:
BlockWriteException
- if fail to write. (This exception will be thrown to the scheduler throughExecutor
and have to be handled by the scheduler with fault tolerance mechanism.)
-
readBlock
java.util.Optional<Block> readBlock(java.lang.String blockId) throws BlockFetchException
Reads a committed block from this store.- Parameters:
blockId
- of the target partition.- Returns:
- the target block (if it exists).
- Throws:
BlockFetchException
- for any error occurred while trying to fetch a block. (This exception will be thrown to the scheduler throughExecutor
and have to be handled by the scheduler with fault tolerance mechanism.)
-
deleteBlock
boolean deleteBlock(java.lang.String blockId)
Deletes a block from this store.- Parameters:
blockId
- of the block.- Returns:
- whether the partition exists or not.
- Throws:
BlockFetchException
- for any error occurred while trying to remove a block. (This exception will be thrown to the scheduler throughExecutor
and have to be handled by the scheduler with fault tolerance mechanism.)
-
-