@ThreadSafe public class RocksBlockStore extends Object implements BlockStore
BlockStore.Block, BlockStore.Factory
Constructor and Description |
---|
RocksBlockStore(String baseDir)
Creates and initializes a rocks block store.
|
Modifier and Type | Method and Description |
---|---|
void |
addLocation(long id,
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.
|
Optional<Block.BlockMeta> |
getBlock(long id) |
List<Block.BlockLocation> |
getLocations(long id)
Gets locations for a block.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public RocksBlockStore(String baseDir)
baseDir
- the base directory in which to store block store metadatapublic Optional<Block.BlockMeta> getBlock(long id)
getBlock
in interface BlockStore
id
- a block idpublic void putBlock(long id, Block.BlockMeta meta)
BlockStore
putBlock
in interface BlockStore
id
- the block idmeta
- the block metadatapublic void removeBlock(long id)
BlockStore
removeBlock
in interface BlockStore
id
- a block id to removepublic void clear()
BlockStore
clear
in interface BlockStore
public void close()
BlockStore
close
in interface BlockStore
public List<Block.BlockLocation> getLocations(long id)
BlockStore
getLocations
in interface BlockStore
id
- a block idpublic void addLocation(long id, Block.BlockLocation location)
BlockStore
addLocation
in interface BlockStore
id
- a block idlocation
- a block locationpublic void removeLocation(long blockId, long workerId)
BlockStore
removeLocation
in interface BlockStore
blockId
- a block idworkerId
- a worker idpublic Iterator<BlockStore.Block> iterator()
iterator
in interface Iterable<BlockStore.Block>
Copyright © 2023. All Rights Reserved.