Example usage for org.apache.cassandra.db ConsistencyLevel ANY

List of usage examples for org.apache.cassandra.db ConsistencyLevel ANY

Introduction

In this page you can find the example usage for org.apache.cassandra.db ConsistencyLevel ANY.

Prototype

ConsistencyLevel ANY

To view the source code for org.apache.cassandra.db ConsistencyLevel ANY.

Click Source Link

Usage

From source file:org.elassandra.cluster.InternalCassandraClusterService.java

License:Apache License

public static ConsistencyLevel consistencyLevelFromString(String value) {
    switch (value.toUpperCase(Locale.ROOT)) {
    case "ANY":
        return ConsistencyLevel.ANY;
    case "ONE":
        return ConsistencyLevel.ONE;
    case "TWO":
        return ConsistencyLevel.TWO;
    case "THREE":
        return ConsistencyLevel.THREE;
    case "QUORUM":
        return ConsistencyLevel.QUORUM;
    case "ALL":
        return ConsistencyLevel.ALL;
    case "LOCAL_QUORUM":
        return ConsistencyLevel.LOCAL_QUORUM;
    case "EACH_QUORUM":
        return ConsistencyLevel.EACH_QUORUM;
    case "SERIAL":
        return ConsistencyLevel.SERIAL;
    case "LOCAL_SERIAL":
        return ConsistencyLevel.LOCAL_SERIAL;
    case "LOCAL_ONE":
        return ConsistencyLevel.LOCAL_ONE;
    default://from  ww  w  .  j  a  v a 2 s . co m
        throw new IllegalArgumentException("No write consistency match [" + value + "]");
    }
}

From source file:org.elasticsearch.cluster.ClusterService.java

License:Apache License

@SuppressForbidden(reason = "toUpperCase() for consistency level")
public static ConsistencyLevel consistencyLevelFromString(String value) {
    switch (value.toUpperCase()) {
    case "ANY":
        return ConsistencyLevel.ANY;
    case "ONE":
        return ConsistencyLevel.ONE;
    case "TWO":
        return ConsistencyLevel.TWO;
    case "THREE":
        return ConsistencyLevel.THREE;
    case "QUORUM":
        return ConsistencyLevel.QUORUM;
    case "ALL":
        return ConsistencyLevel.ALL;
    case "LOCAL_QUORUM":
        return ConsistencyLevel.LOCAL_QUORUM;
    case "EACH_QUORUM":
        return ConsistencyLevel.EACH_QUORUM;
    case "SERIAL":
        return ConsistencyLevel.SERIAL;
    case "LOCAL_SERIAL":
        return ConsistencyLevel.LOCAL_SERIAL;
    case "LOCAL_ONE":
        return ConsistencyLevel.LOCAL_ONE;
    default://w  w  w. j  a va 2 s .  com
        throw new IllegalArgumentException("No write consistency match [" + value + "]");
    }
}

From source file:protocol.bigdata.cassandra.ClientOnlyExample.java

License:Apache License

private static void setupKeyspace()
        throws RequestExecutionException, RequestValidationException, InterruptedException {
    QueryProcessor.process(//w  w w  .j  a  va2s .c o  m
            "CREATE KEYSPACE IF NOT EXISTS " + KEYSPACE
                    + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}",
            ConsistencyLevel.ANY);
    QueryProcessor.process("CREATE TABLE IF NOT EXISTS " + KEYSPACE + "." + COLUMN_FAMILY
            + " (id ascii PRIMARY KEY, name ascii, value ascii )", ConsistencyLevel.ANY);
    TimeUnit.MILLISECONDS.sleep(1000);
}