Class: Google::Cloud::Bigtable::Instance::ClusterMap

Inherits:
Hash
  • Object
show all
Defined in:
lib/google/cloud/bigtable/instance/cluster_map.rb

Overview

Instance::ClusterMap is a hash with cluster ID keys and cluster configuration values. It is used to create a cluster.

Examples:


clusters = Google::Cloud::Bigtable::Instance::ClusterMap.new

clusters.add("cluster-1", "us-east1-b", nodes: 3, storage_type: :SSD)

# Or
clusters.add("cluster-2", "us-east1-b")

Instance Method Summary collapse

Instance Method Details

#add(name, location, nodes: nil, storage_type: nil) ⇒ Object

Adds a cluster to the cluster map.

Parameters:

  • name (String)

    The unique identifier for the cluster.

  • location (String)

    The location where this cluster's nodes and storage reside. For best performance, clients should be located as close as possible to this cluster. Currently only zones are supported.

  • nodes (Integer) (defaults to: nil)

    Number of nodes for the cluster. When creating an instance of type :DEVELOPMENT, nodes must not be set.

  • storage_type (Symbol) (defaults to: nil)

    Valid values are:

    • :SSD(Flash (SSD) storage should be used), *:HDD(Magnetic drive (HDD) storage should be used)

    If not set then default will set to :STORAGE_TYPE_UNSPECIFIED



61
62
63
64
65
66
67
68
69
# File 'lib/google/cloud/bigtable/instance/cluster_map.rb', line 61

def add name, location, nodes: nil, storage_type: nil
  attrs = {
    serve_nodes:          nodes,
    location:             location,
    default_storage_type: storage_type
  }.delete_if { |_, v| v.nil? }

  self[name] = Google::Bigtable::Admin::V2::Cluster.new attrs
end