FileBasedStateStore¶
FileBasedStateStore
is a QuorumStateStore that writes election state to a file.
Creating Instance¶
FileBasedStateStore
takes the following to be created:
FileBasedStateStore
is created when:
KafkaRaftManager
is requested to build a RaftClient
State File¶
FileBasedStateStore
is given a state file when created.
The state file is quorum-state
file under the data directory (of KafkaRaftManager).
The state file is loaded in readElectionState and updated in writeElectionState.
stateFile
is deleted in clear.
readElectionState¶
QuorumStateStore
ElectionState readElectionState()
readElectionState
is part of the QuorumStateStore abstraction.
readElectionState
is null
(undefined) when stateFile does not exist.