Package org.apache.druid.segment.file
Interface SegmentFileBuilder
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
FileSmoosher,SegmentFileBuilderV10
Builder for segment file(s) which are created on
close() and later can be read with a
SegmentFileMapper. At the lowest level, segment files are built by packing multiple chunks of data organized
as internal files, into the same physical file to efficiently share file descriptors, At a higher level, Druid
columns are composed of one or more files containing the column parts, which are stored in the segment during
serialization using this builder.-
Method Summary
Modifier and TypeMethodDescriptionvoidabort()cleanup any open resources in the event of an exception while building the segment filesvoidAdd aFileto the segment file as the specified namevoidadd(String name, ByteBuffer bufferToAdd) Add aByteBufferto a segment file as the specified namevoidaddColumn(String name, ColumnDescriptor columnDescriptor) Add a column to the metadata of this segment fileaddWithChannel(String name, long size) Creates aSegmentFileChannelto write data to the segment file as the specified name.voidclose()Close the segment file builder, writing the file(s) to the destinationdefault SegmentFileBuildergetExternalBuilder(String externalFile) Allow adding data to an 'external' segment container file which will be built in the same directory as this segment file.
-
Method Details
-
addColumn
Add a column to the metadata of this segment file -
add
Add aFileto the segment file as the specified name- Throws:
IOException
-
add
Add aByteBufferto a segment file as the specified name- Throws:
IOException
-
addWithChannel
Creates aSegmentFileChannelto write data to the segment file as the specified name. Callers must be sure to write the amount of data specified by the size parameter.- Throws:
IOException
-
getExternalBuilder
Allow adding data to an 'external' segment container file which will be built in the same directory as this segment file. Legacy implementations of this method just return the same builder since they do not support this concept. This allows column implementations to use these methods, but also still work with older segment formats (assuming the older format otherwise supports the contents). -
abort
void abort()cleanup any open resources in the event of an exception while building the segment files -
close
Close the segment file builder, writing the file(s) to the destination- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-