Package org.apache.bookkeeper.bookie
Class JournalChannel
java.lang.Object
org.apache.bookkeeper.bookie.JournalChannel
- All Implemented Interfaces:
Closeable,AutoCloseable
Simple wrapper around FileChannel to add versioning
information to the file.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) BufferedChannel(package private) final BookieFileChannel(package private) final ServerConfiguration(package private) static final int(package private) final FileChannel(package private) final int(package private) final int(package private) static final int(package private) final byte[](package private) static final long(package private) static final int(package private) long(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final intstatic final int(package private) static final intfinal ByteBuffer -
Constructor Summary
ConstructorsConstructorDescriptionJournalChannel(File journalDirectory, long logId) JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, int journalAlignSize, boolean fRemoveFromPageCache, int formatVersionToWrite, Journal.BufferedChannelBuilder bcBuilder, ServerConfiguration conf, FileChannelProvider provider, Long toReplaceLogId) JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, int journalAlignSize, boolean fRemoveFromPageCache, int formatVersionToWrite, ServerConfiguration conf, FileChannelProvider provider) JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, long position, ServerConfiguration conf, FileChannelProvider provider) JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, ServerConfiguration conf, FileChannelProvider provider) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidforceWrite(boolean forceMetadata) (package private) BufferedChannel(package private) int(package private) voidpreAllocIfNeeded(long size) (package private) intread(ByteBuffer dst) static voidrenameJournalFile(File source, File target)
-
Field Details
-
MB
static final long MB- See Also:
-
channel
-
fd
final int fd -
fc
-
formatVersion
final int formatVersion -
bc
-
nextPrealloc
long nextPrealloc -
magicWord
final byte[] magicWord -
SECTOR_SIZE
static final int SECTOR_SIZE- See Also:
-
V1
static final int V1- See Also:
-
V2
static final int V2- See Also:
-
V3
static final int V3- See Also:
-
V4
static final int V4- See Also:
-
V5
static final int V5- See Also:
-
V6
public static final int V6- See Also:
-
HEADER_SIZE
static final int HEADER_SIZE- See Also:
-
VERSION_HEADER_SIZE
static final int VERSION_HEADER_SIZE- See Also:
-
MIN_COMPAT_JOURNAL_FORMAT_VERSION
static final int MIN_COMPAT_JOURNAL_FORMAT_VERSION- See Also:
-
CURRENT_JOURNAL_FORMAT_VERSION
static final int CURRENT_JOURNAL_FORMAT_VERSION- See Also:
-
zeros
-
configuration
-
-
Constructor Details
-
JournalChannel
JournalChannel(File journalDirectory, long logId) throws IOException - Throws:
IOException
-
JournalChannel
JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, ServerConfiguration conf, FileChannelProvider provider) throws IOException - Throws:
IOException
-
JournalChannel
JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, long position, ServerConfiguration conf, FileChannelProvider provider) throws IOException - Throws:
IOException
-
JournalChannel
JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, int journalAlignSize, boolean fRemoveFromPageCache, int formatVersionToWrite, ServerConfiguration conf, FileChannelProvider provider) throws IOException - Throws:
IOException
-
JournalChannel
JournalChannel(File journalDirectory, long logId, long preAllocSize, int writeBufferSize, int journalAlignSize, boolean fRemoveFromPageCache, int formatVersionToWrite, Journal.BufferedChannelBuilder bcBuilder, ServerConfiguration conf, FileChannelProvider provider, Long toReplaceLogId) throws IOException - Throws:
IOException
-
-
Method Details
-
renameJournalFile
- Throws:
IOException
-
getFormatVersion
int getFormatVersion() -
getBufferedChannel
- Throws:
IOException
-
preAllocIfNeeded
- Throws:
IOException
-
read
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
forceWrite
- Throws:
IOException
-