@ThreadSafe public class HeapBlockStore extends java.lang.Object implements BlockStore
BlockStore.Block, BlockStore.Factory| Modifier and Type | Field and Description |
|---|---|
TwoKeyConcurrentMap<java.lang.Long,java.lang.Long,Block.BlockLocation,java.util.Map<java.lang.Long,Block.BlockLocation>> |
mBlockLocations |
java.util.Map<java.lang.Long,Block.BlockMeta> |
mBlocks |
| Constructor and Description |
|---|
HeapBlockStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLocation(long blockId,
Block.BlockLocation location)
Adds a new block location.
|
void |
clear()
Removes all metadata from the block store.
|
void |
close()
Closes the block store and releases all resources.
|
java.util.Optional<Block.BlockMeta> |
getBlock(long id) |
java.util.List<Block.BlockLocation> |
getLocations(long blockid)
Gets locations for a block.
|
java.util.Iterator<BlockStore.Block> |
iterator() |
void |
putBlock(long id,
Block.BlockMeta meta)
Adds block metadata to the block store.
|
void |
removeBlock(long id)
Removes a block, or does nothing if the block does not exist.
|
void |
removeLocation(long blockId,
long workerId)
Removes a block location.
|
public final java.util.Map<java.lang.Long,Block.BlockMeta> mBlocks
public final TwoKeyConcurrentMap<java.lang.Long,java.lang.Long,Block.BlockLocation,java.util.Map<java.lang.Long,Block.BlockLocation>> mBlockLocations
public java.util.Optional<Block.BlockMeta> getBlock(long id)
getBlock in interface BlockStoreid - a block idpublic void putBlock(long id,
Block.BlockMeta meta)
BlockStoreputBlock in interface BlockStoreid - the block idmeta - the block metadatapublic void removeBlock(long id)
BlockStoreremoveBlock in interface BlockStoreid - a block id to removepublic java.util.Iterator<BlockStore.Block> iterator()
iterator in interface java.lang.Iterable<BlockStore.Block>public void clear()
BlockStoreclear in interface BlockStorepublic void close()
BlockStoreclose in interface BlockStorepublic java.util.List<Block.BlockLocation> getLocations(long blockid)
BlockStoregetLocations in interface BlockStoreblockid - a block idpublic void addLocation(long blockId,
Block.BlockLocation location)
BlockStoreaddLocation in interface BlockStoreblockId - a block idlocation - a block locationpublic void removeLocation(long blockId,
long workerId)
BlockStoreremoveLocation in interface BlockStoreblockId - a block idworkerId - a worker idCopyright © 2020. All Rights Reserved.