Record Class CrdbContextValues

java.lang.Object
java.lang.Record
com.cockroachlabs.crdb.context.CrdbContextValues
Record Components:
region - the region to pin execution to
virtualCluster - the Cockroach vCluster to route to
workload - the workload priority class
followerReadStaleness - the follower-read staleness expression, if any

public record CrdbContextValues(String region, String virtualCluster, Workload.Priority workload, String followerReadStaleness) extends Record
Immutable bundle of CockroachDB call context. Any field may be null meaning "unset".
  • Constructor Details

    • CrdbContextValues

      public CrdbContextValues(String region, String virtualCluster, Workload.Priority workload, String followerReadStaleness)
      Creates an instance of a CrdbContextValues record class.
      Parameters:
      region - the value for the region record component
      virtualCluster - the value for the virtualCluster record component
      workload - the value for the workload record component
      followerReadStaleness - the value for the followerReadStaleness record component
  • Method Details

    • empty

      public static CrdbContextValues empty()
      The empty context (all fields unset).
    • withRegion

      public CrdbContextValues withRegion(String r)
    • withVirtualCluster

      public CrdbContextValues withVirtualCluster(String vc)
    • withWorkload

      public CrdbContextValues withWorkload(Workload.Priority p)
    • withFollowerReadStaleness

      public CrdbContextValues withFollowerReadStaleness(String s)
    • merge

      public CrdbContextValues merge(CrdbContextValues other)
      Overlay other onto this one: any non-null field of other wins, otherwise this value is retained. Lets nested scopes refine parent context without wiping it.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • region

      public String region()
      Returns the value of the region record component.
      Returns:
      the value of the region record component
    • virtualCluster

      public String virtualCluster()
      Returns the value of the virtualCluster record component.
      Returns:
      the value of the virtualCluster record component
    • workload

      public Workload.Priority workload()
      Returns the value of the workload record component.
      Returns:
      the value of the workload record component
    • followerReadStaleness

      public String followerReadStaleness()
      Returns the value of the followerReadStaleness record component.
      Returns:
      the value of the followerReadStaleness record component