Class PipeOpManager


  • public class PipeOpManager
    extends java.lang.Object
    This class' function: 1) manage the all Data from Tsfile/DeleteFile etc. 2) It will simulate 1 operation queue to let consumers get. *
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void appendDeletionOpBlock​(java.lang.String sgName, Deletion deletion, long pipeDataSerialNumber)
      Add 1 DeletionBlock to pipeOpSgManager.
      void appendOpBlock​(java.lang.String sgName, AbstractOpBlock opBlockEntry)
      Append 1 data BlockEntry to pipeOpManager
      void appendTsFileOpBlock​(java.lang.String sgName, java.lang.String tsFilename, java.lang.String modsFileFullName, long pipeDataSerialNumber)
      Add 1 TsFileOpBlock to PipeOpManager.
      void close()
      release the resource of PipeSrcManager
      void commitData​(java.lang.String sgName, long committedIndex)
      Notify that the data (whose index <= committedIndex) has been committed.
      long getCommittedIndex​(java.lang.String sgName)
      Get the committed Index .
      long getFirstAvailableIndex​(java.lang.String sgName)
      Get the first available data in dedicated StorageGroup.
      int getInUseOpBlockNum()
      Get the number of in-using opBlocks in PipeOpManager.
      long getNextIndex​(java.lang.String sgName)
      Get the data index next to the last available data of StorageGroup
      Operation getOperation​(java.lang.String sgName, long index, long length)
      Use SG and index to get Operation from all data files (Tsfile/.modes etc.).
      java.util.Set<java.lang.String> getSgSet()  
      boolean isEmpty()
      Check whether PipeOpManager has no data(OpBlocks)
      boolean opBlockNeedCommit​(java.lang.String sgName, long commitIndex)
      check whether this data commitIndex will cause committing 1 or more complete opBlock
      void setNewDataEventHandler​(PipeOpManager.NewDataEventHandler newDataEventHandler)
      Set NewDataEventHandler to get notification when new data arrive.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PipeOpManager

        public PipeOpManager​(TsFilePipe filePipe)
    • Method Detail

      • getSgSet

        public java.util.Set<java.lang.String> getSgSet()
      • appendOpBlock

        public void appendOpBlock​(java.lang.String sgName,
                                  AbstractOpBlock opBlockEntry)
        Append 1 data BlockEntry to pipeOpManager
        Parameters:
        sgName -
        opBlockEntry -
      • appendTsFileOpBlock

        public void appendTsFileOpBlock​(java.lang.String sgName,
                                        java.lang.String tsFilename,
                                        java.lang.String modsFileFullName,
                                        long pipeDataSerialNumber)
                                 throws java.io.IOException
        Add 1 TsFileOpBlock to PipeOpManager. *
        Parameters:
        sgName -
        tsFilename -
        modsFileFullName -
        pipeDataSerialNumber -
        Throws:
        java.io.IOException
      • appendDeletionOpBlock

        public void appendDeletionOpBlock​(java.lang.String sgName,
                                          Deletion deletion,
                                          long pipeDataSerialNumber)
        Add 1 DeletionBlock to pipeOpSgManager.
        Parameters:
        sgName - - StorageGroup Name
        deletion -
        pipeDataSerialNumber -
      • getOperation

        public Operation getOperation​(java.lang.String sgName,
                                      long index,
                                      long length)
                               throws java.io.IOException
        Use SG and index to get Operation from all data files (Tsfile/.modes etc.). 1 Operation may contain multiple data points.
        Parameters:
        sgName -
        index -
        Returns:
        Throws:
        java.io.IOException
      • opBlockNeedCommit

        public boolean opBlockNeedCommit​(java.lang.String sgName,
                                         long commitIndex)
                                  throws java.io.IOException
        check whether this data commitIndex will cause committing 1 or more complete opBlock
        Parameters:
        sgName -
        commitIndex -
        Returns:
        Throws:
        java.io.IOException
      • getCommittedIndex

        public long getCommittedIndex​(java.lang.String sgName)
        Get the committed Index . Note: The return result may be not same to the value set by last commitData()
        Parameters:
        sgName -
        Returns:
      • getFirstAvailableIndex

        public long getFirstAvailableIndex​(java.lang.String sgName)
        Get the first available data in dedicated StorageGroup. Note: Even if those committed data may still be available as long as it is not deleted.
        Parameters:
        sgName -
        Returns:
      • getInUseOpBlockNum

        public int getInUseOpBlockNum()
        Get the number of in-using opBlocks in PipeOpManager. If return 0, means all FilePipes in PipeOpManager have been consumed.
        Returns:
      • isEmpty

        public boolean isEmpty()
        Check whether PipeOpManager has no data(OpBlocks)
        Returns:
        True - PipeOpManager has no Pipe data
      • commitData

        public void commitData​(java.lang.String sgName,
                               long committedIndex)
        Notify that the data (whose index <= committedIndex) has been committed. May remove the data entry whose whole data's index <= committedIndex.
        Parameters:
        sgName - , StorageGroup Name
        committedIndex - , the data (whose index <= committedIndex) may be removed.
      • getNextIndex

        public long getNextIndex​(java.lang.String sgName)
        Get the data index next to the last available data of StorageGroup
        Parameters:
        sgName -
        Returns:
      • setNewDataEventHandler

        public void setNewDataEventHandler​(PipeOpManager.NewDataEventHandler newDataEventHandler)
        Set NewDataEventHandler to get notification when new data arrive. This function is optionally used.
        Parameters:
        newDataEventHandler -
      • close

        public void close()
        release the resource of PipeSrcManager