Interface ConsistencyLevel
-
- All Known Implementing Classes:
ConsistencyLevel.CL
public interface ConsistencyLevel
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classConsistencyLevel.CL
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanBeSatisfied(java.util.Collection<? extends org.apache.cassandra.spark.common.model.CassandraInstance> succeededInstances, java.util.Collection<? extends org.apache.cassandra.spark.common.model.CassandraInstance> pendingInstances, org.apache.cassandra.spark.data.ReplicationFactor replicationFactor, java.lang.String localDC)Check write consistency can be satisfied with the collection of the succeeded instancesdefault voidensureNetworkTopologyStrategy(org.apache.cassandra.spark.data.ReplicationFactor replicationFactor, ConsistencyLevel.CL cl)booleanisLocal()Whether the consistency level only considers replicas in the local data center.
-
-
-
Method Detail
-
isLocal
boolean isLocal()
Whether the consistency level only considers replicas in the local data center.- Returns:
- true if only considering the local replicas; otherwise, return false
-
canBeSatisfied
boolean canBeSatisfied(java.util.Collection<? extends org.apache.cassandra.spark.common.model.CassandraInstance> succeededInstances, java.util.Collection<? extends org.apache.cassandra.spark.common.model.CassandraInstance> pendingInstances, org.apache.cassandra.spark.data.ReplicationFactor replicationFactor, java.lang.String localDC)Check write consistency can be satisfied with the collection of the succeeded instancesWhen pendingReplicas is non-empty, the minimum number of success is increased by the size of pendingReplicas, keeping the same semantics defined in Cassandra. See blockForWrite
For example, say RF == 3, and there is 2 pending replicas.
- QUORUM write consistency requires at least 4 replicas to succeed, i.e. quorum(3) + 2, tolerating 1 failure
- ONE write consistency requires at least 3 replicas to succeed, i.e. 1 + 2, tolerating 2 failure
- TWO write consistency requires at least 4 replicas to succeed, i.e. 2 + 2, tolerating 1 failure
- Parameters:
succeededInstances- the succeeded instances in the replica setpendingInstances- the pending instances, i.e. JOINING, LEAVING, MOVINGreplicationFactor- replication factor to check withlocalDC- the local data center name if required for the check- Returns:
- true means the consistency level is _definitively_ satisfied. Meanwhile, returning false means no conclusion can be drawn
-
ensureNetworkTopologyStrategy
default void ensureNetworkTopologyStrategy(org.apache.cassandra.spark.data.ReplicationFactor replicationFactor, ConsistencyLevel.CL cl)
-
-