Class SegmentedByteBufJournal.Builder
- Enclosing class:
- SegmentedByteBufJournal
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build theSegmentedByteBufJournal.withByteBufAllocator(io.netty.buffer.ByteBufAllocator byteBufAllocator) Sets theByteBufAllocatorto use for allocating various buffers.withDirectory(File directory) Sets the journal directory.withDirectory(String directory) Sets the journal directory.Enables flushing buffers to disk when entries are committed to a segment.withFlushOnCommit(boolean flushOnCommit) Sets whether to flush buffers to disk when entries are committed to a segment.withIndexDensity(double indexDensity) Sets the journal index density.withMaxEntriesPerSegment(int maxEntriesPerSegment) Deprecated, for removal: This API element is subject to removal in a future version.This option has no effect and is scheduled for removal.withMaxEntrySize(int maxEntrySize) Sets the maximum entry size in bytes.withMaxSegmentSize(int maxSegmentSize) Sets the maximum segment size in bytes.Sets the journal name.withStorageLevel(StorageLevel storageLevel) Sets the storage level.
-
Method Details
-
withName
Sets the journal name.- Parameters:
name- The journal name.- Returns:
- The builder instance
-
withStorageLevel
Sets the storage level.- Parameters:
storageLevel- The storage level.- Returns:
- The builder instance
-
withDirectory
Sets the journal directory.- Parameters:
directory- The log directory.- Returns:
- The builder instance
- Throws:
NullPointerException- If thedirectoryisnull
-
withDirectory
Sets the journal directory.- Parameters:
directory- The log directory.- Returns:
- The builder instance
- Throws:
NullPointerException- If thedirectoryisnull
-
withMaxSegmentSize
Sets the maximum segment size in bytes. By default, the maximum segment size is1024 * 1024 * 32.- Parameters:
maxSegmentSize- The maximum segment size in bytes.- Returns:
- The builder instance
- Throws:
IllegalArgumentException- If themaxSegmentSizeis not positive
-
withMaxEntrySize
Sets the maximum entry size in bytes.- Parameters:
maxEntrySize- the maximum entry size in bytes- Returns:
- the builder instance
- Throws:
IllegalArgumentException- if themaxEntrySizeis not positive
-
withMaxEntriesPerSegment
@Deprecated(forRemoval=true, since="9.0.3") public SegmentedByteBufJournal.Builder withMaxEntriesPerSegment(int maxEntriesPerSegment) Deprecated, for removal: This API element is subject to removal in a future version.This option has no effect and is scheduled for removal.Sets the maximum number of allows entries per segment, returning the builder for method chaining.The maximum entry count dictates when logs should roll over to new segments. As entries are written to a segment of the log, if the entry count in that segment meets the configured maximum entry count, the log will create a new segment and append new entries to that segment.
By default, the maximum entries per segment is
1024 * 1024.- Parameters:
maxEntriesPerSegment- The maximum number of entries allowed per segment.- Returns:
- The storage builder.
- Throws:
IllegalArgumentException- If themaxEntriesPerSegmentnot greater than the default max entries per segment
-
withIndexDensity
Sets the journal index density.The index density is the frequency at which the position of entries written to the journal will be recorded in an in-memory index for faster seeking.
- Parameters:
indexDensity- the index density- Returns:
- the builder instance
- Throws:
IllegalArgumentException- if the density is not between 0 and 1
-
withFlushOnCommit
Enables flushing buffers to disk when entries are committed to a segment.When flush-on-commit is enabled, log entry buffers will be automatically flushed to disk each time an entry is committed in a given segment.
- Returns:
- The builder instance
-
withFlushOnCommit
Sets whether to flush buffers to disk when entries are committed to a segment.When flush-on-commit is enabled, log entry buffers will be automatically flushed to disk each time an entry is committed in a given segment.
- Parameters:
flushOnCommit- Whether to flush buffers to disk when entries are committed to a segment.- Returns:
- The builder instance
-
withByteBufAllocator
public SegmentedByteBufJournal.Builder withByteBufAllocator(io.netty.buffer.ByteBufAllocator byteBufAllocator) Sets theByteBufAllocatorto use for allocating various buffers.- Parameters:
byteBufAllocator- the allocator to use- Returns:
- The builder instance
-
build
Build theSegmentedByteBufJournal.- Returns:
SegmentedByteBufJournalinstance built.
-