Class TransactionLog

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class TransactionLog
    extends java.lang.Object
    implements java.io.Closeable
    • Constructor Detail

      • TransactionLog

        public TransactionLog​(TransactionStorage store,
                              java.lang.String baseName)
      • TransactionLog

        public TransactionLog​(TransactionStorage store,
                              java.lang.String baseName,
                              int maxRetries,
                              long retryWait)
    • Method Detail

      • checkpointId

        public long checkpointId()
      • addDocument

        public void addDocument​(IngestDocument doc)
                         throws java.io.IOException
        Add a document update to the transaction log.
        Throws:
        java.io.IOException
      • addDocument

        public void addDocument​(byte[] id,
                                IngestDocument doc)
                         throws java.io.IOException
        Add a document update to the transaction log.
        Throws:
        java.io.IOException
      • deleteDocument

        public void deleteDocument​(java.lang.String id)
                            throws java.io.IOException
        Add a document deletion to the transaction log.
        Throws:
        java.io.IOException
      • deleteDocument

        public void deleteDocument​(byte[] id)
                            throws java.io.IOException
        Add a document deletion to the transaction log.
        Throws:
        java.io.IOException
      • deleteByQuery

        public void deleteByQuery​(Query query)
                           throws java.io.IOException
        Add a query deletion to the transaction log.
        Throws:
        java.io.IOException
      • addMessage

        public void addMessage​(PlatformMessage msg)
                        throws java.io.IOException
        Add a PlatformMessage to the transaction log.
        Throws:
        java.io.IOException
      • prepareCheckpoint

        public long prepareCheckpoint​(long maxSize)
        Flush the transaction log to stable storage, optionally closing the current checkpoint if the log exceeds maxSize.
      • prepareCheckpoint

        public long prepareCheckpoint()
        Close current traction log.
      • checkpointSpecific

        public 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

      • recoverableCheckpoints

        public int recoverableCheckpoints()
      • truncate

        public void truncate()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • checkpoint

        public void checkpoint​(long flushId)
                        throws java.io.IOException
        Delete all transaction logs older than (but not including) flushId
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • initialize

        public long initialize()
                        throws java.io.IOException
        Initialize any saved checkpoints.
        Throws:
        java.io.IOException
      • initialize

        public <T extends TransactionReceiver> T initialize​(T receiver)
                                                     throws java.io.IOException
        Initialize and replay transaction log.
        Throws:
        java.io.IOException
      • cancelRecovery

        public void cancelRecovery()
      • recover

        public <T extends TransactionReceiver> T recover​(T receiver)
                                                  throws java.io.IOException
        Replay the transaction log, passing events to receiver.
        Throws:
        java.io.IOException