@@ -1238,6 +1238,12 @@ type InstanceConf struct {
12381238 // AutoscalingConfig configures the autoscaling properties on the cluster
12391239 // created with the instance. It is optional.
12401240 AutoscalingConfig * AutoscalingConfig
1241+
1242+ // NodeScalingFactor controls the scaling factor of the cluster (i.e. the
1243+ // increment in which NumNodes can be set). Node scaling delivers better
1244+ // latency and more throughput by removing node boundaries. It is optional,
1245+ // with the default being 1X.
1246+ NodeScalingFactor NodeScalingFactor
12411247}
12421248
12431249// InstanceWithClustersConfig contains the information necessary to create an Instance
@@ -1267,6 +1273,7 @@ func (iac *InstanceAdminClient) CreateInstance(ctx context.Context, conf *Instan
12671273 NumNodes : conf .NumNodes ,
12681274 StorageType : conf .StorageType ,
12691275 AutoscalingConfig : conf .AutoscalingConfig ,
1276+ NodeScalingFactor : conf .NodeScalingFactor ,
12701277 },
12711278 },
12721279 }
@@ -1507,6 +1514,44 @@ func (a *AutoscalingConfig) proto() *btapb.Cluster_ClusterAutoscalingConfig {
15071514 }
15081515}
15091516
1517+ // NodeScalingFactor controls the scaling factor of the cluster (i.e. the
1518+ // increment in which NumNodes can be set). Node scaling delivers better
1519+ // latency and more throughput by removing node boundaries.
1520+ type NodeScalingFactor int32
1521+
1522+ const (
1523+ // NodeScalingFactorUnspecified default to 1X.
1524+ NodeScalingFactorUnspecified NodeScalingFactor = iota
1525+ // NodeScalingFactor1X runs the cluster with a scaling factor of 1.
1526+ NodeScalingFactor1X
1527+ // NodeScalingFactor2X runs the cluster with a scaling factor of 2.
1528+ // All node count values must be in increments of 2 with this scaling
1529+ // factor enabled, otherwise an INVALID_ARGUMENT error will be returned.
1530+ NodeScalingFactor2X
1531+ )
1532+
1533+ func (nsf NodeScalingFactor ) proto () btapb.Cluster_NodeScalingFactor {
1534+ switch nsf {
1535+ case NodeScalingFactor1X :
1536+ return btapb .Cluster_NODE_SCALING_FACTOR_1X
1537+ case NodeScalingFactor2X :
1538+ return btapb .Cluster_NODE_SCALING_FACTOR_2X
1539+ default :
1540+ return btapb .Cluster_NODE_SCALING_FACTOR_UNSPECIFIED
1541+ }
1542+ }
1543+
1544+ func nodeScalingFactorFromProto (nsf btapb.Cluster_NodeScalingFactor ) NodeScalingFactor {
1545+ switch nsf {
1546+ case btapb .Cluster_NODE_SCALING_FACTOR_1X :
1547+ return NodeScalingFactor1X
1548+ case btapb .Cluster_NODE_SCALING_FACTOR_2X :
1549+ return NodeScalingFactor2X
1550+ default :
1551+ return NodeScalingFactorUnspecified
1552+ }
1553+ }
1554+
15101555// ClusterConfig contains the information necessary to create a cluster
15111556type ClusterConfig struct {
15121557 // InstanceID specifies the unique name of the instance. Required.
@@ -1548,6 +1593,12 @@ type ClusterConfig struct {
15481593 // AutoscalingConfig configures the autoscaling properties on a cluster.
15491594 // One of NumNodes or AutoscalingConfig is required.
15501595 AutoscalingConfig * AutoscalingConfig
1596+
1597+ // NodeScalingFactor controls the scaling factor of the cluster (i.e. the
1598+ // increment in which NumNodes can be set). Node scaling delivers better
1599+ // latency and more throughput by removing node boundaries. It is optional,
1600+ // with the default being 1X.
1601+ NodeScalingFactor NodeScalingFactor
15511602}
15521603
15531604func (cc * ClusterConfig ) proto (project string ) * btapb.Cluster {
@@ -1558,6 +1609,7 @@ func (cc *ClusterConfig) proto(project string) *btapb.Cluster {
15581609 EncryptionConfig : & btapb.Cluster_EncryptionConfig {
15591610 KmsKeyName : cc .KMSKeyName ,
15601611 },
1612+ NodeScalingFactor : cc .NodeScalingFactor .proto (),
15611613 }
15621614
15631615 if asc := cc .AutoscalingConfig ; asc != nil {
@@ -1592,6 +1644,9 @@ type ClusterInfo struct {
15921644
15931645 // AutoscalingConfig are the configured values for a cluster.
15941646 AutoscalingConfig * AutoscalingConfig
1647+
1648+ // NodeScalingFactor controls the scaling factor of the cluster.
1649+ NodeScalingFactor NodeScalingFactor
15951650}
15961651
15971652// CreateCluster creates a new cluster in an instance.
@@ -1695,12 +1750,13 @@ func (iac *InstanceAdminClient) Clusters(ctx context.Context, instanceID string)
16951750 kmsKeyName = c .EncryptionConfig .KmsKeyName
16961751 }
16971752 ci := & ClusterInfo {
1698- Name : nameParts [len (nameParts )- 1 ],
1699- Zone : locParts [len (locParts )- 1 ],
1700- ServeNodes : int (c .ServeNodes ),
1701- State : c .State .String (),
1702- StorageType : storageTypeFromProto (c .DefaultStorageType ),
1703- KMSKeyName : kmsKeyName ,
1753+ Name : nameParts [len (nameParts )- 1 ],
1754+ Zone : locParts [len (locParts )- 1 ],
1755+ ServeNodes : int (c .ServeNodes ),
1756+ State : c .State .String (),
1757+ StorageType : storageTypeFromProto (c .DefaultStorageType ),
1758+ KMSKeyName : kmsKeyName ,
1759+ NodeScalingFactor : nodeScalingFactorFromProto (c .NodeScalingFactor ),
17041760 }
17051761 if cfg := c .GetClusterConfig (); cfg != nil {
17061762 if asc := fromClusterConfigProto (cfg ); asc != nil {
@@ -1740,12 +1796,13 @@ func (iac *InstanceAdminClient) GetCluster(ctx context.Context, instanceID, clus
17401796 nameParts := strings .Split (c .Name , "/" )
17411797 locParts := strings .Split (c .Location , "/" )
17421798 ci := & ClusterInfo {
1743- Name : nameParts [len (nameParts )- 1 ],
1744- Zone : locParts [len (locParts )- 1 ],
1745- ServeNodes : int (c .ServeNodes ),
1746- State : c .State .String (),
1747- StorageType : storageTypeFromProto (c .DefaultStorageType ),
1748- KMSKeyName : kmsKeyName ,
1799+ Name : nameParts [len (nameParts )- 1 ],
1800+ Zone : locParts [len (locParts )- 1 ],
1801+ ServeNodes : int (c .ServeNodes ),
1802+ State : c .State .String (),
1803+ StorageType : storageTypeFromProto (c .DefaultStorageType ),
1804+ KMSKeyName : kmsKeyName ,
1805+ NodeScalingFactor : nodeScalingFactorFromProto (c .NodeScalingFactor ),
17491806 }
17501807 // Use type assertion to handle protobuf oneof type
17511808 if cfg := c .GetClusterConfig (); cfg != nil {
0 commit comments