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 name and gRPC object. It is used to create instance.

Examples:

Create


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

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

# Or
cluster.add("cluster-2", 1)

Instance Method Summary collapse

Instance Method Details

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

Add cluster to map

Parameters:

  • name (String)

    Cluster name

  • 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)

    No of nodes

  • storage_type (Symbol)

    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



57
58
59
60
61
62
63
64
65
# File 'lib/google/cloud/bigtable/instance/cluster_map.rb', line 57

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