Class VirtualClusterManager

java.lang.Object
com.cockroachlabs.data.continuum.cloud.VirtualClusterManager

public class VirtualClusterManager extends Object
Manages the lifecycle of Cockroach virtual clusters over a SQL connection to a Continuum host cluster, using the CREATE / SHOW / DROP VIRTUAL CLUSTER statements. These require a Continuum-enabled cluster.

Virtual-cluster names are interpolated into DDL (identifiers cannot be bind parameters), so create(java.lang.String) / drop(java.lang.String) validate the name against a strict identifier pattern to prevent SQL injection.

  • Constructor Details

    • VirtualClusterManager

      public VirtualClusterManager(org.springframework.jdbc.core.JdbcTemplate jdbc)
  • Method Details

    • create

      public void create(String name)
      Runs CREATE VIRTUAL CLUSTER <name>.
    • drop

      public void drop(String name)
      Runs DROP VIRTUAL CLUSTER <name>.
    • list

      Runs SHOW VIRTUAL CLUSTERS and returns the rows.
    • routingConnString

      public static String routingConnString(String base, String vclusterName)
      Rewrites a connection string to route connections to the named virtual cluster. CockroachDB routes via the connection option -ccluster=<name>; this appends an options parameter carrying it. Assumes the base string does not already set options.