public abstract class IOManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IOManager.IOMode |
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOG
Logging
|
Modifier | Constructor and Description |
---|---|
protected |
IOManager(String[] tempDirs)
Constructs a new IOManager.
|
Modifier and Type | Method and Description |
---|---|
BlockChannelReader<MemorySegment> |
createBlockChannelReader(FileIOChannel.ID channelID)
Creates a block channel reader that reads blocks from the given channel.
|
abstract BlockChannelReader<MemorySegment> |
createBlockChannelReader(FileIOChannel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue)
Creates a block channel reader that reads blocks from the given channel.
|
BlockChannelWriter<MemorySegment> |
createBlockChannelWriter(FileIOChannel.ID channelID)
Creates a block channel writer that writes to the given channel.
|
abstract BlockChannelWriter<MemorySegment> |
createBlockChannelWriter(FileIOChannel.ID channelID,
LinkedBlockingQueue<MemorySegment> returnQueue)
Creates a block channel writer that writes to the given channel.
|
abstract BlockChannelWriterWithCallback<MemorySegment> |
createBlockChannelWriter(FileIOChannel.ID channelID,
RequestDoneCallback<MemorySegment> callback)
Creates a block channel writer that writes to the given channel.
|
abstract BufferFileReader |
createBufferFileReader(FileIOChannel.ID channelID,
RequestDoneCallback<Buffer> callback) |
abstract BufferFileSegmentReader |
createBufferFileSegmentReader(FileIOChannel.ID channelID,
RequestDoneCallback<FileSegment> callback) |
abstract BufferFileWriter |
createBufferFileWriter(FileIOChannel.ID channelID) |
abstract BulkBlockChannelReader |
createBulkBlockChannelReader(FileIOChannel.ID channelID,
List<MemorySegment> targetSegments,
int numBlocks)
Creates a block channel reader that reads all blocks from the given channel directly in one bulk.
|
FileIOChannel.ID |
createChannel()
Creates a new
FileIOChannel.ID in one of the temp directories. |
FileIOChannel.Enumerator |
createChannelEnumerator()
Creates a new
FileIOChannel.Enumerator , spreading the channels in a round-robin fashion
across the temporary file directories. |
void |
deleteChannel(FileIOChannel.ID channel)
Deletes the file underlying the given channel.
|
protected int |
getNextPathNum() |
int |
getNumberOfSpillingDirectories()
Gets the number of directories across which the I/O manager rotates its files.
|
File[] |
getSpillingDirectories()
Gets the directories that the I/O manager spills to.
|
boolean |
isProperlyShutDown()
Utility method to check whether the IO manager has been properly shut down.
|
void |
shutdown()
Close method, marks the I/O manager as closed
and removed all temporary files.
|
protected IOManager(String[] tempDirs)
tempDirs
- The basic directories for files underlying anonymous channels.public void shutdown()
public boolean isProperlyShutDown()
public FileIOChannel.ID createChannel()
FileIOChannel.ID
in one of the temp directories. Multiple
invocations of this method spread the channels evenly across the different directories.public FileIOChannel.Enumerator createChannelEnumerator()
FileIOChannel.Enumerator
, spreading the channels in a round-robin fashion
across the temporary file directories.public void deleteChannel(FileIOChannel.ID channel) throws IOException
channel
- The channel to be deleted.IOException
- Thrown if the deletion fails.public BlockChannelWriter<MemorySegment> createBlockChannelWriter(FileIOChannel.ID channelID) throws IOException
channelID
- The descriptor for the channel to write to.IOException
- Thrown, if the channel for the writer could not be opened.public abstract BlockChannelWriter<MemorySegment> createBlockChannelWriter(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException
channelID
- The descriptor for the channel to write to.returnQueue
- The queue to put the written buffers into.IOException
- Thrown, if the channel for the writer could not be opened.public abstract BlockChannelWriterWithCallback<MemorySegment> createBlockChannelWriter(FileIOChannel.ID channelID, RequestDoneCallback<MemorySegment> callback) throws IOException
channelID
- The descriptor for the channel to write to.callback
- The callback to be called forIOException
- Thrown, if the channel for the writer could not be opened.public BlockChannelReader<MemorySegment> createBlockChannelReader(FileIOChannel.ID channelID) throws IOException
channelID
- The descriptor for the channel to write to.IOException
- Thrown, if the channel for the reader could not be opened.public abstract BlockChannelReader<MemorySegment> createBlockChannelReader(FileIOChannel.ID channelID, LinkedBlockingQueue<MemorySegment> returnQueue) throws IOException
channelID
- The descriptor for the channel to write to.returnQueue
- The queue to put the full buffers into.IOException
- Thrown, if the channel for the reader could not be opened.public abstract BufferFileWriter createBufferFileWriter(FileIOChannel.ID channelID) throws IOException
IOException
public abstract BufferFileReader createBufferFileReader(FileIOChannel.ID channelID, RequestDoneCallback<Buffer> callback) throws IOException
IOException
public abstract BufferFileSegmentReader createBufferFileSegmentReader(FileIOChannel.ID channelID, RequestDoneCallback<FileSegment> callback) throws IOException
IOException
public abstract BulkBlockChannelReader createBulkBlockChannelReader(FileIOChannel.ID channelID, List<MemorySegment> targetSegments, int numBlocks) throws IOException
If a channel is not to be read in one bulk, but in multiple smaller batches, a
BlockChannelReader
should be used.
channelID
- The descriptor for the channel to write to.targetSegments
- The list to take the segments from into which to read the data.numBlocks
- The number of blocks in the channel to read.IOException
- Thrown, if the channel for the reader could not be opened.public int getNumberOfSpillingDirectories()
public File[] getSpillingDirectories()
protected int getNextPathNum()
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.