Package org.apache.solr.cloud
Class ShardTerms
java.lang.Object
org.apache.solr.cloud.ShardTerms
- All Implemented Interfaces:
org.apache.solr.common.MapSerializable,org.apache.solr.common.MapWriter,org.apache.solr.common.NavigableObject,org.noggit.JSONWriter.Writable
Hold values of terms, this class is immutable. Create a new instance for every mutation
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
org.apache.solr.common.MapWriter.EntryWriter -
Field Summary
Fields inherited from interface org.apache.solr.common.MapWriter
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionShardTerms(Map<String, Long> values, int version) ShardTerms(ShardTerms newTerms, int version) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBecomeLeader(String coreNodeName) CancoreNodeNamebecome leader?doneRecovering(String coreNodeName) MarkcoreNodeNameas finished recoveringReturn a newShardTermsin which the highest terms are not zerolonggetTerms()intbooleanhaveHighestTermValue(String coreNodeName) IscoreNodeName's term highest?increaseTerms(String leader, Set<String> replicasNeedingRecovery) booleanisRecovering(String name) static StringrecoveringTerm(String coreNodeName) registerTerm(String coreNodeName) Return a newShardTermsin which the associate term ofcoreNodeNameis not nullremoveTerm(String coreNodeName) Return a newShardTermsin which terms for thecoreNodeNameare removedsetTermEqualsToLeader(String coreNodeName) Return a newShardTermsin which the term ofcoreNodeNameis maxsetTermToZero(String coreNodeName) Return a newShardTermsin which the associate term ofcoreNodeNameis equal to zero, creating it if it does not previously exist.startRecovering(String coreNodeName) MarkcoreNodeNameas recoveringtoString()voidwriteMap(org.apache.solr.common.MapWriter.EntryWriter ew) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.solr.common.MapWriter
jsonStr, toMap, writeMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Constructor Details
-
ShardTerms
public ShardTerms() -
ShardTerms
-
ShardTerms
-
-
Method Details
-
writeMap
- Specified by:
writeMapin interfaceorg.apache.solr.common.MapWriter- Throws:
IOException
-
canBecomeLeader
CancoreNodeNamebecome leader?- Parameters:
coreNodeName- of the replica- Returns:
- true if
coreNodeNamecan become leader, false if otherwise
-
haveHighestTermValue
IscoreNodeName's term highest?- Parameters:
coreNodeName- of the replica- Returns:
- true if term of
coreNodeNameis highest
-
getTerm
-
increaseTerms
- Parameters:
leader- coreNodeName of leaderreplicasNeedingRecovery- set of replicas in which their terms should be lower than leader's term- Returns:
- null if term of
leaderis already higher thanreplicasNeedingRecovery
-
ensureHighestTermsAreNotZero
Return a newShardTermsin which the highest terms are not zero- Returns:
- null if highest terms are already larger than zero
-
removeTerm
Return a newShardTermsin which terms for thecoreNodeNameare removed- Parameters:
coreNodeName- of the replica- Returns:
- null if term of
coreNodeNameis already not exist
-
registerTerm
Return a newShardTermsin which the associate term ofcoreNodeNameis not null- Parameters:
coreNodeName- of the replica- Returns:
- null if term of
coreNodeNameis already exist
-
setTermToZero
Return a newShardTermsin which the associate term ofcoreNodeNameis equal to zero, creating it if it does not previously exist.- Parameters:
coreNodeName- of the replica- Returns:
- null if the term of
coreNodeNamealready exists and is zero
-
setTermEqualsToLeader
Return a newShardTermsin which the term ofcoreNodeNameis max- Parameters:
coreNodeName- of the replica- Returns:
- null if term of
coreNodeNameis already maximum
-
getMaxTerm
public long getMaxTerm() -
startRecovering
MarkcoreNodeNameas recovering- Parameters:
coreNodeName- of the replica- Returns:
- null if
coreNodeNameis already marked as doing recovering
-
doneRecovering
MarkcoreNodeNameas finished recovering- Parameters:
coreNodeName- of the replica- Returns:
- null if term of
coreNodeNameis already finished doing recovering
-
recoveringTerm
-
toString
-
getVersion
public int getVersion() -
getTerms
-
isRecovering
-