Enum ReadFrom

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ReadFrom>

    public enum ReadFrom
    extends java.lang.Enum<ReadFrom>
    Represents the client's read from strategy.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ALL_NODES
      Spread the read requests between all nodes (primary and replicas) in a round-robin manner.
      AZ_AFFINITY
      Spread the read requests between replicas in the same client's AZ (Aviliablity zone) in a round-robin manner, falling back to other replicas or the primary if needed.
      AZ_AFFINITY_REPLICAS_AND_PRIMARY
      Spread the read requests among nodes within the client's Availability Zone (AZ) in a round robin manner, prioritizing local replicas, then the local primary, and falling back to any replica or the primary if needed.
      PREFER_REPLICA
      Spread the requests between all replicas in a round-robin manner.
      PRIMARY
      Always get from primary, in order to get the freshest data.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ReadFrom valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ReadFrom[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • PRIMARY

        public static final ReadFrom PRIMARY
        Always get from primary, in order to get the freshest data.
      • PREFER_REPLICA

        public static final ReadFrom PREFER_REPLICA
        Spread the requests between all replicas in a round-robin manner. If no replica is available, route the requests to the primary.
      • AZ_AFFINITY

        public static final ReadFrom AZ_AFFINITY
        Spread the read requests between replicas in the same client's AZ (Aviliablity zone) in a round-robin manner, falling back to other replicas or the primary if needed.
      • AZ_AFFINITY_REPLICAS_AND_PRIMARY

        public static final ReadFrom AZ_AFFINITY_REPLICAS_AND_PRIMARY
        Spread the read requests among nodes within the client's Availability Zone (AZ) in a round robin manner, prioritizing local replicas, then the local primary, and falling back to any replica or the primary if needed.
      • ALL_NODES

        public static final ReadFrom ALL_NODES
        Spread the read requests between all nodes (primary and replicas) in a round-robin manner.
    • Method Detail

      • values

        public static ReadFrom[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ReadFrom c : ReadFrom.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ReadFrom valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null