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) EntryLoggerAllocatorentryLoggerAllocator(package private) LedgerDirsManagerledgerDirsManager(package private) longlogSizeLimitThe 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 longaddEntry(long ledger, io.netty.buffer.ByteBuf entry, boolean rollLog)(package private) voidcreateNewLog(long ledgerId)(package private) voidcreateNewLog(long ledgerId, java.lang.String reason)voidflush()(package private) abstract voidflushCurrentLogs()(package private) voidflushLogChannel(DefaultEntryLogger.BufferedLogChannel logChannel, boolean forceMetadata)(package private) abstract voidflushRotatedLogs()(package private) abstract DefaultEntryLogger.BufferedLogChannelgetCurrentLogForLedger(long ledgerId)(package private) abstract DefaultEntryLogger.BufferedLogChannelgetCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog)(package private) java.util.List<DefaultEntryLogger.BufferedLogChannel>getRotatedLogChannels()(package private) booleanreachEntryLogLimit(DefaultEntryLogger.BufferedLogChannel logChannel, long size)(package private) booleanreadEntryLogHardLimit(DefaultEntryLogger.BufferedLogChannel logChannel, long size)(package private) java.io.FileselectDirForNextEntryLog()(package private) abstract voidsetCurrentLogForLedgerAndAddToRotate(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:
addEntryin 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:
flushin 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
-
-