Class FileTimeIndex
- java.lang.Object
-
- org.apache.iotdb.db.engine.storagegroup.timeindex.FileTimeIndex
-
- All Implemented Interfaces:
ITimeIndex
public class FileTimeIndex extends java.lang.Object implements ITimeIndex
-
-
Field Summary
Fields Modifier and Type Field Description protected longendTimeend times.protected longstartTimestart time-
Fields inherited from interface org.apache.iotdb.db.engine.storagegroup.timeindex.ITimeIndex
SPANS_MULTI_TIME_PARTITIONS_FLAG_ID
-
-
Constructor Summary
Constructors Constructor Description FileTimeIndex()FileTimeIndex(long startTime, long endTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcalculateRamSize()booleancheckDeviceIdExist(java.lang.String deviceId)check whether deviceId exists in TsFilevoidclose()do something when TsFileResource is closing (may be empty method)intcompareDegradePriority(ITimeIndex timeIndex)compare the priority of two ITimeIndexFileTimeIndexdeserialize(java.io.InputStream inputStream)deserialize from inputStreamFileTimeIndexdeserialize(java.nio.ByteBuffer buffer)deserialize from byte bufferbooleanendTimeEmpty()java.util.Set<java.lang.String>getDevices(java.lang.String tsFilePath, TsFileResource tsFileResource)get devices in TimeIndexlonggetEndTime(java.lang.String deviceId)get end time of devicelonggetMaxEndTime()get max end time of devicelonggetMinStartTime()get min start time of devicelonggetStartTime(java.lang.String deviceId)get start time of devicelonggetTimePartition(java.lang.String tsFilePath)get time partitionlonggetTimePartitionWithCheck(java.lang.String tsFilePath)get time partition with check.booleanisSpanMultiTimePartitions()Check whether the tsFile spans multiple time partitions.booleanmayContainsDevice(java.lang.String device)Whether this TsFile contains this device, if false, it must not contain this device, if true, it may or may not contain this devicevoidputEndTime(java.lang.String deviceId, long time)put end timevoidputStartTime(java.lang.String deviceId, long time)put start timevoidserialize(java.io.OutputStream outputStream)serialize to outputStreambooleanstillLives(long ttlLowerBound)voidupdateEndTime(java.lang.String deviceId, long time)update end timevoidupdateStartTime(java.lang.String deviceId, long time)update start time
-
-
-
Method Detail
-
serialize
public void serialize(java.io.OutputStream outputStream) throws java.io.IOExceptionDescription copied from interface:ITimeIndexserialize to outputStream- Specified by:
serializein interfaceITimeIndex- Parameters:
outputStream- outputStream- Throws:
java.io.IOException
-
deserialize
public FileTimeIndex deserialize(java.io.InputStream inputStream) throws java.io.IOException
Description copied from interface:ITimeIndexdeserialize from inputStream- Specified by:
deserializein interfaceITimeIndex- Parameters:
inputStream- inputStream- Returns:
- TimeIndex
- Throws:
java.io.IOException
-
deserialize
public FileTimeIndex deserialize(java.nio.ByteBuffer buffer)
Description copied from interface:ITimeIndexdeserialize from byte buffer- Specified by:
deserializein interfaceITimeIndex- Parameters:
buffer- byte buffer- Returns:
- TimeIndex
-
close
public void close()
Description copied from interface:ITimeIndexdo something when TsFileResource is closing (may be empty method)- Specified by:
closein interfaceITimeIndex
-
getDevices
public java.util.Set<java.lang.String> getDevices(java.lang.String tsFilePath, TsFileResource tsFileResource)Description copied from interface:ITimeIndexget devices in TimeIndex- Specified by:
getDevicesin interfaceITimeIndex- Returns:
- device names
-
endTimeEmpty
public boolean endTimeEmpty()
- Specified by:
endTimeEmptyin interfaceITimeIndex- Returns:
- whether end time is empty (Long.MIN_VALUE)
-
stillLives
public boolean stillLives(long ttlLowerBound)
- Specified by:
stillLivesin interfaceITimeIndex- Parameters:
ttlLowerBound- time lower bound- Returns:
- whether any of the device lives over the given time bound
-
calculateRamSize
public long calculateRamSize()
- Specified by:
calculateRamSizein interfaceITimeIndex- Returns:
- Calculate file index ram size
-
getTimePartition
public long getTimePartition(java.lang.String tsFilePath)
Description copied from interface:ITimeIndexget time partition- Specified by:
getTimePartitionin interfaceITimeIndex- Parameters:
tsFilePath- tsFile absolute path- Returns:
- partition
-
getTimePartitionWithCheck
public long getTimePartitionWithCheck(java.lang.String tsFilePath) throws PartitionViolationExceptionDescription copied from interface:ITimeIndexget time partition with check. If data of tsFile spans partitions, an exception will be thrown- Specified by:
getTimePartitionWithCheckin interfaceITimeIndex- Parameters:
tsFilePath- tsFile path- Returns:
- partition
- Throws:
PartitionViolationException- data of tsFile spans partitions
-
isSpanMultiTimePartitions
public boolean isSpanMultiTimePartitions()
Description copied from interface:ITimeIndexCheck whether the tsFile spans multiple time partitions.- Specified by:
isSpanMultiTimePartitionsin interfaceITimeIndex- Returns:
- true if the tsFile spans multiple time partitions, otherwise false.
-
updateStartTime
public void updateStartTime(java.lang.String deviceId, long time)Description copied from interface:ITimeIndexupdate start time- Specified by:
updateStartTimein interfaceITimeIndex- Parameters:
deviceId- device nametime- start time
-
updateEndTime
public void updateEndTime(java.lang.String deviceId, long time)Description copied from interface:ITimeIndexupdate end time- Specified by:
updateEndTimein interfaceITimeIndex- Parameters:
deviceId- device nametime- end time
-
putStartTime
public void putStartTime(java.lang.String deviceId, long time)Description copied from interface:ITimeIndexput start time- Specified by:
putStartTimein interfaceITimeIndex- Parameters:
deviceId- device nametime- start time
-
putEndTime
public void putEndTime(java.lang.String deviceId, long time)Description copied from interface:ITimeIndexput end time- Specified by:
putEndTimein interfaceITimeIndex- Parameters:
deviceId- device nametime- end time
-
getStartTime
public long getStartTime(java.lang.String deviceId)
Description copied from interface:ITimeIndexget start time of device- Specified by:
getStartTimein interfaceITimeIndex- Parameters:
deviceId- device name- Returns:
- start time
-
getMinStartTime
public long getMinStartTime()
Description copied from interface:ITimeIndexget min start time of device- Specified by:
getMinStartTimein interfaceITimeIndex- Returns:
- min start time
-
getEndTime
public long getEndTime(java.lang.String deviceId)
Description copied from interface:ITimeIndexget end time of device- Specified by:
getEndTimein interfaceITimeIndex- Parameters:
deviceId- device name- Returns:
- end time
-
getMaxEndTime
public long getMaxEndTime()
Description copied from interface:ITimeIndexget max end time of device- Specified by:
getMaxEndTimein interfaceITimeIndex- Returns:
- max end time
-
checkDeviceIdExist
public boolean checkDeviceIdExist(java.lang.String deviceId)
Description copied from interface:ITimeIndexcheck whether deviceId exists in TsFile- Specified by:
checkDeviceIdExistin interfaceITimeIndex- Parameters:
deviceId- device name- Returns:
- true if the deviceId may exist in TsFile, otherwise false.
-
compareDegradePriority
public int compareDegradePriority(ITimeIndex timeIndex)
Description copied from interface:ITimeIndexcompare the priority of two ITimeIndex- Specified by:
compareDegradePriorityin interfaceITimeIndex- Parameters:
timeIndex- another timeIndex- Returns:
- value is less than 0 if the priority of this timeIndex is higher than the argument, value is equal to 0 if the priority of this timeIndex is equal to the argument, value is larger than 0 if the priority of this timeIndex is less than the argument
-
mayContainsDevice
public boolean mayContainsDevice(java.lang.String device)
Description copied from interface:ITimeIndexWhether this TsFile contains this device, if false, it must not contain this device, if true, it may or may not contain this device- Specified by:
mayContainsDevicein interfaceITimeIndex
-
-