Interface CompactionEntryLog

  • All Known Implementing Classes:
    DirectCompactionEntryLog

    public interface CompactionEntryLog
    An entrylog to received compacted entries.

    The expected lifecycle for a compaction entry log is: 1. Creation 2. Mark compacted 3. Make available 4. Cleanup

    Abort can happen at during any step.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void abort()
      Abort the compaction log.
      long addEntry​(long ledgerId, io.netty.buffer.ByteBuf entry)
      Add an entry to the log.
      void finalizeAndCleanup()
      Clean up any temporary resources that were used by the compaction process.
      void flush()
      Flush any unwritten entries to physical storage.
      long getDstLogId()
      Get the log ID of the entrylog to which compacted entries are being written.
      long getSrcLogId()
      Get the log ID of the entrylog which is being compacted.
      void makeAvailable()
      Make the log written by the compaction process available for reads.
      void markCompacted()
      Mark the compaction log as compacted.
      void scan​(EntryLogScanner scanner)
      Scan the entry log, reading out all contained entries.
    • Method Detail

      • addEntry

        long addEntry​(long ledgerId,
                      io.netty.buffer.ByteBuf entry)
               throws java.io.IOException
        Add an entry to the log.
        Parameters:
        ledgerId - the ledger the entry belong to
        entry - the payload of the entry
        Returns:
        the position to which the entry was written
        Throws:
        java.io.IOException
      • scan

        void scan​(EntryLogScanner scanner)
           throws java.io.IOException
        Scan the entry log, reading out all contained entries.
        Throws:
        java.io.IOException
      • flush

        void flush()
            throws java.io.IOException
        Flush any unwritten entries to physical storage.
        Throws:
        java.io.IOException
      • abort

        void abort()
        Abort the compaction log. This should delete any resources held by this log.
      • markCompacted

        void markCompacted()
                    throws java.io.IOException
        Mark the compaction log as compacted. From this point, the heavy work of copying entries from one log to another should be done. We don't want to repeat that work, so this method should take steps to ensure that if the bookie crashes we can resume the compaction from this point.
        Throws:
        java.io.IOException
      • makeAvailable

        void makeAvailable()
                    throws java.io.IOException
        Make the log written by the compaction process available for reads.
        Throws:
        java.io.IOException
      • finalizeAndCleanup

        void finalizeAndCleanup()
        Clean up any temporary resources that were used by the compaction process.
      • getDstLogId

        long getDstLogId()
        Get the log ID of the entrylog to which compacted entries are being written.
      • getSrcLogId

        long getSrcLogId()
        Get the log ID of the entrylog which is being compacted.