Package io.camunda.zeebe.journal.file
Class SegmentedJournalBuilder
java.lang.Object
io.camunda.zeebe.journal.file.SegmentedJournalBuilder
Raft log builder.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()withDirectory(File directory) Sets the journal directory, returning the builder for method chaining.withDirectory(String directory) Sets the journal directory, returning the builder for method chaining.withFreeDiskSpace(long freeDiskSpace) Sets the minimum free disk space to leave when allocating a new segmentwithJournalIndexDensity(int journalIndexDensity) withMaxSegmentSize(int maxSegmentSize) Sets the maximum segment size in bytes, returning the builder for method chaining.withMetaStore(JournalMetaStore metaStore) Sets the storage name.withPartitionId(int partitionId) The ID of the partition on which this journal resides.withPreallocateSegmentFiles(boolean preallocateSegmentFiles) Sets whether segment files are pre-allocated at creation.
-
Field Details
-
name
-
directory
-
maxSegmentSize
protected int maxSegmentSize
-
-
Constructor Details
-
SegmentedJournalBuilder
protected SegmentedJournalBuilder()
-
-
Method Details
-
withName
Sets the storage name.- Parameters:
name- The storage name.- Returns:
- The storage builder.
-
withDirectory
Sets the journal directory, returning the builder for method chaining.The journal will write segment files into the provided directory.
- Parameters:
directory- The log directory.- Returns:
- The storage builder.
- Throws:
NullPointerException- If thedirectoryisnull
-
withDirectory
Sets the journal directory, returning the builder for method chaining.The journal will write segment files into the provided directory.
- Parameters:
directory- The journal directory.- Returns:
- The journal builder.
- Throws:
NullPointerException- If thedirectoryisnull
-
withMaxSegmentSize
Sets the maximum segment size in bytes, returning the builder for method chaining.The maximum segment size dictates when logs should roll over to new segments. As entries are written to a segment of the log, once the size of the segment surpasses the configured maximum segment size, the log will create a new segment and append new entries to that segment.
By default, the maximum segment size is
1024 * 1024 * 32.- Parameters:
maxSegmentSize- The maximum segment size in bytes.- Returns:
- The journal builder.
- Throws:
IllegalArgumentException- If themaxSegmentSizeis not positive
-
withFreeDiskSpace
Sets the minimum free disk space to leave when allocating a new segment- Parameters:
freeDiskSpace- free disk space in bytes- Returns:
- the storage builder
- Throws:
IllegalArgumentException- if thefreeDiskSpaceis not positive
-
withJournalIndexDensity
-
withPreallocateSegmentFiles
Sets whether segment files are pre-allocated at creation. If true, segment files are pre-allocated to the maximum segment size (seewithMaxSegmentSize(int)}) at creation before any writes happen.- Parameters:
preallocateSegmentFiles- true to preallocate files, false otherwise- Returns:
- this builder for chaining
-
withPartitionId
The ID of the partition on which this journal resides. This is used primarily for observability, e.g. inJournalMetrics.- Parameters:
partitionId- the journal's partition ID- Returns:
- this builder for chaining
-
withMetaStore
- Parameters:
metaStore- journal metastore to update lastFlushedIndex- Returns:
- this builder for chaining
-
build
-