Package org.opendaylight.raft.journal
Class SegmentedRaftJournal.Builder
java.lang.Object
org.opendaylight.raft.journal.SegmentedRaftJournal.Builder
- Enclosing class:
SegmentedRaftJournal
Segmented byte journal builder.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build theSegmentedRaftJournal
.withByteBufAllocator
(ByteBufAllocator byteBufAllocator) Sets theByteBufAllocator
to use for allocating various buffers.withDirectory
(File directory) Deprecated.withDirectory
(String directory) Sets the journal directory.withDirectory
(Path directory) Sets the journal directory.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 thedirectory
isnull
-
withDirectory
Sets the journal directory.- Parameters:
directory
- The log directory.- Returns:
- The builder instance
- Throws:
NullPointerException
- If thedirectory
isnull
-
withDirectory
Deprecated.UsewithDirectory(Path)
insteadSets the journal directory.- Parameters:
directory
- The log directory.- Returns:
- The builder instance
- Throws:
NullPointerException
- If thedirectory
isnull
-
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 themaxSegmentSize
is 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 themaxEntrySize
is not positive
-
withMaxEntriesPerSegment
@Deprecated(forRemoval=true, since="9.0.3") public SegmentedRaftJournal.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 themaxEntriesPerSegment
not 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
-
withByteBufAllocator
Sets theByteBufAllocator
to use for allocating various buffers.- Parameters:
byteBufAllocator
- the allocator to use- Returns:
- The builder instance
-
build
Build theSegmentedRaftJournal
.- Returns:
SegmentedRaftJournal
instance built.- Throws:
IOException
- when an I/O error occurs
-
withDirectory(Path)
instead