Interface ConsistencyLevel

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  ConsistencyLevel.CL  
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      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 instances
      default void ensureNetworkTopologyStrategy​(org.apache.cassandra.spark.data.ReplicationFactor replicationFactor, ConsistencyLevel.CL cl)  
      boolean isLocal()
      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 instances

        When 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 set
        pendingInstances - the pending instances, i.e. JOINING, LEAVING, MOVING
        replicationFactor - replication factor to check with
        localDC - 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)