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

    Modifier and Type
    Method
    Description
    void
    Abort the compaction log.
    long
    addEntry(long ledgerId, io.netty.buffer.ByteBuf entry)
    Add an entry to the log.
    void
    Clean up any temporary resources that were used by the compaction process.
    void
    Flush any unwritten entries to physical storage.
    long
    Get the log ID of the entrylog to which compacted entries are being written.
    long
    Get the log ID of the entrylog which is being compacted.
    void
    Make the log written by the compaction process available for reads.
    void
    Mark the compaction log as compacted.
    void
    Scan the entry log, reading out all contained entries.
  • Method Details

    • addEntry

      long addEntry(long ledgerId, io.netty.buffer.ByteBuf entry) throws 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:
      IOException
    • scan

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

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

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

      void markCompacted() throws 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:
      IOException
    • makeAvailable

      void makeAvailable() throws IOException
      Make the log written by the compaction process available for reads.
      Throws:
      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.