Interface ITimeIndex

    • 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.IOException
        serialize 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 PartitionViolationException
        get 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 name
        time - start time
      • updateEndTime

        void updateEndTime​(java.lang.String deviceId,
                           long time)
        update end time
        Parameters:
        deviceId - device name
        time - end time
      • putStartTime

        void putStartTime​(java.lang.String deviceId,
                          long time)
        put start time
        Parameters:
        deviceId - device name
        time - start time
      • putEndTime

        void putEndTime​(java.lang.String deviceId,
                        long time)
        put end time
        Parameters:
        deviceId - device name
        time - 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