Interface CompactionEntryLog
-
- All Known Implementing Classes:
DirectCompactionEntryLog
public interface CompactionEntryLogAn 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 voidabort()Abort the compaction log.longaddEntry(long ledgerId, io.netty.buffer.ByteBuf entry)Add an entry to the log.voidfinalizeAndCleanup()Clean up any temporary resources that were used by the compaction process.voidflush()Flush any unwritten entries to physical storage.longgetDstLogId()Get the log ID of the entrylog to which compacted entries are being written.longgetSrcLogId()Get the log ID of the entrylog which is being compacted.voidmakeAvailable()Make the log written by the compaction process available for reads.voidmarkCompacted()Mark the compaction log as compacted.voidscan(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.IOExceptionAdd an entry to the log.- Parameters:
ledgerId- the ledger the entry belong toentry- 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.IOExceptionFlush 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.IOExceptionMark 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.IOExceptionMake 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.
-
-