java.io.Closeable, java.lang.AutoCloseableCachingBlockManagerpublic abstract class BlockManager
extends java.lang.Object
implements java.io.Closeable
BlockManager that does
perform prefetching or caching.| Constructor | Description |
|---|---|
BlockManager(BlockData blockData) |
Constructs an instance of
BlockManager. |
| Modifier and Type | Method | Description |
|---|---|---|
void |
cancelPrefetches() |
Requests cancellation of any previously issued prefetch requests.
|
void |
close() |
|
BufferData |
get(int blockNumber) |
Gets the block having the given
blockNumber. |
BlockData |
getBlockData() |
Gets block data information.
|
abstract int |
read(java.nio.ByteBuffer buffer,
long startOffset,
int size) |
Reads into the given
buffer size bytes from the underlying file
starting at startOffset. |
void |
release(BufferData data) |
Releases resources allocated to the given block.
|
void |
requestCaching(BufferData data) |
Requests that the given block should be copied to the cache.
|
void |
requestPrefetch(int blockNumber) |
Requests optional prefetching of the given block.
|
public BlockManager(BlockData blockData)
BlockManager.blockData - information about each block of the underlying file.java.lang.IllegalArgumentException - if blockData is null.public BlockData getBlockData()
BlockData.public BufferData get(int blockNumber) throws java.io.IOException
blockNumber.
The entire block is read into memory and returned as a BufferData.
The blocks are treated as a limited resource and must be released when
one is done reading them.blockNumber - the number of the block to be read and returned.BufferData having data from the given block.java.io.IOException - if there an error reading the given block.java.lang.IllegalArgumentException - if blockNumber is negative.public abstract int read(java.nio.ByteBuffer buffer,
long startOffset,
int size)
throws java.io.IOException
buffer size bytes from the underlying file
starting at startOffset.buffer - the buffer to read data in to.startOffset - the offset at which reading starts.size - the number bytes to read.java.io.IOException - if there an error reading the given block.public void release(BufferData data)
data - the BufferData to release.java.lang.IllegalArgumentException - if data is null.public void requestPrefetch(int blockNumber)
blockNumber - the id of the block to prefetch.java.lang.IllegalArgumentException - if blockNumber is negative.public void cancelPrefetches()
public void requestCaching(BufferData data)
data - the BufferData instance to optionally cache.public void close()
close in interface java.lang.AutoCloseableclose in interface java.io.CloseableCopyright © 2008–2025 Apache Software Foundation. All rights reserved.