Module org.elasticsearch.server
Package org.elasticsearch.gateway
Class GatewayMetaState.LucenePersistedState
java.lang.Object
org.elasticsearch.gateway.GatewayMetaState.LucenePersistedState
- All Implemented Interfaces:
Closeable,AutoCloseable,CoordinationState.PersistedState
- Enclosing class:
GatewayMetaState
public static class GatewayMetaState.LucenePersistedState
extends Object
implements CoordinationState.PersistedState
Encapsulates the incremental writing of metadata to a
PersistedClusterStateService.Writer.-
Constructor Summary
ConstructorsConstructorDescriptionLucenePersistedState(PersistedClusterStateService persistedClusterStateService, long currentTerm, ClusterState lastAcceptedState) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longReturns the current termReturns the last accepted cluster stateprotected voidmaybeWriteInitialState(long currentTerm, ClusterState lastAcceptedState, PersistedClusterStateService.Writer writer) voidsetCurrentTerm(long currentTerm) Sets a new current term.voidsetLastAcceptedState(ClusterState clusterState) Sets a new last accepted cluster state.protected voidwriteClusterStateToDisk(ClusterState clusterState) protected voidwriteCurrentTermToDisk(long currentTerm) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.cluster.coordination.CoordinationState.PersistedState
getLatestStoredState, markLastAcceptedStateAsCommitted
-
Constructor Details
-
LucenePersistedState
public LucenePersistedState(PersistedClusterStateService persistedClusterStateService, long currentTerm, ClusterState lastAcceptedState) throws IOException - Throws:
IOException
-
-
Method Details
-
maybeWriteInitialState
protected void maybeWriteInitialState(long currentTerm, ClusterState lastAcceptedState, PersistedClusterStateService.Writer writer) throws IOException - Throws:
IOException
-
getCurrentTerm
public long getCurrentTerm()Description copied from interface:CoordinationState.PersistedStateReturns the current term- Specified by:
getCurrentTermin interfaceCoordinationState.PersistedState
-
getLastAcceptedState
Description copied from interface:CoordinationState.PersistedStateReturns the last accepted cluster state- Specified by:
getLastAcceptedStatein interfaceCoordinationState.PersistedState
-
setCurrentTerm
public void setCurrentTerm(long currentTerm) Description copied from interface:CoordinationState.PersistedStateSets a new current term. After a successful call to this method,CoordinationState.PersistedState.getCurrentTerm()should return the last term that was set. The value returned byCoordinationState.PersistedState.getLastAcceptedState()should not be influenced by calls to this method.- Specified by:
setCurrentTermin interfaceCoordinationState.PersistedState
-
writeCurrentTermToDisk
protected void writeCurrentTermToDisk(long currentTerm) -
setLastAcceptedState
Description copied from interface:CoordinationState.PersistedStateSets a new last accepted cluster state. After a successful call to this method,CoordinationState.PersistedState.getLastAcceptedState()should return the last cluster state that was set. The value returned byCoordinationState.PersistedState.getCurrentTerm()should not be influenced by calls to this method.- Specified by:
setLastAcceptedStatein interfaceCoordinationState.PersistedState
-
writeClusterStateToDisk
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCoordinationState.PersistedState- Throws:
IOException
-