Class: Google::Cloud::Bigtable::Table::ColumnFamilyMap

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

Overview

Table::ColumnFamilyMap is a Hash with column_family name and grpc object. It is used to create instance.

Examples:

Add column family with name and GC rule


column_families = Google::Cloud::Bigtable::Instance::ColumnFamilyMap.new

column_families.add('cf1', Google::Cloud::Bigtable::GcRule.max_versions(3))

Instance Method Summary collapse

Instance Method Details

#add(name, gc_rule) ⇒ Object

Add column family.

Examples:

column_families = Google::Cloud::Bigtable::Instance::ColumnFamilyMap.new

gc_rule_1 = Google::Cloud::Bigtable::GcRule.max_versions(3)
column_families.add('cf1', gc_rule_1)

gc_rule = Google::Cloud::Bigtable::GcRule.max_age(1800)
column_families.add('cf2', gc_rule)

Parameters:

  • name (String)

    Column family name

  • gc_rule (Google::Bigtable::GcRule)

    GC Rule



50
51
52
53
54
# File 'lib/google/cloud/bigtable/table/column_family_map.rb', line 50

def add name, gc_rule
  self[name] = Google::Bigtable::Admin::V2::ColumnFamily.new(
    gc_rule: gc_rule.to_grpc
  )
end

#remove(name) ⇒ Google::Bigtable::Admin::V2::ColumnFamily

Remove column family from map.

Parameters:

  • name (String)

    Column family name

Returns:



61
62
63
# File 'lib/google/cloud/bigtable/table/column_family_map.rb', line 61

def remove name
  delete(name)
end