Package org.apache.iotdb.tsfile.read
Class TsFileSequenceReader
- java.lang.Object
-
- org.apache.iotdb.tsfile.read.TsFileSequenceReader
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
TsFileRestorableReader,UnClosedTsFileReader
public class TsFileSequenceReader extends Object implements AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTsFileSequenceReader.LocateStatusThe location of a chunkGroupMetaData with respect to a space partition constraint.
-
Field Summary
Fields Modifier and Type Field Description protected static TSFileConfigconfigprotected Stringfileprotected longfileMetadataPosprotected intfileMetadataSizeprotected TsFileInputtsFileInputprotected TsFileMetadatatsFileMetaData
-
Constructor Summary
Constructors Constructor Description TsFileSequenceReader(String file)Create a file reader of the given file.TsFileSequenceReader(String file, boolean loadMetadataSize)construct function for TsFileSequenceReader.TsFileSequenceReader(String file, boolean loadMetadata, boolean cacheDeviceMetadata)TsFileSequenceReader(TsFileInput input)Create a file reader of the given file.TsFileSequenceReader(TsFileInput input, boolean loadMetadataSize)construct function for TsFileSequenceReader.TsFileSequenceReader(TsFileInput input, long fileMetadataPos, int fileMetadataSize)construct function for TsFileSequenceReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected intbinarySearchInTimeseriesMetadataList(List<TimeseriesMetadata> timeseriesMetadataList, String key)longcheckChunkAndPagesStatistics(IChunkMetadata chunkMetadata)voidclose()booleanequals(Object o)longfileSize()List<AlignedChunkMetadata>getAlignedChunkMetadata(String device)Get AlignedChunkMetadata of sensors under one deviceList<String>getAllDevices()TsFileDeviceIteratorgetAllDevicesIteratorWithIsAligned()Map<String,TSDataType>getAllMeasurements()get all measurements in this filelonggetAllMetadataSize()Return the whole meta data size of this tsfile, including ChunkMetadata, TimeseriesMetadata and etc.List<Path>getAllPaths()this function return all timeseries namesMap<String,List<TimeseriesMetadata>>getAllTimeseriesMetadata(boolean needChunkMetadata)List<ChunkMetadata>getChunkMetadataList(Path path)List<ChunkMetadata>getChunkMetadataList(Path path, boolean ignoreNotExists)get ChunkMetaDatas of given path, and throw exception if path not existsList<IChunkMetadata>getChunkMetadataListByTimeseriesMetadataOffset(long startOffset, long endOffset)Get chunk metadata list by the start offset and end offset of the timeseries metadata.Map<String,List<String>>getDeviceMeasurementsMap()List<String>getDeviceNameInRange(long start, long end)get device names which has valid chunks in [start, end)voidgetDevicesAndEntriesOfOneLeafNode(Long startOffset, Long endOffset, Queue<Pair<String,long[]>> measurementNodeOffsetQueue)Get devices and first measurement node offset.voidgetDeviceTimeseriesMetadata(List<TimeseriesMetadata> timeseriesMetadataList, MetadataIndexNode measurementNode, Set<String> excludedMeasurementIds, boolean needChunkMetadata)Get timeseries metadata under the measurementNode and put them into timeseriesMetadataList.longgetFileMetadataPos()longgetFileMetadataSize()Return the tsfile meta data size of this tsfile.StringgetFileName()Map<String,TSDataType>getFullPathDataTypeMap()get all types of measurements in this fileList<IChunkMetadata>getIChunkMetadataList(Path path)longgetMaxPlanIndex()Iterator<Map<String,List<ChunkMetadata>>>getMeasurementChunkMetadataListMapIterator(String device)MeasurementSchemagetMeasurementSchema(List<IChunkMetadata> chunkMetadataList)Get measurement schema by chunkMetadatas.protected Pair<MetadataIndexEntry,Long>getMetadataAndEndOffset(MetadataIndexNode metadataIndex, String name, boolean isDeviceLevel, boolean exactSearch)Get target MetadataIndexEntry and its end offsetMetadataIndexNodegetMetadataIndexNode(long startOffset, long endOffset)get metadata index nodelonggetMinPlanIndex()Iterator<List<Path>>getPathsIterator()Map<String,Pair<List<IChunkMetadata>,Pair<Long,Long>>>getTimeseriesMetadataOffsetByDevice(MetadataIndexNode measurementNode, Set<String> excludedMeasurementIds, boolean needChunkMetadata)Get the measurements of current device by its first measurement node.intgetTsFileMetadataSize()inthashCode()booleanisAlignedDevice(MetadataIndexNode measurementNode)Check whether the deivce is aligned or not.booleanisComplete()whether the file is a complete TsFile: only if the head magic and tail magic string exists.voidloadMetadataSize()longposition()voidposition(long offset)BloomFilterreadBloomFilter()this function does not modify the position of the file reader.ByteBufferreadChunk(long position, int dataSize)notice, this function will modify channel's position.ChunkGroupHeaderreadChunkGroupHeader()read data from current position of the input, and deserialize it to a CHUNK_GROUP_FOOTER.ChunkGroupHeaderreadChunkGroupHeader(long position, boolean markerRead)read data from current position of the input, and deserialize it to a CHUNK_GROUP_FOOTER.ChunkHeaderreadChunkHeader(byte chunkType)read data from current position of the input, and deserialize it to a CHUNK_HEADER.Map<String,List<ChunkMetadata>>readChunkMetadataInDevice(String device)read all ChunkMetaDatas of given deviceList<ChunkMetadata>readChunkMetaDataList(TimeseriesMetadata timeseriesMetaData)get ChunkMetaDatas in given TimeseriesMetaDataByteBufferreadCompressedPage(PageHeader header)protected ByteBufferreadData(long position, int totalSize)read data from tsFileInput, from the current position (if position = -1), or the given position.protected ByteBufferreadData(long start, long end)read data from tsFileInput, from the current position (if position = -1), or the given position.Map<String,TimeseriesMetadata>readDeviceMetadata(String device)this function reads measurements and TimeseriesMetaDatas in given device Thread SafeTsFileMetadatareadFileMetadata()this function does not modify the position of the file reader.StringreadHeadMagic()this function does not modify the position of the file reader.List<IChunkMetadata>readIChunkMetaDataList(ITimeSeriesMetadata timeseriesMetaData)List<ITimeSeriesMetadata>readITimeseriesMetadata(String device, Set<String> measurements)ITimeSeriesMetadatareadITimeseriesMetadata(Path path, boolean ignoreNotExists)bytereadMarker()read one byte from the input.ChunkreadMemChunk(ChunkMetadata metaData)read memory chunk.ChunkreadMemChunk(CachedChunkLoaderImpl.ChunkCacheKey chunkCacheKey)read memory chunk.MetadataIndexNodereadMetadataIndexNode(long start, long end)Read MetadataIndexNode by start and end offset.ByteBufferreadPage(PageHeader header, CompressionType type)PageHeaderreadPageHeader(TSDataType type, boolean hasStatistic)not thread safe.voidreadPlanIndex()intreadRaw(long position, int length, ByteBuffer target)notice, the target bytebuffer are not flipped.StringreadTailMagic()this function does not modify the position of the file reader.Pair<CompressionType,TSEncoding>readTimeseriesCompressionTypeAndEncoding(TimeseriesMetadata timeseriesMetadata)read theCompressionTypeandTSEncodingof a timeseries.TimeseriesMetadatareadTimeseriesMetadata(String device, String measurement, boolean ignoreNotExists)List<TimeseriesMetadata>readTimeseriesMetadata(String device, String measurement, Set<String> allSensors)TimeseriesMetadatareadTimeseriesMetadata(Path path, boolean ignoreNotExists)Deprecated.UsereadTimeseriesMetadata(String, String, boolean)instead.bytereadVersionNumber()this function reads version number and checks compatibility of TsFile.longselfCheck(Map<Path,IMeasurementSchema> newSchema, List<ChunkGroupMetadata> chunkGroupMetadataList, boolean fastFinish)Self Check the file and return the position before where the data is safe.longselfCheckWithInfo(String filename, boolean fastFinish, Map<Long,Pair<Path,TimeseriesMetadata>> timeseriesMetadataMap)Self Check the file and return whether the file is safe.voidskipPageData(PageHeader header)
-
-
-
Field Detail
-
config
protected static final TSFileConfig config
-
file
protected String file
-
tsFileInput
protected TsFileInput tsFileInput
-
fileMetadataPos
protected long fileMetadataPos
-
fileMetadataSize
protected int fileMetadataSize
-
tsFileMetaData
protected volatile TsFileMetadata tsFileMetaData
-
-
Constructor Detail
-
TsFileSequenceReader
public TsFileSequenceReader(String file) throws IOException
Create a file reader of the given file. The reader will read the tail of the file to get the file metadata size.Then the reader will skip the first TSFileConfig.MAGIC_STRING.getBytes().length + TSFileConfig.NUMBER_VERSION.getBytes().length bytes of the file for preparing reading real data.- Parameters:
file- the data file- Throws:
IOException- If some I/O error occurs
-
TsFileSequenceReader
public TsFileSequenceReader(String file, boolean loadMetadataSize) throws IOException
construct function for TsFileSequenceReader.- Parameters:
file- -given file nameloadMetadataSize- -whether load meta data size- Throws:
IOException
-
TsFileSequenceReader
public TsFileSequenceReader(String file, boolean loadMetadata, boolean cacheDeviceMetadata) throws IOException
- Throws:
IOException
-
TsFileSequenceReader
public TsFileSequenceReader(TsFileInput input) throws IOException
Create a file reader of the given file. The reader will read the tail of the file to get the file metadata size.Then the reader will skip the first TSFileConfig.MAGIC_STRING.getBytes().length + TSFileConfig.NUMBER_VERSION.getBytes().length bytes of the file for preparing reading real data.- Parameters:
input- given input- Throws:
IOException
-
TsFileSequenceReader
public TsFileSequenceReader(TsFileInput input, boolean loadMetadataSize) throws IOException
construct function for TsFileSequenceReader.- Parameters:
input- -given inputloadMetadataSize- -load meta data size- Throws:
IOException
-
TsFileSequenceReader
public TsFileSequenceReader(TsFileInput input, long fileMetadataPos, int fileMetadataSize)
construct function for TsFileSequenceReader.- Parameters:
input- the input of a tsfile. The current position should be a marker and then a chunk Header, rather than the magic numberfileMetadataPos- the position of the file metadata in the TsFileInput from the beginning of the input to the current positionfileMetadataSize- the byte size of the file metadata in the input
-
-
Method Detail
-
loadMetadataSize
public void loadMetadataSize() throws IOException- Throws:
IOException
-
getFileMetadataPos
public long getFileMetadataPos()
-
getTsFileMetadataSize
public int getTsFileMetadataSize()
-
getFileMetadataSize
public long getFileMetadataSize() throws IOExceptionReturn the tsfile meta data size of this tsfile.- Throws:
IOException
-
getAllMetadataSize
public long getAllMetadataSize() throws IOExceptionReturn the whole meta data size of this tsfile, including ChunkMetadata, TimeseriesMetadata and etc.- Throws:
IOException
-
readTailMagic
public String readTailMagic() throws IOException
this function does not modify the position of the file reader.- Throws:
IOException
-
isComplete
public boolean isComplete() throws IOExceptionwhether the file is a complete TsFile: only if the head magic and tail magic string exists.- Throws:
IOException
-
readHeadMagic
public String readHeadMagic() throws IOException
this function does not modify the position of the file reader.- Throws:
IOException
-
readVersionNumber
public byte readVersionNumber() throws IOExceptionthis function reads version number and checks compatibility of TsFile.- Throws:
IOException
-
readFileMetadata
public TsFileMetadata readFileMetadata() throws IOException
this function does not modify the position of the file reader.- Throws:
IOException- io error
-
readBloomFilter
public BloomFilter readBloomFilter() throws IOException
this function does not modify the position of the file reader.- Throws:
IOException- io error
-
readDeviceMetadata
public Map<String,TimeseriesMetadata> readDeviceMetadata(String device) throws IOException
this function reads measurements and TimeseriesMetaDatas in given device Thread Safe- Parameters:
device- name- Returns:
- the map measurementId -> TimeseriesMetaData in one device
- Throws:
IOException- io error
-
readTimeseriesMetadata
@Deprecated public TimeseriesMetadata readTimeseriesMetadata(Path path, boolean ignoreNotExists) throws IOException
Deprecated.UsereadTimeseriesMetadata(String, String, boolean)instead.- Throws:
IOException
-
readTimeseriesMetadata
public TimeseriesMetadata readTimeseriesMetadata(String device, String measurement, boolean ignoreNotExists) throws IOException
- Throws:
IOException
-
readITimeseriesMetadata
public ITimeSeriesMetadata readITimeseriesMetadata(Path path, boolean ignoreNotExists) throws IOException
- Throws:
IOException
-
readTimeseriesMetadata
public List<TimeseriesMetadata> readTimeseriesMetadata(String device, String measurement, Set<String> allSensors) throws IOException
- Throws:
IOException
-
readITimeseriesMetadata
public List<ITimeSeriesMetadata> readITimeseriesMetadata(String device, Set<String> measurements) throws IOException
- Throws:
IOException
-
binarySearchInTimeseriesMetadataList
protected int binarySearchInTimeseriesMetadataList(List<TimeseriesMetadata> timeseriesMetadataList, String key)
-
getAllDevices
public List<String> getAllDevices() throws IOException
- Throws:
IOException
-
getAllDevicesIteratorWithIsAligned
public TsFileDeviceIterator getAllDevicesIteratorWithIsAligned() throws IOException
- Returns:
- an iterator of "device, isAligned" list, in which names of devices are ordered in dictionary order, and isAligned represents whether the device is aligned. Only read devices on one device leaf node each time to save memory.
- Throws:
IOException
-
getDevicesAndEntriesOfOneLeafNode
public void getDevicesAndEntriesOfOneLeafNode(Long startOffset, Long endOffset, Queue<Pair<String,long[]>> measurementNodeOffsetQueue) throws IOException
Get devices and first measurement node offset.- Parameters:
startOffset- start offset of device leaf nodeendOffset- end offset of device leaf nodemeasurementNodeOffsetQueue- device -> first measurement node offset- Throws:
IOException
-
readChunkMetadataInDevice
public Map<String,List<ChunkMetadata>> readChunkMetadataInDevice(String device) throws IOException
read all ChunkMetaDatas of given device- Parameters:
device- name- Returns:
- measurement -> ChunkMetadata list
- Throws:
IOException- io error
-
getAllPaths
public List<Path> getAllPaths() throws IOException
this function return all timeseries names- Returns:
- list of Paths
- Throws:
IOException- io error
-
getPathsIterator
public Iterator<List<Path>> getPathsIterator() throws IOException
- Returns:
- an iterator of timeseries list, in which names of timeseries are ordered in dictionary order
- Throws:
IOException- io error
-
isAlignedDevice
public boolean isAlignedDevice(MetadataIndexNode measurementNode)
Check whether the deivce is aligned or not.- Parameters:
measurementNode- the next measurement layer node of specific device node
-
getTimeseriesMetadataOffsetByDevice
public Map<String,Pair<List<IChunkMetadata>,Pair<Long,Long>>> getTimeseriesMetadataOffsetByDevice(MetadataIndexNode measurementNode, Set<String> excludedMeasurementIds, boolean needChunkMetadata) throws IOException
Get the measurements of current device by its first measurement node. Also get the chunk metadata list and timeseries metadata offset.- Parameters:
measurementNode- first measurement node of the deviceexcludedMeasurementIds- do not deserialize chunk metadatas whose measurementId is in the set. Notice: It only takes effect when the needChunkMetadata parameter is true.needChunkMetadata- need to deserialize chunk metadatas or not- Returns:
- measurement -> chunk metadata list -> timeseries metadata
- Throws:
IOException
-
getChunkMetadataListByTimeseriesMetadataOffset
public List<IChunkMetadata> getChunkMetadataListByTimeseriesMetadataOffset(long startOffset, long endOffset) throws IOException
Get chunk metadata list by the start offset and end offset of the timeseries metadata.- Parameters:
startOffset- the start offset of timeseries metadataendOffset- the end offset of timeseries metadata- Throws:
IOException
-
getDeviceTimeseriesMetadata
public void getDeviceTimeseriesMetadata(List<TimeseriesMetadata> timeseriesMetadataList, MetadataIndexNode measurementNode, Set<String> excludedMeasurementIds, boolean needChunkMetadata) throws IOException
Get timeseries metadata under the measurementNode and put them into timeseriesMetadataList. Skip timeseries whose measurementId is in the excludedMeasurementIds.- Parameters:
measurementNode- next layer measurement node of specific device leaf nodeexcludedMeasurementIds- skip timeseries whose measurementId is in the set- Throws:
IOException
-
getAllTimeseriesMetadata
public Map<String,List<TimeseriesMetadata>> getAllTimeseriesMetadata(boolean needChunkMetadata) throws IOException
- Throws:
IOException
-
getMetadataAndEndOffset
protected Pair<MetadataIndexEntry,Long> getMetadataAndEndOffset(MetadataIndexNode metadataIndex, String name, boolean isDeviceLevel, boolean exactSearch) throws IOException
Get target MetadataIndexEntry and its end offset- Parameters:
metadataIndex- given MetadataIndexNodename- target device / measurement nameisDeviceLevel- whether target MetadataIndexNode is device levelexactSearch- whether is in exact search mode, return null when there is no entry with name; or else return the nearest MetadataIndexEntry before it (for deeper search)- Returns:
- target MetadataIndexEntry, endOffset pair
- Throws:
IOException
-
readChunkGroupHeader
public ChunkGroupHeader readChunkGroupHeader() throws IOException
read data from current position of the input, and deserialize it to a CHUNK_GROUP_FOOTER.
This method is not threadsafe.- Returns:
- a CHUNK_GROUP_FOOTER
- Throws:
IOException- io error
-
readChunkGroupHeader
public ChunkGroupHeader readChunkGroupHeader(long position, boolean markerRead) throws IOException
read data from current position of the input, and deserialize it to a CHUNK_GROUP_FOOTER.- Parameters:
position- the offset of the chunk group footer in the filemarkerRead- true if the offset does not contains the marker , otherwise false- Returns:
- a CHUNK_GROUP_FOOTER
- Throws:
IOException- io error
-
readPlanIndex
public void readPlanIndex() throws IOException- Throws:
IOException
-
readChunkHeader
public ChunkHeader readChunkHeader(byte chunkType) throws IOException
read data from current position of the input, and deserialize it to a CHUNK_HEADER.
This method is not threadsafe.- Returns:
- a CHUNK_HEADER
- Throws:
IOException- io error
-
readChunk
public ByteBuffer readChunk(long position, int dataSize) throws IOException
notice, this function will modify channel's position.- Parameters:
dataSize- the size of chunkdataposition- the offset of the chunk data- Returns:
- the pages of this chunk
- Throws:
IOException
-
readMemChunk
public Chunk readMemChunk(ChunkMetadata metaData) throws IOException
read memory chunk.- Parameters:
metaData- -given chunk meta data- Returns:
- -chunk
- Throws:
IOException
-
readMemChunk
public Chunk readMemChunk(CachedChunkLoaderImpl.ChunkCacheKey chunkCacheKey) throws IOException
read memory chunk.- Parameters:
chunkCacheKey- given key of chunk LRUCache- Returns:
- chunk
- Throws:
IOException
-
readTimeseriesCompressionTypeAndEncoding
public Pair<CompressionType,TSEncoding> readTimeseriesCompressionTypeAndEncoding(TimeseriesMetadata timeseriesMetadata) throws IOException
read theCompressionTypeandTSEncodingof a timeseries. This method will skip the measurement id, and data type. This method will change the position of this reader.- Parameters:
timeseriesMetadata- timeseries' metadata- Returns:
- a pair of
CompressionTypeandTSEncodingof given timeseries. - Throws:
IOException
-
getMeasurementSchema
public MeasurementSchema getMeasurementSchema(List<IChunkMetadata> chunkMetadataList) throws IOException
Get measurement schema by chunkMetadatas.- Throws:
IOException
-
readPageHeader
public PageHeader readPageHeader(TSDataType type, boolean hasStatistic) throws IOException
not thread safe.- Parameters:
type- given tsfile data type- Throws:
IOException
-
position
public long position() throws IOException- Throws:
IOException
-
position
public void position(long offset) throws IOException- Throws:
IOException
-
skipPageData
public void skipPageData(PageHeader header) throws IOException
- Throws:
IOException
-
readCompressedPage
public ByteBuffer readCompressedPage(PageHeader header) throws IOException
- Throws:
IOException
-
readPage
public ByteBuffer readPage(PageHeader header, CompressionType type) throws IOException
- Throws:
IOException
-
readMarker
public byte readMarker() throws IOExceptionread one byte from the input.
this method is not thread safe- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
getFileName
public String getFileName()
-
fileSize
public long fileSize() throws IOException- Throws:
IOException
-
readData
protected ByteBuffer readData(long position, int totalSize) throws IOException
read data from tsFileInput, from the current position (if position = -1), or the given position.
if position = -1, the tsFileInput's position will be changed to the current position + real data size that been read. Other wise, the tsFileInput's position is not changed.- Parameters:
position- the start position of data in the tsFileInput, or the current position if position = -1totalSize- the size of data that want to read- Returns:
- data that been read.
- Throws:
IOException
-
readData
protected ByteBuffer readData(long start, long end) throws IOException
read data from tsFileInput, from the current position (if position = -1), or the given position.- Parameters:
start- the start position of data in the tsFileInput, or the current position if position = -1end- the end position of data that want to read- Returns:
- data that been read.
- Throws:
IOException
-
readRaw
public int readRaw(long position, int length, ByteBuffer target) throws IOExceptionnotice, the target bytebuffer are not flipped.- Throws:
IOException
-
selfCheck
public long selfCheck(Map<Path,IMeasurementSchema> newSchema, List<ChunkGroupMetadata> chunkGroupMetadataList, boolean fastFinish) throws IOException
Self Check the file and return the position before where the data is safe.- Parameters:
newSchema- the schema on each time series in the filechunkGroupMetadataList- ChunkGroupMetadata ListfastFinish- if true and the file is complete, then newSchema and chunkGroupMetadataList parameter will be not modified.- Returns:
- the position of the file that is fine. All data after the position in the file should be truncated.
- Throws:
IOException
-
selfCheckWithInfo
public long selfCheckWithInfo(String filename, boolean fastFinish, Map<Long,Pair<Path,TimeseriesMetadata>> timeseriesMetadataMap) throws IOException, TsFileStatisticsMistakesException
Self Check the file and return whether the file is safe.- Parameters:
filename- the path of filefastFinish- if true, the method will only check the format of head (Magic String TsFile, Version Number) and tail (Magic String TsFile) of TsFile.- Returns:
- the status of TsFile
- Throws:
IOExceptionTsFileStatisticsMistakesException
-
checkChunkAndPagesStatistics
public long checkChunkAndPagesStatistics(IChunkMetadata chunkMetadata) throws IOException
- Throws:
IOException
-
getChunkMetadataList
public List<ChunkMetadata> getChunkMetadataList(Path path, boolean ignoreNotExists) throws IOException
get ChunkMetaDatas of given path, and throw exception if path not exists- Parameters:
path- timeseries path- Returns:
- List of ChunkMetaData
- Throws:
IOException
-
getIChunkMetadataList
public List<IChunkMetadata> getIChunkMetadataList(Path path) throws IOException
- Throws:
IOException
-
getChunkMetadataList
public List<ChunkMetadata> getChunkMetadataList(Path path) throws IOException
- Throws:
IOException
-
getAlignedChunkMetadata
public List<AlignedChunkMetadata> getAlignedChunkMetadata(String device) throws IOException
Get AlignedChunkMetadata of sensors under one device- Parameters:
device- device name- Throws:
IOException
-
readChunkMetaDataList
public List<ChunkMetadata> readChunkMetaDataList(TimeseriesMetadata timeseriesMetaData) throws IOException
get ChunkMetaDatas in given TimeseriesMetaData- Returns:
- List of ChunkMetaData
- Throws:
IOException
-
readIChunkMetaDataList
public List<IChunkMetadata> readIChunkMetaDataList(ITimeSeriesMetadata timeseriesMetaData)
-
getAllMeasurements
public Map<String,TSDataType> getAllMeasurements() throws IOException
get all measurements in this file- Returns:
- measurement -> datatype
- Throws:
IOException
-
getFullPathDataTypeMap
public Map<String,TSDataType> getFullPathDataTypeMap() throws IOException
get all types of measurements in this file- Returns:
- full path -> datatype
- Throws:
IOException
-
getDeviceMeasurementsMap
public Map<String,List<String>> getDeviceMeasurementsMap() throws IOException
- Throws:
IOException
-
getDeviceNameInRange
public List<String> getDeviceNameInRange(long start, long end) throws IOException
get device names which has valid chunks in [start, end)- Parameters:
start- start of the partitionend- end of the partition- Returns:
- device names in range
- Throws:
IOException
-
getMetadataIndexNode
public MetadataIndexNode getMetadataIndexNode(long startOffset, long endOffset) throws IOException
get metadata index node- Parameters:
startOffset- start read offsetendOffset- end read offset- Returns:
- MetadataIndexNode
- Throws:
IOException
-
getMinPlanIndex
public long getMinPlanIndex()
-
getMaxPlanIndex
public long getMaxPlanIndex()
-
getMeasurementChunkMetadataListMapIterator
public Iterator<Map<String,List<ChunkMetadata>>> getMeasurementChunkMetadataListMapIterator(String device) throws IOException
- Returns:
- An iterator of linked hashmaps ( measurement -> chunk metadata list ). When traversing the linked hashmap, you will get chunk metadata lists according to the lexicographic order of the measurements. The first measurement of the linked hashmap of each iteration is always larger than the last measurement of the linked hashmap of the previous iteration in lexicographic order.
- Throws:
IOException
-
readMetadataIndexNode
public MetadataIndexNode readMetadataIndexNode(long start, long end) throws IOException
Read MetadataIndexNode by start and end offset.- Parameters:
start- the start offset of the MetadataIndexNodeend- the end offset of the MetadataIndexNode- Returns:
- MetadataIndexNode
- Throws:
IOException- IOException
-
-