## org.apache.cassandra.thrift
Enum ConsistencyLevel

    java.lang.Object
      java.lang.Enum<ConsistencyLevel>
          org.apache.cassandra.thrift.ConsistencyLevel

All Implemented Interfaces:
  java.io.Serializable, java.lang.Comparable<ConsistencyLevel>, org.apache.thrift.TEnum

    public enum ConsistencyLevel

extends java.lang.Enum<ConsistencyLevel>
implements org.apache.thrift.TEnum

The ConsistencyLevel is an enum that controls both read and write behavior based on the ReplicationFactor of the keyspace. The different consistency levels have different meanings, depending on if you're doing a write or read operation. If W + R > ReplicationFactor, where W is the number of nodes to block for on write, and R the number to block for on reads, you will have strongly consistent behavior; that is, readers will always see the most recent write. Of these, the most interesting is to do QUORUM reads and writes, which gives you consistency while still allowing availability in the face of node failures up to half of <ReplicationFactor>. Of course if latency is more important than consistency then you can use lower values for either or both. Some ConsistencyLevels (ONE, TWO, THREE) refer to a specific number of replicas rather than a logical concept that adjusts automatically with the replication factor. Of these, only ONE is commonly used; TWO and (even more rarely) THREE are only useful when you care more about guaranteeing a certain level of durability, than consistency. Write consistency levels make the following guarantees before reporting success to the client: ANY Ensure that the write has been written once somewhere, including possibly being hinted in a non-target node. ONE Ensure that the write has been written to at least 1 node's commit log and memory table TWO Ensure that the write has been written to at least 2 node's commit log and memory table THREE Ensure that the write has been written to at least 3 node's commit log and memory table QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes LOCAL_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter (requires NetworkTopologyStrategy) EACH_QUORUM Ensure that the write has been written to <ReplicationFactor> / 2 + 1 nodes in each datacenter (requires NetworkTopologyStrategy) ALL Ensure that the write is written to `<ReplicationFactor>` nodes before responding to the client. Read consistency levels make the following guarantees before returning successful results to the client: ANY Not supported. You probably want ONE instead. ONE Returns the record obtained from a single replica. TWO Returns the record with the most recent timestamp once two replicas have replied. THREE Returns the record with the most recent timestamp once three replicas have replied. QUORUM Returns the record with the most recent timestamp once a majority of replicas have replied. LOCAL_QUORUM Returns the record with the most recent timestamp once a majority of replicas within the local datacenter have replied. EACH_QUORUM Returns the record with the most recent timestamp once a majority of replicas within each datacenter have replied. ALL Returns the record with the most recent timestamp once all replicas have replied (implies no replica may be down)..

Enum Constant Summary
`ALL`
`ANY`
`EACH_QUORUM`
`LOCAL_QUORUM`
`ONE`
`QUORUM`
`THREE`
`TWO`

Method Summary
`static ConsistencyLevel` `findByValue(int value)` Find a the enum type by its integer value, as defined in the Thrift IDL.
`int` `getValue()` Get the integer value of this enum value, as defined in the Thrift IDL.
`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.

Methods inherited from class java.lang.Enum
`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Enum Constant Detail

### ONE

    public static final ConsistencyLevel ONE

### QUORUM

    public static final ConsistencyLevel QUORUM

### LOCAL_QUORUM

    public static final ConsistencyLevel LOCAL_QUORUM

### EACH_QUORUM

    public static final ConsistencyLevel EACH_QUORUM

### ALL

    public static final ConsistencyLevel ALL

### ANY

    public static final ConsistencyLevel ANY

### TWO

    public static final ConsistencyLevel TWO

### THREE

    public static final ConsistencyLevel THREE

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 name
    `java.lang.NullPointerException` - if the argument is null

### getValue

    public int getValue()

  Get the integer value of this enum value, as defined in the Thrift IDL.

  Specified by:
    `getValue` in interface `org.apache.thrift.TEnum`

### findByValue

    public static ConsistencyLevel findByValue(int value)

  Find a the enum type by its integer value, as defined in the Thrift IDL.

  Returns:
    null if the value is not found.

Copyright © 2012 The Apache Software Foundation