Interface ISegment

  • All Known Implementing Classes:
    Segment

    public interface ISegment
    This interface interacts with segment bytebuffer.
    • Method Detail

      • insertRecord

        int insertRecord​(java.lang.String key,
                         java.nio.ByteBuffer buffer)
                  throws RecordDuplicatedException
        check whether enough space, notice that pairLength including 3 parts: [var length] key string itself, [int, 4 bytes] length of key string, [short, 2 bytes] key address
        Returns:
        -1 for segment overflow, otherwise for spare space
        Throws:
        RecordDuplicatedException
      • removeRecord

        int removeRecord​(java.lang.String key)
      • getRecordAsIMNode

        IMNode getRecordAsIMNode​(java.lang.String key)
                          throws org.apache.iotdb.commons.exception.MetadataException
        get a MNode by its name or alias
        Parameters:
        key - name or alias of the target node
        Returns:
        node instance
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • hasRecordKey

        boolean hasRecordKey​(java.lang.String key)
      • hasRecordAlias

        boolean hasRecordAlias​(java.lang.String alias)
      • getAllRecords

        java.util.Queue<IMNode> getAllRecords()
                                       throws org.apache.iotdb.commons.exception.MetadataException
        Throws:
        org.apache.iotdb.commons.exception.MetadataException
      • syncBuffer

        void syncBuffer()
        Records are always sync with buffer, but header and key-address list are not. This method sync these values to the buffer.
      • size

        short size()
      • getSpareSize

        short getSpareSize()
      • delete

        void delete()
      • getPrevSegAddress

        long getPrevSegAddress()
      • getNextSegAddress

        long getNextSegAddress()
      • setPrevSegAddress

        void setPrevSegAddress​(long prevSegAddress)
      • setNextSegAddress

        void setNextSegAddress​(long nextSegAddress)
      • extendsTo

        void extendsTo​(java.nio.ByteBuffer newBuffer)
        This method will write info into a buffer equal or larger to existed one. There is no need to call sync before this method, since it will flush header and key-offset list directly.
        Parameters:
        newBuffer - target buffer
      • toString

        java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • inspect

        java.lang.String inspect()