Skip to content

Commit

Permalink
Rename Query.Consistency to ConsistencyLevel, ironically for consiste…
Browse files Browse the repository at this point in the history
…ncy.
  • Loading branch information
kuujo committed Jun 4, 2015
1 parent 64b53c8 commit 3c2e237
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Expand Up @@ -61,7 +61,7 @@ public CompletableFuture<Boolean> isEmpty() {
* @param consistency The query consistency level.
* @return A completable future to be completed with a boolean value indicating whether the map is empty.
*/
public CompletableFuture<Boolean> isEmpty(Query.Consistency consistency) {
public CompletableFuture<Boolean> isEmpty(ConsistencyLevel consistency) {
return submit(IsEmpty.builder().withConsistency(consistency).build());
}

Expand All @@ -80,7 +80,7 @@ public CompletableFuture<Integer> size() {
* @param consistency The query consistency level.
* @return A completable future to be completed with the number of entries in the map.
*/
public CompletableFuture<Integer> size(Query.Consistency consistency) {
public CompletableFuture<Integer> size(ConsistencyLevel consistency) {
return submit(Size.builder().withConsistency(consistency).build());
}

Expand All @@ -103,7 +103,7 @@ public CompletableFuture<Boolean> containsKey(Object key) {
* @param consistency The query consistency level.
* @return A completable future to be completed with the result once complete.
*/
public CompletableFuture<Boolean> containsKey(Object key, Query.Consistency consistency) {
public CompletableFuture<Boolean> containsKey(Object key, ConsistencyLevel consistency) {
return submit(ContainsKey.builder()
.withKey(key)
.withConsistency(consistency)
Expand Down Expand Up @@ -132,7 +132,7 @@ public CompletableFuture<V> get(Object key) {
* @return A completable future to be completed with the result once complete.
*/
@SuppressWarnings("unchecked")
public CompletableFuture<V> get(Object key, Query.Consistency consistency) {
public CompletableFuture<V> get(Object key, ConsistencyLevel consistency) {
return submit(Get.builder()
.withKey(key)
.withConsistency(consistency)
Expand Down Expand Up @@ -291,7 +291,7 @@ public CompletableFuture<V> getOrDefault(Object key, V defaultValue) {
* @return A completable future to be completed with the result once complete.
*/
@SuppressWarnings("unchecked")
public CompletableFuture<V> getOrDefault(Object key, V defaultValue, Query.Consistency consistency) {
public CompletableFuture<V> getOrDefault(Object key, V defaultValue, ConsistencyLevel consistency) {
return submit(GetOrDefault.builder()
.withKey(key)
.withDefaultValue(defaultValue)
Expand Down Expand Up @@ -437,10 +437,10 @@ protected Builder(U command) {
* Abstract map query.
*/
public static abstract class MapQuery<V> implements Query<V>, Writable {
protected Consistency consistency = Consistency.LINEARIZABLE_LEASE;
protected ConsistencyLevel consistency = ConsistencyLevel.LINEARIZABLE_LEASE;

@Override
public Consistency consistency() {
public ConsistencyLevel consistency() {
return consistency;
}

Expand All @@ -451,7 +451,7 @@ public void writeObject(Buffer buffer, Serializer serializer) {

@Override
public void readObject(Buffer buffer, Serializer serializer) {
consistency = Consistency.values()[buffer.readByte()];
consistency = ConsistencyLevel.values()[buffer.readByte()];
}

/**
Expand All @@ -469,7 +469,7 @@ protected Builder(U query) {
* @return The query builder.
*/
@SuppressWarnings("unchecked")
public T withConsistency(Consistency consistency) {
public T withConsistency(ConsistencyLevel consistency) {
if (consistency == null)
throw new NullPointerException("consistency cannot be null");
query.consistency = consistency;
Expand Down
Expand Up @@ -154,7 +154,7 @@ public CompletableFuture<Boolean> contains(Object value) {
* @param consistency The query consistency level.
* @return A completable future to be completed with the result once complete.
*/
public CompletableFuture<Boolean> contains(Object value, Query.Consistency consistency) {
public CompletableFuture<Boolean> contains(Object value, ConsistencyLevel consistency) {
return submit(Contains.builder()
.withValue(value.hashCode())
.withConsistency(consistency)
Expand All @@ -176,7 +176,7 @@ public CompletableFuture<Integer> size() {
* @param consistency The query consistency level.
* @return A completable future to be completed with the set size.
*/
public CompletableFuture<Integer> size(Query.Consistency consistency) {
public CompletableFuture<Integer> size(ConsistencyLevel consistency) {
return submit(Size.builder().withConsistency(consistency).build());
}

Expand All @@ -195,7 +195,7 @@ public CompletableFuture<Boolean> isEmpty() {
* @param consistency The query consistency level.
* @return A completable future to be completed with a boolean value indicating whether the set is empty.
*/
public CompletableFuture<Boolean> isEmpty(Query.Consistency consistency) {
public CompletableFuture<Boolean> isEmpty(ConsistencyLevel consistency) {
return submit(IsEmpty.builder().withConsistency(consistency).build());
}

Expand Down Expand Up @@ -227,10 +227,10 @@ protected Builder(U command) {
* Abstract set query.
*/
public static abstract class SetQuery<V> implements Query<V>, Writable {
protected Consistency consistency = Consistency.LINEARIZABLE_LEASE;
protected ConsistencyLevel consistency = ConsistencyLevel.LINEARIZABLE_LEASE;

@Override
public Consistency consistency() {
public ConsistencyLevel consistency() {
return consistency;
}

Expand All @@ -241,7 +241,7 @@ public void writeObject(Buffer buffer, Serializer serializer) {

@Override
public void readObject(Buffer buffer, Serializer serializer) {
consistency = Consistency.values()[buffer.readByte()];
consistency = ConsistencyLevel.values()[buffer.readByte()];
}

/**
Expand All @@ -259,7 +259,7 @@ protected Builder(U query) {
* @return The query builder.
*/
@SuppressWarnings("unchecked")
public T withConsistency(Consistency consistency) {
public T withConsistency(ConsistencyLevel consistency) {
query.consistency = consistency;
return (T) this;
}
Expand Down

0 comments on commit 3c2e237

Please sign in to comment.