Class Crdb
java.lang.Object
com.cockroachlabs.crdb.Crdb
The one-stop entry point for the CockroachDB pure-Java library.
Two things you reach for constantly:
enhance(Object)— wrap an annotated object so retry, circuit breaking, and context "just happen"; the anomalytry/catchdisappears from your code.tx(DataSource, ConnectionCallback)— the always-available functional core: a SERIALIZABLE, auto-retrying transaction.
The storage, vcluster, and aegis methods expose the
Cockroach Continuum surface (Plenum, vCluster, Aegis); storage/aegis
providers are discovered from the continuum module via
ServiceLoader. The agent/MCP surface lives in the agent
module (CrdbAgent). See docs/CONTINUUM_PLAN.md.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AegisClientaegis(AegisConfig config) Cockroach Aegis client (autonomous-ops findings/recommendations + exhaust).static Objectagent()Agent / MCP surface.static <T> Tenhance(T target) Return an enhanced view oftargetwhose annotated methods gain retry / circuit-breaking / context behavior.static <T> Tenhance(T target, CrdbConfig config) Asenhance(Object), using a specificCrdbConfig.static StorageInsightsstorage(DataSource ds) Cockroach Plenum storage insights (read-only usage signals).static TransactionTemplatetemplate(DataSource ds) A reusableTransactionTemplatebound tods.static <T> Ttx(DataSource ds, ConnectionCallback<T> work) Runworkin a SERIALIZABLE transaction with automatic retry on serialization conflicts.static VirtualClusterScopeCockroach vCluster handle: a context-scoped executor that tags work with a vCluster name and (optionally) a workload priority/QoS.
-
Method Details
-
enhance
public static <T> T enhance(T target) Return an enhanced view oftargetwhose annotated methods gain retry / circuit-breaking / context behavior. SeeCrdbProxyFactory.enhance(Object)for the interface-vs-class caveat. -
enhance
Asenhance(Object), using a specificCrdbConfig. -
tx
Runworkin a SERIALIZABLE transaction with automatic retry on serialization conflicts. This is the functional core that never needs a proxy or annotations. -
template
A reusableTransactionTemplatebound tods. -
storage
Cockroach Plenum storage insights (read-only usage signals). The provider is discovered from thecontinuummodule viaServiceLoader.- Throws:
IllegalStateException- if thecontinuummodule is not on the classpath
-
vcluster
Cockroach vCluster handle: a context-scoped executor that tags work with a vCluster name and (optionally) a workload priority/QoS. -
aegis
Cockroach Aegis client (autonomous-ops findings/recommendations + exhaust). The provider is discovered from thecontinuummodule viaServiceLoader; a disabled/endpoint-less config selects the simulated in-memory backend.- Throws:
IllegalStateException- if thecontinuummodule is not on the classpath
-
agent
Agent / MCP surface. UseCrdbAgent.from(...)in theagentmodule to build the tool surface.- Throws:
UnsupportedOperationException- always; this is a signpost to theagentmodule'sCrdbAgententry point
-