public interface InMemorySorter<T> extends IndexedSortable
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes the sorter.
|
long |
getCapacity()
Gets the total capacity of this sorter, in bytes.
|
MutableObjectIterator<T> |
getIterator()
Gets an iterator over all records in this buffer in their logical order.
|
long |
getOccupancy()
Gets the number of bytes currently occupied in this sorter, records and sort index.
|
T |
getRecord(int logicalPosition)
Gets the record at the given logical position.
|
T |
getRecord(T reuse,
int logicalPosition)
Gets the record at the given logical position.
|
boolean |
isEmpty()
Checks whether the buffer is empty.
|
void |
reset()
Resets the sort buffer back to the state where it is empty.
|
boolean |
write(T record)
Writes a given record to this sort buffer.
|
void |
writeToOutput(ChannelWriterOutputView output)
Writes the records in this buffer in their logical order to the given output.
|
void |
writeToOutput(ChannelWriterOutputView output,
int start,
int num)
Writes a subset of the records in this buffer in their logical order to the given output.
|
void |
writeToOutput(ChannelWriterOutputView output,
LargeRecordHandler<T> largeRecordsOutput) |
compare, size, swap
void reset()
boolean isEmpty()
void dispose()
long getCapacity()
long getOccupancy()
T getRecord(int logicalPosition) throws IOException
logicalPosition
- The logical position of the record.IOException
- Thrown, if an exception occurred during deserialization.T getRecord(T reuse, int logicalPosition) throws IOException
reuse
- The reuse object to deserialize the record into.logicalPosition
- The logical position of the record.IOException
- Thrown, if an exception occurred during deserialization.boolean write(T record) throws IOException
record
- The record to be written.IOException
- Thrown, if an error occurred while serializing the record into the buffers.MutableObjectIterator<T> getIterator()
void writeToOutput(ChannelWriterOutputView output) throws IOException
output
- The output view to write the records to.IOException
- Thrown, if an I/O exception occurred writing to the output view.void writeToOutput(ChannelWriterOutputView output, LargeRecordHandler<T> largeRecordsOutput) throws IOException
IOException
void writeToOutput(ChannelWriterOutputView output, int start, int num) throws IOException
output
- The output view to write the records to.start
- The logical start position of the subset.num
- The number of elements to write.IOException
- Thrown, if an I/O exception occurred writing to the output view.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.