Interface ITimeIndex
-
- All Known Implementing Classes:
DeviceTimeIndex,FileTimeIndex,V012FileTimeIndex
public interface ITimeIndex
-
-
Field Summary
Fields Modifier and Type Field Description static intSPANS_MULTI_TIME_PARTITIONS_FLAG_ID
-
Method Summary
All Methods Instance Methods Abstract 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 ITimeIndexITimeIndexdeserialize(java.io.InputStream inputStream)deserialize from inputStreamITimeIndexdeserialize(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
-
-
-
Field Detail
-
SPANS_MULTI_TIME_PARTITIONS_FLAG_ID
static final int SPANS_MULTI_TIME_PARTITIONS_FLAG_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
serialize
void serialize(java.io.OutputStream outputStream) throws java.io.IOExceptionserialize to outputStream- Parameters:
outputStream- outputStream- Throws:
java.io.IOException
-
deserialize
ITimeIndex deserialize(java.io.InputStream inputStream) throws java.io.IOException
deserialize from inputStream- Parameters:
inputStream- inputStream- Returns:
- TimeIndex
- Throws:
java.io.IOException
-
deserialize
ITimeIndex deserialize(java.nio.ByteBuffer buffer)
deserialize from byte buffer- Parameters:
buffer- byte buffer- Returns:
- TimeIndex
-
close
void close()
do something when TsFileResource is closing (may be empty method)
-
getDevices
java.util.Set<java.lang.String> getDevices(java.lang.String tsFilePath, TsFileResource tsFileResource)get devices in TimeIndex- Returns:
- device names
-
endTimeEmpty
boolean endTimeEmpty()
- Returns:
- whether end time is empty (Long.MIN_VALUE)
-
stillLives
boolean stillLives(long ttlLowerBound)
- Parameters:
ttlLowerBound- time lower bound- Returns:
- whether any of the device lives over the given time bound
-
calculateRamSize
long calculateRamSize()
- Returns:
- Calculate file index ram size
-
getTimePartition
long getTimePartition(java.lang.String tsFilePath)
get time partition- Parameters:
tsFilePath- tsFile absolute path- Returns:
- partition
-
getTimePartitionWithCheck
long getTimePartitionWithCheck(java.lang.String tsFilePath) throws PartitionViolationExceptionget time partition with check. If data of tsFile spans partitions, an exception will be thrown- Parameters:
tsFilePath- tsFile path- Returns:
- partition
- Throws:
PartitionViolationException- data of tsFile spans partitions
-
isSpanMultiTimePartitions
boolean isSpanMultiTimePartitions()
Check whether the tsFile spans multiple time partitions.- Returns:
- true if the tsFile spans multiple time partitions, otherwise false.
-
updateStartTime
void updateStartTime(java.lang.String deviceId, long time)update start time- Parameters:
deviceId- device nametime- start time
-
updateEndTime
void updateEndTime(java.lang.String deviceId, long time)update end time- Parameters:
deviceId- device nametime- end time
-
putStartTime
void putStartTime(java.lang.String deviceId, long time)put start time- Parameters:
deviceId- device nametime- start time
-
putEndTime
void putEndTime(java.lang.String deviceId, long time)put end time- Parameters:
deviceId- device nametime- end time
-
getStartTime
long getStartTime(java.lang.String deviceId)
get start time of device- Parameters:
deviceId- device name- Returns:
- start time
-
getEndTime
long getEndTime(java.lang.String deviceId)
get end time of device- Parameters:
deviceId- device name- Returns:
- end time
-
checkDeviceIdExist
boolean checkDeviceIdExist(java.lang.String deviceId)
check whether deviceId exists in TsFile- Parameters:
deviceId- device name- Returns:
- true if the deviceId may exist in TsFile, otherwise false.
-
getMinStartTime
long getMinStartTime()
get min start time of device- Returns:
- min start time
-
getMaxEndTime
long getMaxEndTime()
get max end time of device- Returns:
- max end time
-
compareDegradePriority
int compareDegradePriority(ITimeIndex timeIndex)
compare the priority of two ITimeIndex- 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
boolean mayContainsDevice(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 device
-
-