Class ShardTerms
- java.lang.Object
- 
- org.apache.solr.client.solrj.cloud.ShardTerms
 
- 
- All Implemented Interfaces:
- MapSerializable,- MapWriter,- NavigableObject,- org.noggit.JSONWriter.Writable
 
 public class ShardTerms extends Object implements MapWriter 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.MapWriterMapWriter.EntryWriter
 
- 
 - 
Constructor SummaryConstructors Constructor Description ShardTerms()ShardTerms(Map<String,Long> values, int version)ShardTerms(ShardTerms newTerms, int version)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanBecomeLeader(String coreNodeName)CancoreNodeNamebecome leader?ShardTermsdoneRecovering(String coreNodeName)MarkcoreNodeNameas finished recoveringShardTermsensureHighestTermsAreNotZero()Return a newShardTermsin which the highest terms are not zerolonggetMaxTerm()LonggetTerm(String coreNodeName)Map<String,Long>getTerms()intgetVersion()booleanhaveHighestTermValue(String coreNodeName)IscoreNodeName's term highest?ShardTermsincreaseTerms(String leader, Set<String> replicasNeedingRecovery)booleanisRecovering(String name)static StringrecoveringTerm(String coreNodeName)ShardTermsregisterTerm(String coreNodeName)Return a newShardTermsin which the associate term ofcoreNodeNameis not nullShardTermsremoveTerm(String coreNodeName)Return a newShardTermsin which terms for thecoreNodeNameare removedShardTermssetTermEqualsToLeader(String coreNodeName)Return a newShardTermsin which the term ofcoreNodeNameis maxShardTermssetTermToZero(String coreNodeName)Return a newShardTermsin which the associate term ofcoreNodeNameis equal to zero, creating it if it does not previously exist.ShardTermsstartRecovering(String coreNodeName)MarkcoreNodeNameas recoveringStringtoString()voidwriteMap(MapWriter.EntryWriter ew)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.solr.common.NavigableObject_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
 
- 
 
- 
- 
- 
Constructor Detail- 
ShardTermspublic ShardTerms() 
 - 
ShardTermspublic ShardTerms(ShardTerms newTerms, int version) 
 
- 
 - 
Method Detail- 
writeMappublic void writeMap(MapWriter.EntryWriter ew) throws IOException - Specified by:
- writeMapin interface- MapWriter
- Throws:
- IOException
 
 - 
canBecomeLeaderpublic boolean canBecomeLeader(String coreNodeName) CancoreNodeNamebecome leader?- Parameters:
- coreNodeName- of the replica
- Returns:
- true if coreNodeNamecan become leader, false if otherwise
 
 - 
haveHighestTermValuepublic boolean haveHighestTermValue(String coreNodeName) IscoreNodeName's term highest?- Parameters:
- coreNodeName- of the replica
- Returns:
- true if term of coreNodeNameis highest
 
 - 
increaseTermspublic ShardTerms increaseTerms(String leader, Set<String> replicasNeedingRecovery) - Parameters:
- leader- coreNodeName of leader
- replicasNeedingRecovery- set of replicas in which their terms should be lower than leader's term
- Returns:
- null if term of leaderis already higher thanreplicasNeedingRecovery
 
 - 
ensureHighestTermsAreNotZeropublic ShardTerms ensureHighestTermsAreNotZero() Return a newShardTermsin which the highest terms are not zero- Returns:
- null if highest terms are already larger than zero
 
 - 
removeTermpublic ShardTerms removeTerm(String coreNodeName) Return a newShardTermsin which terms for thecoreNodeNameare removed- Parameters:
- coreNodeName- of the replica
- Returns:
- null if term of coreNodeNameis already not exist
 
 - 
registerTermpublic ShardTerms registerTerm(String coreNodeName) Return a newShardTermsin which the associate term ofcoreNodeNameis not null- Parameters:
- coreNodeName- of the replica
- Returns:
- null if term of coreNodeNameis already exist
 
 - 
setTermToZeropublic ShardTerms setTermToZero(String coreNodeName) 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
 
 - 
setTermEqualsToLeaderpublic ShardTerms setTermEqualsToLeader(String coreNodeName) Return a newShardTermsin which the term ofcoreNodeNameis max- Parameters:
- coreNodeName- of the replica
- Returns:
- null if term of coreNodeNameis already maximum
 
 - 
getMaxTermpublic long getMaxTerm() 
 - 
startRecoveringpublic ShardTerms startRecovering(String coreNodeName) MarkcoreNodeNameas recovering- Parameters:
- coreNodeName- of the replica
- Returns:
- null if coreNodeNameis already marked as doing recovering
 
 - 
doneRecoveringpublic ShardTerms doneRecovering(String coreNodeName) MarkcoreNodeNameas finished recovering- Parameters:
- coreNodeName- of the replica
- Returns:
- null if term of coreNodeNameis already finished doing recovering
 
 - 
getVersionpublic int getVersion() 
 - 
isRecoveringpublic boolean isRecovering(String name) 
 
- 
 
-