Class PropertiesTermInfoStore
java.lang.Object
org.opendaylight.controller.cluster.raft.spi.PropertiesTermInfoStore
- All Implemented Interfaces:
TermInfoStore
@NonNullByDefault
public final class PropertiesTermInfoStore
extends Object
implements TermInfoStore
A
TermInfoStore based on an atomic Properties file.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturnsTermInfofor current term.@Nullable TermInfoAttempt to load the last persistedTermInfo, if available.voidThis method updates the in-memory election term state.voidstoreAndSetTerm(TermInfo newTerm) This method updates the in-memory election term state and persists it so it can be recovered on next restart.toString()
-
Constructor Details
-
PropertiesTermInfoStore
-
-
Method Details
-
currentTerm
Description copied from interface:TermInfoStoreReturnsTermInfofor current term. Freshly-initialized instances returnTermInfo.INITIAL.- Specified by:
currentTermin interfaceTermInfoStore- Returns:
TermInfofor current term
-
setTerm
Description copied from interface:TermInfoStoreThis method updates the in-memory election term state. This method should be called when recovering election state from persistent storage.- Specified by:
setTermin interfaceTermInfoStore- Parameters:
newTerm- newTermInfo
-
storeAndSetTerm
Description copied from interface:TermInfoStoreThis method updates the in-memory election term state and persists it so it can be recovered on next restart. This method should be called when starting a new election or when a Raft RPC message is received with a higher term.- Specified by:
storeAndSetTermin interfaceTermInfoStore- Parameters:
newTerm- newTermInfo- Throws:
IOException- if an I/O error occurs
-
loadAndSetTerm
Description copied from interface:TermInfoStoreAttempt to load the last persistedTermInfo, if available. If successful,TermInfoStore.currentTerm()is updated.- Specified by:
loadAndSetTermin interfaceTermInfoStore- Returns:
- the persisted
TermInfo, ornullof none is available - Throws:
IOException- if an I/O error occurs
-
toString
-