public class ShardTerms extends Object implements MapWriter
MapWriter.EntryWriter
Constructor and Description |
---|
ShardTerms() |
ShardTerms(Map<String,Long> values,
int version) |
ShardTerms(ShardTerms newTerms,
int version) |
Modifier and Type | Method and Description |
---|---|
boolean |
canBecomeLeader(String coreNodeName)
Can
coreNodeName become leader? |
ShardTerms |
doneRecovering(String coreNodeName)
Mark
coreNodeName as finished recovering |
ShardTerms |
ensureHighestTermsAreNotZero()
Return a new
ShardTerms in which highest terms are not zero |
long |
getMaxTerm() |
Long |
getTerm(String coreNodeName) |
Map<String,Long> |
getTerms() |
int |
getVersion() |
boolean |
haveHighestTermValue(String coreNodeName)
Is
coreNodeName 's term highest? |
ShardTerms |
increaseTerms(String leader,
Set<String> replicasNeedingRecovery)
|
boolean |
isRecovering(String name) |
static String |
recoveringTerm(String coreNodeName) |
ShardTerms |
registerTerm(String coreNodeName)
Return a new
ShardTerms in which the associate term of coreNodeName is not null |
ShardTerms |
removeTerm(String coreNodeName)
Return a new
ShardTerms in which terms for the coreNodeName are removed |
ShardTerms |
setTermEqualsToLeader(String coreNodeName)
Return a new
ShardTerms in which the term of coreNodeName is max |
ShardTerms |
setTermToZero(String coreNodeName) |
ShardTerms |
startRecovering(String coreNodeName)
Mark
coreNodeName as recovering |
String |
toString() |
void |
writeMap(MapWriter.EntryWriter ew) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr
public ShardTerms()
public ShardTerms(ShardTerms newTerms, int version)
public void writeMap(MapWriter.EntryWriter ew) throws IOException
writeMap
in interface MapWriter
IOException
public boolean canBecomeLeader(String coreNodeName)
coreNodeName
become leader?coreNodeName
- of the replicacoreNodeName
can become leader, false if otherwisepublic boolean haveHighestTermValue(String coreNodeName)
coreNodeName
's term highest?coreNodeName
- of the replicacoreNodeName
is highestpublic ShardTerms increaseTerms(String leader, Set<String> replicasNeedingRecovery)
leader
- coreNodeName of leaderreplicasNeedingRecovery
- set of replicas in which their terms should be lower than leader's termleader
is already higher than replicasNeedingRecovery
public ShardTerms ensureHighestTermsAreNotZero()
ShardTerms
in which highest terms are not zeropublic ShardTerms removeTerm(String coreNodeName)
ShardTerms
in which terms for the coreNodeName
are removedcoreNodeName
- of the replicacoreNodeName
is already not existpublic ShardTerms registerTerm(String coreNodeName)
ShardTerms
in which the associate term of coreNodeName
is not nullcoreNodeName
- of the replicacoreNodeName
is already existpublic ShardTerms setTermToZero(String coreNodeName)
public ShardTerms setTermEqualsToLeader(String coreNodeName)
ShardTerms
in which the term of coreNodeName
is maxcoreNodeName
- of the replicacoreNodeName
is already maximumpublic long getMaxTerm()
public ShardTerms startRecovering(String coreNodeName)
coreNodeName
as recoveringcoreNodeName
- of the replicacoreNodeName
is already marked as doing recoveringpublic ShardTerms doneRecovering(String coreNodeName)
coreNodeName
as finished recoveringcoreNodeName
- of the replicacoreNodeName
is already finished doing recoveringpublic int getVersion()
public boolean isRecovering(String name)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.