Package org.iq80.leveldb.impl
Class MMapLogWriter
java.lang.Object
org.iq80.leveldb.impl.MMapLogWriter
- All Implemented Interfaces:
LogWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intCurrent offset in the current blockprivate final AtomicBooleanprivate final Fileprivate final FileChannelprivate final longprivate longprivate MappedByteBufferprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()voiddelete()private voidprivate voidensureCapacity(int bytes) getFile()longbooleanisClosed()private static SlicenewLogRecordHeader(LogChunkType type, Slice slice) private voidunmap()private voidwriteChunk(LogChunkType type, Slice slice)
-
Field Details
-
PAGE_SIZE
private static final int PAGE_SIZE- See Also:
-
file
-
fileNumber
private final long fileNumber -
fileChannel
-
closed
-
mappedByteBuffer
-
fileOffset
private long fileOffset -
blockOffset
private int blockOffsetCurrent offset in the current block
-
-
Constructor Details
-
MMapLogWriter
- Throws:
IOException
-
-
Method Details
-
isClosed
public boolean isClosed() -
close
- Specified by:
closein interfaceLogWriter- Throws:
IOException
-
delete
- Specified by:
deletein interfaceLogWriter- Throws:
IOException
-
destroyMappedByteBuffer
private void destroyMappedByteBuffer() -
getFile
-
getFileNumber
public long getFileNumber()- Specified by:
getFileNumberin interfaceLogWriter
-
addRecord
- Specified by:
addRecordin interfaceLogWriter- Throws:
IOException
-
writeChunk
- Throws:
IOException
-
ensureCapacity
- Throws:
IOException
-
unmap
private void unmap() -
newLogRecordHeader
-