public class MetaStore extends Object implements AutoCloseable
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 and Description |
|---|
MetaStore(String name,
Storage storage,
Serializer serializer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Configuration |
loadConfiguration()
Loads the current cluster configuration.
|
long |
loadTerm()
Loads the stored server term.
|
int |
loadVote()
Loads the last vote for the server.
|
Serializer |
serializer()
Returns the metastore serializer.
|
MetaStore |
storeConfiguration(Configuration configuration)
Stores the current cluster configuration.
|
MetaStore |
storeTerm(long term)
Stores the current server term.
|
MetaStore |
storeVote(int vote)
Stores the last voted server.
|
String |
toString() |
public MetaStore(String name, Storage storage, Serializer serializer)
public Serializer serializer()
public MetaStore storeTerm(long term)
term - The current server term.public long loadTerm()
public MetaStore storeVote(int vote)
vote - The server vote.public int loadVote()
public MetaStore storeConfiguration(Configuration configuration)
configuration - The current cluster configuration.public Configuration loadConfiguration()
public void close()
close in interface AutoCloseableCopyright © 2013–2016. All rights reserved.