Package io.atomix.raft.storage.system
Class MetaStore
java.lang.Object
io.atomix.raft.storage.system.MetaStore
- All Implemented Interfaces:
AutoCloseable
Manages persistence of server configurations.
The server metastore is responsible for persisting server configurations according to the
configured storage level. Each server persists their current
term and last vote as is dictated by the Raft consensus
algorithm. Additionally, the metastore is responsible for storing the last know server Configuration, including cluster membership.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Loads the current cluster configuration.longlongloadTerm()Loads the stored server term.loadVote()Loads the last vote for the server.voidstoreConfiguration(Configuration configuration) Stores the current cluster configuration.voidstoreLastWrittenIndex(long index) voidstoreTerm(long term) Stores the current server term.voidStores the last voted server.toString()
-
Constructor Details
-
MetaStore
- Throws:
IOException
-
-
Method Details
-
storeTerm
public void storeTerm(long term) Stores the current server term.- Parameters:
term- The current server term.
-
loadTerm
public long loadTerm()Loads the stored server term.- Returns:
- The stored server term.
-
storeVote
Stores the last voted server.- Parameters:
vote- The server vote.
-
loadVote
Loads the last vote for the server.- Returns:
- The last vote for the server.
-
loadLastWrittenIndex
public long loadLastWrittenIndex() -
storeLastWrittenIndex
public void storeLastWrittenIndex(long index) -
storeConfiguration
Stores the current cluster configuration.- Parameters:
configuration- The current cluster configuration.
-
loadConfiguration
Loads the current cluster configuration.- Returns:
- The current cluster configuration.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
toString
-