Package org.apache.bookkeeper.bookie
Class EntryLogManagerBase
- java.lang.Object
-
- org.apache.bookkeeper.bookie.EntryLogManagerBase
-
- All Implemented Interfaces:
EntryLogManager
- Direct Known Subclasses:
EntryLogManagerForEntryLogPerLedger
,EntryLogManagerForSingleEntryLog
abstract class EntryLogManagerBase extends java.lang.Object implements EntryLogManager
-
-
Field Summary
Fields Modifier and Type Field Description (package private) EntryLoggerAllocator
entryLoggerAllocator
(package private) LedgerDirsManager
ledgerDirsManager
(package private) long
logSizeLimit
The maximum size of a entry logger file.(package private) java.util.List<DefaultEntryLogger.BufferedLogChannel>
rotatedLogChannels
-
Constructor Summary
Constructors Constructor Description EntryLogManagerBase(ServerConfiguration conf, LedgerDirsManager ledgerDirsManager, EntryLoggerAllocator entryLoggerAllocator, java.util.List<DefaultEntryLogger.EntryLogListener> listeners)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
addEntry(long ledger, io.netty.buffer.ByteBuf entry, boolean rollLog)
(package private) void
createNewLog(long ledgerId)
(package private) void
createNewLog(long ledgerId, java.lang.String reason)
void
flush()
(package private) abstract void
flushCurrentLogs()
(package private) void
flushLogChannel(DefaultEntryLogger.BufferedLogChannel logChannel, boolean forceMetadata)
(package private) abstract void
flushRotatedLogs()
(package private) abstract DefaultEntryLogger.BufferedLogChannel
getCurrentLogForLedger(long ledgerId)
(package private) abstract DefaultEntryLogger.BufferedLogChannel
getCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog)
(package private) java.util.List<DefaultEntryLogger.BufferedLogChannel>
getRotatedLogChannels()
(package private) boolean
reachEntryLogLimit(DefaultEntryLogger.BufferedLogChannel logChannel, long size)
(package private) boolean
readEntryLogHardLimit(DefaultEntryLogger.BufferedLogChannel logChannel, long size)
(package private) java.io.File
selectDirForNextEntryLog()
(package private) abstract void
setCurrentLogForLedgerAndAddToRotate(long ledgerId, DefaultEntryLogger.BufferedLogChannel logChannel)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.bookie.EntryLogManager
checkpoint, close, commitEntryMemTableFlush, createNewLogForCompaction, forceClose, getCurrentLogIfPresent, getDirForNextEntryLog, prepareEntryMemTableFlush, prepareSortedLedgerStorageCheckpoint
-
-
-
-
Field Detail
-
rotatedLogChannels
volatile java.util.List<DefaultEntryLogger.BufferedLogChannel> rotatedLogChannels
-
entryLoggerAllocator
final EntryLoggerAllocator entryLoggerAllocator
-
ledgerDirsManager
final LedgerDirsManager ledgerDirsManager
-
logSizeLimit
final long logSizeLimit
The maximum size of a entry logger file.
-
-
Constructor Detail
-
EntryLogManagerBase
EntryLogManagerBase(ServerConfiguration conf, LedgerDirsManager ledgerDirsManager, EntryLoggerAllocator entryLoggerAllocator, java.util.List<DefaultEntryLogger.EntryLogListener> listeners)
-
-
Method Detail
-
addEntry
public long addEntry(long ledger, io.netty.buffer.ByteBuf entry, boolean rollLog) throws java.io.IOException
- Specified by:
addEntry
in interfaceEntryLogManager
- Throws:
java.io.IOException
-
reachEntryLogLimit
boolean reachEntryLogLimit(DefaultEntryLogger.BufferedLogChannel logChannel, long size)
-
readEntryLogHardLimit
boolean readEntryLogHardLimit(DefaultEntryLogger.BufferedLogChannel logChannel, long size)
-
getCurrentLogForLedger
abstract DefaultEntryLogger.BufferedLogChannel getCurrentLogForLedger(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
getCurrentLogForLedgerForAddEntry
abstract DefaultEntryLogger.BufferedLogChannel getCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog) throws java.io.IOException
- Throws:
java.io.IOException
-
setCurrentLogForLedgerAndAddToRotate
abstract void setCurrentLogForLedgerAndAddToRotate(long ledgerId, DefaultEntryLogger.BufferedLogChannel logChannel) throws java.io.IOException
- Throws:
java.io.IOException
-
flushCurrentLogs
abstract void flushCurrentLogs() throws java.io.IOException
- Throws:
java.io.IOException
-
flushRotatedLogs
abstract void flushRotatedLogs() throws java.io.IOException
- Throws:
java.io.IOException
-
getRotatedLogChannels
java.util.List<DefaultEntryLogger.BufferedLogChannel> getRotatedLogChannels()
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfaceEntryLogManager
- Throws:
java.io.IOException
-
flushLogChannel
void flushLogChannel(DefaultEntryLogger.BufferedLogChannel logChannel, boolean forceMetadata) throws java.io.IOException
- Throws:
java.io.IOException
-
createNewLog
void createNewLog(long ledgerId) throws java.io.IOException
- Throws:
java.io.IOException
-
createNewLog
void createNewLog(long ledgerId, java.lang.String reason) throws java.io.IOException
- Throws:
java.io.IOException
-
selectDirForNextEntryLog
java.io.File selectDirForNextEntryLog() throws LedgerDirsManager.NoWritableLedgerDirException
-
-