Package org.apache.bookkeeper.bookie
Class EntryLoggerAllocator
java.lang.Object
org.apache.bookkeeper.bookie.EntryLoggerAllocator
An allocator pre-allocates entry log files.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ExecutorService(package private) final io.netty.buffer.ByteBuf(package private) Future<DefaultEntryLogger.BufferedLogChannel> -
Constructor Summary
ConstructorsConstructorDescriptionEntryLoggerAllocator(ServerConfiguration conf, LedgerDirsManager ledgerDirsManager, DefaultEntryLogger.RecentEntryLogsStatus recentlyCreatedEntryLogsStatus, long logId, io.netty.buffer.ByteBufAllocator byteBufAllocator) -
Method Summary
Modifier and TypeMethodDescription(package private) void(package private) DefaultEntryLogger.BufferedLogChannelcreateNewLog(File dirForNextEntryLog) (package private) DefaultEntryLogger.BufferedLogChannelcreateNewLogForCompaction(File dirForNextEntryLog) (package private) long(package private) Future<DefaultEntryLogger.BufferedLogChannel>get the preallocation for tests.booleanisSealed(long logId) (package private) voidsetLastLogId(File dir, long logId) writes the given id to the "lastId" file in the given directory.(package private) voidsetWritingCompactingLogId(long logId) (package private) voidsetWritingLogId(long logId) (package private) voidstop()Stop the allocator.
-
Field Details
-
preallocation
Future<DefaultEntryLogger.BufferedLogChannel> preallocation -
allocatorExecutor
ExecutorService allocatorExecutor -
logfileHeader
final io.netty.buffer.ByteBuf logfileHeader
-
-
Constructor Details
-
EntryLoggerAllocator
EntryLoggerAllocator(ServerConfiguration conf, LedgerDirsManager ledgerDirsManager, DefaultEntryLogger.RecentEntryLogsStatus recentlyCreatedEntryLogsStatus, long logId, io.netty.buffer.ByteBufAllocator byteBufAllocator)
-
-
Method Details
-
getPreallocatedLogId
long getPreallocatedLogId() -
isSealed
public boolean isSealed(long logId) -
createNewLog
- Throws:
IOException
-
createNewLogForCompaction
DefaultEntryLogger.BufferedLogChannel createNewLogForCompaction(File dirForNextEntryLog) throws IOException - Throws:
IOException
-
setWritingLogId
void setWritingLogId(long logId) -
setWritingCompactingLogId
void setWritingCompactingLogId(long logId) -
clearCompactingLogId
void clearCompactingLogId() -
setLastLogId
writes the given id to the "lastId" file in the given directory.- Throws:
IOException
-
stop
void stop()Stop the allocator. -
getPreallocationFuture
Future<DefaultEntryLogger.BufferedLogChannel> getPreallocationFuture()get the preallocation for tests.
-