1 // Copyright 2010 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.datastore
;
9 public final class ReadPolicy
{
12 * Setting the {@code Consistency} for reads allows you to decide whether
13 * freshness or availability is more important.
15 public enum Consistency
{
18 * Selects freshness over availability. Strongly consistent reads are
19 * guaranteed to return the most up-to-date data but will timeout more
20 * often than eventually consistent reads.
25 * Selects availability over freshness. Eventually consistent reads will
26 * timeout less often than Strong reads but will occasionally return
32 private final Consistency consistency
;
34 public ReadPolicy(Consistency consistency
) {
35 if (consistency
== null) {
36 throw new NullPointerException("consistency must not be null");
38 this.consistency
= consistency
;
41 public Consistency
getConsistency() {
46 public boolean equals(Object o
) {
50 if (o
== null || getClass() != o
.getClass()) {
54 ReadPolicy that
= (ReadPolicy
) o
;
56 if (consistency
!= that
.consistency
) {
64 public int hashCode() {
65 return consistency
.hashCode();