Enum Class ConsistencyLevel

java.lang.Object
java.lang.Enum<ConsistencyLevel>
com.loomcache.server.replication.ConsistencyLevel
All Implemented Interfaces:
Serializable, Comparable<ConsistencyLevel>, Constable

public enum ConsistencyLevel extends Enum<ConsistencyLevel>
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)
  • Enum Constant Details

    • STRONG

      public static final ConsistencyLevel STRONG
      Strong consistency: all reads go to the leader. Ensures linearizability but higher load on leader.
    • BOUNDED_STALENESS

      public static final ConsistencyLevel 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

      public static final ConsistencyLevel EVENTUAL
      Eventual consistency: read from any active replica. Lowest latency but highest staleness risk.
    • SESSION

      public static final ConsistencyLevel SESSION
      Session consistency: read from same replica within a session. Provides monotonic read consistency within a session.
  • Method Details

    • values

      public static ConsistencyLevel[] 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

      public static ConsistencyLevel valueOf(String name)
      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 name
      NullPointerException - if the argument is null