Enum Class ConsistencyLevel
- All Implemented Interfaces:
Serializable, Comparable<ConsistencyLevel>, Constable
Enumeration of consistency levels for read operations.
Different levels provide different trade-offs between consistency and availability:
- STRONG: Read from leader only (linearizable consistency)
- BOUNDED_STALENESS: Read from replica if lag invalid input: '<' threshold (configurable, default 1000ms)
- EVENTUAL: Read from any active replica (eventual consistency)
- SESSION: Read from same replica within a session (session consistency)
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBounded staleness: read from replica if lag invalid input: '<' threshold.Eventual consistency: read from any active replica.Session consistency: read from same replica within a session.Strong consistency: all reads go to the leader. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConsistencyLevelReturns the enum constant of this class with the specified name.static ConsistencyLevel[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STRONG
Strong consistency: all reads go to the leader. Ensures linearizability but higher load on leader. -
BOUNDED_STALENESS
Bounded staleness: read from replica if lag invalid input: '<' threshold. Configurable threshold (default 1000ms). Best for applications that can tolerate slight staleness. -
EVENTUAL
Eventual consistency: read from any active replica. Lowest latency but highest staleness risk. -
SESSION
Session consistency: read from same replica within a session. Provides monotonic read consistency within a session.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-