Package io.atomix.raft.partition
Class RaftStorageConfig
java.lang.Object
io.atomix.raft.partition.RaftStorageConfig
Raft storage configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDirectory(String groupName) Returns the partition data directory.longReturns the minimum free disk space buffer to leave when allocating a new segmentintReturns the current snapshot store factory.Returns the Raft log segment size.booleansetDirectory(String directory) Sets the partition data directory.setFlushExplicitly(boolean flushExplicitly) Sets whether to flush logs to disk to guarantee correctness.setFreeDiskSpace(long freeDiskSpace) Sets the minimum free disk space buffersetJournalIndexDensity(int journalIndexDensity) setPersistedSnapshotStoreFactory(ReceivableSnapshotStoreFactory persistedSnapshotStoreFactory) Sets the snapshot store factory.voidsetPreallocateSegmentFiles(boolean preallocateSegmentFiles) Sets whether segment files are pre-allocated at creation.setSegmentSize(MemorySize segmentSize) Sets the Raft log segment size.booleanReturns whether to flush logs to disk to guarantee correctness.
-
Constructor Details
-
RaftStorageConfig
public RaftStorageConfig()
-
-
Method Details
-
getDirectory
Returns the partition data directory.- Parameters:
groupName- the partition group name- Returns:
- the partition data directory
-
getSegmentSize
Returns the Raft log segment size.- Returns:
- the Raft log segment size
-
setSegmentSize
Sets the Raft log segment size.- Parameters:
segmentSize- the Raft log segment size- Returns:
- the partition group configuration
-
shouldFlushExplicitly
public boolean shouldFlushExplicitly()Returns whether to flush logs to disk to guarantee correctness. If true, followers will flush on every append, and the leader will flush on commit.- Returns:
- whether to flush logs to disk
-
setFlushExplicitly
Sets whether to flush logs to disk to guarantee correctness. If true, followers will flush on every append, and the leader will flush on commit.- Parameters:
flushExplicitly- whether to flush logs to disk- Returns:
- the Raft partition group configuration
-
setDirectory
Sets the partition data directory.- Parameters:
directory- the partition data directory- Returns:
- the Raft partition group configuration
-
getPersistedSnapshotStoreFactory
Returns the current snapshot store factory.- Returns:
- the snapshot store factory
-
setPersistedSnapshotStoreFactory
public RaftStorageConfig setPersistedSnapshotStoreFactory(ReceivableSnapshotStoreFactory persistedSnapshotStoreFactory) Sets the snapshot store factory.- Parameters:
persistedSnapshotStoreFactory- the new snapshot store factory- Returns:
- the Raft storage configuration
-
getFreeDiskSpace
public long getFreeDiskSpace()Returns the minimum free disk space buffer to leave when allocating a new segment- Returns:
- free disk buffer
-
setFreeDiskSpace
Sets the minimum free disk space buffer- Parameters:
freeDiskSpace-- Returns:
-
getJournalIndexDensity
public int getJournalIndexDensity() -
setJournalIndexDensity
-
isPreallocateSegmentFiles
public boolean isPreallocateSegmentFiles()- Returns:
- true to preallocate segment files, false otherwise
-
setPreallocateSegmentFiles
public void setPreallocateSegmentFiles(boolean preallocateSegmentFiles) Sets whether segment files are pre-allocated at creation. If true, segment files are pre-allocated tosegmentSizeat creation before any writes happen.- Parameters:
preallocateSegmentFiles- true to preallocate files, false otherwise
-