Class CrdbContext
java.lang.Object
com.cockroachlabs.crdb.context.CrdbContext
Access point for the current
CrdbContextValues, bound via
ScopedValue so it is safe under virtual threads and
structured concurrency.-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<CrdbContextValues> current()The full context bound to the current scope, if any.The follower-read staleness expression bound to the current scope, if any.region()The region bound to the current scope, if any.The virtual cluster bound to the current scope, if any.static <T> Twith(CrdbContextValues values, Callable<T> body) Runbodywithvaluesmerged onto any currently-bound context.static Optional<Workload.Priority> workload()The workload priority bound to the current scope, if any.
-
Method Details
-
with
Runbodywithvaluesmerged onto any currently-bound context. Nested calls refine, they do not clobber, the parent scope.- Returns:
- the value produced by
body
-
current
The full context bound to the current scope, if any. -
region
-
virtualCluster
-
workload
The workload priority bound to the current scope, if any. -
followerReadStaleness
-