@Override
public void init(StateContext context) {
super.init(context);
replicator = new ClusterReplicator(context);
// When the leader is first elected, it needs to commit any pending operations
// in its log to the state machine and then commit a snapshot to its log.
// This methodology differs slightly from the standard Raft algorithm. Instead
// if storing snapshots in a separate file, we store them as normal log entries.