Class PipeOpManager
- java.lang.Object
-
- org.apache.iotdb.db.sync.datasource.PipeOpManager
-
public class PipeOpManager extends java.lang.ObjectThis class' function: 1) manage the all Data from Tsfile/DeleteFile etc. 2) It will simulate 1 operation queue to let consumers get. *
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePipeOpManager.NewDataEventHandler
-
Constructor Summary
Constructors Constructor Description PipeOpManager(TsFilePipe filePipe)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendDeletionOpBlock(java.lang.String sgName, Deletion deletion, long pipeDataSerialNumber)Add 1 DeletionBlock to pipeOpSgManager.voidappendOpBlock(java.lang.String sgName, AbstractOpBlock opBlockEntry)Append 1 data BlockEntry to pipeOpManagervoidappendTsFileOpBlock(java.lang.String sgName, java.lang.String tsFilename, java.lang.String modsFileFullName, long pipeDataSerialNumber)Add 1 TsFileOpBlock to PipeOpManager.voidclose()release the resource of PipeSrcManagervoidcommitData(java.lang.String sgName, long committedIndex)Notify that the data (whose index <= committedIndex) has been committed.longgetCommittedIndex(java.lang.String sgName)Get the committed Index .longgetFirstAvailableIndex(java.lang.String sgName)Get the first available data in dedicated StorageGroup.intgetInUseOpBlockNum()Get the number of in-using opBlocks in PipeOpManager.longgetNextIndex(java.lang.String sgName)Get the data index next to the last available data of StorageGroupOperationgetOperation(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()booleanisEmpty()Check whether PipeOpManager has no data(OpBlocks)booleanopBlockNeedCommit(java.lang.String sgName, long commitIndex)check whether this data commitIndex will cause committing 1 or more complete opBlockvoidsetNewDataEventHandler(PipeOpManager.NewDataEventHandler newDataEventHandler)Set NewDataEventHandler to get notification when new data arrive.
-
-
-
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.IOExceptionAdd 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 Namedeletion-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.IOExceptioncheck 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 NamecommittedIndex- , 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
-
-