Package org.apache.cassandra.db
Enum ConsistencyLevel
- java.lang.Object
-
- java.lang.Enum<ConsistencyLevel>
-
- org.apache.cassandra.db.ConsistencyLevel
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConsistencyLevel>
public enum ConsistencyLevel extends java.lang.Enum<ConsistencyLevel>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALL
ANY
EACH_QUORUM
LOCAL_ONE
LOCAL_QUORUM
LOCAL_SERIAL
NODE_LOCAL
ONE
QUORUM
SERIAL
THREE
TWO
-
Field Summary
Fields Modifier and Type Field Description int
code
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
blockFor(AbstractReplicationStrategy replicationStrategy)
int
blockForWrite(AbstractReplicationStrategy replicationStrategy, Endpoints<?> pending)
static com.carrotsearch.hppc.ObjectIntHashMap<java.lang.String>
eachQuorumForRead(AbstractReplicationStrategy replicationStrategy)
static com.carrotsearch.hppc.ObjectIntHashMap<java.lang.String>
eachQuorumForWrite(AbstractReplicationStrategy replicationStrategy, Endpoints<?> pendingWithDown)
static ConsistencyLevel
fromCode(int code)
static ConsistencyLevel
fromString(java.lang.String str)
boolean
isDatacenterLocal()
boolean
isSerialConsistency()
static int
localQuorumFor(AbstractReplicationStrategy replicationStrategy, java.lang.String dc)
static int
localQuorumForOurDc(AbstractReplicationStrategy replicationStrategy)
boolean
needsReconciliation()
With a replication factor greater than one, reads that contact more than one replica will require reconciliation of the individual replica results at the coordinator.static int
quorumFor(AbstractReplicationStrategy replicationStrategy)
boolean
satisfies(ConsistencyLevel other, AbstractReplicationStrategy replicationStrategy)
Determine if this consistency level meets or exceeds the consistency requirements of the given cl for the given keyspace WARNING: this is not locality aware; you cannot safely use this with mixed locality consistency levels (e.g.void
validateCounterForWrite(TableMetadata metadata)
void
validateForCas()
void
validateForCasCommit(AbstractReplicationStrategy replicationStrategy)
void
validateForRead()
void
validateForWrite()
static ConsistencyLevel
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ConsistencyLevel[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ANY
public static final ConsistencyLevel ANY
-
ONE
public static final ConsistencyLevel ONE
-
TWO
public static final ConsistencyLevel TWO
-
THREE
public static final ConsistencyLevel THREE
-
QUORUM
public static final ConsistencyLevel QUORUM
-
ALL
public static final ConsistencyLevel ALL
-
LOCAL_QUORUM
public static final ConsistencyLevel LOCAL_QUORUM
-
EACH_QUORUM
public static final ConsistencyLevel EACH_QUORUM
-
SERIAL
public static final ConsistencyLevel SERIAL
-
LOCAL_SERIAL
public static final ConsistencyLevel LOCAL_SERIAL
-
LOCAL_ONE
public static final ConsistencyLevel LOCAL_ONE
-
NODE_LOCAL
public static final ConsistencyLevel NODE_LOCAL
-
-
Method Detail
-
values
public static ConsistencyLevel[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ConsistencyLevel c : ConsistencyLevel.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConsistencyLevel valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
fromCode
public static ConsistencyLevel fromCode(int code)
-
fromString
public static ConsistencyLevel fromString(java.lang.String str)
-
quorumFor
public static int quorumFor(AbstractReplicationStrategy replicationStrategy)
-
localQuorumFor
public static int localQuorumFor(AbstractReplicationStrategy replicationStrategy, java.lang.String dc)
-
localQuorumForOurDc
public static int localQuorumForOurDc(AbstractReplicationStrategy replicationStrategy)
-
eachQuorumForRead
public static com.carrotsearch.hppc.ObjectIntHashMap<java.lang.String> eachQuorumForRead(AbstractReplicationStrategy replicationStrategy)
-
eachQuorumForWrite
public static com.carrotsearch.hppc.ObjectIntHashMap<java.lang.String> eachQuorumForWrite(AbstractReplicationStrategy replicationStrategy, Endpoints<?> pendingWithDown)
-
blockFor
public int blockFor(AbstractReplicationStrategy replicationStrategy)
-
blockForWrite
public int blockForWrite(AbstractReplicationStrategy replicationStrategy, Endpoints<?> pending)
-
satisfies
public boolean satisfies(ConsistencyLevel other, AbstractReplicationStrategy replicationStrategy)
Determine if this consistency level meets or exceeds the consistency requirements of the given cl for the given keyspace WARNING: this is not locality aware; you cannot safely use this with mixed locality consistency levels (e.g. LOCAL_QUORUM and QUORUM)
-
isDatacenterLocal
public boolean isDatacenterLocal()
-
validateForRead
public void validateForRead() throws InvalidRequestException
- Throws:
InvalidRequestException
-
validateForWrite
public void validateForWrite() throws InvalidRequestException
- Throws:
InvalidRequestException
-
validateForCasCommit
public void validateForCasCommit(AbstractReplicationStrategy replicationStrategy) throws InvalidRequestException
- Throws:
InvalidRequestException
-
validateForCas
public void validateForCas() throws InvalidRequestException
- Throws:
InvalidRequestException
-
isSerialConsistency
public boolean isSerialConsistency()
-
validateCounterForWrite
public void validateCounterForWrite(TableMetadata metadata) throws InvalidRequestException
- Throws:
InvalidRequestException
-
needsReconciliation
public boolean needsReconciliation()
With a replication factor greater than one, reads that contact more than one replica will require reconciliation of the individual replica results at the coordinator.- Returns:
- true if reads at this consistency level require merging at the coordinator
-
-