public abstract class Consistency extends Object implements oracle.kv.impl.util.FastExternalizable, Serializable
In general, read operations may be serviced either at a Master or Replica
node. When serviced at the Master node, consistency is always absolute. If
absolute consistency is required, ABSOLUTE
may be specified to
force the operation to be serviced at the Master. For other types of
consistency, when the operation is serviced at a Replica node, the
transaction will not begin until the consistency policy is satisfied.
The Consistency is specified as an argument to all read operations, for
example, get
.
Modifier and Type | Class and Description |
---|---|
static class |
Consistency.Time
A consistency policy which describes the amount of time the Replica is
allowed to lag the Master.
|
static class |
Consistency.Version
A consistency policy which ensures that the environment on a Replica
node is at least as current as denoted by the specified Key-Value pair
Version . |
Modifier and Type | Field and Description |
---|---|
static Consistency |
ABSOLUTE
A consistency policy that requires that a transaction be serviced on the
Master so that consistency is absolute.
|
static Consistency |
NONE_REQUIRED
A consistency policy that lets a transaction on a replica using this
policy proceed regardless of the state of the Replica relative to the
Master.
|
static Consistency |
NONE_REQUIRED_NO_MASTER
A consistency policy that requires that a read operation be serviced on
a replica; never the Master.
|
Modifier and Type | Method and Description |
---|---|
static Consistency |
fromByteArray(byte[] keyBytes)
Deserializes the given bytes that were returned earlier by
toByteArray() and returns the resulting Consistency. |
abstract String |
getName()
Returns the name used to identify the policy.
|
byte[] |
toByteArray()
Returns this Consistency as a serialized byte array, such that
fromByteArray(byte[]) may be used to reconstitute the Consistency. |
public static final Consistency NONE_REQUIRED
public static final Consistency ABSOLUTE
public static final Consistency NONE_REQUIRED_NO_MASTER
For read-heavy applications (ex. analytics), it may be desirable to reduce the load on the master by restricting the read requests to only the replicas in the store. It is important to note however, that the secondary zones feature is preferred over this consistency policy as the mechanism for achieving this sort of read isolation. But for cases where the use of secondary zones is either impractical or not desired, this consistency policy can be used to achieve a similar effect; without employing the additional resources that secondary zones may require.
public byte[] toByteArray()
fromByteArray(byte[])
may be used to reconstitute the Consistency.public static Consistency fromByteArray(byte[] keyBytes)
toByteArray()
and returns the resulting Consistency.public abstract String getName()
Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.