Package com.attivio.util.ft
Class TransactionLog
- java.lang.Object
- 
- com.attivio.util.ft.TransactionLog
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable
 
 public class TransactionLog extends java.lang.Object implements java.io.Closeable
- 
- 
Field SummaryFields Modifier and Type Field Description protected static byteADD_DOCUMENT_FRAMEprotected static byteADD_MESSAGE_FRAMEstatic intDEFAULT_MAX_RETRIESstatic longDEFAULT_RETRY_WAITprotected static byteDEL_DOCUMENT_FRAMEprotected static byteDEL_QUERY_FRAMEprotected AttivioLoggerlog
 - 
Constructor SummaryConstructors Constructor Description TransactionLog(TransactionStorage store, java.lang.String baseName)TransactionLog(TransactionStorage store, java.lang.String baseName, int maxRetries, long retryWait)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDocument(byte[] id, IngestDocument doc)Add a document update to the transaction log.voidaddDocument(IngestDocument doc)Add a document update to the transaction log.voidaddMessage(PlatformMessage msg)Add aPlatformMessageto the transaction log.voidcancelRecovery()voidcheckpoint(long flushId)Delete all transaction logs older than (but not including)flushIdlongcheckpointId()voidcheckpointSpecific(long checkpoint)Deletes a set of checkpoint files given a set of checkpoint ids.voidclose()voiddeleteByQuery(Query query)Add a query deletion to the transaction log.voiddeleteDocument(byte[] id)Add a document deletion to the transaction log.voiddeleteDocument(java.lang.String id)Add a document deletion to the transaction log.TransactionStoragegetStorage()longinitialize()Initialize any saved checkpoints.<T extends TransactionReceiver>
 Tinitialize(T receiver)Initialize and replay transaction log.longprepareCheckpoint()Close current traction log.longprepareCheckpoint(long maxSize)Flush the transaction log to stable storage, optionally closing the current checkpoint if the log exceedsmaxSize.<T extends TransactionReceiver>
 Trecover(T receiver)Replay the transaction log, passing events toreceiver.intrecoverableCheckpoints()voidtruncate()protected voidwriteFrame(TransactionStorage.FrameOutputStream frame)
 
- 
- 
- 
Field Detail- 
DEFAULT_MAX_RETRIESpublic static final int DEFAULT_MAX_RETRIES - See Also:
- Constant Field Values
 
 - 
DEFAULT_RETRY_WAITpublic static final long DEFAULT_RETRY_WAIT - See Also:
- Constant Field Values
 
 - 
logprotected final AttivioLogger log 
 - 
ADD_DOCUMENT_FRAMEprotected static final byte ADD_DOCUMENT_FRAME - See Also:
- Constant Field Values
 
 - 
DEL_DOCUMENT_FRAMEprotected static final byte DEL_DOCUMENT_FRAME - See Also:
- Constant Field Values
 
 - 
DEL_QUERY_FRAMEprotected static final byte DEL_QUERY_FRAME - See Also:
- Constant Field Values
 
 - 
ADD_MESSAGE_FRAMEprotected static final byte ADD_MESSAGE_FRAME - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
TransactionLogpublic TransactionLog(TransactionStorage store, java.lang.String baseName) 
 - 
TransactionLogpublic TransactionLog(TransactionStorage store, java.lang.String baseName, int maxRetries, long retryWait) 
 
- 
 - 
Method Detail- 
checkpointIdpublic long checkpointId() 
 - 
getStoragepublic TransactionStorage getStorage() 
 - 
writeFrameprotected void writeFrame(TransactionStorage.FrameOutputStream frame) throws java.io.IOException - Throws:
- java.io.IOException
 
 - 
addDocumentpublic void addDocument(IngestDocument doc) throws java.io.IOException Add a document update to the transaction log.- Throws:
- java.io.IOException
 
 - 
addDocumentpublic void addDocument(byte[] id, IngestDocument doc) throws java.io.IOExceptionAdd a document update to the transaction log.- Throws:
- java.io.IOException
 
 - 
deleteDocumentpublic void deleteDocument(java.lang.String id) throws java.io.IOExceptionAdd a document deletion to the transaction log.- Throws:
- java.io.IOException
 
 - 
deleteDocumentpublic void deleteDocument(byte[] id) throws java.io.IOExceptionAdd a document deletion to the transaction log.- Throws:
- java.io.IOException
 
 - 
deleteByQuerypublic void deleteByQuery(Query query) throws java.io.IOException Add a query deletion to the transaction log.- Throws:
- java.io.IOException
 
 - 
addMessagepublic void addMessage(PlatformMessage msg) throws java.io.IOException Add aPlatformMessageto the transaction log.- Throws:
- java.io.IOException
 
 - 
prepareCheckpointpublic long prepareCheckpoint(long maxSize) Flush the transaction log to stable storage, optionally closing the current checkpoint if the log exceedsmaxSize.
 - 
prepareCheckpointpublic long prepareCheckpoint() Close current traction log.
 - 
checkpointSpecificpublic void checkpointSpecific(long checkpoint) Deletes a set of checkpoint files given a set of checkpoint ids.Note that this traverses backwards through the checkpoint list and thus is optimized for recent checkpoints 
 - 
recoverableCheckpointspublic int recoverableCheckpoints() 
 - 
truncatepublic void truncate() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
checkpointpublic void checkpoint(long flushId) throws java.io.IOExceptionDelete all transaction logs older than (but not including)flushId- Throws:
- java.io.IOException
 
 - 
closepublic void close() throws java.io.IOException- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Throws:
- java.io.IOException
 
 - 
initializepublic long initialize() throws java.io.IOExceptionInitialize any saved checkpoints.- Throws:
- java.io.IOException
 
 - 
initializepublic <T extends TransactionReceiver> T initialize(T receiver) throws java.io.IOException Initialize and replay transaction log.- Throws:
- java.io.IOException
 
 - 
cancelRecoverypublic void cancelRecovery() 
 - 
recoverpublic <T extends TransactionReceiver> T recover(T receiver) throws java.io.IOException Replay the transaction log, passing events toreceiver.- Throws:
- java.io.IOException
 
 
- 
 
-