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 TypeMethodDescriptionvoid
close()
long
Returns the current termReturns the last accepted cluster stateprotected void
maybeWriteInitialState
(long currentTerm, ClusterState lastAcceptedState, PersistedClusterStateService.Writer writer) void
setCurrentTerm
(long currentTerm) Sets a new current term.void
setLastAcceptedState
(ClusterState clusterState) Sets a new last accepted cluster state.protected void
writeClusterStateToDisk
(ClusterState clusterState) protected void
writeCurrentTermToDisk
(long currentTerm) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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.PersistedState
Returns the current term- Specified by:
getCurrentTerm
in interfaceCoordinationState.PersistedState
-
getLastAcceptedState
Description copied from interface:CoordinationState.PersistedState
Returns the last accepted cluster state- Specified by:
getLastAcceptedState
in interfaceCoordinationState.PersistedState
-
setCurrentTerm
public void setCurrentTerm(long currentTerm) Description copied from interface:CoordinationState.PersistedState
Sets 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:
setCurrentTerm
in interfaceCoordinationState.PersistedState
-
writeCurrentTermToDisk
protected void writeCurrentTermToDisk(long currentTerm) -
setLastAcceptedState
Description copied from interface:CoordinationState.PersistedState
Sets 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:
setLastAcceptedState
in interfaceCoordinationState.PersistedState
-
writeClusterStateToDisk
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCoordinationState.PersistedState
- Throws:
IOException
-