Package org.apache.druid.segment.file
Class SegmentFileMapperV10
java.lang.Object
org.apache.druid.segment.file.SegmentFileMapperV10
- All Implemented Interfaces:
Closeable,AutoCloseable,SegmentFileMapper
SegmentFileMapper implementation for V10 segment files.
V10 file format: | version (byte) | meta compression (byte) | meta length (int) | meta json | container 0 | ... | container n |
-
Constructor Summary
ConstructorsConstructorDescriptionSegmentFileMapperV10(File segmentFile, SegmentFileMetadata segmentFileMetadata, List<MappedByteBuffer> containers, Map<String, SegmentFileMapperV10> externalMappers) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static SegmentFileMapperV10Create a v10SegmentFileMapperstatic SegmentFileMapperV10create(File segmentFile, com.fasterxml.jackson.databind.ObjectMapper mapper, List<String> externals) Create a v10SegmentFileMapperwith 'external' attached v10 segment filesReturns the list of files contained within in the segment file which can be retrieved withSegmentFileMapper.mapFile(String)mapExternalFile(String filename, String name) Loads a file from an 'external' segment container file, in the same directory as thisSegmentFileMapper.Returns a mappedByteBufferwhich of the contents of the internal file, or null if the file is not present in this segment.
-
Constructor Details
-
SegmentFileMapperV10
public SegmentFileMapperV10(File segmentFile, SegmentFileMetadata segmentFileMetadata, List<MappedByteBuffer> containers, Map<String, SegmentFileMapperV10> externalMappers)
-
-
Method Details
-
create
public static SegmentFileMapperV10 create(File segmentFile, com.fasterxml.jackson.databind.ObjectMapper mapper, List<String> externals) throws IOException Create a v10SegmentFileMapperwith 'external' attached v10 segment files- Parameters:
segmentFile- v10 segment file with nameIndexIO.V10_FILE_NAMEmapper- json mapper to deserialize metadataexternals- list of 'external' v10 segment files to attach to this mapper and files that can be referenced usingmapExternalFile(String, String)- Returns:
- v10
SegmentFileMapperusing memory mappedByteBuffer - Throws:
IOException
-
create
public static SegmentFileMapperV10 create(File segmentFile, com.fasterxml.jackson.databind.ObjectMapper mapper) throws IOException Create a v10SegmentFileMapper- Throws:
IOException
-
getSegmentFileMetadata
-
getInternalFilenames
Description copied from interface:SegmentFileMapperReturns the list of files contained within in the segment file which can be retrieved withSegmentFileMapper.mapFile(String)- Specified by:
getInternalFilenamesin interfaceSegmentFileMapper
-
mapFile
Description copied from interface:SegmentFileMapperReturns a mappedByteBufferwhich of the contents of the internal file, or null if the file is not present in this segment. The file data is from 0 toBuffer.capacity(),Buffer.limit()is equal to the capacity.- Specified by:
mapFilein interfaceSegmentFileMapper- Throws:
IOException
-
mapExternalFile
Description copied from interface:SegmentFileMapperLoads a file from an 'external' segment container file, in the same directory as thisSegmentFileMapper. Legacy implementations do not support this concept, and so just map these files directly, which allows column implementations to use these methods but also still work with older segment formats.- Specified by:
mapExternalFilein interfaceSegmentFileMapper- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSegmentFileMapper
-