Class PipeOpSgManager


  • public class PipeOpSgManager
    extends java.lang.Object
    This class manage the operation data for 1 StorageGroup
    • Constructor Summary

      Constructors 
      Constructor Description
      PipeOpSgManager​(java.lang.String storageGroupName)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPipeOpBlock​(AbstractOpBlock opBlock)
      Add 1 new operation block to SG
      java.util.List<java.lang.Long> commitData​(long committedIndex)
      Notify that the data (whose index <= committedIndex) has been committed.
      long getFirstAvailableIndex()
      Get the first available data.
      long getNextIndex()
      Get Next Operation Index after last operation.
      Operation getOperation​(long beginIndex, long length)
      Get Operations from current StorageGroup.
      boolean isEmpty()  
      boolean opBlockNeedCommit​(long commitIndex)
      Check whether this data commit-index will cause committing some opBlocks
      • Methods inherited from class java.lang.Object

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

      • PipeOpSgManager

        public PipeOpSgManager​(java.lang.String storageGroupName)
    • Method Detail

      • addPipeOpBlock

        public void addPipeOpBlock​(AbstractOpBlock opBlock)
        Add 1 new operation block to SG
        Parameters:
        opBlock - , 1 new operation block
      • getOperation

        public Operation getOperation​(long beginIndex,
                                      long length)
                               throws java.io.IOException
        Get Operations from current StorageGroup. returned Operations rang is [beginIndex, endIndex), endIndex <= (beginIndex+length). Note: Real returned Operations size can be <= length
        Parameters:
        beginIndex - , the start beginIndex of operation
        length - , the max number of operations
        Returns:
        Throws:
        java.io.IOException
      • opBlockNeedCommit

        public boolean opBlockNeedCommit​(long commitIndex)
                                  throws java.io.IOException
        Check whether this data commit-index will cause committing some opBlocks
        Parameters:
        commitIndex -
        Returns:
        Throws:
        java.io.IOException
      • getFirstAvailableIndex

        public long getFirstAvailableIndex()
        Get the first available data. Note: Even if those committed data may still be available as long as it is not deleted.
        Returns:
      • getNextIndex

        public long getNextIndex()
        Get Next Operation Index after last operation.
        Returns:
      • isEmpty

        public boolean isEmpty()
      • commitData

        public java.util.List<java.lang.Long> commitData​(long committedIndex)
        Notify that the data (whose index <= committedIndex) has been committed. May remove the data entry whose whole data's index <= committedIndex.
        Parameters:
        committedIndex -
        Returns:
        If successful, return filePipeSerialNumber. Otherwise, return Long.MIN_VALUE.